portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject svn commit: r708175 - /portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/
Date Mon, 27 Oct 2008 13:41:36 GMT
Author: ate
Date: Mon Oct 27 06:41:36 2008
New Revision: 708175

URL: http://svn.apache.org/viewvc?rev=708175&view=rev
Log:
JS2-871 - Upgrade Pluto container to version 2.0
See:  http://issues.apache.org/jira/browse/JS2-871
- new implementations for the refactored Jetspeed-2 portlet OM (not yet 100% complete but getting there)

Modified:
    portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/EventDefinitionImpl.java
    portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/EventDefinitionReferenceImpl.java
    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/FilterMappingImpl.java
    portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/JetspeedServiceReferenceImpl.java
    portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/ListenerImpl.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/PublicRenderParameterImpl.java
    portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/SecurityConstraintImpl.java
    portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/UserDataConstraintImpl.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/EventDefinitionImpl.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/EventDefinitionImpl.java?rev=708175&r1=708174&r2=708175&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/EventDefinitionImpl.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/EventDefinitionImpl.java Mon Oct 27 06:41:36 2008
@@ -18,6 +18,7 @@
 package org.apache.jetspeed.om.portlet.impl;
 
 import java.io.Serializable;
+import java.util.ArrayList;
 import java.util.List;
 import java.util.Locale;
 
