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 at...@apache.org on 2008/10/27 17:22:32 UTC

svn commit: r708230 - /portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/

Author: ate
Date: Mon Oct 27 09:22:32 2008
New Revision: 708230

URL: http://svn.apache.org/viewvc?rev=708230&view=rev
Log:
JS2-871 - Upgrade Pluto container to version 2.0
See:  http://issues.apache.org/jira/browse/JS2-871
- new Jetspeed-2 portlet OM implementations  for PortletDefinitionImpl
  yet unfinished: lookup language/resourcebundle by locale & prefs still have to be done

Modified:
    portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/FilterImpl.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/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/PortletDefinitionImpl.java
    portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/SupportsImpl.java

Modified: portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/FilterImpl.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/FilterImpl.java?rev=708230&r1=708229&r2=708230&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/FilterImpl.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/FilterImpl.java Mon Oct 27 09:22:32 2008
@@ -36,7 +36,7 @@
     protected String filterName;
     protected String filterClass;
     protected List<String> lifecycle;
-    protected List<InitParam> initParam;
+    protected List<InitParam> initParams;
     protected List<Description> descriptions;
     protected List<DisplayName> displayNames;
     
@@ -157,11 +157,11 @@
 
     public List<InitParam> getInitParams()
     {
-        if (initParam == null)
+        if (initParams == null)
         {
-            initParam = new ArrayList<InitParam>();
+            initParams = new ArrayList<InitParam>();
         }
-        return initParam;
+        return initParams;
     }
     
     public InitParam addInitParam(String paramName)
@@ -173,7 +173,7 @@
         InitParamImpl param = new InitParamImpl();
         param.setParamName(paramName);
         getInitParams();
-        initParam.add(param);
+        initParams.add(param);
         return param;
     }
 }

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=708230&r1=708229&r2=708230&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 09:22:32 2008
@@ -22,7 +22,6 @@
 import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 

Modified: portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/PortletDefinitionImpl.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/PortletDefinitionImpl.java?rev=708230&r1=708229&r2=708230&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/PortletDefinitionImpl.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/PortletDefinitionImpl.java Mon Oct 27 09:22:32 2008
@@ -42,6 +42,7 @@
 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.EventDefinition;
 import org.apache.jetspeed.om.portlet.EventDefinitionReference;
 import org.apache.jetspeed.om.portlet.GenericMetadata;
 import org.apache.jetspeed.om.portlet.InitParam;
@@ -53,10 +54,12 @@
 import org.apache.jetspeed.om.portlet.Supports;
 import org.apache.jetspeed.util.HashCodeBuilder;
 import org.apache.jetspeed.util.JetspeedLocale;
-import org.apache.jetspeed.util.JetspeedLongObjectID;
 import org.apache.ojb.broker.PersistenceBroker;
 import org.apache.ojb.broker.PersistenceBrokerAware;
 import org.apache.ojb.broker.PersistenceBrokerException;
+import org.apache.pluto.descriptors.portlet.EventDefinitionReferenceType;
+import org.apache.pluto.descriptors.portlet.SecurityRoleRefType;
+import org.apache.pluto.descriptors.portlet.SupportsType;
 import org.apache.jetspeed.om.portlet.Language;
 
 /**
@@ -73,7 +76,7 @@
     private static PortletFactory  portletFactory;
     private static PortletPreferencesProvider portletPreferencesProvider;
 
-    private PortletApplication application;
+    private PortletApplication app;
     
     private Long id;
 
@@ -81,24 +84,54 @@
     protected String portletClass;
     protected String resourceBundle;
     protected String preferenceValidatorClassname;
+    private Integer expirationCache;
+    private String cacheScope;
+
+    /** Metadata property */    
+    private Collection metadataFields;
+
+    private String jetspeedSecurityConstraint;
     
