You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by ta...@apache.org on 2008/10/28 06:57:04 UTC

svn commit: r708446 - in /portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade: components/jetspeed-portal/src/main/java/org/apache/jetspeed/tools/pamanager/ components/jetspeed-portal/src/main/java/org/apache/jetspeed/util/descriptor/ componen...

Author: taylor
Date: Mon Oct 27 22:57:03 2008
New Revision: 708446

URL: http://svn.apache.org/viewvc?rev=708446&view=rev
Log:
https://issues.apache.org/jira/browse/JS2-871
upgrading portlet/web descriptor processing, still work in progress

Added:
    portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-registry/src/main/java/org/apache/jetspeed/descriptor/
    portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-registry/src/main/java/org/apache/jetspeed/descriptor/ExtendedDescriptorServiceImpl.java
    portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/jetspeed-api/src/main/java/org/apache/jetspeed/descriptor/
    portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/jetspeed-api/src/main/java/org/apache/jetspeed/descriptor/ExtendedDescriptorService.java
Modified:
    portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/main/java/org/apache/jetspeed/tools/pamanager/PortletApplicationManager.java
    portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/main/java/org/apache/jetspeed/util/descriptor/PortletApplicationWar.java
    portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/PortletApplicationDefinitionImpl.java
    portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/jetspeed-portal-resources/src/main/resources/assembly/pluto-services.xml

Modified: portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/main/java/org/apache/jetspeed/tools/pamanager/PortletApplicationManager.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/main/java/org/apache/jetspeed/tools/pamanager/PortletApplicationManager.java?rev=708446&r1=708445&r2=708446&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/main/java/org/apache/jetspeed/tools/pamanager/PortletApplicationManager.java (original)
+++ portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/main/java/org/apache/jetspeed/tools/pamanager/PortletApplicationManager.java Mon Oct 27 22:57:03 2008
@@ -46,6 +46,7 @@
 import org.apache.jetspeed.util.descriptor.PortletApplicationWar;
 import org.apache.jetspeed.container.PortletEntity;
 import org.apache.jetspeed.om.portlet.PortletDefinition;
