portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rwat...@apache.org
Subject svn commit: r746641 [2/5] - in /portals/jetspeed-2/portal/branches/JPA_BRANCH: applications/jetspeed/src/main/webapp/WEB-INF/min-pages/Administrative/portal-admin/ applications/jetspeed/src/main/webapp/WEB-INF/pages/ applications/jetspeed/src/main/weba...
Date Sun, 22 Feb 2009 06:06:23 GMT
Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/state/impl/SessionNavigationalState.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/state/impl/SessionNavigationalState.java?rev=746641&r1=746640&r2=746641&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/state/impl/SessionNavigationalState.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/state/impl/SessionNavigationalState.java Sun Feb 22 06:06:20 2009
@@ -44,7 +44,7 @@
 public class SessionNavigationalState extends AbstractNavigationalState
 {   
     protected final Log log = LogFactory.getLog(getClass());    
-    private Map currentPageWindowStates;
+    private Map<String, PortletWindowBaseNavigationalState> currentPageWindowStates;
     private boolean clearPortletsModeAndWindowStateEnabled = false;
     
     public SessionNavigationalState(NavigationalStateCodec codec, JetspeedContentCache cache)
@@ -130,7 +130,7 @@
         }
     }
     
-    public Map getCurrentPageWindowStates()
+    public Map<String, PortletWindowBaseNavigationalState> getCurrentPageWindowStates()
     {
         return currentPageWindowStates;
     }

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/url/impl/AbstractPortalURL.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/url/impl/AbstractPortalURL.java?rev=746641&r1=746640&r2=746641&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/url/impl/AbstractPortalURL.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/url/impl/AbstractPortalURL.java Sun Feb 22 06:06:20 2009
@@ -102,11 +102,16 @@
         return navStateParameter;
     }
     