-    private List<Language> languages = null;
-    private Map<Locale,ResourceBundle> resourceBundles = new HashMap<Locale, ResourceBundle>();
+    private List<Description> descriptions;
+    private List<DisplayName> displayNames;
+    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 transient Map<Locale,ResourceBundle> resourceBundles = new HashMap<Locale, ResourceBundle>();
     
     protected List portletEntities;
 
-    /** PortletApplicationDefinition this PortletDefinition belongs to */
-    private PortletApplication app;
+    public static void setPortletRegistry(PortletRegistry registry)
+    {
+        PortletDefinitionImpl.registry = registry;
+    }
 
-    /** Metadata property */    
-    private Collection metadataFields = null;
+    public static void setPortletFactory(PortletFactory portletFactory)
+    {
+        PortletDefinitionImpl.portletFactory = portletFactory;
+    }
+
+    public static void setPortletPreferencesProvider(PortletPreferencesProvider portletPreferencesProvider)
+    {
+        PortletDefinitionImpl.portletPreferencesProvider = portletPreferencesProvider;
+    }
 
-    private String jetspeedSecurityConstraint = null;
-    
     public PortletDefinitionImpl()
     {
     }
 
+    protected ClassLoader getPortletClassLoader()
+    {
+        return portletFactory.getPortletApplicationClassLoader(app);
+    }
+
     protected ResourceBundle loadResourceBundle( Locale locale )
     {
         ResourceBundle resourceBundle = null;
@@ -125,24 +158,51 @@
         return resourceBundle;
     }
     
-    /**
-     * @see org.apache.pluto.om.portlet.PortletDefinition#getPortletClass()
-     */
-    public String getPortletClass()
+    public PortletApplication getApplication()
     {
-        return portletClass;
+        return app;
+    }
+    
+    public void setApplication(PortletApplication app)
+    {
+        this.app = app;
     }
 
-    /**
-     * @see org.apache.pluto.om.portlet.PortletDefinition#getPortletName()
-     */
     public String getPortletName()
     {
         return portletName;
     }
     
+    public void setPortletName( String name )
+    {
+        this.portletName = name;
+    }
+
+    public String getPortletClass()
+    {
+        return portletClass;
+    }
+
+    public void setPortletClass(String portletClass)
+    {
+        this.portletClass = portletClass;
+    }
+
+    public Preferences getPortletPreferences()
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public ResourceBundle getResourceBundle(Locale locale)
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
     public Language getLanguage(Locale locale)
     {
+        // TODO Auto-generated method stub
         return null;
     }
     
@@ -170,81 +230,12 @@
         return l;
     }
     