+import org.apache.pluto.spi.optional.PortletAppDescriptorService;
 
 /**
  * PortletApplicationManager
@@ -67,7 +68,7 @@
     protected RoleManager           roleManager;
     protected PermissionManager     permissionManager;
     protected boolean               autoCreateRoles;
-    protected List                  permissionRoles;
+    protected List<String>          permissionRoles;
     protected int  descriptorChangeMonitorInterval = DEFAULT_DESCRIPTOR_CHANGE_MONITOR_INTERVAL;
     /**
      * holds the max number of retries in case of unsuccessful PA start
@@ -78,6 +79,7 @@
     protected boolean started;
     protected String appRoot;
     protected NodeManager nodeManager;
+    protected PortletAppDescriptorService descriptorService;
     
     /**
 	 * Creates a new PortletApplicationManager object.
@@ -85,7 +87,8 @@
 	public PortletApplicationManager(PortletFactory portletFactory, PortletRegistry registry,
 		PortletEntityAccessComponent entityAccess, PortletWindowAccessor windowAccess,
         PermissionManager permissionManager, SearchEngine searchEngine,
-        RoleManager roleManager, List permissionRoles, NodeManager nodeManager, String appRoot)
+        RoleManager roleManager, List<String> permissionRoles, NodeManager nodeManager, String appRoot,
+        PortletAppDescriptorService descriptorService)
 	{
 		this.portletFactory     = portletFactory;
 		this.registry		    = registry;
@@ -426,7 +429,7 @@
             }
             // create PA  from war (file) structure
             // paWar = new PortletApplicationWar(warStruct, contextName, "/" + contextName, checksum);
-            paWar = new PortletApplicationWar(warStruct, contextName, contextPath, checksum);
+            paWar = new PortletApplicationWar(warStruct, contextName, contextPath, checksum, this.descriptorService);
             try
             {
                 if (paClassLoader == null)
@@ -746,10 +749,8 @@
         try
         {
             // create a default permission for this portlet app, granting configured roles to the portlet application 
-            Iterator roles = permissionRoles.iterator();
-            while (roles.hasNext())
+            for (String roleName : permissionRoles)
             {
-                String roleName = (String)roles.next();
                 Role userRole = roleManager.getRole(roleName);
                 if (userRole != null)
                 {
@@ -772,10 +773,8 @@
     {
         try
         {
-            Iterator roles = permissionRoles.iterator();
-            while (roles.hasNext())
+            for (String roleName : permissionRoles)
             {
-                String roleName = (String)roles.next();
                 Role userRole = roleManager.getRole(roleName);
                 if (userRole != null)
                 {

Modified: portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/main/java/org/apache/jetspeed/util/descriptor/PortletApplicationWar.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/main/java/org/apache/jetspeed/util/descriptor/PortletApplicationWar.java?rev=708446&r1=708445&r2=708446&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/main/java/org/apache/jetspeed/util/descriptor/PortletApplicationWar.java (original)
+++ portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/main/java/org/apache/jetspeed/util/descriptor/PortletApplicationWar.java Mon Oct 27 22:57:03 2008
@@ -42,7 +42,7 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.jetspeed.Jetspeed;
-import org.apache.jetspeed.om.common.servlet.MutableWebApplication;
+import org.apache.jetspeed.descriptor.ExtendedDescriptorService;
 import org.apache.jetspeed.om.portlet.PortletApplication;
 import org.apache.jetspeed.om.servlet.WebApplicationDefinition;
 import org.apache.jetspeed.tools.deploy.JetspeedWebApplicationRewriter;
@@ -52,13 +52,8 @@
 import org.apache.jetspeed.util.FileSystemHelper;
 import org.apache.jetspeed.util.MultiFileChecksumHelper;
 import org.apache.pluto.om.portlet.SecurityRoleRef;
-import org.apache.pluto.om.portlet.SecurityRoleRefSet;
-import org.apache.pluto.om.portlet.SecurityRoleSet;
 import org.apache.pluto.om.portlet.PortletDefinition;
-import org.jdom.Document;
-import org.jdom.input.SAXBuilder;
-import org.jdom.output.Format;
-import org.jdom.output.XMLOutputter;
+import org.apache.pluto.spi.optional.PortletAppDescriptorService;
 import org.xml.sax.EntityResolver;
 import org.xml.sax.InputSource;
 import org.xml.sax.SAXException;
@@ -102,10 +97,11 @@
     protected String paName;
     protected String webAppContextRoot;
     protected FileSystemHelper warStruct;
-    private MutableWebApplication webApp;
+    private WebApplicationDefinition webApp;
     private PortletApplication portletApp;
     private long paChecksum;
     protected final List openedResources;
+    protected ExtendedDescriptorService descriptorService;
 
     protected static final String[] ELEMENTS_BEFORE_SERVLET = new String[]{"icon", "display-name", "description",
             "distributable", "context-param", "filter", "filter-mapping", "listener", "servlet"};
@@ -123,12 +119,12 @@
      * @param webAppContextRoot
      *            context root relative to the servlet container of this app
      */
-    public PortletApplicationWar( FileSystemHelper warStruct, String paName, String webAppContextRoot )
+    public PortletApplicationWar( FileSystemHelper warStruct, String paName, String webAppContextRoot, ExtendedDescriptorService descriptorService)
     {
-        this(warStruct, paName, webAppContextRoot, 0);
+        this(warStruct, paName, webAppContextRoot, 0, descriptorService);
     }
 