-    public String createNavigationalEncoding(PortletWindow window, Map parameters, PortletMode mode, WindowState state, boolean action)
+    public String createNavigationalEncoding(PortletWindow window, Map<String, String[]> parameters, PortletMode mode, WindowState state, boolean action)
+    {
+        return createNavigationalEncoding(window, parameters, mode, state, action ? URLType.ACTION : URLType.RENDER);
+    }
+    
+    public String createNavigationalEncoding(PortletWindow window, Map<String, String[]> parameters, PortletMode mode, WindowState state, URLType urlType)
     {
         try
         {
-            return getNavigationalStateParameterName() + ":" + getNavigationalState().encode(window, parameters, mode, state, action);
+            return getNavigationalStateParameterName() + ":" + getNavigationalState().encode(window, parameters, mode, state, urlType);
         }
         catch (UnsupportedEncodingException e)
         {
@@ -252,11 +257,16 @@
         return navState;
     }
 
-    public String createPortletURL(PortletWindow window, Map parameters, PortletMode mode, WindowState state, boolean action, boolean secure)
+    public String createPortletURL(PortletWindow window, Map<String, String[]> parameters, PortletMode mode, WindowState state, boolean action, boolean secure)
+    {
+        return createPortletURL(window, parameters, mode, state, action ? URLType.ACTION : URLType.RENDER, secure);
+    }
+    
+    public String createPortletURL(PortletWindow window, Map<String, String[]> parameters, PortletMode mode, WindowState state, URLType urlType, boolean secure)
     {
         try
         {
-            return createPortletURL(navState.encode(window,parameters,mode,state,action), secure);
+            return createPortletURL(navState.encode(window,parameters,mode,state,urlType), secure);
         }
         catch (UnsupportedEncodingException e)
         {

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/url/impl/DesktopEncodingPortalURL.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/url/impl/DesktopEncodingPortalURL.java?rev=746641&r1=746640&r2=746641&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/url/impl/DesktopEncodingPortalURL.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/url/impl/DesktopEncodingPortalURL.java Sun Feb 22 06:06:20 2009
@@ -25,14 +25,11 @@
 import javax.servlet.http.HttpServletRequest;
 
 import org.apache.jetspeed.PortalContext;
-import org.apache.jetspeed.PortalReservedParameters;
 import org.apache.jetspeed.container.state.NavigationalState;
 import org.apache.jetspeed.container.url.BasePortalURL;
 import org.apache.jetspeed.desktop.JetspeedDesktop;
-import org.apache.jetspeed.om.portlet.PortletApplication;
 import org.apache.jetspeed.container.PortletWindow;
 import org.apache.jetspeed.container.PortletEntity;
-import org.apache.pluto.om.portlet.PortletDefinition;
 
 /**
  * DesktopEncodingPortalURL encodes action URLs to target desktop specific /action pipeline,
@@ -94,7 +91,7 @@
             desktopRenderPipelinePath = desktopRenderPipelinePath.substring( 0, desktopRenderPipelinePath.length() -1 );
         
         this.desktopRenderPipelinePath = desktopRenderPipelinePath;
-        this.desktopActionPipelinePath = desktopActionPipelinePath;        
+        this.desktopActionPipelinePath = desktopActionPipelinePath;
     }
 
     protected void decodeBasePath(HttpServletRequest request)
@@ -152,26 +149,27 @@
 
     protected String createPortletURL(String encodedNavState, boolean secure)
     {
-        return createPortletURL(encodedNavState, secure, null, false);
+        return createPortletURL(encodedNavState, secure, null, URLType.RENDER, false);
     }
     
-    protected String createPortletURL(String encodedNavState, boolean secure, PortletWindow window, boolean action)
-    {   
-        return createPortletURL(encodedNavState, secure, window, action, false, false);
-    }
-    
-    protected String createPortletURL(String encodedNavState, boolean secure, PortletWindow window, boolean action, boolean resource, boolean desktopRequestNotAjax)
+    protected String createPortletURL(String encodedNavState, boolean secure, PortletWindow window, URLType urlType, boolean desktopRequestNotAjax)
     {   
         StringBuffer buffer = new StringBuffer("");
         buffer.append(getBaseURL(secure));
-        if (action)
+        boolean desktopEncoder = false;
+        
+        if (URLType.ACTION.equals(urlType))
         {
             buffer.append(this.baseActionPath);
         }
         else
         {
-            buffer.append(this.baseRenderPath);        
-        }            
+            buffer.append(this.baseRenderPath);
+            if (URLType.RESOURCE.equals(urlType))
+            {
+                desktopEncoder = true;
+            }            
+        }
         if ( encodedNavState != null )
         {
             buffer.append("/");
@@ -184,17 +182,13 @@
             buffer.append(getPath());
         }
         
-        if ( !resource )
+        if ( !desktopEncoder )
         {
         	if ( ! desktopRequestNotAjax )
             {
         		PortletEntity pe = window.getPortletEntity();
         		buffer.append( "?entity=" ).append( pe.getId() );
-            
-        		PortletDefinition portlet = pe.getPortletDefinition();
-        		PortletApplication app = (PortletApplication)portlet.getApplication();
-        		String uniqueName = app.getName() + "::" + portlet.getPortletName();
-        		buffer.append( "&portlet=" ).append( uniqueName );
+        		buffer.append( "&portlet=" ).append( pe.getPortletDefinition().getUniqueName() );
             }
         }
         else
@@ -205,18 +199,22 @@
         return buffer.toString();
     }        
     
-    public String createPortletURL(PortletWindow window, Map parameters, PortletMode mode, WindowState state, boolean action, boolean secure)
+    public String createPortletURL(PortletWindow window, Map<String, String[]> parameters, PortletMode mode, WindowState state, boolean action, boolean secure)
+    {
+        return createPortletURL(window, parameters, mode, state, action ? URLType.ACTION : URLType.RENDER ,secure);
+    }
+    
+    public String createPortletURL(PortletWindow window, Map<String, String[]> parameters, PortletMode mode, WindowState state, URLType urlType, boolean secure)
     {
         try
         {
-            boolean resource = !action && parameters.containsKey(PortalReservedParameters.PORTLET_RESOURCE_URL_REQUEST_PARAMETER);
             boolean desktopRequestNotAjax = false;
             if ( parameters.containsKey(JetspeedDesktop.DESKTOP_REQUEST_NOT_AJAX_PARAMETER) )
             {
             	desktopRequestNotAjax = true;
             	parameters.remove(JetspeedDesktop.DESKTOP_REQUEST_NOT_AJAX_PARAMETER);
             }
-            return createPortletURL(this.getNavigationalState().encode(window,parameters,mode,state,action), secure, window, action, resource, desktopRequestNotAjax);
+            return createPortletURL(this.getNavigationalState().encode(window,parameters,mode,state,urlType), secure, window, urlType, desktopRequestNotAjax);
         }
         catch (UnsupportedEncodingException e)
         {

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-portal/src/main/java/org/apache/jetspeed/login/filter/PortalFilter.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-portal/src/main/java/org/apache/jetspeed/login/filter/PortalFilter.java?rev=746641&r1=746640&r2=746641&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-portal/src/main/java/org/apache/jetspeed/login/filter/PortalFilter.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-portal/src/main/java/org/apache/jetspeed/login/filter/PortalFilter.java Sun Feb 22 06:06:20 2009
@@ -80,8 +80,10 @@
                 try{
                 	authUser = authProvider.authenticate(username, password);	
                 }
-                catch (SecurityException e) {
-                		throw new ServletException(e);                		
+                catch (SecurityException e) 
+                {
+                    audit.logUserActivity(username, request.getRemoteAddr(), AuditActivity.AUTHENTICATION_FAILURE, "PortalFilter");                    
+                    request.getSession().setAttribute(LoginConstants.ERRORCODE, LoginConstants.ERROR_INVALID_PASSWORD);
 				}
                 if (authUser != null)
                 {

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-portal/src/main/java/org/apache/jetspeed/resource/BufferedHttpServletResponse.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-portal/src/main/java/org/apache/jetspeed/resource/BufferedHttpServletResponse.java?rev=746641&r1=746640&r2=746641&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-portal/src/main/java/org/apache/jetspeed/resource/BufferedHttpServletResponse.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-portal/src/main/java/org/apache/jetspeed/resource/BufferedHttpServletResponse.java Sun Feb 22 06:06:20 2009
@@ -22,9 +22,8 @@
 import java.io.PrintWriter;
 import java.util.ArrayList;
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.Locale;
-import java.util.Map.Entry;
+import java.util.Map;
 
 import javax.servlet.ServletOutputStream;
 import javax.servlet.http.Cookie;
@@ -70,8 +69,8 @@
     private CharArrayWriterBuffer charOutputBuffer;
     private ServletOutputStream outputStream;
     private PrintWriter printWriter;
-    private HashMap headers;
-    private ArrayList cookies;
+    private HashMap<String, ArrayList<String>> headers;
+    private ArrayList<Cookie> cookies;
     private int errorCode;
     private int statusCode;
     private String errorMessage;
@@ -82,6 +81,7 @@
     private Locale locale;
     private boolean closed;
     private String characterEncoding;
+    private boolean setContentTypeAfterEncoding;
     private int contentLength = -1;
     private String contentType;
     private boolean flushed;
@@ -99,61 +99,51 @@
         }
         flushed = true;
         
+        if (cookies != null)
+        {
+            for (Cookie cookie : cookies)
+            {
+                response.addCookie(cookie);
+            }
+            cookies = null;
+        }
         if (locale != null)
         {
             response.setLocale(locale);
         }        
+        
         if (contentType != null)
         {
-            response.setContentType(contentType);
-        }
-        if (characterEncoding != null)
-        {
-            // setCharacterEncoding only available on Servlet Spec 2.4+
-            try
-            {
-                response.getClass().getMethod("setCharacterEncoding", new Class[]{String.class}).invoke(response, new Object[]{characterEncoding});
-            }
-            catch (NoSuchMethodException nsme)
+            if (characterEncoding != null)
             {
-                // servlet spec 2.3
+                if (setContentTypeAfterEncoding)
+                {
+                    response.setCharacterEncoding(characterEncoding);
+                    response.setContentType(contentType);
+                }
+                else
+                {
+                    response.setContentType(contentType);
+                    response.setCharacterEncoding(characterEncoding);
+                }
             }
-            catch (Exception e)
+            else
             {
-                throw new RuntimeException(e);
+                response.setContentType(contentType);
             }
         }
-        if (cookies != null)
+        else if (characterEncoding != null)
         {
-            for (int i=0,size=cookies.size(); i<size; i++)
-            {
-                response.addCookie((Cookie)cookies.get(i));
-            }
-            cookies = null;
+            response.setCharacterEncoding(characterEncoding);
         }
+        
         if (headers != null)
         {
-            Iterator iter = headers.entrySet().iterator();
-            while (iter.hasNext())
+            for (Map.Entry<String, ArrayList<String>> entry : headers.entrySet())
             {
-                Entry e = (Entry)iter.next();
-                String name = (String)e.getKey();
-                ArrayList values = (ArrayList)e.getValue();
-                for (int i=0, size=values.size(); i < size; i++ )
+                for (String value : entry.getValue())
                 {
-                    Object value = values.get(i);
-                    if (value instanceof Integer)
-                    {
-                        response.addIntHeader(name, ((Integer)value).intValue());
-                    }
-                    else if (value instanceof Long)
-                    {
-                        response.addDateHeader(name, ((Long)value).longValue());
-                    }
-                    else
-                    {
-                        response.addHeader(name, (String)value);
-                    }
+                    response.addHeader(entry.getKey(), value);
                 }
             }
             headers = null;
@@ -215,16 +205,16 @@
         }
     }
     
-    private ArrayList getHeaderList(String name, boolean create)
+    private ArrayList<String> getHeaderList(String name, boolean create)
     {
         if ( headers == null )
         {
-            headers = new HashMap();
+            headers = new HashMap<String, ArrayList<String>>();
         }
-        ArrayList headerList = (ArrayList)headers.get(name);
+        ArrayList<String> headerList = headers.get(name);
         if ( headerList == null && create )
         {
-            headerList = new ArrayList();
+            headerList = new ArrayList<String>();
             headers.put(name,headerList);
         }
         return headerList;
@@ -247,7 +237,7 @@
         {
             if ( cookies == null )
             {
-                cookies = new ArrayList();
+                cookies = new ArrayList<Cookie>();
             }
             cookies.add(cookie);
         }
@@ -260,8 +250,7 @@
     {
         if (!committed)
         {
-            ArrayList headerList = getHeaderList(name, true);
-            headerList.add(new Long(date));
+            addHeader(name, Long.toString(date));
         }
     }
 
@@ -272,8 +261,7 @@
     {
         if (!committed)
         {
-            ArrayList headerList = getHeaderList(name, true);
-            headerList.add(value);
+            getHeaderList(name, true).add(value);
         }
     }
 
@@ -284,8 +272,7 @@
     {
         if (!committed)
         {
-            ArrayList headerList = getHeaderList(name, true);
-            headerList.add(new Integer(value));
+            addHeader(name, Integer.toString(value));
         }
     }
 
@@ -336,9 +323,7 @@
     {
         if (!committed)
         {
-            ArrayList headerList = getHeaderList(name, true);
-            headerList.clear();
-            headerList.add(new Long(date));
+            setHeader(name, Long.toString(date));
         }
     }
 
@@ -349,7 +334,7 @@
     {
         if (!committed)
         {
-            ArrayList headerList = getHeaderList(name, true);
+            ArrayList<String> headerList = getHeaderList(name, true);
             headerList.clear();
             headerList.add(value);
         }
@@ -362,9 +347,7 @@
     {
         if (!committed)
         {
-            ArrayList headerList = getHeaderList(name, true);
-            headerList.clear();
-            headerList.add(new Integer(value));
+            setHeader(name, Integer.toString(value));
         }
     }
 
@@ -537,6 +520,7 @@
         if (charset != null && !committed && printWriter == null)
         {
             characterEncoding = charset;
+            setContentTypeAfterEncoding = false;
         }
     }
 
@@ -568,6 +552,7 @@
         if (!committed)
         {
             contentType = type;
+            setContentTypeAfterEncoding = false;
             if (printWriter == null)
             {
                 // TODO: parse possible encoding for better return value from getCharacterEncoding()
@@ -583,9 +568,6 @@
         if (!committed)
         {
             this.locale = locale;
-            /* NON-FIXABLE ISSUE: defaulting the characterEncoding from the Locale
-               This feature cannot be implemented/wrapped as it might depend on web.xml locale settings
-             */
         }
     }
 }

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-portal/src/main/java/org/apache/jetspeed/resource/ResourceValveImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-portal/src/main/java/org/apache/jetspeed/resource/ResourceValveImpl.java?rev=746641&r1=746640&r2=746641&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-portal/src/main/java/org/apache/jetspeed/resource/ResourceValveImpl.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-portal/src/main/java/org/apache/jetspeed/resource/ResourceValveImpl.java Sun Feb 22 06:06:20 2009
@@ -96,9 +96,15 @@
                 request.setAttribute(PortalReservedParameters.REQUEST_CONTEXT_OBJECTS, request.getObjects());                        
                 request.setAttribute(PortalReservedParameters.PATH_ATTRIBUTE, request.getAttribute(PortalReservedParameters.PATH_ATTRIBUTE));
                 request.setAttribute(PortalReservedParameters.PORTLET_WINDOW_ATTRIBUTE, resourceWindow);