-    public ResourceBundle getResourceBundle(Locale locale)
-    {
-        return null;
-    }
-
-    public PortletApplication getPortletApplicationDefinition()
-    {
-        return app;
-    }
-
-    /**
-     * @see org.apache.pluto.om.portlet.PortletDefinition#getPortletClassLoader()
-     */
-    public ClassLoader getPortletClassLoader()
-    {
-        return portletFactory.getPortletApplicationClassLoader(app);
-    }
-
-    /**
-     * @see org.apache.pluto.om.portlet.PortletDefinition#setPortletName(java.lang.String)
-     */
-    public void setPortletName( String name )
-    {
-        this.portletName = name;
-    }
-
-    public void setPortletApplication( PortletApplication pa )
-    {
-        app = (PortletApplication) pa;
-    }
-
-    /**
-     * @see java.lang.Object#equals(java.lang.Object)
-     */
-    public boolean equals( Object obj )
-    {
-        if (obj != null && obj.getClass().equals(getClass()))
-        {
-            PortletDefinitionImpl pd = (PortletDefinitionImpl) obj;
-            boolean sameId = (id != null && pd.id != null && id.equals(pd.id));
-            if (sameId)
-            {
-                return true;
-            }
-//            boolean sameAppId = (appId == pd.appId);
-            boolean sameName = (pd.getPortletName() != null && portletName != null && pd.getPortletName().equals(portletName));
-            return sameName;// && sameAppId;
-        }
-        return false;
-    }
-
-    /**
-     * @see java.lang.Object#hashCode()
-     */
-    public int hashCode()
-    {
-        HashCodeBuilder hasher = new HashCodeBuilder(1, 3);
-        hasher.append(portletName);
-        if (app != null)
-        {
-//            if ( getId() != null )
-//            {
-//              hasher.append(getId().toString());
-//            }
-            hasher.append(app.getName());
-        }
-        return hasher.toHashCode();
-    }
-
     /**
      * @see org.apache.jetspeed.om.portlet.PortletDefinition#getUniqueName()
      */
     public String getUniqueName()
     {
-        if (app != null && portletName != null)
+        if (app != null && app.getName() != null && portletName != null)
         {
             return app.getName() + "::" + portletName;
         }
@@ -266,71 +257,25 @@
     public String getDescriptionText( Locale locale )
     {
         Description desc = getDescription(locale);
-        if (desc != null)
-        {
-            return desc.getDescription();
-        }
-        return null;
+        return desc != null ? desc.getDescription() : null;
     }
     
-    /**
-     * <p>
-     * store will attempt to perform an atomic persistence call against this
-     * portletDefinition.
-     * </p>
-     * 
-     * @see org.apache.pluto.om.portlet.PortletDefinition#store()
-     * @throws java.io.IOException
-     */
-    public void store() throws IOException
-    {
-        try
-        {
-            registry.savePortletDefinition(this);
-        }
-        catch (RegistryException e)
-        {
-            IOException ioe = new IOException("Failed to store portlet definition: "+e.getMessage());
-            ioe.initCause(e);
-        }
-    }
-
-    public void storeChildren()
+    public String getDisplayNameText(Locale locale)
     {
-//        if (preferenceSet != null)
-//        {
-//            portletPreferencesProvider.savePreferenceSet(this, preferenceSet);
-//        }
+        DisplayName dn = getDisplayName(locale);
+        return dn != null ? dn.getDisplayName() : null;
     }
 
-    /**
-     * <p>
-     * getPreferenceValidatorClassname
-     * </p>
-     * 
-     * @return
-     */
     public String getPreferenceValidatorClassname()
     {
         return preferenceValidatorClassname;
     }
 
-    /**
-     * <p>
-     * setPreferenceValidatorClassname
-     * </p>
-     * 
-     * @param string
-     *  
-     */
     public void setPreferenceValidatorClassname( String string )
     {
         preferenceValidatorClassname = string;
     }
 
-    /**
-     * @see org.apache.jetspeed.om.portlet.PortletApplication#getMetadata()
-     */
     public GenericMetadata getMetadata()
     {
         if (metadataFields == null)
@@ -345,14 +290,6 @@
     }
 
     /**
-     * @see org.apache.jetspeed.om.portlet.PortletApplication#setMetadata(org.apache.jetspeed.om.portlet.GenericMetadata)
-     */
-    public void setMetadata( GenericMetadata metadata )
-    {
-        this.metadataFields = metadata.getFields();
-    }
-
-    /**
      * @return
      */
     protected Collection getMetadataFields()
@@ -384,32 +321,94 @@
         resourceBundle = string;
     }
     
-    /* (non-Javadoc)
-     * @see org.apache.jetspeed.om.Support#postLoad(java.lang.Object)
-     */
-    public void postLoad(Object parameter) throws Exception
+    public String getJetspeedSecurityConstraint()
     {
+        return this.jetspeedSecurityConstraint;
+    }
+
+    public void setJetspeedSecurityConstraint(String constraint)
+    {
+        this.jetspeedSecurityConstraint = constraint;
     }
     