-    public PortletApplicationWar( FileSystemHelper warStruct, String paName, String webAppContextRoot, long paChecksum )
+    public PortletApplicationWar( FileSystemHelper warStruct, String paName, String webAppContextRoot, long paChecksum, ExtendedDescriptorService descriptorService)
     {
         validatePortletApplicationName(paName);
 
@@ -137,6 +133,7 @@
         this.openedResources = new ArrayList();
         this.warStruct = warStruct;
         this.paChecksum = paChecksum;
+        this.descriptorService = descriptorService;
     }
     
     public long getPortletApplicationChecksum() throws IOException
@@ -188,7 +185,6 @@
     public WebApplicationDefinition createWebApp() throws PortletApplicationException, IOException
     {
         Reader webXmlReader = getReader(WEB_XML_PATH);
-
         try
         {
             WebApplicationDescriptor webAppDescriptor = new WebApplicationDescriptor(webXmlReader, webAppContextRoot);
@@ -228,12 +224,12 @@
      */
     public PortletApplication createPortletApp(ClassLoader classLoader, WebApplicationDefinition wa, int paType) throws PortletApplicationException, IOException
     {
-        Reader portletXmlReader = getReader(PORTLET_XML_PATH);
-        
+        InputStream portletXmlStream = getInputStream(PORTLET_XML_PATH);        
         try
         {
-            PortletApplicationDescriptor paDescriptor = new PortletApplicationDescriptor(portletXmlReader, paName);
-            portletApp = paDescriptor.createPortletApplication(classLoader);
+            PortletApplication pa = this.descriptorService.read(portletXmlStream);
+//            PortletApplicationDescriptor paDescriptor = new PortletApplicationDescriptor(portletXmlReader, paName);
+//            portletApp = paDescriptor.createPortletApplication(classLoader);
             // validate(portletApplication);
             Reader extMetaDataXml = null;
             try
@@ -272,9 +268,9 @@
         }
         finally
         {
-            if (portletXmlReader != null)
+            if (portletXmlStream != null)
             {
-                portletXmlReader.close();
+                portletXmlStream.close();
             }
         }
     }
@@ -427,7 +423,7 @@
         {
             target.copyFrom(warStruct.getRootDirectory());
 
-            return new PortletApplicationWar(target, paName, webAppContextRoot, paChecksum);
+            return new PortletApplicationWar(target, paName, webAppContextRoot, paChecksum, this.descriptorService);
 
         }
         catch (IOException e)

Added: portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-registry/src/main/java/org/apache/jetspeed/descriptor/ExtendedDescriptorServiceImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-registry/src/main/java/org/apache/jetspeed/descriptor/ExtendedDescriptorServiceImpl.java?rev=708446&view=auto
==============================================================================
--- portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-registry/src/main/java/org/apache/jetspeed/descriptor/ExtendedDescriptorServiceImpl.java (added)
+++ portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-registry/src/main/java/org/apache/jetspeed/descriptor/ExtendedDescriptorServiceImpl.java Mon Oct 27 22:57:03 2008
@@ -0,0 +1,291 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.descriptor;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import org.apache.jetspeed.om.portlet.ContainerRuntimeOption;
+import org.apache.jetspeed.om.portlet.DisplayName;
+import org.apache.jetspeed.om.portlet.EventDefinition;
+import org.apache.jetspeed.om.portlet.Filter;
+import org.apache.jetspeed.om.portlet.FilterMapping;
+import org.apache.jetspeed.om.portlet.InitParam;
+import org.apache.jetspeed.om.portlet.Listener;
+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.SecurityConstraint;
+import org.apache.jetspeed.om.portlet.SecurityRoleRef;
+import org.apache.jetspeed.om.portlet.Supports;
+import org.apache.jetspeed.om.portlet.UserAttribute;
+import org.apache.jetspeed.om.portlet.impl.PortletApplicationDefinitionImpl;
+import org.apache.pluto.descriptors.services.jaxb.PortletAppDescriptorServiceImpl;
+import org.apache.pluto.om.portlet.CustomPortletMode;
+import org.apache.pluto.om.portlet.CustomWindowState;
+import org.apache.pluto.om.portlet.Description;
+import org.apache.pluto.om.portlet.PortletApplicationDefinition;
+
+/**
+ * Extends Pluto Descriptor service for loading portlet applications in a Jetspeed format.
+ * Additionally, has two APIs to load extended Jetspeed descriptor information (jetspeed-portlet.xml) 
+ * 
+ * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
+ * @version $Id: $
+ */
+public class ExtendedDescriptorServiceImpl extends PortletAppDescriptorServiceImpl implements ExtendedDescriptorService
+{
+    public PortletApplication createPortletApplicationDefinition()
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public PortletApplication read(InputStream in) throws IOException
+    {
+        PortletApplicationDefinition pad = super.read(in);
+        // TODO: do extended processing here 
+        return upgrade(pad);
+    }
+
+    public void write(PortletApplication portletDescriptor, OutputStream out)
+            throws IOException
+    {
+        // TODO Auto-generated method stub
+
+    }
+
+    public void write(PortletApplicationDefinition portletDescriptor,
+            OutputStream out) throws IOException
+    {
+        throw new UnsupportedOperationException();
+    }
+
+    protected PortletApplication upgrade(PortletApplicationDefinition pa)
+    {
+        PortletApplication jpa = new PortletApplicationDefinitionImpl();
+        jpa.setDefaultNamespace(pa.getDefaultNamespace());
+        //pa.setDescription(pad.get) // TODO: 2.2 should we get this from the web.xml (as well as <display-name> and <security-role>
+        // not upgradable: checksum, revision
+        jpa.setName(pa.getName());
+        jpa.setResourceBundle(pa.getResourceBundle());
+        jpa.setVersion(pa.getVersion());
+        for (org.apache.pluto.om.portlet.PortletDefinition pd : pa.getPortlets())
+        {
+            PortletDefinition jpd = jpa.addPortlet(pd.getPortletName());
+            upgradePortlet(jpd, pd);
+        }
+        for (org.apache.pluto.om.portlet.ContainerRuntimeOption cro : pa.getContainerRuntimeOptions())
+        {
+            ContainerRuntimeOption jcro = jpa.addContainerRuntimeOption(cro.getName());
+            for (String value : cro.getValues())
+            {
+                jcro.addValue(value);
+            }
+        }
+        for (org.apache.pluto.om.portlet.CustomPortletMode cpm : pa.getCustomPortletModes())
+        {
+            CustomPortletMode jcpm = jpa.addCustomPortletMode(cpm.getPortletMode());
+            jcpm.setPortalManaged(cpm.isPortalManaged());
+            for (org.apache.pluto.om.portlet.Description desc : cpm.getDescriptions())
+            {
+                Description jdesc = jcpm.addDescription(desc.getDescription());
+                // TODO: 2.2 - there is no setLang or setLocale, not sure if there is a good reason
+            }            
+        }
+        for (org.apache.pluto.om.portlet.CustomWindowState cws : pa.getCustomWindowStates())
+        {
+            CustomWindowState jcws = jpa.addCustomWindowState(cws.getWindowState());
+            for (org.apache.pluto.om.portlet.Description desc : cws.getDescriptions())
+            {
+                Description jdesc = jcws.addDescription(desc.getDescription());
+                // TODO: 2.2 - there is no setLang or setLocale, not sure if there is a good reason
+            }            
+        }        
+        for (org.apache.pluto.om.portlet.EventDefinition ed : pa.getEventDefinitions())
+        {
+            EventDefinition jed = jpa.addEventDefinition(ed.getName());
+            jed.setValueType(ed.getValueType());
+            // TODO: 2.2 - aliases, qnames ?
+            for (org.apache.pluto.om.portlet.Description desc : ed.getDescriptions())
+            {
+                Description jdesc = jed.addDescription(desc.getDescription());
+                // TODO: 2.2 - there is no setLang or setLocale, not sure if there is a good reason
+            }                        
+        }
+        for (org.apache.pluto.om.portlet.FilterMapping fm : pa.getFilterMappings())
+        {
+            FilterMapping jfm = jpa.addFilterMapping(fm.getFilterName());
+            for (String portletName : fm.getPortletNames())
+            {
+                jfm.addPortletName(portletName);
+            }
+        }
+        for (org.apache.pluto.om.portlet.Filter f : pa.getFilters())
+        {
+            Filter jf = jpa.addFilter(f.getFilterName());
+            jf.setFilterClass(f.getFilterClass());
+            for (org.apache.pluto.om.portlet.Description desc : f.getDescriptions())
+            {
+                Description jdesc = jf.addDescription(desc.getDescription());
+                // TODO: 2.2 - there is no setLang or setLocale, not sure if there is a good reason
+            }                                   
+            for (org.apache.pluto.om.portlet.DisplayName dn : f.getDisplayNames())
+            {
+                DisplayName jdn = jf.addDisplayName(dn.getDisplayName());
+                // TODO: 2.2 - lang, locale
+            }
+            for (org.apache.pluto.om.portlet.InitParam ip : f.getInitParams())
+            {
+                InitParam jip = jf.addInitParam(ip.getParamName());
+                jip.setParamValue(ip.getParamValue());
+                for (org.apache.pluto.om.portlet.Description desc : ip.getDescriptions())
+                {
+                    Description jdesc = jip.addDescription(desc.getDescription());
+                    // TODO: 2.2 - there is no setLang or setLocale, not sure if there is a good reason
+                }                                        
+            }
+            for (String lc : f.getLifecycles())
+            {
+                jf.addLifecycle(lc);
+            }            
+        }
+        for (org.apache.pluto.om.portlet.Listener l : pa.getListeners())
+        {
+            Listener jl = jpa.addListener(l.getListenerClass());
+            for (org.apache.pluto.om.portlet.Description desc : l.getDescriptions())
+            {
+                Description jdesc = jl.addDescription(desc.getDescription());
+                // TODO: 2.2 - there is no setLang or setLocale, not sure if there is a good reason
+            }                                        
+            for (org.apache.pluto.om.portlet.DisplayName dn : l.getDisplayNames())
+            {
+                DisplayName jdn = jl.addDisplayName(dn.getDisplayName());
+                // TODO: 2.2 - lang, locale
+            }
+        }
+        for (org.apache.pluto.om.portlet.PublicRenderParameter prd : pa.getPublicRenderParameters())
+        {
+            
+            PublicRenderParameter jprp = jpa.addPublicRenderParameter(prd.getName(), prd.getIdentifier());
+            for (org.apache.pluto.om.portlet.Description desc : prd.getDescriptions())
+            {
+                Description jdesc = jprp.addDescription(desc.getDescription());
+                // TODO: 2.2 - there is no setLang or setLocale, not sure if there is a good reason
+            }                                        
+            // TODO: 2.2 aliases, qname
+        }
+        for (org.apache.pluto.om.portlet.SecurityConstraint sc :  pa.getSecurityConstraints())
+        {
+            SecurityConstraint jsc = jpa.addSecurityConstraint(sc.getUserDataConstraint().getTransportGuarantee());
+            for (org.apache.pluto.om.portlet.DisplayName dn : sc.getDisplayNames())
+            {
+                DisplayName jdn = jsc.addDisplayName(dn.getDisplayName());
+                // TODO: 2.2 - lang, locale
+            }
+            for (String portletName : sc.getPortletNames())
+            {
+                jsc.addPortletName(portletName);
+            }            
+        }
+        for (org.apache.pluto.om.portlet.UserAttribute ua : pa.getUserAttributes())
+        {
+            UserAttribute jua = jpa.addUserAttribute(ua.getName());
+            for (org.apache.pluto.om.portlet.Description desc : ua.getDescriptions())
+            {
+                Description jdesc = jua.addDescription(desc.getDescription());
+                // TODO: 2.2 - there is no setLang or setLocale, not sure if there is a good reason
+            }                                                    
+        }
+        return jpa;
+    }
+
+    protected void upgradePortlet(PortletDefinition jpd, org.apache.pluto.om.portlet.PortletDefinition pd)
+    {
+        jpd.setCacheScope(pd.getCacheScope());
+        jpd.setExpirationCache(pd.getExpirationCache());
+        jpd.setPortletClass(pd.getPortletClass());
+        jpd.setResourceBundle(pd.getResourceBundle());
+        for (org.apache.pluto.om.portlet.ContainerRuntimeOption cro : pd.getContainerRuntimeOptions())
+        {
+            ContainerRuntimeOption jcro = jpd.addContainerRuntimeOption(cro.getName());
+            for (String value : cro.getValues())
+            {
+                jcro.addValue(value);
+            }
+        }
+        for (org.apache.pluto.om.portlet.Description desc : pd.getDescriptions())
+        {
+            Description jdesc = jpd.addDescription(desc.getDescription());
+            // TODO: 2.2 - there is no setLang or setLocale, not sure if there is a good reason
+        }                        
+        for (org.apache.pluto.om.portlet.DisplayName dn : pd.getDisplayNames())
+        {
+            DisplayName jdn = jpd.addDisplayName(dn.getDisplayName());
+            // TODO: 2.2 - lang, locale
+        }
+        for (org.apache.pluto.om.portlet.InitParam ip : pd.getInitParams())
+        {
+            InitParam jip = jpd.addInitParam(ip.getParamName());
+            jip.setParamValue(ip.getParamValue());
+            for (org.apache.pluto.om.portlet.Description desc : ip.getDescriptions())
+            {
+                Description jdesc = jip.addDescription(desc.getDescription());
+                // TODO: 2.2 - there is no setLang or setLocale, not sure if there is a good reason
+            }                                        
+        }
+        // TODO: 2.2 still relevant? jpd.addLanguage()
+        for (org.apache.pluto.om.portlet.SecurityRoleRef srr : pd.getSecurityRoleRefs())
+        {
+            SecurityRoleRef jsrr = jpd.addSecurityRoleRef(srr.getRoleName());
+            jsrr.setRoleLink(srr.getRoleLink());
+        }
+        for (String locale : pd.getSupportedLocales())
+        {
+            jpd.addSupportedLocale(locale);
+        }
+        for (org.apache.pluto.om.portlet.EventDefinitionReference ed : pd.getSupportedProcessingEvents())
+        {
+            jpd.addSupportedProcessingEvent(ed.getName());
+            //EventDefinitionReference jedr = jpd.addSupportedProcessingEvent(ed.getName());
+            // TODO: 2.2 qname
+        }
+        for (String sprd : pd.getSupportedPublicRenderParameters())
+        {
+            jpd.addSupportedPublicRenderParameter(sprd);
+        }
+        for (org.apache.pluto.om.portlet.EventDefinitionReference ed : pd.getSupportedPublishingEvents())
+        {
+            jpd.addSupportedPublishingEvent(ed.getName());
+            //EventDefinitionReference jedr = jpd.addSupportedProcessingEvent(ed.getName());
+            // TODO: 2.2 qname
+        }
+        for (org.apache.pluto.om.portlet.Supports supports : pd.getSupports())
+        {
+            Supports jsupports = jpd.addSupports(supports.getMimeType());
+            for (String pm : supports.getPortletModes())
+            {
+                jsupports.addPortletMode(pm);
+            }
+            for (String ws : supports.getWindowStates())
+            {
+                jsupports.addWindowState(ws);
+            }
+        }
+    }    
+}

Modified: portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/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/JS2-871-pluto-2.0-upgrade/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/PortletApplicationDefinitionImpl.java?rev=708446&r1=708445&r2=708446&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/PortletApplicationDefinitionImpl.java (original)
+++ portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/PortletApplicationDefinitionImpl.java Mon Oct 27 22:57:03 2008
@@ -283,7 +283,7 @@
         PortletDefinitionImpl portlet = new PortletDefinitionImpl();
         portlet.setPortletName(name);
         portlet.setApplication(this);
-        portlets.add(portlet);
+        getPortlets().add(portlet);
         return portlet;
     }
 

Added: portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/jetspeed-api/src/main/java/org/apache/jetspeed/descriptor/ExtendedDescriptorService.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/jetspeed-api/src/main/java/org/apache/jetspeed/descriptor/ExtendedDescriptorService.java?rev=708446&view=auto
==============================================================================
--- portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/jetspeed-api/src/main/java/org/apache/jetspeed/descriptor/ExtendedDescriptorService.java (added)
+++ portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/jetspeed-api/src/main/java/org/apache/jetspeed/descriptor/ExtendedDescriptorService.java Mon Oct 27 22:57:03 2008
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.descriptor;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import org.apache.jetspeed.om.portlet.PortletApplication;
+import org.apache.pluto.spi.optional.PortletAppDescriptorService;
+
+
+/**
+ * Extends Pluto Descriptor service for loading portlet applications in a Jetspeed format.
+ * Additionally, has two APIs to load extended Jetspeed descriptor information (jetspeed-portlet.xml) 
+ * 
+ * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
+ * @version $Id: $
+ */
+public interface ExtendedDescriptorService extends PortletAppDescriptorService
+{
+    /**
+     * Create a new portlet application definition
+     */
+    PortletApplication createPortletApplicationDefinition();
+    
+    /**
+     * Retrieve the PortletApp deployment descriptor
+     * (portlet.xml).
+     * @return Object representation of the descriptor.
+     * @throws IOException if an IO error occurs.
+     */
+    PortletApplication read(InputStream in) throws IOException;
+
+    /**
+     * Write the PortletApp deployment descriptor
+     * (portlet.xml).
+     * @param portletDescriptor
+     * @param out
+     * @throws IOException if an IO error occurs.
+     */
+    void write(PortletApplication portletDescriptor, OutputStream out) throws IOException;
+
+}

Modified: portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/jetspeed-portal-resources/src/main/resources/assembly/pluto-services.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/jetspeed-portal-resources/src/main/resources/assembly/pluto-services.xml?rev=708446&r1=708445&r2=708446&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/jetspeed-portal-resources/src/main/resources/assembly/pluto-services.xml (original)
+++ portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/jetspeed-portal-resources/src/main/resources/assembly/pluto-services.xml Mon Oct 27 22:57:03 2008
@@ -119,6 +119,7 @@
       <constructor-arg><ref bean="org.apache.pluto.services.RequestAttributeService"/></constructor-arg>
       <constructor-arg><ref bean="org.apache.pluto.services.PortletInvokerService"/></constructor-arg>            
       <constructor-arg><ref bean="org.apache.pluto.services.PlutoRegistryServiceAdaptor"/></constructor-arg>            
+      <constructor-arg><ref bean="org.apache.pluto.services.DescriptorService"/></constructor-arg>
 	<!--  TODO: preferences -->
     </bean>
     
@@ -165,5 +166,10 @@
 	    <constructor-arg index="0"><ref bean="portletFactory" /></constructor-arg>         
         <constructor-arg index="1"><ref bean="portletRegistry"/></constructor-arg>
     </bean>
+    
+    <bean id="org.apache.pluto.services.DescriptorService"
+    		class="org.apache.jetspeed.descriptor.ExtendedDescriptorService">
+	    <meta key="j2:cat" value="default" />
+	</bean>    		
         
 </beans>
\ No newline at end of file



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