-                BufferedHttpServletResponse bufferedResponse = new BufferedHttpServletResponse(response);
-                container.doRender(resourceWindow, requestForWindow, bufferedResponse);
-                bufferedResponse.flush(response);
+                request.setAttribute(PortalReservedParameters.PORTLET_CONTAINER_INVOKER_USE_FORWARD, Boolean.TRUE);
+                if (resourceWindow.getPortletEntity().getPortletDefinition().getApplication().getVersion().equals("1.0"))
+                {
+                    container.doRender(resourceWindow, requestForWindow, response);
+                }
+                else
+                {
+                    container.doServeResource(resourceWindow, requestForWindow, response);
+                }
             }
             catch (PortletContainerException e)
             {

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-portal/src/test/testdata/pages/pages/page.security
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-portal/src/test/testdata/pages/pages/page.security?rev=746641&r1=746640&r2=746641&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-portal/src/test/testdata/pages/pages/page.security (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-portal/src/test/testdata/pages/pages/page.security Sun Feb 22 06:06:20 2009
@@ -3,7 +3,7 @@
     <security-constraints-def name="admin">
         <security-constraint>
             <roles>admin</roles>
-            <permissions>view, edit</permissions>
+            <permissions>view,edit</permissions>
         </security-constraint>
     </security-constraints-def>
     <security-constraints-def name="manager">
@@ -39,7 +39,7 @@
     <security-constraints-def name="public-edit">
         <security-constraint>
             <users>*</users>
-            <permissions>view, edit</permissions>
+            <permissions>view,edit</permissions>
         </security-constraint>
     </security-constraints-def>
     <security-constraints-def name="delete3">

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/JETSPEED-INF/ojb/registry_repository.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/JETSPEED-INF/ojb/registry_repository.xml?rev=746641&r1=746640&r2=746641&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/JETSPEED-INF/ojb/registry_repository.xml (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/JETSPEED-INF/ojb/registry_repository.xml Sun Feb 22 06:06:20 2009
@@ -160,7 +160,12 @@
          column="SECURITY_REF"
          jdbc-type="VARCHAR"
       />
-      
+      <field-descriptor
+         name="defaultNamespace"
+         column="DEFAULT_NAMESPACE"
+         jdbc-type="VARCHAR"
+      />
+            
       <collection-descriptor
          name="metadataFields"
          element-class-ref="org.apache.jetspeed.om.portlet.impl.PortletApplicationLocalizedFieldImpl"
@@ -267,13 +272,44 @@
      <collection-descriptor
        name="roles"
        element-class-ref="org.apache.jetspeed.om.portlet.impl.SecurityRoleImpl"
-       auto-delete="false"
+       auto-delete="true"
+         auto-update = "true"
+         auto-retrieve = "true"
+     >
+       <inverse-foreignkey field-ref="appId"/>
+    </collection-descriptor>
+
+     <collection-descriptor
+       name="eventDefinitions"
+       element-class-ref="org.apache.jetspeed.om.portlet.impl.EventDefinitionImpl"
+       auto-delete="true"
+         auto-update = "true"
+         auto-retrieve = "true"
+     >
+       <inverse-foreignkey field-ref="appId"/>
+    </collection-descriptor>
+
+     <collection-descriptor
+       name="publicRenderParameters"
+       element-class-ref="org.apache.jetspeed.om.portlet.impl.PublicRenderParameterImpl"
+       auto-delete="true"
          auto-update = "true"
          auto-retrieve = "true"
      >
        <inverse-foreignkey field-ref="appId"/>
     </collection-descriptor>
+  
 
+   <collection-descriptor
+         name="containerRuntimeOptions"
+         element-class-ref="org.apache.jetspeed.om.portlet.impl.ContainerRuntimeOptionImpl"
+          auto-delete="true"
+          auto-update = "true"
+          auto-retrieve = "true"
+      >
+         <inverse-foreignkey field-ref="ownerId"/>
+      </collection-descriptor>
+      
    </class-descriptor>
 
 <!--
@@ -320,6 +356,12 @@
          jdbc-type="INTEGER"
       />
 
+       <field-descriptor
+         name="cacheScope"
+         column="CACHE_SCOPE"
+         jdbc-type="VARCHAR"
+      />
+
       <field-descriptor
          name="resourceBundle"
          column="RESOURCE_BUNDLE"
@@ -448,6 +490,46 @@
          </query-customizer>
       </collection-descriptor>
 
+     <collection-descriptor
+       name="supportedProcessingEvents"
+       element-class-ref="org.apache.jetspeed.om.portlet.impl.ProcessingEventReferenceImpl"
+       auto-delete="true"
+       auto-update = "true"
+       auto-retrieve = "true"
+     >
+       <inverse-foreignkey field-ref="ownerId"/>
+    </collection-descriptor>
+
+     <collection-descriptor
+       name="supportedPublishingEvents"
+       element-class-ref="org.apache.jetspeed.om.portlet.impl.PublishingEventReferenceImpl"
+       auto-delete="true"
+       auto-update = "true"
+       auto-retrieve = "true"
+     >
+       <inverse-foreignkey field-ref="ownerId"/>
+    </collection-descriptor>
+
+     <collection-descriptor
+         name="supportedPublicRenderParameters"
+         element-class-ref="org.apache.jetspeed.om.portlet.impl.SupportedPublicRenderParameterImpl"
+         auto-delete="true"
+         auto-update = "true"
+         auto-retrieve = "true"
+
+      >
+         <inverse-foreignkey field-ref="ownerId"/>
+      </collection-descriptor>
+
+   <collection-descriptor
+         name="containerRuntimeOptions"
+         element-class-ref="org.apache.jetspeed.om.portlet.impl.ContainerRuntimeOptionImpl"
+          auto-delete="true"
+          auto-update = "true"
+          auto-retrieve = "true"
+      >
+         <inverse-foreignkey field-ref="ownerId"/>
+      </collection-descriptor>
 
    <!--
       <collection-descriptor
@@ -616,7 +698,7 @@
 
 
 <!--
-   - L O C A L I Z E D   D E S C R I P I T I O N
+   - L O C A L I Z E D   D E S C R I P T I O N
  -->
    <class-descriptor
       class="org.apache.jetspeed.om.portlet.impl.DescriptionImpl"
@@ -1242,4 +1324,447 @@
       />
    </class-descriptor>
 
+<!--
+   - E V E N T  D E F I N I T I O N
+-->
+
+  <class-descriptor
+      class="org.apache.jetspeed.om.portlet.impl.EventDefinitionImpl"
+      table="EVENT_DEFINITION"
+   >
+        <field-descriptor
+         name="id"
+         column="ID"
+         jdbc-type="BIGINT"
+         primarykey="true"
+         autoincrement="true"
+         access="anonymous"
+      />
+
+     <field-descriptor
+         name="appId"
+         column="APPLICATION_ID"
+         jdbc-type="BIGINT"
+         access="anonymous"
+      />
+
+      <field-descriptor
+         name="localPart"
+         column="LOCAL_PART"
+         jdbc-type="VARCHAR"
+      />
+
+      <field-descriptor
+         name="namespace"
+         column="NAMESPACE"
+         jdbc-type="VARCHAR"
+      />
+
+      <field-descriptor
+         name="prefix"
+         column="PREFIX"
+         jdbc-type="VARCHAR"
+      />
+
+       <field-descriptor
+         name="valueType"
+         column="VALUE_TYPE"
+         jdbc-type="VARCHAR"
+      />
+
+      <collection-descriptor
+         name="descriptions"
+         element-class-ref="org.apache.jetspeed.om.portlet.impl.DescriptionImpl"
+         auto-delete="true"
+         auto-update = "true"
+         auto-retrieve = "true"
+
+      >
+         <inverse-foreignkey field-ref="ownerId"/>
+         <query-customizer class="org.apache.jetspeed.util.ojb.CollectionOwnerClassDiscriminatorQueryCustomizer">
+            <attribute
+              attribute-name="discriminatorField"
+              attribute-value="owner"
+            />
+         </query-customizer>
+
+      </collection-descriptor>
+
+      <collection-descriptor
+         name="aliases"
+         element-class-ref="org.apache.jetspeed.om.portlet.impl.EventAliasImpl"
+         auto-delete="true"
+         auto-update = "true"
+         auto-retrieve = "true"
+
+      >
+         <inverse-foreignkey field-ref="ownerId"/>
+      </collection-descriptor>
+   
+	</class-descriptor>
+
+
+<!--
+   - E V E N T  A L I A S
+ -->
+   <class-descriptor
+      class="org.apache.jetspeed.om.portlet.impl.EventAliasImpl"
+      table="EVENT_ALIAS"
+   >
+
+      <field-descriptor
+         name="id"
+         column="ID"
+         jdbc-type="BIGINT"
+         primarykey="true"
+         autoincrement="true"
+         access="anonymous"
+      />
+
+      <field-descriptor
+         name="ownerId"
+         column="OWNER_ID"
+         jdbc-type="BIGINT"
+         access="anonymous"
+      />
+
+      <field-descriptor
+         name="localPart"
+         column="LOCAL_PART"
+         jdbc-type="VARCHAR"
+      />
+
+      <field-descriptor
+         name="namespace"
+         column="NAMESPACE"
+         jdbc-type="VARCHAR"
+      />
+
+      <field-descriptor
+         name="prefix"
+         column="PREFIX"
+         jdbc-type="VARCHAR"
+      />
+
+    </class-descriptor>
+
+<!--
+   - P A R A M E T E R  A L I A S
+ -->
+   <class-descriptor
+      class="org.apache.jetspeed.om.portlet.impl.ParameterAliasImpl"
+      table="PARAMETER_ALIAS"
+   >
+
+      <field-descriptor
+         name="id"
+         column="ID"
+         jdbc-type="BIGINT"
+         primarykey="true"
+         autoincrement="true"
+         access="anonymous"
+      />
+
+      <field-descriptor
+         name="ownerId"
+         column="OWNER_ID"
+         jdbc-type="BIGINT"
+         access="anonymous"
+      />
+
+      <field-descriptor
+         name="localPart"
+         column="LOCAL_PART"
+         jdbc-type="VARCHAR"
+      />
+
+      <field-descriptor
+         name="namespace"
+         column="NAMESPACE"
+         jdbc-type="VARCHAR"
+      />
+
+      <field-descriptor
+         name="prefix"
+         column="PREFIX"
+         jdbc-type="VARCHAR"
+      />
+
+    </class-descriptor>
+
+<!--
+   - PUBLISHING EVENT
+ -->
+   <class-descriptor
+      class="org.apache.jetspeed.om.portlet.impl.PublishingEventReferenceImpl"
+      table="PUBLISHING_EVENT"
+   >
+
+      <field-descriptor
+         name="id"
+         column="ID"
+         jdbc-type="BIGINT"
+         primarykey="true"
+         autoincrement="true"
+         access="anonymous"
+      />
+
+      <field-descriptor
+         name="ownerId"
+         column="OWNER_ID"
+         jdbc-type="BIGINT"
+         access="anonymous"
+      />
+
+      <field-descriptor
+         name="localPart"
+         column="LOCAL_PART"
+         jdbc-type="VARCHAR"
+      />
+
+      <field-descriptor
+         name="namespace"
+         column="NAMESPACE"
+         jdbc-type="VARCHAR"
+      />
+
+      <field-descriptor
+         name="prefix"
+         column="PREFIX"
+         jdbc-type="VARCHAR"
+      />
+
+    </class-descriptor>
+
+<!--
+   - PROCESSING EVENT
+ -->
+   <class-descriptor
+      class="org.apache.jetspeed.om.portlet.impl.ProcessingEventReferenceImpl"
+      table="PROCESSING_EVENT"
+   >
+
+      <field-descriptor
+         name="id"
+         column="ID"
+         jdbc-type="BIGINT"
+         primarykey="true"
+         autoincrement="true"
+         access="anonymous"
+      />
+
+      <field-descriptor
+         name="ownerId"
+         column="OWNER_ID"
+         jdbc-type="BIGINT"
+         access="anonymous"
+      />
+
+      <field-descriptor
+         name="localPart"
+         column="LOCAL_PART"
+         jdbc-type="VARCHAR"
+      />
+
+      <field-descriptor
+         name="namespace"
+         column="NAMESPACE"
+         jdbc-type="VARCHAR"
+      />
+
+      <field-descriptor
+         name="prefix"
+         column="PREFIX"
+         jdbc-type="VARCHAR"
+      />
+
+    </class-descriptor>
+
+<!--
+   - S U P P O R T E D  P U B L I C  R E N D E R  P A R A M E T E R S
+ -->
+   <class-descriptor
+      class="org.apache.jetspeed.om.portlet.impl.SupportedPublicRenderParameterImpl"
+      table="NAMED_PARAMETER"
+   >
+
+      <field-descriptor
+         name="id"
+         column="ID"
+         jdbc-type="BIGINT"
+         primarykey="true"
+         autoincrement="true"
+         access="anonymous"
+      />
+
+      <field-descriptor
+         name="ownerId"
+         column="OWNER_ID"
+         jdbc-type="BIGINT"
+         access="anonymous"
+      />
+
+      <field-descriptor
+         name="name"
+         column="NAME"
+         jdbc-type="VARCHAR"
+      />
+
+    </class-descriptor>
+
+<!--
+   - C O N T A I N E R  R U N T I M E  O P T I O N
+ -->
+   <class-descriptor
+      class="org.apache.jetspeed.om.portlet.impl.ContainerRuntimeOptionImpl"
+      table="RUNTIME_OPTION"
+   >
+
+      <field-descriptor
+         name="id"
+         column="ID"
+         jdbc-type="BIGINT"
+         primarykey="true"
+         autoincrement="true"
+         access="anonymous"
+      />
+
+      <field-descriptor
+         name="ownerId"
+         column="OWNER_ID"
+         jdbc-type="BIGINT"
+         access="anonymous"
+      />
+
+
+      <field-descriptor
+         name="owner"
+         column="OWNER_CLASS_NAME"
+         jdbc-type="VARCHAR"
+      />
+
+      <field-descriptor
+         name="name"
+         column="NAME"
+         jdbc-type="VARCHAR"
+      />
+
+
+     <collection-descriptor
+         name="values"
+         element-class-ref="org.apache.jetspeed.om.portlet.impl.ContainerRuntimeOptionValueImpl"
+       auto-delete="true"
+       auto-update = "true"
+       auto-retrieve = "true"
+     >
+       <inverse-foreignkey field-ref="ownerId"/>
+    </collection-descriptor>
+
+    </class-descriptor>
+
+<!--
+   - C O N T A I N E R  R U N T I M E  O P T I O N  V A L U E
+ -->
+   <class-descriptor
+      class="org.apache.jetspeed.om.portlet.impl.ContainerRuntimeOptionValueImpl"
+      table="RUNTIME_VALUE"
+   >
+
+      <field-descriptor
+         name="id"
+         column="ID"
+         jdbc-type="BIGINT"
+         primarykey="true"
+         autoincrement="true"
+         access="anonymous"
+      />
+
+      <field-descriptor
+         name="ownerId"
+         column="OWNER_ID"
+         jdbc-type="BIGINT"
+         access="anonymous"
+      />
+
+      <field-descriptor
+         name="value"
+         column="RVALUE"
+         jdbc-type="VARCHAR"
+      />
+
+    </class-descriptor>
+
+<!--
+   - PUBLIC RENDER PARAMETERS
+-->
+
+  <class-descriptor
+      class="org.apache.jetspeed.om.portlet.impl.PublicRenderParameterImpl"
+      table="PUBLIC_PARAMETER"
+   >
+        <field-descriptor
+         name="id"
+         column="ID"
+         jdbc-type="BIGINT"
+         primarykey="true"
+         autoincrement="true"
+         access="anonymous"
+      />
+
+     <field-descriptor
+         name="appId"
+         column="APPLICATION_ID"
+         jdbc-type="BIGINT"
+         access="anonymous"
+      />
+
+      <field-descriptor
+         name="localPart"
+         column="LOCAL_PART"
+         jdbc-type="VARCHAR"
+      />
+
+      <field-descriptor
+         name="namespace"
+         column="NAMESPACE"
+         jdbc-type="VARCHAR"
+      />
+
+      <field-descriptor
+         name="prefix"
+         column="PREFIX"
+         jdbc-type="VARCHAR"
+      />
+
+       <field-descriptor
+         name="identifier"
+         column="IDENTIFIER"
+         jdbc-type="VARCHAR"
+      />
+
+      <collection-descriptor
+         name="descriptions"
+         element-class-ref="org.apache.jetspeed.om.portlet.impl.DescriptionImpl"
+         auto-delete="true"
+         auto-update = "true"
+         auto-retrieve = "true"
+
+      >
+         <inverse-foreignkey field-ref="ownerId"/>
+
+      </collection-descriptor>
+
+      <collection-descriptor
+         name="aliases"
+         element-class-ref="org.apache.jetspeed.om.portlet.impl.ParameterAliasImpl"
+         auto-delete="true"
+         auto-update = "true"
+         auto-retrieve = "true"
+
+      >
+       <inverse-foreignkey field-ref="ownerId"/>
+      </collection-descriptor>
+   
+	</class-descriptor>
+	
 </descriptor-repository>

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletpreferences/jpa/DatabasePreference.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletpreferences/jpa/DatabasePreference.java?rev=746641&r1=746640&r2=746641&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletpreferences/jpa/DatabasePreference.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletpreferences/jpa/DatabasePreference.java Sun Feb 22 06:06:20 2009
@@ -49,10 +49,10 @@
 @Entity (name="PortletPreference")
 @Table (name="PORTLET_PREFERENCE")
 @NamedQueries ({@NamedQuery(name="PORTLET_PREFERENCES", query="select pp from PortletPreference pp where pp.dtype = :dtype and pp.applicationName = :applicationName and pp.portletName = :portletName"),
-                @NamedQuery(name="DELETE_PORTLET_PREFERENCES", query="delete from PortletPreference pp where pp.dtype = :dtype and pp.applicationName = :applicationName and pp.portletName = :portletName"),
+                @NamedQuery(name="DELETE_PORTLET_PREFERENCES", query="select pp from PortletPreference pp where pp.dtype = :dtype and pp.applicationName = :applicationName and pp.portletName = :portletName"),
                 @NamedQuery(name="PORTLET_DTYPE_PREFERENCES", query="select pp from PortletPreference pp where pp.dtype = :dtype"),
                 @NamedQuery(name="PORTLET_APPLICATION_PREFERENCES", query="select pp from PortletPreference pp where pp.dtype = :dtype and pp.applicationName = :applicationName"),
-                @NamedQuery(name="DELETE_PORTLET_APPLICATION_PREFERENCES", query="delete from PortletPreference pp where pp.dtype = :dtype and pp.applicationName = :applicationName"),
+                @NamedQuery(name="DELETE_PORTLET_APPLICATION_PREFERENCES", query="select pp from PortletPreference pp where pp.dtype = :dtype and pp.applicationName = :applicationName"),
                 @NamedQuery(name="FULLY_QUALIFIED_PORTLET_PREFERENCES", query="select pp from PortletPreference pp where pp.dtype = :dtype and pp.applicationName = :applicationName and pp.portletName = :portletName and pp.entityId = :entityId and pp.userName = :userName")})
 public class DatabasePreference implements InternalPortletPreference
 {

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletpreferences/jpa/PortletPreferencesProviderImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletpreferences/jpa/PortletPreferencesProviderImpl.java?rev=746641&r1=746640&r2=746641&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletpreferences/jpa/PortletPreferencesProviderImpl.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletpreferences/jpa/PortletPreferencesProviderImpl.java Sun Feb 22 06:06:20 2009
@@ -238,7 +238,17 @@
         Query portletPreferencesDelete = entityManager.createNamedQuery("DELETE_PORTLET_APPLICATION_PREFERENCES");
         portletPreferencesDelete.setParameter("dtype", DISCRIMINATOR_PORTLET);
         portletPreferencesDelete.setParameter("applicationName", applicationName);
-        portletPreferencesDelete.executeUpdate();
+        List<DatabasePreference> deleteList = portletPreferencesDelete.getResultList();
+        if (!deleteList.isEmpty())
+        {
+            // remove queried preferences
+            for (DatabasePreference delete : deleteList)
+            {
+                entityManager.remove(delete);
+            }
+            // explicitly flush entity manager after remove
+            entityManager.flush();
+        }
     }
 
     /* (non-Javadoc)
@@ -256,7 +266,17 @@
         portletPreferencesDelete.setParameter("dtype", DISCRIMINATOR_PORTLET);
         portletPreferencesDelete.setParameter("applicationName", applicationName);
         portletPreferencesDelete.setParameter("portletName", portletName);
-        portletPreferencesDelete.executeUpdate();
+        List<DatabasePreference> deleteList = portletPreferencesDelete.getResultList();
+        if (!deleteList.isEmpty())
+        {
+            // remove queried preferences
+            for (DatabasePreference delete : deleteList)
+            {
+                entityManager.remove(delete);
+            }
+            // explicitly flush entity manager after remove
+            entityManager.flush();
+        }
     }
 
     /* (non-Javadoc)

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletregistry/PersistenceBrokerPortletRegistry.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletregistry/PersistenceBrokerPortletRegistry.java?rev=746641&r1=746640&r2=746641&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletregistry/PersistenceBrokerPortletRegistry.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletregistry/PersistenceBrokerPortletRegistry.java Sun Feb 22 06:06:20 2009
@@ -18,18 +18,32 @@
 
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Locale;
+import java.util.Map;
 
 import org.apache.jetspeed.cache.JetspeedCache;
 import org.apache.jetspeed.cache.JetspeedCacheEventListener;
 import org.apache.jetspeed.components.dao.InitablePersistenceBrokerDaoSupport;
 import org.apache.jetspeed.components.portletpreferences.PortletPreferencesProvider;
 import org.apache.jetspeed.om.common.Support;
+import org.apache.jetspeed.om.portlet.ContainerRuntimeOption;
+import org.apache.jetspeed.om.portlet.Description;
+import org.apache.jetspeed.om.portlet.DisplayName;
+import org.apache.jetspeed.om.portlet.EventDefinitionReference;
+import org.apache.jetspeed.om.portlet.InitParam;
+import org.apache.jetspeed.om.portlet.Language;
+import org.apache.jetspeed.om.portlet.LocalizedField;
 import org.apache.jetspeed.om.portlet.PortletApplication;
 import org.apache.jetspeed.om.portlet.PortletDefinition;
+import org.apache.jetspeed.om.portlet.Preferences;
+import org.apache.jetspeed.om.portlet.SecurityRoleRef;
+import org.apache.jetspeed.om.portlet.Supports;
 import org.apache.jetspeed.om.portlet.impl.PortletApplicationDefinitionImpl;
 import org.apache.jetspeed.om.portlet.impl.PortletDefinitionImpl;
+import org.apache.jetspeed.om.portlet.impl.PreferencesImpl;
 import org.apache.ojb.broker.query.Criteria;
 import org.apache.ojb.broker.query.QueryFactory;
 import org.springframework.dao.DataAccessException;
@@ -301,5 +315,48 @@
     {
         this.listeners.remove(listener);
     }
+ 
+    public void clonePortletDefinition(PortletDefinition source, String newPortletName) throws FailedToStorePortletDefinitionException
+    {
+        if (this.portletDefinitionExists(newPortletName, source.getApplication()))
+        {
+            throw new FailedToStorePortletDefinitionException("Cannot clone to portlet named " + newPortletName + ", name already exists"); 
+        }
+        PortletDefinitionImpl copy = new PortletDefinitionImpl();
+        copy.setApplication(source.getApplication());
+        copy.setPortletName(newPortletName);
+        copy.setPortletClass(source.getPortletClass());
+        copy.setResourceBundle(source.getResourceBundle());
+        copy.setPreferenceValidatorClassname(source.getPreferenceValidatorClassname());
+        copy.setExpirationCache(source.getExpirationCache());
+        copy.setCacheScope(source.getCacheScope());
+        // TODO: Metadata
+        
+        copy.setJetspeedSecurityConstraint(source.getJetspeedSecurityConstraint());
+        copy.getDescriptions().addAll(source.getDescriptions());
+        copy.getDisplayNames().addAll(source.getDisplayNames());
+        
+    }
+    
+    /*
+
+    private Collection<LocalizedField> metadataFields = null;
+
+    
+    private List<InitParam> initParams;
+    private List<EventDefinitionReference> supportedProcessingEvents;
+    private List<EventDefinitionReference> supportedPublishingEvents;
+    private List<SecurityRoleRef> securityRoleRefs;
+    private List<Supports> supports;
+    private List<String> supportedLocales;
+    private List<Language> languages;
+    private List<ContainerRuntimeOption> containerRuntimeOptions;    
+    private List<String> supportedPublicRenderParameters;
+    private Preferences descriptorPreferences = new PreferencesImpl();    
+    
+    private transient Map<Locale,InlinePortletResourceBundle> resourceBundles = new HashMap<Locale, InlinePortletResourceBundle>();
+    
+    protected List portletEntities;     
+     */
     
 }

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletregistry/jpa/PortletRegistryImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletregistry/jpa/PortletRegistryImpl.java?rev=746641&r1=746640&r2=746641&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletregistry/jpa/PortletRegistryImpl.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletregistry/jpa/PortletRegistryImpl.java Sun Feb 22 06:06:20 2009
@@ -30,6 +30,8 @@
 import org.apache.jetspeed.components.portletregistry.PortletRegistryHelper;
 import org.apache.jetspeed.components.portletregistry.RegistryEventListener;
 import org.apache.jetspeed.components.portletregistry.RegistryException;
+import org.apache.jetspeed.om.portlet.Description;
+import org.apache.jetspeed.om.portlet.DisplayName;
 import org.apache.jetspeed.om.portlet.PortletApplication;
 import org.apache.jetspeed.om.portlet.PortletDefinition;
 import org.apache.jetspeed.om.portlet.jpa.PortletApplicationDefinitionImpl;
@@ -271,6 +273,38 @@
         entityManager.flush();
     }
     
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.components.portletregistry.PortletRegistry#clonePortletDefinition(org.apache.jetspeed.om.portlet.PortletDefinition, java.lang.String)
+     */
+    public void clonePortletDefinition(PortletDefinition source, String newPortletName) throws FailedToStorePortletDefinitionException
+    {
+        if (portletDefinitionExists(newPortletName, source.getApplication()))
+        {
+            throw new FailedToStorePortletDefinitionException("Cannot clone to portlet named " + newPortletName + ", name already exists"); 
+        }
+        PortletDefinitionImpl copy = new PortletDefinitionImpl();
+        copy.setApplication(source.getApplication());
+        copy.setPortletName(newPortletName);
+        copy.setPortletClass(source.getPortletClass());
+        copy.setResourceBundle(source.getResourceBundle());
+        copy.setPreferenceValidatorClassname(source.getPreferenceValidatorClassname());
+        copy.setExpirationCache(source.getExpirationCache());
+        copy.setCacheScope(source.getCacheScope());
+        // TODO: Metadata
+        
+        copy.setJetspeedSecurityConstraint(source.getJetspeedSecurityConstraint());
+        for (Description sourceDescription : source.getDescriptions())
+        {
+            Description copyDescription = copy.addDescription(sourceDescription.getLang());
+            copyDescription.setDescription(sourceDescription.getDescription());
+        }
+        for (DisplayName sourceDisplayName : source.getDisplayNames())
+        {
+            DisplayName copyDisplayName = copy.addDisplayName(sourceDisplayName.getLang());
+            copyDisplayName.setDisplayName(sourceDisplayName.getDisplayName());
+        }
+    }
+
     /**
      * Notify registry event listeners that portlet definition
      * may have been updated and removed from local cache.

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/AbstractPortletApplicationDefinitionImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/AbstractPortletApplicationDefinitionImpl.java?rev=746641&r1=746640&r2=746641&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/AbstractPortletApplicationDefinitionImpl.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/AbstractPortletApplicationDefinitionImpl.java Sun Feb 22 06:06:20 2009
@@ -63,14 +63,10 @@
     
     protected String description;
     protected String resourceBundle;
-    protected String defaultNamespace;
-    protected List<EventDefinition> eventDefinitions;
-    protected List<PublicRenderParameter> publicRenderParameters;
     protected List<SecurityConstraint> securityConstraints;
     protected List<Filter> filters;
     protected List<FilterMapping> filterMappings;
     protected List<Listener> listeners;
-    protected List<ContainerRuntimeOption> containerRuntimeOptions;
     
     protected transient Map<PortletMode,PortletMode> supportedCustomModes;
     protected transient Map<WindowState,WindowState> supportedCustomStates;
@@ -81,16 +77,6 @@
     
     // Base PortletApplication Implementation
     
-    public String getDefaultNamespace()
-    {
-        return defaultNamespace;
-    }
-
-    public void setDefaultNamespace(String defaultNamespace)
-    {
-        this.defaultNamespace = defaultNamespace;
-    }
-
     public String getResourceBundle()
     {
         return resourceBundle;
@@ -133,31 +119,10 @@
         return null;
     }
 
-    public List<EventDefinition> getEventDefinitions()
-    {
-        if (eventDefinitions == null)
-        {
-            eventDefinitions = new ArrayList<EventDefinition>();
-        }
-        return eventDefinitions;
-    }
-
     public EventDefinition addEventDefinition(String name)
     {
-        // TODO: check duplicates (complication: set of qname and name)
-        EventDefinitionImpl ed = new EventDefinitionImpl();
-        ed.setName(name);
-        getEventDefinitions().add(ed);
-        return ed;
-    }
-
-    public EventDefinition addEventDefinition(QName qname)
-    {
-        // TODO: check duplicates (complication: set of qname and name)
-        EventDefinitionImpl ed = new EventDefinitionImpl();
-        ed.setQName(qname);
-        getEventDefinitions().add(ed);
-        return ed;
+        QName qname = new QName(name);
+        return addEventDefinition(qname);
     }
 
     public PublicRenderParameter getPublicRenderParameter(String identifier)
@@ -172,43 +137,16 @@
         return null;
     }
 
-    public List<PublicRenderParameter> getPublicRenderParameters()
+    protected boolean containsPublicRenderParameter(PublicRenderParameter prp)
     {
-        if (publicRenderParameters == null)
-        {
-            publicRenderParameters = new ArrayList<PublicRenderParameter>();
-        }
-        return publicRenderParameters;
-    }
-
-    public PublicRenderParameter addPublicRenderParameter(String name, String identifier)
-    {
-        if (getPublicRenderParameter(identifier) != null)
-        {
-            throw new IllegalArgumentException("PublicRenderParameter with identifier: "+identifier+" already defined");
-        }
-        // TODO: check duplicates on name|qname?
-        PublicRenderParameterImpl p = new PublicRenderParameterImpl();
-        p.setName(name);
-        p.setIdentifier(identifier);
-        getPublicRenderParameters().add(p);
-        return p;        
-    }
-
-    public PublicRenderParameter addPublicRenderParameter(QName qname, String identifier)
-    {
-        if (getPublicRenderParameter(identifier) != null)
+        for (PublicRenderParameter p : getPublicRenderParameters())
         {
-            throw new IllegalArgumentException("PublicRenderParameter with identifier: "+identifier+" already defined");
+            if (p.equals(prp))
+                return true;
         }
-        // TODO: check duplicates on name|qname?
-        PublicRenderParameterImpl p = new PublicRenderParameterImpl();
-        p.setQName(qname);
-        p.setIdentifier(identifier);
-        getPublicRenderParameters().add(p);
-        return p;        
+        return false;
     }
-
+    
     public CustomPortletMode getCustomPortletMode(String name)
     {
         for (CustomPortletMode cpm : getCustomPortletModes())
@@ -481,27 +419,6 @@
         return null;
     }
 
-    public List<ContainerRuntimeOption> getContainerRuntimeOptions()
-    {
-        if (containerRuntimeOptions == null)
-        {
-            containerRuntimeOptions = new ArrayList<ContainerRuntimeOption>();
-        }
-        return containerRuntimeOptions;
-    }
-
-    public ContainerRuntimeOption addContainerRuntimeOption(String name)
-    {
-        if (getContainerRuntimeOption(name) != null)
-        {
-            throw new IllegalArgumentException("Container runtime option with name: "+name+" already defined");
-        }
-        ContainerRuntimeOptionImpl cro = new ContainerRuntimeOptionImpl();
-        cro.setName(name);
-        getContainerRuntimeOptions().add(cro);
-        return cro;        
-    }
-
     public boolean isLayoutApplication()
     {
         if (getMetadata() != null)

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/AbstractPortletDefinitionImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/AbstractPortletDefinitionImpl.java?rev=746641&r1=746640&r2=746641&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/AbstractPortletDefinitionImpl.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/AbstractPortletDefinitionImpl.java Sun Feb 22 06:06:20 2009
@@ -74,12 +74,7 @@
 
     // Members
     
-    protected String cacheScope;
-    protected List<EventDefinitionReference> supportedProcessingEvents;
-    protected List<EventDefinitionReference> supportedPublishingEvents;
     protected List<String> supportedLocales;
-    protected List<ContainerRuntimeOption> containerRuntimeOptions;    
-    protected List<String> supportedPublicRenderParameters;
     protected Preferences descriptorPreferences = new PreferencesImpl();    
     
     protected transient Map<Locale,InlinePortletResourceBundle> resourceBundles = new HashMap<Locale, InlinePortletResourceBundle>();
@@ -282,27 +277,6 @@
         return null;
     }
 
-    public List<ContainerRuntimeOption> getContainerRuntimeOptions()
-    {
-        if (containerRuntimeOptions == null)
-        {
-            containerRuntimeOptions = new ArrayList<ContainerRuntimeOption>();
-        }
-        return containerRuntimeOptions;
-    }
-
-    public ContainerRuntimeOption addContainerRuntimeOption(String name)
-    {
-        if (getContainerRuntimeOption(name) != null)
-        {
-            throw new IllegalArgumentException("Container runtime option with name: "+name+" already defined");
-        }
-        ContainerRuntimeOptionImpl cro = new ContainerRuntimeOptionImpl();
-        cro.setName(name);
-        containerRuntimeOptions.add(cro);
-        return cro;        
-    }
-
     public PortletInfo getPortletInfo()
     {
         return getLanguage(JetspeedLocale.getDefaultLocale());
@@ -353,41 +327,6 @@
         supportedLocales.add(lang);    
     }
 
-    public List<String> getSupportedPublicRenderParameters()
-    {
-        if (supportedPublicRenderParameters == null)
-        {
-            supportedPublicRenderParameters = new ArrayList<String>();
-        }
-        return supportedPublicRenderParameters;
-    }
-    
-    public void addSupportedPublicRenderParameter(String identifier)
-    {
-        for (String ident : getSupportedPublicRenderParameters())
-        {
-            if (ident.equals(identifier))
-            {
-                throw new IllegalArgumentException("Support for public render parameter with identifier: "+identifier+" already defined");
-            }
-        }
-        supportedPublicRenderParameters.add(identifier);
-    }
-
-    /**
-     * Caching scope, allowed values are "private" indicating that the content should not be shared across users and
-     * "public" indicating that the content may be shared across users. The default value if not present is "private".
-     */
-    public String getCacheScope()
-    {
-        return cacheScope != null ? cacheScope : "private";
-    }
-
-    public void setCacheScope(String cacheScope)
-    {
-        this.cacheScope = cacheScope;
-    }
-
     public DisplayName getDisplayName(Locale locale)
     {
         return (DisplayName)JetspeedLocale.getBestLocalizedObject(getDisplayNames(), locale);
@@ -405,61 +344,15 @@
         return null;
     }
 
-    public List<EventDefinitionReference> getSupportedProcessingEvents()
-    {
-        if (supportedProcessingEvents == null)
-        {
-            supportedProcessingEvents = new ArrayList<EventDefinitionReference>();            
-        }
-        return supportedProcessingEvents;
-    }
-
-    public EventDefinitionReference addSupportedProcessingEvent(QName qname)
-    {
-        // TODO: check duplicates
-        getSupportedProcessingEvents();
-        EventDefinitionReferenceImpl edr = new EventDefinitionReferenceImpl();
-        edr.setQName(qname);
-        supportedProcessingEvents.add(edr);
-        return edr;
-    }
-    
     public EventDefinitionReference addSupportedProcessingEvent(String name)
     {
-        // TODO check duplicates
-        getSupportedProcessingEvents();
-        EventDefinitionReferenceImpl edr = new EventDefinitionReferenceImpl();
-        edr.setName(name);
-        supportedProcessingEvents.add(edr);
-        return edr;
+        QName qname = new QName(name);
+        return this.addSupportedProcessingEvent(qname);
     }
-        
-    public List<EventDefinitionReference> getSupportedPublishingEvents()
-    {
-        if (supportedPublishingEvents == null)
-        {
-            supportedPublishingEvents = new ArrayList<EventDefinitionReference>();            
-        }
-        return supportedPublishingEvents;
-    }
-
-    public EventDefinitionReference addSupportedPublishingEvent(QName qname)
-    {
-        // TODO: check duplicates
-        getSupportedPublishingEvents();
-        EventDefinitionReferenceImpl edr = new EventDefinitionReferenceImpl();
-        edr.setQName(qname);
-        supportedPublishingEvents.add(edr);
-        return edr;
-    }
-    
+         
     public EventDefinitionReference addSupportedPublishingEvent(String name)
     {
-        // TODO check duplicates
-        getSupportedPublishingEvents();
-        EventDefinitionReferenceImpl edr = new EventDefinitionReferenceImpl();
-        edr.setName(name);
-        supportedPublishingEvents.add(edr);
-        return edr;
+        QName qname = new QName(name);
+        return this.addSupportedPublishingEvent(qname);
     }
 }

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/ContainerRuntimeOptionImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/ContainerRuntimeOptionImpl.java?rev=746641&r1=746640&r2=746641&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/ContainerRuntimeOptionImpl.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/ContainerRuntimeOptionImpl.java Sun Feb 22 06:06:20 2009
@@ -22,6 +22,7 @@
 import java.util.List;
 
 import org.apache.jetspeed.om.portlet.ContainerRuntimeOption;