-    public PreferencesValidator getPreferencesValidator()
+    public boolean isSameIdentity(PortletDefinition other)
     {
-        return portletFactory.getPreferencesValidator(this);
+        Long otherId = null;
+        if (other != null && other instanceof PortletDefinitionImpl)
+        {
+            otherId = ((PortletDefinitionImpl)other).id;
+        }
+        return id != null && otherId != null && id.equals(otherId);
+    }
+
+    public boolean equals( Object obj )
+    {
+        if (obj != null && obj.getClass().equals(getClass()))
+        {
+            PortletDefinitionImpl pd = (PortletDefinitionImpl) obj;
+            boolean sameId = id != null && pd.id != null && id.equals(pd.id);
+            if (sameId)
+            {
+                return true;
+            }
+            String otherAppName = pd.getApplication() != null ? pd.getApplication().getName() : null;
+            boolean sameAppName = (app != null && app.getName() != null && otherAppName != null && app.getName().equals(otherAppName));
+            return sameAppName && (pd.getPortletName() != null && portletName != null && pd.getPortletName().equals(portletName));
+        }
+        return false;
     }
 
-    /* (non-Javadoc)
-     * @see org.apache.jetspeed.om.common.portlet.PortletDefinitionComposite#getJetspeedSecurityConstraint()
+    /**
+     * @see java.lang.Object#hashCode()
      */
-    public String getJetspeedSecurityConstraint()
+    public int hashCode()
     {
-        return this.jetspeedSecurityConstraint;
+        HashCodeBuilder hasher = new HashCodeBuilder(1, 3);
+        hasher.append(portletName);
+        if ( id != null )
+        {
+          hasher.append(id.toString());
+        }
+        if (app != null)
+        {
+            hasher.append(app.getName());
+        }
+        return hasher.toHashCode();
     }
 
-    /* (non-Javadoc)
-     * @see org.apache.jetspeed.om.common.portlet.PortletDefinitionComposite#setJetspeedSecurityConstraint(java.lang.String)
+    /**
+     * <p>
+     * store will attempt to perform an atomic persistence call against this
+     * portletDefinition.
+     * </p>
+     * 
+     * @see org.apache.pluto.om.portlet.PortletDefinition#store()
+     * @throws java.io.IOException
      */
-    public void setJetspeedSecurityConstraint(String constraint)
+    public void store() throws IOException
+    {
+        try
+        {
+            registry.savePortletDefinition(this);
+        }
+        catch (RegistryException e)
+        {
+            IOException ioe = new IOException("Failed to store portlet definition: "+e.getMessage());
+            ioe.initCause(e);
+        }
+    }
+
+    public void storeChildren()
+    {
+// TODO        
+//        if (preferenceSet != null)
+//        {
+//            portletPreferencesProvider.savePreferenceSet(this, preferenceSet);
+//        }
+    }
+
+    public void postLoad(Object parameter) throws Exception
     {
-        this.jetspeedSecurityConstraint = constraint;
     }
     
     //
@@ -444,247 +443,334 @@
     {
     }
     
-
-    public static void setPortletRegistry(PortletRegistry registry)
-    {
-        PortletDefinitionImpl.registry = registry;
-    }
-
-    public static void setPortletFactory(PortletFactory portletFactory)
+    public ContainerRuntimeOption getContainerRuntimeOption(String name)
     {
-        PortletDefinitionImpl.portletFactory = portletFactory;
+        for (ContainerRuntimeOption cro : getContainerRuntimeOptions())
+        {
+            if (cro.getName().equals(name))
+            {
+                return cro;
+            }
+        }
+        return null;
     }
 