@@ -32,91 +33,95 @@
  */
 public class EventDefinitionImpl implements EventDefinition, Serializable
 {
-    /* (non-Javadoc)
-     * @see org.apache.jetspeed.om.portlet.EventDefinition#addDescription(java.lang.String)
-     */
-    public Description addDescription(String lang)
-    {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    /* (non-Javadoc)
-     * @see org.apache.jetspeed.om.portlet.EventDefinition#getDescription(java.util.Locale)
-     */
+    protected String name;
+    protected QName qname;
+    protected String valueType;
+    protected List<QName> aliases;
+    protected List<Description> descriptions;
+    
     public Description getDescription(Locale locale)
     {
-        // TODO Auto-generated method stub
+        for (Description d : getDescriptions())
+        {
+            if (d.getLocale().equals(locale))
+            {
+                return d;
+            }
+        }
         return null;
     }
-
-    /* (non-Javadoc)
-     * @see org.apache.jetspeed.om.portlet.EventDefinition#getDescriptions()
-     */
+    
     public List<Description> getDescriptions()
     {
-        // TODO Auto-generated method stub
-        return null;
+        if (descriptions == null)
+        {
+            descriptions = new ArrayList<Description>();
+        }
+        return descriptions;
+    }
+    
+    public Description addDescription(String lang)
+    {
+        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;
     }
 
-    /* (non-Javadoc)
-     * @see org.apache.pluto.om.portlet.EventDefinition#addAlias(javax.xml.namespace.QName)
-     */
-    public void addAlias(QName name)
+    public QName getQName()
     {
-        // TODO Auto-generated method stub
+        return qname;
     }
 
-    /* (non-Javadoc)
-     * @see org.apache.pluto.om.portlet.EventDefinition#getAliases()
-     */
-    public List<QName> getAliases()
+    public void setQName(QName value)
     {
-        // TODO Auto-generated method stub
-        return null;
+        qname = value;
+        name = null;
     }
 
-    /* (non-Javadoc)
-     * @see org.apache.pluto.om.portlet.EventDefinition#getName()
-     */
     public String getName()
     {
-        // TODO Auto-generated method stub
-        return null;
+        return name;
     }
 
-    /* (non-Javadoc)
-     * @see org.apache.pluto.om.portlet.EventDefinition#getQName()
-     */
-    public QName getQName()
+    public void setName(String value)
     {
-        // TODO Auto-generated method stub
-        return null;
+        name = value;
+        qname = null;
     }
 
-    /* (non-Javadoc)
-     * @see org.apache.pluto.om.portlet.EventDefinition#getQualifiedName(java.lang.String)
-     */
-    public QName getQualifiedName(String defaultNamespace)
+    public List<QName> getAliases()
     {
-        // TODO Auto-generated method stub
-        return null;
+        if (aliases == null)
+        {
+            aliases = new ArrayList<QName>();
+        }
+        return aliases;
+    }
+    
+    public void addAlias(QName alias)
+    {
+        // TODO: check for duplicates
+        getAliases().add(alias);
     }
 
-    /* (non-Javadoc)
-     * @see org.apache.pluto.om.portlet.EventDefinition#getValueType()
-     */
     public String getValueType()
     {
-        // TODO Auto-generated method stub
-        return null;
+        return valueType;
+    }
+
+    public void setValueType(String value)
+    {
+        valueType = value;
     }
 
-    /* (non-Javadoc)
-     * @see org.apache.pluto.om.portlet.EventDefinition#setValueType(java.lang.String)
-     */
-    public void setValueType(String valueType)
+    public QName getQualifiedName(String defaultNamespace)
     {
-        // TODO Auto-generated method stub
+        return qname != null ? qname : name != null ? new QName(defaultNamespace, name) : null;
     }
 }

Modified: portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/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/JS2-871-pluto-2.0-upgrade/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/EventDefinitionReferenceImpl.java?rev=708175&r1=708174&r2=708175&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/EventDefinitionReferenceImpl.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/EventDefinitionReferenceImpl.java Mon Oct 27 06:41:36 2008
@@ -29,30 +29,33 @@
  */
 public class EventDefinitionReferenceImpl implements EventDefinitionReference, Serializable
 {
-    /* (non-Javadoc)
-     * @see org.apache.pluto.om.portlet.EventDefinitionReference#getName()
-     */
+    protected QName qname;
+    protected String name;
+    
+    public QName getQName()
+    {
+        return qname;
+    }
+
+    public void setQName(QName value)
+    {
+        qname = value;
+        name = null;
+    }
+
     public String getName()
     {
-        // TODO Auto-generated method stub
-        return null;
+        return name;
     }
 
-    /* (non-Javadoc)
-     * @see org.apache.pluto.om.portlet.EventDefinitionReference#getQName()
-     */
-    public QName getQName()
+    public void setName(String value)
     {
-        // TODO Auto-generated method stub
-        return null;
+        name = value;
+        qname = null;
     }
 
-    /* (non-Javadoc)
-     * @see org.apache.pluto.om.portlet.EventDefinitionReference#getQualifiedName(java.lang.String)
-     */
     public QName getQualifiedName(String defaultNamespace)
     {
-        // TODO Auto-generated method stub
-        return null;
+        return qname != null ? qname : name != null ? new QName(defaultNamespace, name) : null;
     }
 }

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=708175&r1=708174&r2=708175&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 06:41:36 2008
@@ -18,6 +18,7 @@
 package org.apache.jetspeed.om.portlet.impl;
 
 import java.io.Serializable;
+import java.util.ArrayList;
 import java.util.List;
 import java.util.Locale;
 
@@ -32,127 +33,147 @@
  */
 public class FilterImpl implements Filter, Serializable
 {
-    /* (non-Javadoc)
-     * @see org.apache.jetspeed.om.portlet.Filter#addDescription(java.lang.String)
-     */
-    public Description addDescription(String lang)
-    {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    /* (non-Javadoc)
-     * @see org.apache.jetspeed.om.portlet.Filter#addDisplayName(java.lang.String)
-     */
-    public DisplayName addDisplayName(String lang)
-    {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    /* (non-Javadoc)
-     * @see org.apache.jetspeed.om.portlet.Filter#addInitParam(java.lang.String)
-     */
-    public InitParam addInitParam(String paramName)
-    {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    /* (non-Javadoc)
-     * @see org.apache.jetspeed.om.portlet.Filter#getDescription(java.util.Locale)
-     */
+    protected String filterName;
+    protected String filterClass;
+    protected List<String> lifecycle;
+    protected List<InitParam> initParam;
+    protected List<Description> descriptions;
+    protected List<DisplayName> displayNames;
+    
     public Description getDescription(Locale locale)
     {
-        // TODO Auto-generated method stub
+        for (Description d : getDescriptions())
+        {
+            if (d.getLocale().equals(locale))
+            {
+                return d;
+            }
+        }
         return null;
     }
-
-    /* (non-Javadoc)
-     * @see org.apache.jetspeed.om.portlet.Filter#getDescriptions()
-     */
+    
     public List<Description> getDescriptions()
     {
-        // TODO Auto-generated method stub
-        return null;
+        if (descriptions == null)
+        {
+            descriptions = new ArrayList<Description>();
+        }
+        return descriptions;
+    }
+    
+    public Description addDescription(String lang)
+    {
+        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;
     }
 
-    /* (non-Javadoc)
-     * @see org.apache.jetspeed.om.portlet.Filter#getDisplayName(java.util.Locale)
-     */
     public DisplayName getDisplayName(Locale locale)
     {
-        // TODO Auto-generated method stub
+        for (DisplayName d : getDisplayNames())
+        {
+            if (d.getLocale().equals(locale))
+            {
+                return d;
+            }
+        }
         return null;
     }
-
-    /* (non-Javadoc)
-     * @see org.apache.jetspeed.om.portlet.Filter#getDisplayNames()
-     */
+    
     public List<DisplayName> getDisplayNames()
     {
-        // TODO Auto-generated method stub
-        return null;
+        if (displayNames == null)
+        {
+            displayNames = new ArrayList<DisplayName>();
+        }
+        return displayNames;
     }
-
-    /* (non-Javadoc)
-     * @see org.apache.jetspeed.om.portlet.Filter#getInitParam(java.lang.String)
-     */
-    public InitParam getInitParam(String paramName)
+    
+    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;
     }
 
-    /* (non-Javadoc)
-     * @see org.apache.jetspeed.om.portlet.Filter#getInitParams()
-     */
-    public List<InitParam> getInitParams()
+    public String getFilterName()
     {
-        // TODO Auto-generated method stub
-        return null;
+        return filterName;
     }
 
-    /* (non-Javadoc)
-     * @see org.apache.pluto.om.portlet.Filter#addLifecycle(java.lang.String)
-     */
-    public void addLifecycle(String lifecycle)
+    public void setFilterName(String value)
     {
-        // TODO Auto-generated method stub
+        filterName = value;
     }
 
-    /* (non-Javadoc)
-     * @see org.apache.pluto.om.portlet.Filter#getFilterClass()
-     */
     public String getFilterClass()
     {
-        // TODO Auto-generated method stub
-        return null;
+        return filterClass;
     }
 
-    /* (non-Javadoc)
-     * @see org.apache.pluto.om.portlet.Filter#getFilterName()
-     */
-    public String getFilterName()
+    public void setFilterClass(String value)
     {
-        // TODO Auto-generated method stub
-        return null;
+        filterClass = value;
     }
 
-    /* (non-Javadoc)
-     * @see org.apache.pluto.om.portlet.Filter#getLifecycles()
-     */
     public List<String> getLifecycles()
     {
-        // TODO Auto-generated method stub
+        if (lifecycle == null)
+        {
+            lifecycle = new ArrayList<String>();
+        }
+        return lifecycle;
+    }
+    
+    public void addLifecycle(String name)
+    {
+        // TODO: check valid name and duplicates
+        getLifecycles().add(name);
+    }
+    
+    public InitParam getInitParam(String name)
+    {
+        for (InitParam param : getInitParams())
+        {
+            if (param.getParamName().equals(name))
+            {
+                return param;
+            }
+        }
         return null;
     }
 
-    /* (non-Javadoc)
-     * @see org.apache.pluto.om.portlet.Filter#setFilterClass(java.lang.String)
-     */
-    public void setFilterClass(String filterClass)
+    public List<InitParam> getInitParams()
+    {
+        if (initParam == null)
+        {
+            initParam = new ArrayList<InitParam>();
+        }
+        return initParam;
+    }
+    
+    public InitParam addInitParam(String paramName)
     {
-        // TODO Auto-generated method stub
+        if (getInitParam(paramName) != null)
+        {
+            throw new IllegalArgumentException("Init parameter: "+paramName+" already defined");
+        }
+        InitParamImpl param = new InitParamImpl();
+        param.setParamName(paramName);
+        getInitParams();
+        initParam.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/FilterMappingImpl.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/FilterMappingImpl.java?rev=708175&r1=708174&r2=708175&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/FilterMappingImpl.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/FilterMappingImpl.java Mon Oct 27 06:41:36 2008
@@ -18,6 +18,7 @@
 package org.apache.jetspeed.om.portlet.impl;
 
 import java.io.Serializable;
+import java.util.ArrayList;
 import java.util.List;
 
 import org.apache.jetspeed.om.portlet.FilterMapping;
@@ -28,29 +29,31 @@
  */
 public class FilterMappingImpl implements FilterMapping, Serializable
 {
-    /* (non-Javadoc)
-     * @see org.apache.pluto.om.portlet.FilterMapping#addPortletName(java.lang.String)
-     */
-    public void addPortletName(String portletName)
+    protected String filterName;
+    protected List<String> portletName;
+    
+    public String getFilterName()
     {
-        // TODO Auto-generated method stub
+        return filterName;
     }
 
-    /* (non-Javadoc)
-     * @see org.apache.pluto.om.portlet.FilterMapping#getFilterName()
-     */
-    public String getFilterName()
+    public void setFilterName(String value)
     {
-        // TODO Auto-generated method stub
-        return null;
+        filterName = value;
     }
 
-    /* (non-Javadoc)
-     * @see org.apache.pluto.om.portlet.FilterMapping#getPortletNames()
-     */
     public List<String> getPortletNames()
     {
-        // TODO Auto-generated method stub
-        return null;
+        if (portletName == null)
+        {
+            portletName = new ArrayList<String>();
+        }
+        return portletName;
+    }
+    
+    public void addPortletName(String name)
+    {
+        // TODO: check for duplicates
+        getPortletNames().add(name);
     }
 }

Modified: portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/JetspeedServiceReferenceImpl.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/JetspeedServiceReferenceImpl.java?rev=708175&r1=708174&r2=708175&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/JetspeedServiceReferenceImpl.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/JetspeedServiceReferenceImpl.java Mon Oct 27 06:41:36 2008
@@ -36,20 +36,13 @@
         this.name = name;
     }
     
-    /* (non-Javadoc)
-     * @see org.apache.jetspeed.om.common.JetspeedServiceReference#getName()
-     */
     public String getName()
     {
         return name;
     }
 
-    /* (non-Javadoc)
-     * @see org.apache.jetspeed.om.common.JetspeedServiceReference#setName(java.lang.String)
-     */
     public void setName(String name)
     {
         this.name = name;
     }
-
 }

Modified: portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/ListenerImpl.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/ListenerImpl.java?rev=708175&r1=708174&r2=708175&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/ListenerImpl.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/ListenerImpl.java Mon Oct 27 06:41:36 2008
@@ -18,12 +18,13 @@
 package org.apache.jetspeed.om.portlet.impl;
 
 import java.io.Serializable;
+import java.util.ArrayList;
 import java.util.List;
 import java.util.Locale;
 
-import org.apache.pluto.om.portlet.Description;
-import org.apache.pluto.om.portlet.DisplayName;
-import org.apache.pluto.om.portlet.Listener;
+import org.apache.jetspeed.om.portlet.Description;
+import org.apache.jetspeed.om.portlet.DisplayName;
+import org.apache.jetspeed.om.portlet.Listener;
 
 /**
  * @version $Id$
@@ -31,66 +32,86 @@
  */
 public class ListenerImpl implements Listener, Serializable
 {
-    /* (non-Javadoc)
-     * @see org.apache.pluto.om.portlet.Listener#addDescription(java.lang.String)
-     */
-    public Description addDescription(String lang)
+    protected String listenerClass;
+    protected List<Description> descriptions;
+    protected List<DisplayName> displayNames;
+
+    
+    public String getListenerClass()
     {
-        // TODO Auto-generated method stub
-        return null;
+        return listenerClass;
     }
 
-    /* (non-Javadoc)
-     * @see org.apache.pluto.om.portlet.Listener#addDisplayName(java.lang.String)
-     */
-    public DisplayName addDisplayName(String lang)
+    public void setListenerClass(String listenerClass)
     {
-        // TODO Auto-generated method stub
-        return null;
+        this.listenerClass = listenerClass;
     }
 
-    /* (non-Javadoc)
-     * @see org.apache.pluto.om.portlet.Listener#getDescription(java.util.Locale)
-     */
     public Description getDescription(Locale locale)
     {
-        // TODO Auto-generated method stub
-        return null;
+        for (Description d : getDescriptions())
+        {
+            if (d.getLocale().equals(locale))
+            {
+                return d;
+            }
+        }
+        return null;
+    }
+    
+    public List<Description> getDescriptions()
+    {
+        if (descriptions == null)
+        {
+            descriptions = new ArrayList<Description>();
+        }
+        return descriptions;
     }
-
-    /* (non-Javadoc)
-     * @see org.apache.pluto.om.portlet.Listener#getDescriptions()
-     */
-    public List<? extends Description> getDescriptions()
+    
+    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;
     }
 
-    /* (non-Javadoc)
-     * @see org.apache.pluto.om.portlet.Listener#getDisplayName(java.util.Locale)
-     */
     public DisplayName getDisplayName(Locale locale)
     {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    /* (non-Javadoc)
-     * @see org.apache.pluto.om.portlet.Listener#getDisplayNames()
-     */
-    public List<? extends DisplayName> getDisplayNames()
-    {
-        // TODO Auto-generated method stub
-        return null;
+        for (DisplayName d : getDisplayNames())
+        {
+            if (d.getLocale().equals(locale))
+            {
+                return d;
+            }
+        }
+        return null;
+    }
+    
+    public List<DisplayName> getDisplayNames()
+    {
+        if (displayNames == null)
+        {
+            displayNames = new ArrayList<DisplayName>();
+        }
+        return displayNames;
     }
-
-    /* (non-Javadoc)
-     * @see org.apache.pluto.om.portlet.Listener#getListenerClass()
-     */
-    public String getListenerClass()
+    
+    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;
     }
 }

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=708175&r1=708174&r2=708175&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 06:41:36 2008
@@ -58,57 +58,56 @@
  */
 public class PortletApplicationDefinitionImpl implements PortletApplication, Serializable, Support
 { 
-    /** Holds value of property name. */
-    private String name;
-
+    private int applicationType = PortletApplication.WEBAPP;
+    
+    private String checksum = "0";
+    private long checksumLong = -1;
+    
     /** Holds value of property version. */
     private String version;
 
+    /** Holds value of property name. */
+    private String name;
+
     /** WebApplication property */
     private transient WebApplicationDefinition webApplication;
     
     /** Metadata property */
     private Collection metadataFields = null;
-
-    /** Metadata property */
-    private List<JetspeedServiceReference> services = new ArrayList<JetspeedServiceReference>();
     
     /** Description */
     private String description;
 
-    /** User attribute refs collection. */
-    private List<UserAttributeRefImpl> userAttributeRefs;
-    
-    /** User attributes collection. */
-    private Collection userAttributes;
-    
-    protected List<PortletDefinition> portlets;
+    private String resourceBundle;
+    private String defaultNamespace;
     
-    private int applicationType = PortletApplication.WEBAPP;
-    
-    private String checksum = "0";
-    private long checksumLong = -1;
+    private String jetspeedSecurityConstraint;
     
-    private List customPortletModes;
-    private List customWindowStates;
-    
-    private String jetspeedSecurityConstraint = null;
+    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<SecurityConstraint> securityConstraints;
+    private List<Filter> filters;
+    private List<FilterMapping> filterMappings;
+    private List<Listener> listeners;
+    private List<ContainerRuntimeOption> containerRuntimeOptions;
+
+    private List<UserAttributeRef> userAttributeRefs;
+    private List<JetspeedServiceReference> services = new ArrayList<JetspeedServiceReference>();
     
-    private transient Map supportedCustomModes;
-    private transient Map supportedCustomStates;
-    private transient Map mappedCustomModes;
-    private transient Map mappedCustomStates;    
+    private transient Map<PortletMode,PortletMode> supportedCustomModes;
+    private transient Map<WindowState,WindowState> supportedCustomStates;
+    private transient Map<PortletMode,PortletMode> mappedCustomModes;
+    private transient Map<WindowState,WindowState> mappedCustomStates;    
     private transient List<PortletMode> supportedPortletModes;
     private transient List<WindowState> supportedWindowStates;
     
     /** Creates a new instance of BaseApplication */
     public PortletApplicationDefinitionImpl()
     {
-        portlets = new ArrayList<PortletDefinition>();
-        userAttributes = new ArrayList();        
-        userAttributeRefs = new ArrayList();
-        customPortletModes = new ArrayList<PortletMode>();
-        customWindowStates = new ArrayList<WindowState>();
     }
 
     /**
@@ -144,64 +143,74 @@
     }
 
     /**
-     * @return
+     * @see org.apache.jetspeed.om.portlet.PortletApplication#setApplicationType(int)
      */
-    public WebApplicationDefinition getWebApplicationDefinition()
+    public void setApplicationType(int type)
     {
-        return webApplication;
+        this.applicationType = type;
     }
 
-    public PortletDefinition getPortlet(String portletName)
+    /**
+     * @see org.apache.jetspeed.om.portlet.PortletApplication#getApplicationType()
+     */
+    public int getApplicationType()
     {
-        for (PortletDefinition pd : getPortlets())
+        return applicationType;
+    }
+
+    public long getChecksum()
+    {
+        if(checksumLong == -1)
         {
-            if (pd.getPortletName().equals(portletName))
-            {
-                return pd;
-            }
+            checksumLong = Long.parseLong(checksum);
         }
-        return null;
+        return checksumLong;
     }
-
-    /**
-     * @return
-     */
-    public String getDescription()
+    
+    public void setChecksum(long checksum)
     {
-        return description;
+        this.checksumLong = checksum;
+        this.checksum = Long.toString(checksum);
+    }
+    
+    public String getDefaultNamespace()
+    {
+        return defaultNamespace;
     }
 
-    /**
-     * @param string
-     */
-    public void setDescription(String string)
+    public void setDefaultNamespace(String defaultNamespace)
     {
-        description = string;
+        this.defaultNamespace = defaultNamespace;
     }
 
-    /**
-     * @see org.apache.jetspeed.om.common.portlet.PortletApplication#setWebApplicationDefinition(org.apache.pluto.om.servlet.WebApplicationDefinition)
-     */
-    public void setWebApplicationDefinition(WebApplicationDefinition wad)
+    public String getResourceBundle()
     {
-        this.webApplication = wad;
+        return resourceBundle;
+    }
 
+    public void setResourceBundle(String resourceBundle)
+    {
+        this.resourceBundle = resourceBundle;
+    }
+    
+    public String getJetspeedSecurityConstraint()
+    {
+        return this.jetspeedSecurityConstraint;
     }
 
-    /**
-     * @see org.apache.jetspeed.om.portlet.PortletApplication#setApplicationType(int)
-     */
-    public void setApplicationType(int type)
+    public void setJetspeedSecurityConstraint(String constraint)
     {
-        this.applicationType = type;
+        this.jetspeedSecurityConstraint = constraint;
+    }
+    
+    public String getDescription()
+    {
+        return description;
     }
 
-    /**
-     * @see org.apache.jetspeed.om.portlet.PortletApplication#getApplicationType()
-     */
-    public int getApplicationType()
+    public void setDescription(String string)
     {
-        return applicationType;
+        description = string;
     }
 
     /**
@@ -209,97 +218,150 @@
      */
     public GenericMetadata getMetadata()
     {
-    	if(metadataFields == null)
+        if(metadataFields == null)
         {
             metadataFields = new ArrayList();
         }
-    	
-    	GenericMetadata metadata = new PortletApplicationMetadataImpl();
-    	metadata.setFields(metadataFields);
+        
+        GenericMetadata metadata = new PortletApplicationMetadataImpl();
+        metadata.setFields(metadataFields);
         
         return metadata;
     }
+    
+    public WebApplicationDefinition getWebApplicationDefinition()
+    {
+        return webApplication;
+    }
 
-    /* (non-Javadoc)
-     * @see org.apache.jetspeed.om.common.portlet.PortletApplication#getJetspeedServices()
-     */
-    public List<JetspeedServiceReference> getJetspeedServices()
+    public void setWebApplicationDefinition(WebApplicationDefinition wad)
     {
-        return services;
+        this.webApplication = wad;
+
     }
     
-    public long getChecksum()
+    public PortletDefinition getPortlet(String portletName)
     {
-        if(checksumLong == -1)
+        for (PortletDefinition pd : getPortlets())
         {
-            checksumLong = Long.parseLong(checksum);
+            if (pd.getPortletName().equals(portletName))
+            {
+                return pd;
+            }
         }
-        return checksumLong;
+        return null;
     }
-    
-    public void setChecksum(long checksum)
+
+    public List<PortletDefinition> getPortlets()
     {
-        this.checksumLong = checksum;
-        this.checksum = Long.toString(checksum);
+        if (portlets == null)
+        {
+            portlets = new ArrayList<PortletDefinition>();
+        }
+        return portlets;
     }
-    
-    /* (non-Javadoc)
-     * @see org.apache.jetspeed.om.common.Support#postLoad(java.lang.Object)
-     */
-    public void postLoad(Object parameter) throws Exception
+
+    public PortletDefinition addPortlet(String name)
     {
-        for (PortletDefinition pd : portlets)
+        if (getPortlet(name) != null)
         {
-            ((Support)pd).postLoad(this);
+            throw new IllegalArgumentException("Portlet with name: "+name+" already defined");
         }
+        PortletDefinitionImpl portlet = new PortletDefinitionImpl();
+        portlet.setPortletName(name);
+        portlet.setPortletApplication(this);
+        portlets.add(portlet);
+        return portlet;
     }
 
-    public List<CustomPortletMode> getCustomPortletModes()
+    public List<EventDefinition> getEventDefinitions()
     {
-        return customPortletModes;
+        if (eventDefinitions == null)
+        {
+            eventDefinitions = new ArrayList<EventDefinition>();
+        }
+        return eventDefinitions;
     }
-    
-    public void addCustomPortletMode(CustomPortletMode customPortletMode)
+
+    public EventDefinition addEventDefinition(String name)
     {
-        // clear transient cache
-        supportedPortletModes = null;
-        supportedCustomModes = null;
-        mappedCustomModes = null;
-        
-        if ( !customPortletModes.contains(customPortletMode) )
+        // 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;
+    }
+
+    public PublicRenderParameter getPublicRenderParameter(String identifier)
+    {
+        for (PublicRenderParameter p : getPublicRenderParameters())
         {
-            customPortletModes.add(customPortletMode);
+            if (p.getIdentifier().equals(identifier))
+            {
+                return p;
+            }
         }
+        return null;
     }
-    
-    public void setCustomPortletModes(Collection customPortletModes)
+
+    public List<PublicRenderParameter> getPublicRenderParameters()
     {
-        // clear transient cache
-        supportedPortletModes = null;
-        supportedCustomModes = null;
-        mappedCustomModes = null;
+        if (publicRenderParameters == null)
+        {
+            publicRenderParameters = new ArrayList<PublicRenderParameter>();
+        }
+        return publicRenderParameters;
+    }
 
-        this.customPortletModes.clear();
-        
-        if ( customPortletModes != null )
+    public PublicRenderParameter addPublicRenderParameter(String name, String identifier)
+    {
+        if (getPublicRenderParameter(identifier) != null)
         {
-            this.customPortletModes.addAll(customPortletModes);
+            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);
+        publicRenderParameters.add(p);
+        return p;        
     }
-    
-    public PortletMode getMappedPortletMode(PortletMode mode)
+
+    public PublicRenderParameter addPublicRenderParameter(QName qname, String identifier)
     {
-        if ( JetspeedActions.getStandardPortletModes().contains(mode) )
+        if (getPublicRenderParameter(identifier) != null)
         {
-            return mode;
+            throw new IllegalArgumentException("PublicRenderParameter with identifier: "+identifier+" already defined");
         }
-        else if ( getSupportedPortletModes().contains(mode) )
+        // TODO: check duplicates on name|qname?
+        PublicRenderParameterImpl p = new PublicRenderParameterImpl();
+        p.setQName(qname);
+        p.setIdentifier(identifier);
+        publicRenderParameters.add(p);
+        return p;        
+    }
+
+    public CustomPortletMode getCustomPortletMode(String name)
+    {
+        for (CustomPortletMode cpm : getCustomPortletModes())
         {
-            return (PortletMode)mappedCustomModes.get(mode);
+            if (cpm.getPortletMode().equalsIgnoreCase(name))
+            {
+                return cpm;
+            }
         }
         return null;
     }
-    
+
     public PortletMode getCustomPortletMode(PortletMode mode)
     {
         if (JetspeedActions.getStandardPortletModes().contains(mode))
@@ -315,79 +377,45 @@
         return null;            
     }
     
-    public List<PortletMode> getSupportedPortletModes()
+    public List<CustomPortletMode> getCustomPortletModes()
     {
-        if ( supportedPortletModes == null )
+        if (customPortletModes == null)
         {
-            ArrayList list = new ArrayList(JetspeedActions.getStandardPortletModes());
-            supportedCustomModes = new HashMap();
-            mappedCustomModes = new HashMap();
-            
-            if ( customPortletModes.size() > 0 )
-            {
-                Iterator iter = customPortletModes.iterator();
-                while ( iter.hasNext() )
-                {
-                    CustomPortletMode customMode = (CustomPortletMode)iter.next();
-                    if ( !list.contains(customMode.getCustomMode()) && JetspeedActions.getExtendedPortletModes().contains(customMode.getMappedMode()) )
-                    {
-                        list.add(customMode.getCustomMode());
-                        supportedCustomModes.put(customMode.getMappedMode(), customMode.getCustomMode());
-                        mappedCustomModes.put(customMode.getCustomMode(), customMode.getMappedMode());
-                    }
-                }
-            }
-            supportedPortletModes = Collections.unmodifiableList(list);
+            customPortletModes = new ArrayList<CustomPortletMode>();
         }
-        return supportedPortletModes;
-    }
-    
-    public List<CustomWindowState> getCustomWindowStates()
-    {
-        return customWindowStates;
+        return customPortletModes;
     }
     
-    public void addCustomWindowState(CustomWindowState customWindowState)
+    public CustomPortletMode addCustomPortletMode(String name)
     {
-        // clear transient cache
-        supportedWindowStates = null;
-        supportedCustomStates = null;
-        mappedCustomStates = null;
-        
-        if ( !customWindowStates.contains(customWindowState) )
+        if (getCustomPortletMode(name) != null)
         {
-            customWindowStates.add(customWindowState);
+            throw new IllegalArgumentException("Custom PortletMode with mode name: "+name+" already defined");
         }
-    }
-    
-    public void setCustomWindowStates(Collection customWindowStates)
-    {
+        
         // clear transient cache
-        supportedWindowStates = null;
-        supportedCustomStates = null;
-        mappedCustomStates = null;
-
-        this.customWindowStates.clear();
-
-        if ( customWindowStates != null )
-        {
-            this.customWindowStates.addAll(customWindowStates);
-        }
+        supportedPortletModes = null;
+        supportedCustomModes = null;
+        mappedCustomModes = null;
+        
+        CustomPortletModeImpl cpm = new CustomPortletModeImpl();
+        cpm.setPortletMode(name);
+        customPortletModes.add(cpm);
+        return cpm;        
     }
-    
-    public WindowState getMappedWindowState(WindowState state)
+
+    public CustomWindowState getCustomWindowState(String name)
     {
-        if (JetspeedActions.getStandardWindowStates().contains(state) )
-        {
-            return state;
-        }
-        else if ( getSupportedWindowStates().contains(state) )
+        for (CustomWindowState cws : getCustomWindowStates())
         {
-            return (WindowState)mappedCustomStates.get(state);
+            if (cws.getWindowState().equalsIgnoreCase(name))
+            {
+                return cws;
+            }
         }
         return null;
     }
-    
+
     public WindowState getCustomWindowState(WindowState state)
     {
         if (JetspeedActions.getStandardWindowStates().contains(state))
@@ -403,284 +431,357 @@
         return null;            
     }
     
-    public List<WindowState> getSupportedWindowStates()
+    public List<CustomWindowState> getCustomWindowStates()
     {
-        if ( supportedWindowStates == null )
+        if (customWindowStates == null)
         {
-            ArrayList list = new ArrayList(JetspeedActions.getStandardWindowStates());
-            supportedCustomStates = new HashMap();
-            mappedCustomStates = new HashMap();
-            
-            if ( customWindowStates.size() > 0 )
-            {
-                Iterator iter = customWindowStates.iterator();
-                while ( iter.hasNext() )
-                {
-                    CustomWindowState customState = (CustomWindowState)iter.next();
-                    if ( !list.contains(customState.getCustomState()) && JetspeedActions.getExtendedWindowStates().contains(customState.getMappedState()) )
-                    {
-                        list.add(customState.getCustomState());
-                        supportedCustomStates.put(customState.getMappedState(),customState.getCustomState());
-                        mappedCustomStates.put(customState.getCustomState(),customState.getMappedState());
-                    }
-                }
-            }
-            supportedWindowStates = Collections.unmodifiableList(list);
+            customWindowStates = new ArrayList<CustomWindowState>();
         }
-        return supportedWindowStates;
+        return customWindowStates;
     }
-
-    /* (non-Javadoc)
-     * @see org.apache.jetspeed.om.common.portlet.PortletDefinitionComposite#getJetspeedSecurityConstraint()
-     */
-    public String getJetspeedSecurityConstraint()
+    
+    public CustomWindowState addCustomWindowState(String name)
     {
-        return this.jetspeedSecurityConstraint;
+        if (getCustomWindowState(name) != null)
+        {
+            throw new IllegalArgumentException("Custom WindowState with state name: "+name+" already defined");
+        }
+
+        // clear transient cache
+        supportedWindowStates = null;
+        supportedCustomStates = null;
+        mappedCustomStates = null;
+        
+        CustomWindowStateImpl cws = new CustomWindowStateImpl();
+        cws.setWindowState(name);
+        customWindowStates.add(cws);
+        return cws;        
     }
 
-    /* (non-Javadoc)
-     * @see org.apache.jetspeed.om.common.portlet.PortletDefinitionComposite#setJetspeedSecurityConstraint(java.lang.String)
-     */
-    public void setJetspeedSecurityConstraint(String constraint)
+    public List<PortletMode> getSupportedPortletModes()
     {
-        this.jetspeedSecurityConstraint = constraint;
+        if ( supportedPortletModes == null )
+        {
+            ArrayList<PortletMode> list = new ArrayList<PortletMode>(JetspeedActions.getStandardPortletModes());
+            supportedCustomModes = new HashMap<PortletMode,PortletMode>();
+            mappedCustomModes = new HashMap<PortletMode,PortletMode>();
+            
+            for (CustomPortletMode customMode : getCustomPortletModes())
+            {
+                if ( !list.contains(customMode.getCustomMode()) && JetspeedActions.getExtendedPortletModes().contains(customMode.getMappedMode()) )
+                {
+                    list.add(customMode.getCustomMode());
+                    supportedCustomModes.put(customMode.getMappedMode(), customMode.getCustomMode());
+                    mappedCustomModes.put(customMode.getCustomMode(), customMode.getMappedMode());
+                }
+            }
+            supportedPortletModes = Collections.unmodifiableList(list);
+        }
+        return supportedPortletModes;
     }
     
-    public boolean isLayoutApplication()
+    public List<WindowState> getSupportedWindowStates()
     {
-        if (this.getMetadata() != null)
+        if ( supportedWindowStates == null )
         {
-            Collection c = this.getMetadata().getFields("layout-app");
-            if (c != null)
+            ArrayList<WindowState> list = new ArrayList<WindowState>(JetspeedActions.getStandardWindowStates());
+            supportedCustomStates = new HashMap<WindowState,WindowState>();
+            mappedCustomStates = new HashMap<WindowState,WindowState>();
+            
+            for (CustomWindowState customState : getCustomWindowStates())
             {
-                if (!c.isEmpty())
+                if ( !list.contains(customState.getCustomState()) && JetspeedActions.getExtendedWindowStates().contains(customState.getMappedState()) )
                 {
-                   return true;
+                    list.add(customState.getCustomState());
+                    supportedCustomStates.put(customState.getMappedState(),customState.getCustomState());
+                    mappedCustomStates.put(customState.getCustomState(),customState.getMappedState());
                 }
             }
+            supportedWindowStates = Collections.unmodifiableList(list);
         }
-        return false;
-     }
-
-    public ContainerRuntimeOption addContainerRuntimeOption(String name)
-    {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    public CustomPortletMode addCustomPortletMode(String name)
-    {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    public CustomWindowState addCustomWindowState(String name)
-    {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    public EventDefinition addEventDefinition(String name)
-    {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    public EventDefinition addEventDefinition(QName qname)
-    {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    public Filter addFilter(String filterName)
-    {
-        // TODO Auto-generated method stub
-        return null;
+        return supportedWindowStates;
     }
 
-    public FilterMapping addFilterMapping(String filterName)
+    public PortletMode getMappedPortletMode(PortletMode mode)
     {
-        // TODO Auto-generated method stub
+        if ( JetspeedActions.getStandardPortletModes().contains(mode) )
+        {
+            return mode;
+        }
+        else if ( getSupportedPortletModes().contains(mode) )
+        {
+            return (PortletMode)mappedCustomModes.get(mode);
+        }
         return null;
     }
-
-    public void addJetspeedServiceReference(String name)
-    {
-        // TODO Auto-generated method stub
-        
-    }
-
-    public Listener addListener(String listenerClass)
+    
+    public WindowState getMappedWindowState(WindowState state)
     {
-        // TODO Auto-generated method stub
+        if (JetspeedActions.getStandardWindowStates().contains(state) )
+        {
+            return state;
+        }
+        else if ( getSupportedWindowStates().contains(state) )
+        {
+            return (WindowState)mappedCustomStates.get(state);
+        }
         return null;
     }
-
-    public PortletDefinition addPortlet(String name)
+    
+    public UserAttribute getUserAttribute(String name)
     {
-        // TODO Auto-generated method stub
+        for (UserAttribute ua : getUserAttributes())
+        {
+            if (ua.getName().equals(name))
+            {
+                return ua;
+            }
+        }
         return null;
     }
 
-    public PublicRenderParameter addPublicRenderParameter(String name, String identifier)
+    public List<UserAttribute> getUserAttributes()
     {
-        // TODO Auto-generated method stub
-        return null;
+        if (userAttributes == null)
+        {
+            userAttributes = new ArrayList<UserAttribute>();
+        }
+        return userAttributes;
     }
 
-    public PublicRenderParameter addPublicRenderParameter(QName qname, String identifier)
+    public UserAttribute addUserAttribute(String name)
     {
-        // TODO Auto-generated method stub
-        return null;
+        if (getUserAttribute(name) != null)
+        {
+            throw new IllegalArgumentException("User attribute with name: "+name+" already defined");
+        }
+        UserAttributeImpl ua = new UserAttributeImpl();
+        ua.setName(name);
+        userAttributes.add(ua);
+        return ua;        
     }
 
-    public SecurityConstraint addSecurityConstraint(String transportGuarantee)
+    public UserAttributeRef getUserAttributeRef(String name)
     {
-        // TODO Auto-generated method stub
+        for (UserAttributeRef uar : getUserAttributeRefs())
+        {
+            if (uar.getName().equals(name))
+            {
+                return uar;
+            }
+        }
         return null;
     }
 
-    public UserAttribute addUserAttribute(String name)
+    public List<UserAttributeRef> getUserAttributeRefs()
     {
-        // TODO Auto-generated method stub
-        return null;
+        if (userAttributeRefs == null)
+        {
+            userAttributeRefs = new ArrayList<UserAttributeRef>();
+        }
+        return userAttributeRefs;
     }
 
     public UserAttributeRef addUserAttributeRef(String name)
     {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    public ContainerRuntimeOption getContainerRuntimeOption(String name)
-    {
-        // TODO Auto-generated method stub
-        return null;
+        if (getUserAttributeRef(name) != null)
+        {
+            throw new IllegalArgumentException("User attribute reference with name: "+name+" already defined");
+        }
+        UserAttributeRefImpl uar = new UserAttributeRefImpl();
+        uar.setName(name);
+        userAttributeRefs.add(uar);
+        return uar;        
     }
 
-    public List<ContainerRuntimeOption> getContainerRuntimeOptions()
+    public List<SecurityConstraint> getSecurityConstraints()
     {
-        // TODO Auto-generated method stub
-        return null;
+        if (securityConstraints == null)
+        {
+            securityConstraints = new ArrayList<SecurityConstraint>();
+        }
+        return securityConstraints;
     }
 
-    public CustomPortletMode getCustomPortletMode(String name)
+    public SecurityConstraint addSecurityConstraint(String transportGuarantee)
     {
-        // TODO Auto-generated method stub
-        return null;
+        SecurityConstraintImpl sc = new SecurityConstraintImpl();
+        ((UserDataConstraintImpl)sc.getUserDataConstraint()).setTransportGuarantee(transportGuarantee);
+        getSecurityConstraints();
+        securityConstraints.add(sc);
+        return sc;        
     }
 
-    public CustomWindowState getCustomWindowState(String name)
+    public Filter getFilter(String filterName)
     {
-        // TODO Auto-generated method stub
+        for (Filter f : getFilters())
+        {
+            if (f.getFilterName().equals(name))
+            {
+                return f;
+            }
+        }
         return null;
     }
 
-    public List<EventDefinition> getEventDefinitions()
+    public List<Filter> getFilters()
     {
-        // TODO Auto-generated method stub
-        return null;
+        if (filters == null)
+        {
+            filters = new ArrayList<Filter>();
+        }
+        return filters;
     }
 
-    public Filter getFilter(String filterName)
+    public Filter addFilter(String filterName)
     {
-        // TODO Auto-generated method stub
-        return null;
+        if (getFilter(name) != null)
+        {
+            throw new IllegalArgumentException("Filter with name: "+name+" already defined");
+        }
+        FilterImpl f = new FilterImpl();
+        f.setFilterName(name);
+        filters.add(f);
+        return f;        
     }
 
     public FilterMapping getFilterMapping(String filterName)
     {
-        // TODO Auto-generated method stub
+        for (FilterMapping f : getFilterMappings())
+        {
+            if (f.getFilterName().equals(name))
+            {
+                return f;
+            }
+        }
         return null;
     }
 
     public List<FilterMapping> getFilterMappings()
     {
-        // TODO Auto-generated method stub
-        return null;
+        if (filterMappings == null)
+        {
+            filterMappings = new ArrayList<FilterMapping>();
+        }
+        return filterMappings;
     }
 
-    public List<Filter> getFilters()
+    public FilterMapping addFilterMapping(String filterName)
     {
-        // TODO Auto-generated method stub
-        return null;
+        if (getFilterMapping(name) != null)
+        {
+            throw new IllegalArgumentException("Filtermapping for filter: "+name+" already defined");
+        }
+        FilterMappingImpl fm = new FilterMappingImpl();
+        fm.setFilterName(name);
+        filterMappings.add(fm);
+        return fm;        
     }
 
     public List<Listener> getListeners()
     {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    public List<PortletDefinition> getPortlets()
-    {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    public PublicRenderParameter getPublicRenderParameter(String identifier)
-    {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    public List<PublicRenderParameter> getPublicRenderParameters()
-    {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    public List<SecurityConstraint> getSecurityConstraints()
-    {
-        // TODO Auto-generated method stub
-        return null;
+        if (listeners == null)
+        {
+            listeners = new ArrayList<Listener>();
+        }
+        return listeners;
     }
 
-    public UserAttribute getUserAttribute(String name)
+    public Listener addListener(String listenerClass)
     {
-        // TODO Auto-generated method stub
-        return null;
+        for (Listener l : getListeners())
+        {
+            if (l.getListenerClass().equals(listenerClass))
+            {
+                throw new IllegalArgumentException("Listener of class: "+listenerClass+" already defined");
+            }
+        }
+        ListenerImpl l = new ListenerImpl();
+        l.setListenerClass(listenerClass);
+        listeners.add(l);
+        return l;        
     }
 
-    public UserAttributeRef getUserAttributeRef(String name)
+    public ContainerRuntimeOption getContainerRuntimeOption(String name)
     {
-        // TODO Auto-generated method stub
+        for (ContainerRuntimeOption cro : getContainerRuntimeOptions())
+        {
+            if (cro.getName().equals(name))
+            {
+                return cro;
+            }
+        }
         return null;
     }
 
-    public List<UserAttributeRef> getUserAttributeRefs()
+    public List<ContainerRuntimeOption> getContainerRuntimeOptions()
     {
-        // TODO Auto-generated method stub
-        return null;
+        if (containerRuntimeOptions == null)
+        {
+            containerRuntimeOptions = new ArrayList<ContainerRuntimeOption>();
+        }
+        return containerRuntimeOptions;
     }
 
-    public List<UserAttribute> getUserAttributes()
+    public ContainerRuntimeOption addContainerRuntimeOption(String name)
     {
-        // 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 String getDefaultNamespace()
+    public List<JetspeedServiceReference> getJetspeedServices()
     {
-        // TODO Auto-generated method stub
-        return null;
+        if (services == null)
+        {
+            this.services = new ArrayList<JetspeedServiceReference>();
+        }
+        return services;
     }
-
-    public String getResourceBundle()
+    
+    public void addJetspeedServiceReference(String name)
     {
-        // TODO Auto-generated method stub
-        return null;
+        for (JetspeedServiceReference ref : getJetspeedServices())
+        {
+            if (ref.getName().equals(name))
+            {
+                throw new IllegalArgumentException("Jetspeed service: "+name+" already defined");
+            }
+        }
+        JetspeedServiceReferenceImpl ref = new JetspeedServiceReferenceImpl();
+        ref.setName(name);
+        services.add(ref);
     }
 
-    public void setDefaultNamespace(String defaultNamespace)
+    public boolean isLayoutApplication()
     {
-        // TODO Auto-generated method stub
-        
-    }
+        if (this.getMetadata() != null)
+        {
+            Collection c = this.getMetadata().getFields("layout-app");
+            if (c != null)
+            {
+                if (!c.isEmpty())
+                {
+                   return true;
+                }
+            }
+        }
+        return false;
+     }
 
-    public void setResourceBundle(String resourceBundle)
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.common.Support#postLoad(java.lang.Object)
+     */
+    public void postLoad(Object parameter) throws Exception
     {
-        // TODO Auto-generated method stub
-        
+        for (PortletDefinition pd : portlets)
+        {
+            ((Support)pd).postLoad(this);
+        }
     }
 }

Modified: portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/PublicRenderParameterImpl.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/PublicRenderParameterImpl.java?rev=708175&r1=708174&r2=708175&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/PublicRenderParameterImpl.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/PublicRenderParameterImpl.java Mon Oct 27 06:41:36 2008
@@ -18,6 +18,7 @@
 package org.apache.jetspeed.om.portlet.impl;
 
 import java.io.Serializable;
+import java.util.ArrayList;
 import java.util.List;
 import java.util.Locale;
 
@@ -32,74 +33,88 @@
  */
 public class PublicRenderParameterImpl implements PublicRenderParameter, Serializable
 {
-    /* (non-Javadoc)
-     * @see org.apache.jetspeed.om.portlet.PublicRenderParameter#addDescription(java.lang.String)
-     */
-    public Description addDescription(String lang)
+    protected String identifier;
+    protected QName qname;
+    protected String name;
+    protected List<QName> alias;
+    protected List<Description> descriptions;
+    
+    public String getIdentifier()
     {
-        // TODO Auto-generated method stub
-        return null;
+        return identifier;
     }
 
-    /* (non-Javadoc)
-     * @see org.apache.jetspeed.om.portlet.PublicRenderParameter#getDescription(java.util.Locale)
-     */
-    public Description getDescription(Locale locale)
+    public void setIdentifier(String value)
     {
-        // TODO Auto-generated method stub
-        return null;
+        identifier = value;
     }
 
-    /* (non-Javadoc)
-     * @see org.apache.jetspeed.om.portlet.PublicRenderParameter#getDescriptions()
-     */
-    public List<Description> getDescriptions()
+    public QName getQName()
     {
-        // TODO Auto-generated method stub
-        return null;
+        return qname;
     }
 
-    /* (non-Javadoc)
-     * @see org.apache.pluto.om.portlet.PublicRenderParameter#addAlias(javax.xml.namespace.QName)
-     */
-    public void addAlias(QName alias)
+    public void setQName(QName value)
     {
-        // TODO Auto-generated method stub
+        qname = value;
     }
 
-    /* (non-Javadoc)
-     * @see org.apache.pluto.om.portlet.PublicRenderParameter#getAliases()
-     */
-    public List<QName> getAliases()
+    public String getName()
     {
-        // TODO Auto-generated method stub
-        return null;
+        return name;
     }
 
-    /* (non-Javadoc)
-     * @see org.apache.pluto.om.portlet.PublicRenderParameter#getIdentifier()
-     */
-    public String getIdentifier()
+    public void setName(String value)
     {
-        // TODO Auto-generated method stub
-        return null;
+        name = value;
     }
 
-    /* (non-Javadoc)
-     * @see org.apache.pluto.om.portlet.PublicRenderParameter#getName()
-     */
-    public String getName()
+    public List<QName> getAliases()
     {
-        // TODO Auto-generated method stub
-        return null;
+        if (alias == null)
+        {
+            alias = new ArrayList<QName>();
+        }
+        return alias;
     }
 
-    /* (non-Javadoc)
-     * @see org.apache.pluto.om.portlet.PublicRenderParameter#getQName()
-     */
-    public QName getQName()
+    public void addAlias(QName alias)
+    {
+        // TODO: check duplicates
+        getAliases().add(alias);
+    }
+    
+    public Description getDescription(Locale locale)
     {
-        // TODO Auto-generated method stub
+        for (Description d : getDescriptions())
+        {
+            if (d.getLocale().equals(locale))
+            {
+                return d;
+            }
+        }
         return null;
     }
+    
+    public List<Description> getDescriptions()
+    {
+        if (descriptions == null)
+        {
+            descriptions = new ArrayList<Description>();
+        }
+        return descriptions;
+    }
+    
+    public Description addDescription(String lang)
+    {
+        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;
+    }
 }

Modified: portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/SecurityConstraintImpl.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/SecurityConstraintImpl.java?rev=708175&r1=708174&r2=708175&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/SecurityConstraintImpl.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/SecurityConstraintImpl.java Mon Oct 27 06:41:36 2008
@@ -18,6 +18,7 @@
 package org.apache.jetspeed.om.portlet.impl;
 
 import java.io.Serializable;
+import java.util.ArrayList;
 import java.util.List;
 import java.util.Locale;
 
@@ -31,56 +32,71 @@
  */
 public class SecurityConstraintImpl implements SecurityConstraint, Serializable
 {
-    /* (non-Javadoc)
-     * @see org.apache.jetspeed.om.portlet.SecurityConstraint#addDisplayName(java.lang.String)
-     */
-    public DisplayName addDisplayName(String lang)
-    {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    /* (non-Javadoc)
-     * @see org.apache.jetspeed.om.portlet.SecurityConstraint#getDisplayName(java.util.Locale)
-     */
+    protected UserDataConstraint userDataConstraint;
+    protected List<String> portletNames;
+    protected List<DisplayName> displayNames;
+    
     public DisplayName getDisplayName(Locale locale)
     {
-        // TODO Auto-generated method stub
+        for (DisplayName d : getDisplayNames())
+        {
+            if (d.getLocale().equals(locale))
+            {
+                return d;
+            }
+        }
         return null;
     }
-
-    /* (non-Javadoc)
-     * @see org.apache.jetspeed.om.portlet.SecurityConstraint#getDisplayNames()
-     */
+    
     public List<DisplayName> getDisplayNames()
     {
-        // TODO Auto-generated method stub
-        return null;
+        if (displayNames == null)
+        {
+            displayNames = new ArrayList<DisplayName>();
+        }
+        return displayNames;
     }
-
-    /* (non-Javadoc)
-     * @see org.apache.jetspeed.om.portlet.SecurityConstraint#getUserDataConstraint()
-     */
-    public UserDataConstraint getUserDataConstraint()
+    
+    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;
     }
 
-    /* (non-Javadoc)
-     * @see org.apache.pluto.om.portlet.SecurityConstraint#addPortletName(java.lang.String)
-     */
+    public List<String> getPortletNames()
+    {
+        if (portletNames == null)
+        {
+            portletNames = new ArrayList<String>();
+        }
+        return portletNames;
+    }
+    
     public void addPortletName(String portletName)
     {
-        // TODO Auto-generated method stub
+        for (String name : getPortletNames())
+        {
+            if (name.equals(portletName))
+            {
+                throw new IllegalArgumentException("Portlet name: "+name+" already defined");
+            }
+        }
+        portletNames.add(portletName);        
     }
 
-    /* (non-Javadoc)
-     * @see org.apache.pluto.om.portlet.SecurityConstraint#getPortletNames()
-     */
-    public List<String> getPortletNames()
+    public UserDataConstraint getUserDataConstraint()
     {
-        // TODO Auto-generated method stub
-        return null;
+        if (userDataConstraint == null)
+        {
+            userDataConstraint = new UserDataConstraintImpl();
+        }
+        return userDataConstraint;
     }
 }

Modified: portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/UserDataConstraintImpl.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/UserDataConstraintImpl.java?rev=708175&r1=708174&r2=708175&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/UserDataConstraintImpl.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/UserDataConstraintImpl.java Mon Oct 27 06:41:36 2008
@@ -18,6 +18,7 @@
 package org.apache.jetspeed.om.portlet.impl;
 
 import java.io.Serializable;
+import java.util.ArrayList;
 import java.util.List;
 import java.util.Locale;
 
@@ -30,39 +31,50 @@
  */
 public class UserDataConstraintImpl implements UserDataConstraint, Serializable
 {
-    /* (non-Javadoc)
-     * @see org.apache.jetspeed.om.portlet.UserDataConstraint#addDescription(java.lang.String)
-     */
-    public Description addDescription(String lang)
-    {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    /* (non-Javadoc)
-     * @see org.apache.jetspeed.om.portlet.UserDataConstraint#getDescription(java.util.Locale)
-     */
+    private String transportGuarantee;
+    protected List<Description> descriptions;
+    
     public Description getDescription(Locale locale)
     {
-        // TODO Auto-generated method stub
+        for (Description d : getDescriptions())
+        {
+            if (d.getLocale().equals(locale))
+            {
+                return d;
+            }
+        }
         return null;
     }
-
-    /* (non-Javadoc)
-     * @see org.apache.jetspeed.om.portlet.UserDataConstraint#getDescriptions()
-     */
+    
     public List<Description> getDescriptions()
     {
-        // TODO Auto-generated method stub
-        return null;
+        if (descriptions == null)
+        {
+            descriptions = new ArrayList<Description>();
+        }
+        return descriptions;
+    }
+    
+    public Description addDescription(String lang)
+    {
+        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;
     }
 
-    /* (non-Javadoc)
-     * @see org.apache.pluto.om.portlet.UserDataConstraint#getTransportGuarantee()
-     */
     public String getTransportGuarantee()
     {
-        // TODO Auto-generated method stub
-        return null;
+        return transportGuarantee;
+    }
+
+    public void setTransportGuarantee(String value)
+    {
+        transportGuarantee = value;
     }
 }



---------------------------------------------------------------------
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