+import org.apache.jetspeed.om.portlet.ContainerRuntimeOptionValue;
 
 /**
  * @version $Id$
@@ -29,8 +30,19 @@
  */
 public class ContainerRuntimeOptionImpl implements ContainerRuntimeOption, Serializable
 {
+    private static final long serialVersionUID = 1L;
     protected String name;
-    protected List<String> values = new ArrayList<String>();
+    protected List<ContainerRuntimeOptionValue> values = new ArrayList<ContainerRuntimeOptionValue>();    
+    protected String owner;    
+
+    public ContainerRuntimeOptionImpl()
+    {}
+    
+    public ContainerRuntimeOptionImpl(Object owner, String name)
+    {
+        this.owner = owner.getClass().getName();        
+        this.name = name;
+    }
     
     public String getName()
     {
@@ -44,11 +56,31 @@
 
     public void addValue(String value)
     {
-        values.add(value);
+        if (values == null)
+        {
+            values = new ArrayList<ContainerRuntimeOptionValue>();
+        }
+        for (ContainerRuntimeOptionValue param : this.values)
+        {
+            if (param.equals(value))
+            {
+                throw new IllegalArgumentException("Support for container runtime parameter with identifier: "+value+" already defined");
+            }
+        }
+        values.add(new ContainerRuntimeOptionValueImpl(value));                
     }
 
     public List<String> getValues()
     {
-        return values;
+        if (values == null)
+        {
+            values = new ArrayList<ContainerRuntimeOptionValue>();
+        }
+        List<String> vals = new ArrayList<String>();
+        for (ContainerRuntimeOptionValue v : this.values)
+        {
+            vals.add(v.toString());
+        }
+        return vals;
     }
 }

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/DescriptionImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/DescriptionImpl.java?rev=746641&r1=746640&r2=746641&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/DescriptionImpl.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/DescriptionImpl.java Sun Feb 22 06:06:20 2009
@@ -41,8 +41,7 @@
     protected Locale locale = null;
     
     public DescriptionImpl()
-    {
-        
+    {        
     }
     
     public DescriptionImpl(Object owner, String lang)

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/EventDefinitionImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/EventDefinitionImpl.java?rev=746641&r1=746640&r2=746641&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/EventDefinitionImpl.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/EventDefinitionImpl.java Sun Feb 22 06:06:20 2009
@@ -26,6 +26,7 @@
 
 import org.apache.jetspeed.om.portlet.Description;
 import org.apache.jetspeed.om.portlet.EventDefinition;
+import org.apache.jetspeed.om.portlet.PortletQName;
 import org.apache.jetspeed.util.JetspeedLocale;
 
 /**
@@ -34,12 +35,23 @@
  */
 public class EventDefinitionImpl implements EventDefinition, Serializable
 {
-    protected String name;
-    protected QName qname;
+    private static final long serialVersionUID = 1L;
+    protected String localPart;
+    protected String prefix;
+    protected String namespace;
     protected String valueType;
-    protected List<QName> aliases;
+    protected List<EventAliasImpl> aliases;
     protected List<Description> descriptions;
     
+    public EventDefinitionImpl()
+    {
+    }
+
+    public EventDefinitionImpl(QName qname)
+    {
+        setQName(qname);
+    }
+
     public Description getDescription(Locale locale)
     {
         return (Description)JetspeedLocale.getBestLocalizedObject(getDescriptions(), locale);
@@ -70,39 +82,77 @@
 
     public QName getQName()
     {
-        return qname;
+        if (namespace == null)
+        {
+            return new QName(localPart);
+        }
+        else if (prefix == null)
+        {
+            return new QName(namespace, localPart);
+        }
+        else
+        {
+            return new QName(namespace, localPart, prefix);
+        }
     }
 
-    public void setQName(QName value)
+    public void setQName(QName qname)
     {
-        qname = value;
-        name = null;
+        this.namespace = qname.getNamespaceURI();
+        if (this.namespace != null && this.namespace.equals(""))
+            this.namespace = null;
+        this.prefix = qname.getPrefix();
+        if (this.prefix != null && this.prefix.equals(""))
+            this.prefix = null;
+        this.localPart = qname.getLocalPart();
     }
 
     public String getName()
     {
-        return name;
+        return this.localPart;
     }
 
-    public void setName(String value)
+    public void setName(String name)
     {
-        name = value;
-        qname = null;
+        this.localPart = name;
+        this.prefix = null;
+        this.namespace = null;
     }
 
     public List<QName> getAliases()
     {
-        if (aliases == null)
+        List<QName> result = new ArrayList<QName>();
+        if (aliases != null)
         {
-            aliases = new ArrayList<QName>();
+            for (PortletQName qname : aliases)
+            {
+                result.add(qname.getQName());
+            }
         }
-        return aliases;
+        return result;
     }
     
     public void addAlias(QName alias)
+    {       
+        if (aliases == null)
+        {
+            aliases = new ArrayList<EventAliasImpl>();
+        }
+        if (!containsAlias(alias))
+        {
+            aliases.add(new EventAliasImpl(alias));
+        }
+    }
+    
+    protected boolean containsAlias(QName qname)
     {
-        // TODO: check for duplicates
-        getAliases().add(alias);
+        PortletQName alias = new EventAliasImpl(qname);
+        for (PortletQName p : aliases)
+        {
+            if (p.equals(alias))
+                return true;
+        }
+        return false;
     }
 
     public String getValueType()
@@ -115,8 +165,22 @@
         valueType = value;
     }
 
-    public QName getQualifiedName(String defaultNamespace)
+    public QName getQualifiedName(String defaultnamespace)
     {
-        return qname != null ? qname : name != null ? new QName(defaultNamespace, name) : null;
+        return new QName(defaultnamespace, localPart);
+        //return qname != null ? qname : name != null ? new QName(defaultNamespace, name) : null;
     }
+
+    public boolean equals(Object qname)
+    {
+        return (this.toString().equals(qname.toString()));
+    }
+    
+    public String toString()
+    {
+        return ((this.namespace == null) ? "" : this.namespace + "//:") + 
+               ((this.prefix == null) ? "" : this.prefix + ":") +
+               ((this.localPart == null) ? "" : this.localPart);
+    }
+    
 }

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/EventDefinitionReferenceImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/EventDefinitionReferenceImpl.java?rev=746641&r1=746640&r2=746641&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/EventDefinitionReferenceImpl.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/EventDefinitionReferenceImpl.java Sun Feb 22 06:06:20 2009
@@ -27,35 +27,32 @@
  * @version $Id$
  *
  */
-public class EventDefinitionReferenceImpl implements EventDefinitionReference, Serializable
+public class EventDefinitionReferenceImpl extends PortletQNameImpl implements EventDefinitionReference, Serializable
 {
-    protected QName qname;
-    protected String name;
-    
-    public QName getQName()
+    private static final long serialVersionUID = 1L;
+
+    public EventDefinitionReferenceImpl()
     {
-        return qname;
+        super();
     }
-
-    public void setQName(QName value)
+    
+    public EventDefinitionReferenceImpl(QName qname)
     {
-        qname = value;
-        name = null;
+        super(qname);
     }
 
-    public String getName()
+    public EventDefinitionReferenceImpl(String qname)
     {
-        return name;
+        super(new QName(qname));
     }
-
-    public void setName(String value)
+    
+    public String getName()
     {
-        name = value;
-        qname = null;
+        return super.getLocalPart();
     }
 
     public QName getQualifiedName(String defaultNamespace)
     {
-        return qname != null ? qname : name != null ? new QName(defaultNamespace, name) : null;
+        return super.getQName();
     }
 }

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/GenericMetadataImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/GenericMetadataImpl.java?rev=746641&r1=746640&r2=746641&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/GenericMetadataImpl.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/GenericMetadataImpl.java Sun Feb 22 06:06:20 2009
@@ -36,7 +36,7 @@
  */
 public abstract class GenericMetadataImpl implements GenericMetadata
 {   
-    private Collection fields = null;
+    private Collection<LocalizedField> fields = null;
     private transient MultiValueMap fieldMap = null;
     
     private MultiValueMap getFieldMap(boolean create)
@@ -75,7 +75,7 @@
     {
         if(fields == null)
         {
-            fields = new ArrayList();
+            fields = new ArrayList<LocalizedField>();
         }
         
         fields.add(field);
@@ -85,17 +85,18 @@
     /* (non-Javadoc)
      * @see org.apache.jetspeed.om.common.GenericMetadata#getFields(java.lang.String)
      */
-    public Collection getFields(String name)
+    @SuppressWarnings("unchecked")
+    public Collection<LocalizedField> getFields(String name)
     {
     	//TODO:  return an immutable version?
         MultiValueMap fieldMap = getFieldMap(false);
-        return (Collection)(fieldMap !=null ? fieldMap.get(name) : null);
+        return (Collection<LocalizedField>)(fieldMap !=null ? fieldMap.get(name) : null);
     }
 
     /* (non-Javadoc)
      * @see org.apache.jetspeed.om.common.GenericMetadata#setFields(java.lang.String, java.util.Collection)
      */
-    public void setFields(String name, Collection values)
+    public void setFields(String name, Collection<LocalizedField> values)
     {
         MultiValueMap fieldMap = getFieldMap(false);
         if (fieldMap != null)
@@ -103,7 +104,7 @@
             fieldMap.remove(name);
         }
         
-        Iterator fieldIter = fields.iterator();
+        Iterator<LocalizedField> fieldIter = fields.iterator();
         while(fieldIter.hasNext())
         {
             LocalizedField field = (LocalizedField)fieldIter.next();
@@ -115,7 +116,7 @@
         
         if(values != null)
         {    
-            Iterator iter = values.iterator();
+            Iterator<LocalizedField> iter = values.iterator();
             while(iter.hasNext())
             {
                 LocalizedField field = (LocalizedField)iter.next();
@@ -129,14 +130,15 @@
     /* (non-Javadoc)
      * @see org.apache.jetspeed.om.common.GenericMetadata#getFields()
      */
-    public Collection getFields() {
+    public Collection<LocalizedField> getFields() 
+    {
         return fields;
     }
 
     /* (non-Javadoc)
      * @see org.apache.jetspeed.om.common.GenericMetadata#setFields(java.util.Collection)
      */
-    public void setFields(Collection fields)
+    public void setFields(Collection<LocalizedField> fields)
     {
         this.fields = fields;
 
@@ -148,7 +150,7 @@
         
         if(fields != null)
         {    
-            Iterator fieldIter = fields.iterator();
+            Iterator<LocalizedField> fieldIter = fields.iterator();
             while(fieldIter.hasNext())
             {
                 LocalizedField field = (LocalizedField)fieldIter.next();
@@ -164,7 +166,7 @@
     /* (non-Javadoc)
      * @see org.apache.jetspeed.om.common.GenericMetadata#copyFields(java.util.Collection)
      */
-    public void copyFields(Collection fields)
+    public void copyFields(Collection<LocalizedField> fields)
     {
         // preserve matching fields during copy to
         // minimize persistent store thrash and
@@ -188,10 +190,10 @@
             // create new fields collection if necessary
             if (this.fields == null)
             {
-                this.fields = new ArrayList();
+                this.fields = new ArrayList<LocalizedField>();
             }
             // copy unique new metadata members
-            Iterator fieldIter = fields.iterator();
+            Iterator<LocalizedField> fieldIter = fields.iterator();
             while (fieldIter.hasNext())
             {
                 LocalizedField field = (LocalizedField)fieldIter.next();
@@ -211,7 +213,7 @@
         
         if (this.fields != null)
         {    
-            Iterator fieldIter = this.fields.iterator();
+            Iterator<LocalizedField> fieldIter = this.fields.iterator();
             while (fieldIter.hasNext())
             {
                 LocalizedField field = (LocalizedField)fieldIter.next();

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/PortletApplicationDefinitionImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/PortletApplicationDefinitionImpl.java?rev=746641&r1=746640&r2=746641&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/PortletApplicationDefinitionImpl.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/PortletApplicationDefinitionImpl.java Sun Feb 22 06:06:20 2009
@@ -22,16 +22,21 @@
 import java.util.Collection;
 import java.util.List;
 
+import javax.xml.namespace.QName;
+
 import org.apache.jetspeed.om.common.Support;
+import org.apache.jetspeed.om.portlet.ContainerRuntimeOption;
 import org.apache.jetspeed.om.portlet.CustomPortletMode;
 import org.apache.jetspeed.om.portlet.CustomWindowState;
 import org.apache.jetspeed.om.portlet.Description;
 import org.apache.jetspeed.om.portlet.DisplayName;
+import org.apache.jetspeed.om.portlet.EventDefinition;
 import org.apache.jetspeed.om.portlet.GenericMetadata;
 import org.apache.jetspeed.om.portlet.JetspeedServiceReference;
 import org.apache.jetspeed.om.portlet.LocalizedField;
 import org.apache.jetspeed.om.portlet.PortletApplication;
 import org.apache.jetspeed.om.portlet.PortletDefinition;
+import org.apache.jetspeed.om.portlet.PublicRenderParameter;
 import org.apache.jetspeed.om.portlet.SecurityRole;
 import org.apache.jetspeed.om.portlet.UserAttribute;
 import org.apache.jetspeed.om.portlet.UserAttributeRef;
@@ -57,15 +62,19 @@
     private String version;
     private String name;
     private String contextRoot;
+    private String defaultNamespace;
     private Collection<LocalizedField> metadataFields = null;
     private String jetspeedSecurityConstraint;
     private List<Description> descriptions;
     private List<DisplayName> displayNames;
     private List<SecurityRole> roles;
     private List<PortletDefinition> portlets;
+    private List<EventDefinition> eventDefinitions;
+    private List<PublicRenderParameter> publicRenderParameters;
     private List<CustomPortletMode> customPortletModes;
     private List<CustomWindowState> customWindowStates;
     private List<UserAttribute> userAttributes;
+    private List<ContainerRuntimeOption> containerRuntimeOptions;
     private List<UserAttributeRef> userAttributeRefs;
     private List<JetspeedServiceReference> services = new ArrayList<JetspeedServiceReference>();
     
@@ -158,6 +167,16 @@
     {
         return contextRoot;
     }
+
+    public String getDefaultNamespace()
+    {
+        return defaultNamespace;
+    }
+
+    public void setDefaultNamespace(String defaultNamespace)
+    {
+        this.defaultNamespace = defaultNamespace;
+    }
     
     public String getJetspeedSecurityConstraint()
     {
@@ -277,6 +296,68 @@
         return portlet;
     }
 
+    public List<EventDefinition> getEventDefinitions()
+    {
+        if (eventDefinitions == null)
+        {
+            eventDefinitions = new ArrayList<EventDefinition>();
+        }
+        return eventDefinitions;
+    }
+
+    public EventDefinition addEventDefinition(QName qname)
+    {
+        List<EventDefinition> defs = getEventDefinitions();
+        for (EventDefinition def : defs)
+        {
+            if (def.getQName().equals(qname))
+            {
+                return def;
+            }
+        }
+        EventDefinitionImpl ed = new EventDefinitionImpl(qname);
+        getEventDefinitions().add(ed);
+        return ed;
+    }
+
+    public List<PublicRenderParameter> getPublicRenderParameters()
+    {
+        if (publicRenderParameters == null)
+        {
+            publicRenderParameters = new ArrayList<PublicRenderParameter>();
+        }
+        return publicRenderParameters;
+    }
+
+    public PublicRenderParameter addPublicRenderParameter(String name, String identifier)
+    {
+        if (getPublicRenderParameter(identifier) != null)
+        {
+            throw new IllegalArgumentException("PublicRenderParameter with identifier: "+identifier+" already defined");
+        }
+        PublicRenderParameterImpl p = new PublicRenderParameterImpl(name, identifier);
+        if (!containsPublicRenderParameter(p))
+        {
+            getPublicRenderParameters().add(p);
+        }
+        return p;        
+    }
+
+    public PublicRenderParameter addPublicRenderParameter(QName qname, String identifier)
+    {
+        if (getPublicRenderParameter(identifier) != null)
+        {
+            throw new IllegalArgumentException("PublicRenderParameter with identifier: "+identifier+" already defined");
+        }
+        PublicRenderParameterImpl p = new PublicRenderParameterImpl(qname);        
+        p.setIdentifier(identifier);
+        if (!containsPublicRenderParameter(p))
+        {
+            getPublicRenderParameters().add(p);
+        }
+        return p;        
+    }
+    
     public List<CustomPortletMode> getCustomPortletModes()
     {
         if (customPortletModes == null)
@@ -352,6 +433,26 @@
         return ua;        
     }
 
+    public List<ContainerRuntimeOption> getContainerRuntimeOptions()
+    {
+        if (containerRuntimeOptions == null)
+        {
+            containerRuntimeOptions = new ArrayList<ContainerRuntimeOption>();
+        }
+        return containerRuntimeOptions;
+    }
+
+    public ContainerRuntimeOption addContainerRuntimeOption(String name)
+    {
+        if (getContainerRuntimeOption(name) != null)
+        {
+            throw new IllegalArgumentException("Container runtime option with name: "+name+" already defined");
+        }
+        ContainerRuntimeOptionImpl cro = new ContainerRuntimeOptionImpl(this, name);
+        getContainerRuntimeOptions().add(cro);
+        return cro;        
+    }
+
     public List<UserAttributeRef> getUserAttributeRefs()
     {
         if (userAttributeRefs == null)



---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org


Mime
View raw message