-    public static void setPortletPreferencesProvider(PortletPreferencesProvider portletPreferencesProvider)
+    public List<ContainerRuntimeOption> getContainerRuntimeOptions()
     {
-        PortletDefinitionImpl.portletPreferencesProvider = portletPreferencesProvider;
+        if (containerRuntimeOptions == null)
+        {
+            containerRuntimeOptions = new ArrayList<ContainerRuntimeOption>();
+        }
+        return containerRuntimeOptions;
     }
 
     public ContainerRuntimeOption addContainerRuntimeOption(String name)
     {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    public Description addDescription(String lang)
-    {
-        // TODO Auto-generated method stub
-        return null;
+        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 DisplayName addDisplayName(String lang)
+    public SecurityRoleRef getSecurityRoleRef(String roleName)
     {
-        // TODO Auto-generated method stub
+        for (SecurityRoleRef ref : getSecurityRoleRefs())
+        {
+            if (ref.getRoleName().equals(roleName))
+            {
+                return ref;
+            }
+        }
         return null;
     }
 
-    public InitParam addInitParam(String paramName)
+    public List<SecurityRoleRef> getSecurityRoleRefs()
     {
-        // TODO Auto-generated method stub
-        return null;
+        if (securityRoleRefs == null)
+        {
+            securityRoleRefs = new ArrayList<SecurityRoleRef>();
+        }
+        return securityRoleRefs;
     }
-
+    
     public SecurityRoleRef addSecurityRoleRef(String roleName)
     {
-        // TODO Auto-generated method stub
-        return null;
+        if (getSecurityRoleRef(roleName) != null)
+        {
+            throw new IllegalArgumentException("Security role reference for role: "+roleName+" already defined");
+        }
+        SecurityRoleRefImpl srr = new SecurityRoleRefImpl();
+        srr.setRoleName(roleName);
+        securityRoleRefs.add(srr);
+        return srr;        
     }
-
-    public EventDefinitionReference addSupportedProcessingEvent(QName qname)
+    
+    public PortletInfo getPortletInfo()
     {
-        // TODO Auto-generated method stub
-        return null;
+        return getLanguage(JetspeedLocale.getDefaultLocale());
     }
 
-    public EventDefinitionReference addSupportedProcessingEvent(String name)
-    {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    public EventDefinitionReference addSupportedPublishingEvent(QName qname)
+    public Supports getSupports(String mimeType)
     {
-        // TODO Auto-generated method stub
+        for (Supports s : getSupports())
+        {
+            if (s.getMimeType().equals(mimeType))
+            {
+                return s;
+            }
+        }
         return null;
     }
-
-    public EventDefinitionReference addSupportedPublishingEvent(String name)
+    
+    public List<Supports> getSupports()
     {
-        // TODO Auto-generated method stub
-        return null;
+        if (supports == null)
+        {
+            supports = new ArrayList<Supports>();
+        }
+        return supports;
     }
-
+    
     public Supports addSupports(String mimeType)
     {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    public PortletApplication getApplication()
-    {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    public ContainerRuntimeOption getContainerRuntimeOption(String name)
-    {
-        // TODO Auto-generated method stub
-        return null;
+        if (getSupports(mimeType) != null)
+        {
+            throw new IllegalArgumentException("Supports for mime type: "+mimeType+" already defined");
+        }
+        SupportsImpl s = new SupportsImpl();
+        s.setMimeType(mimeType);
+        supports.add(s);
+        return s;        
     }
-
-    public List<ContainerRuntimeOption> getContainerRuntimeOptions()
+    
+    public List<String> getSupportedLocales()
     {
-        // TODO Auto-generated method stub
-        return null;
+        if (supportedLocales == null)
+        {
+            supportedLocales = new ArrayList<String>();
+        }
+        return supportedLocales;
     }
-
-    public Description getDescription(Locale locale)
+    
+    public void addSupportedLocale(String lang)
     {
-        // TODO Auto-generated method stub
-        return null;
+        for (String l : getSupportedLocales())
+        {
+            if (l.equals(lang))
+            {
+                throw new IllegalArgumentException("Supported locale: "+lang+" already defined");
+            }
+        }
+        supportedLocales.add(lang);    
     }
 
-    public List<Description> getDescriptions()
+    public List<String> getSupportedPublicRenderParameters()
     {
-        // TODO Auto-generated method stub
-        return null;
+        if (supportedPublicRenderParameters == null)
+        {
+            supportedPublicRenderParameters = new ArrayList<String>();
+        }
+        return supportedPublicRenderParameters;
     }
-
-    public DisplayName getDisplayName(Locale locale)
+    
+    public void addSupportedPublicRenderParameter(String identifier)
     {
-        // TODO Auto-generated method stub
-        return null;
+        for (String ident : getSupportedPublicRenderParameters())
+        {
+            if (ident.equals(identifier))
+            {
+                throw new IllegalArgumentException("Support for public render parameter with identifier: "+identifier+" already defined");
+            }
+        }
+        supportedPublicRenderParameters.add(identifier);
     }
 
-    public String getDisplayNameText(Locale locale)
-    {
-        // TODO Auto-generated method stub
-        return null;
-    }
 
-    public List<DisplayName> getDisplayNames()
+    /**
+     * 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()
     {
-        // TODO Auto-generated method stub
-        return null;
+        return cacheScope != null ? cacheScope : "private";
     }
 
-    public InitParam getInitParam(String paramName)
+    public void setCacheScope(String cacheScope)
     {
-        // TODO Auto-generated method stub
-        return null;
+        this.cacheScope = cacheScope;
     }
 
-    public List<InitParam> getInitParams()
+    public int getExpirationCache()
     {
-        // TODO Auto-generated method stub
-        return null;
+        return expirationCache != null ? expirationCache.intValue() : 0;
     }
 
-    public PortletInfo getPortletInfo()
+    public void setExpirationCache(int value)
     {
-        // TODO Auto-generated method stub
-        return null;
+        expirationCache = new Integer(value);
     }
 
-    public Preferences getPortletPreferences()
+    public Description getDescription(Locale locale)
     {
-        // TODO Auto-generated method stub
+        for (Description d : getDescriptions())
+        {
+            if (d.getLocale().equals(locale))
+            {
+                return d;
+            }
+        }
         return null;
     }
-
-    public SecurityRoleRef getSecurityRoleRef(String roleName)
+    
+    public List<Description> getDescriptions()
     {
-        // TODO Auto-generated method stub
-        return null;
+        if (descriptions == null)
+        {
+            descriptions = new ArrayList<Description>();
+        }
+        return descriptions;
     }
-
-    public List<SecurityRoleRef> getSecurityRoleRefs()
+    
+    public Description addDescription(String lang)
     {
-        // TODO Auto-generated method stub
-        return null;
+        DescriptionImpl d = new DescriptionImpl();
+        d.setLang(lang);
+        if (getDescription(d.getLocale()) != null)
+        {
+            throw new IllegalArgumentException("Description for language: "+d.getLocale()+" already defined");
+        }
+        getDescriptions();
+        descriptions.add(d);
+        return d;
     }
 
-    public List<EventDefinitionReference> getSupportedProcessingEvents()
+    public DisplayName getDisplayName(Locale locale)
     {
-        // TODO Auto-generated method stub
+        for (DisplayName d : getDisplayNames())
+        {
+            if (d.getLocale().equals(locale))
+            {
+                return d;
+            }
+        }
         return null;
     }
-
-    public List<EventDefinitionReference> getSupportedPublishingEvents()
+    
+    public List<DisplayName> getDisplayNames()
     {
-        // TODO Auto-generated method stub
-        return null;
+        if (displayNames == null)
+        {
+            displayNames = new ArrayList<DisplayName>();
+        }
+        return displayNames;
     }
-
-    public Supports getSupports(String mimeType)
+    
+    public DisplayName addDisplayName(String lang)
     {
-        // TODO Auto-generated method stub
-        return null;
+        DisplayNameImpl d = new DisplayNameImpl();
+        d.setLang(lang);
+        if (getDisplayName(d.getLocale()) != null)
+        {
+            throw new IllegalArgumentException("DisplayName for language: "+d.getLocale()+" already defined");
+        }
+        getDisplayNames();
+        displayNames.add(d);
+        return d;
     }
 
-    public List<Supports> getSupports()
+    public InitParam getInitParam(String name)
     {
-        // TODO Auto-generated method stub
+        for (InitParam param : getInitParams())
+        {
+            if (param.getParamName().equals(name))
+            {
+                return param;
+            }
+        }
         return null;
     }
 
-    public boolean isSameIdentity(PortletDefinition other)
-    {
-        // TODO Auto-generated method stub
-        return false;
-    }
-
-    public void addSupportedLocale(String lang)
-    {
-        // TODO Auto-generated method stub
-        
-    }
-
-    public void addSupportedPublicRenderParameter(String identifier)
+    public List<InitParam> getInitParams()
     {
-        // TODO Auto-generated method stub
-        
+        if (initParams == null)
+        {
+            initParams = new ArrayList<InitParam>();
+        }
+        return initParams;
     }
-
-    public String getCacheScope()
+    
+    public InitParam addInitParam(String paramName)
     {
-        // TODO Auto-generated method stub
-        return null;
+        if (getInitParam(paramName) != null)
+        {
+            throw new IllegalArgumentException("Init parameter: "+paramName+" already defined");
+        }
+        InitParamImpl param = new InitParamImpl();
+        param.setParamName(paramName);
+        getInitParams();
+        initParams.add(param);
+        return param;
     }
-
-    public int getExpirationCache()
+    
+    public List<EventDefinitionReference> getSupportedProcessingEvents()
     {
-        // TODO Auto-generated method stub
-        return 0;
+        if (supportedProcessingEvents == null)
+        {
+            supportedProcessingEvents = new ArrayList<EventDefinitionReference>();            
+        }
+        return supportedProcessingEvents;
     }
 
-    public List<String> getSupportedLocales()
+    public EventDefinitionReference addSupportedProcessingEvent(QName qname)
     {
-        // TODO Auto-generated method stub
-        return null;
+        // TODO: check duplicates
+        getSupportedProcessingEvents();
+        EventDefinitionReferenceImpl edr = new EventDefinitionReferenceImpl();
+        edr.setQName(qname);
+        supportedProcessingEvents.add(edr);
+        return edr;
     }
-
-    public List<String> getSupportedPublicRenderParameters()
+    
+    public EventDefinitionReference addSupportedProcessingEvent(String name)
     {
-        // TODO Auto-generated method stub
-        return null;
+        // TODO check duplicates
+        getSupportedProcessingEvents();
+        EventDefinitionReferenceImpl edr = new EventDefinitionReferenceImpl();
+        edr.setName(name);
+        supportedProcessingEvents.add(edr);
+        return edr;
     }
-
-    public void setCacheScope(String cacheScope)
-    {
-        // TODO Auto-generated method stub
         
-    }
-
-    public void setExpirationCache(int expirationCache)
+    public List<EventDefinitionReference> getSupportedPublishingEvents()
     {
-        // TODO Auto-generated method stub
-        
+        if (supportedPublishingEvents == null)
+        {
+            supportedPublishingEvents = new ArrayList<EventDefinitionReference>();            
+        }
+        return supportedPublishingEvents;
     }
 
-    public void setPortletClass(String portletClass)
+    public EventDefinitionReference addSupportedPublishingEvent(QName qname)
     {
-        // TODO Auto-generated method stub
-        
+        // 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;
+    }       
 }

Modified: portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/SupportsImpl.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/SupportsImpl.java?rev=708230&r1=708229&r2=708230&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/SupportsImpl.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/SupportsImpl.java Mon Oct 27 09:22:32 2008
@@ -21,7 +21,7 @@
 import java.util.List;
 
 import org.apache.jetspeed.util.HashCodeBuilder;
-import org.apache.pluto.om.portlet.Supports;
+import org.apache.jetspeed.om.portlet.Supports;
 
 /**
  * @version $Id$



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