portals-pluto-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From msnickl...@apache.org
Subject [13/38] portals-pluto git commit: Replaced code that reads the deployment descriptor with an implementation that can be better extended to add v3.0 support. Added test cases. Uses jaxb binding classes that are generated at compile time.
Date Fri, 27 Nov 2015 12:37:54 GMT
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/bf15b331/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/JSR362ConfigurationProcessor.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/JSR362ConfigurationProcessor.java b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/JSR362ConfigurationProcessor.java
new file mode 100644
index 0000000..d23afc2
--- /dev/null
+++ b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/JSR362ConfigurationProcessor.java
@@ -0,0 +1,895 @@
+/*  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.pluto.container.om.portlet.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Locale;
+
+import javax.portlet.Portlet;
+import javax.portlet.PortletURLGenerationListener;
+import javax.portlet.PreferencesValidator;
+import javax.portlet.filter.PortletFilter;
+import javax.xml.XMLConstants;
+import javax.xml.bind.JAXBElement;
+import javax.xml.namespace.QName;
+
+import org.apache.pluto.container.om.portlet.ContainerRuntimeOption;
+import org.apache.pluto.container.om.portlet.CustomPortletMode;
+import org.apache.pluto.container.om.portlet.CustomWindowState;
+import org.apache.pluto.container.om.portlet.Description;
+import org.apache.pluto.container.om.portlet.DisplayName;
+import org.apache.pluto.container.om.portlet.EventDefinition;
+import org.apache.pluto.container.om.portlet.EventDefinitionReference;
+import org.apache.pluto.container.om.portlet.Filter;
+import org.apache.pluto.container.om.portlet.FilterMapping;
+import org.apache.pluto.container.om.portlet.InitParam;
+import org.apache.pluto.container.om.portlet.Listener;
+import org.apache.pluto.container.om.portlet.PortletApplicationDefinition;
+import org.apache.pluto.container.om.portlet.PortletDefinition;
+import org.apache.pluto.container.om.portlet.PortletInfo;
+import org.apache.pluto.container.om.portlet.Preference;
+import org.apache.pluto.container.om.portlet.Preferences;
+import org.apache.pluto.container.om.portlet.PublicRenderParameter;
+import org.apache.pluto.container.om.portlet.SecurityConstraint;
+import org.apache.pluto.container.om.portlet.SecurityRoleRef;
+import org.apache.pluto.container.om.portlet.Supports;
+import org.apache.pluto.container.om.portlet.UserDataConstraint;
+import org.apache.pluto.container.om.portlet30.impl.ContainerRuntimeOptionType;
+import org.apache.pluto.container.om.portlet30.impl.CustomPortletModeType;
+import org.apache.pluto.container.om.portlet30.impl.CustomWindowStateType;
+import org.apache.pluto.container.om.portlet30.impl.DescriptionType;
+import org.apache.pluto.container.om.portlet30.impl.DisplayNameType;
+import org.apache.pluto.container.om.portlet30.impl.EventDefinitionReferenceType;
+import org.apache.pluto.container.om.portlet30.impl.EventDefinitionType;
+import org.apache.pluto.container.om.portlet30.impl.FilterMappingType;
+import org.apache.pluto.container.om.portlet30.impl.FilterType;
+import org.apache.pluto.container.om.portlet30.impl.InitParamType;
+import org.apache.pluto.container.om.portlet30.impl.ListenerType;
+import org.apache.pluto.container.om.portlet30.impl.MimeTypeType;
+import org.apache.pluto.container.om.portlet30.impl.PortletAppType;
+import org.apache.pluto.container.om.portlet30.impl.PortletCollectionType;
+import org.apache.pluto.container.om.portlet30.impl.PortletInfoType;
+import org.apache.pluto.container.om.portlet30.impl.PortletModeType;
+import org.apache.pluto.container.om.portlet30.impl.PortletNameType;
+import org.apache.pluto.container.om.portlet30.impl.PortletPreferencesType;
+import org.apache.pluto.container.om.portlet30.impl.PortletType;
+import org.apache.pluto.container.om.portlet30.impl.PreferenceType;
+import org.apache.pluto.container.om.portlet30.impl.PublicRenderParameterType;
+import org.apache.pluto.container.om.portlet30.impl.SecurityConstraintType;
+import org.apache.pluto.container.om.portlet30.impl.SecurityRoleRefType;
+import org.apache.pluto.container.om.portlet30.impl.SupportedLocaleType;
+import org.apache.pluto.container.om.portlet30.impl.SupportsType;
+import org.apache.pluto.container.om.portlet30.impl.UserAttributeType;
+import org.apache.pluto.container.om.portlet30.impl.UserDataConstraintType;
+import org.apache.pluto.container.om.portlet30.impl.ValueType;
+import org.apache.pluto.container.om.portlet30.impl.WindowStateType;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Processes configuration for JSR 168 portlet app.
+ * 
+ * @author Scott Nicklous
+ * 
+ */
+public class JSR362ConfigurationProcessor extends ConfigurationProcessor {
+
+   /** Logger. */
+   private static final Logger          LOG     = LoggerFactory
+                                                      .getLogger(JSR362ConfigurationProcessor.class);
+   // private static final boolean isDebug = LOG.isDebugEnabled();
+   private static final boolean         isTrace = LOG.isTraceEnabled();
+
+   private PortletApplicationDefinition pad;
+
+   /*
+    * (non-Javadoc)
+    * 
+    * @see
+    * org.apache.pluto.container.om.portlet.impl.jsr168.ConfigurationProcessor
+    * #process(javax.xml.bind.JAXBElement)
+    */
+   @Override
+   public PortletApplicationDefinition process(JAXBElement<?> rootElement)
+         throws IllegalArgumentException {
+      pad = new PortletApplicationDefinitionImpl();
+
+      // make sure we were called properly
+      assert (rootElement != null);
+      assert (rootElement.getValue() instanceof PortletAppType);
+
+      PortletAppType app = (PortletAppType) rootElement.getValue();
+
+      // handle string values
+
+      pad.setId(app.getId());
+
+      if ((app.getVersion() == null) || !app.getVersion().equals("3.0")) {
+         String warning = "Bad version. Expected 3.0, was: " + app.getVersion();
+         LOG.warn(warning);
+         throw new IllegalArgumentException(warning);
+      }
+      pad.setVersion(app.getVersion());
+
+      if (isTrace) {
+         StringBuilder txt = new StringBuilder();
+         txt.append("Reading portlet DD. ");
+         txt.append("Version: ");
+         txt.append(app.getVersion());
+         txt.append(", ID: ");
+         txt.append(app.getId());
+         LOG.trace(txt.toString());
+      }
+
+      if (app.getDefaultNamespace() != null
+            && !app.getDefaultNamespace().equals("")) {
+         pad.setDefaultNamespace(app.getDefaultNamespace());
+      } else {
+         pad.setDefaultNamespace(XMLConstants.NULL_NS_URI);
+      }
+
+      if (app.getResourceBundle() != null
+            && app.getResourceBundle().getValue() != null
+            && !app.getResourceBundle().getValue().equals("")) {
+         pad.setResourceBundle(app.getResourceBundle().getValue());
+      }
+
+      for (EventDefinition ed : handleEventDefs(app.getEventDefinition())) {
+         pad.addEventDefinition(ed);
+      }
+
+      for (PublicRenderParameter prp : handlePRPs(app
+            .getPublicRenderParameter())) {
+         pad.addPublicRenderParameter(prp);
+      }
+      
+      for (ContainerRuntimeOption cro : handleRTOptions(app.getContainerRuntimeOption())) {
+         pad.addContainerRuntimeOption(cro);
+      }
+
+      handleCPM(app.getCustomPortletMode());
+      handleCWS(app.getCustomWindowState());
+      handleSC(app.getSecurityConstraint());
+      handleUA(app.getUserAttribute());
+      handleListeners(app.getListener());
+      handleFilters(app.getFilter());
+      handlePortlets(app.getPortlet());
+      handleFilterMappings(app.getFilterMapping());
+
+      return pad;
+   }
+
+   /**
+    * DisplayNames
+    */
+   private List<DisplayName> handleDisplayNames(List<DisplayNameType> dispNames) {
+      ArrayList<DisplayName> list = new ArrayList<DisplayName>();
+      for (DisplayNameType dispName : dispNames) {
+
+         if (dispName.getValue() == null) {
+            String warning = "Bad display name - no display name value; will be ignored. continuing ...";
+            LOG.warn(warning);
+            continue;
+         }
+
+         Locale loc = deriveLocale(dispName.getLang());
+
+         DisplayNameImpl d = new DisplayNameImpl(loc, dispName.getValue());
+         list.add(d);
+      }
+      return list;
+   }
+
+   /**
+    * Descriptions
+    */
+   private List<Description> handleDescriptions(List<DescriptionType> descs) {
+      ArrayList<Description> list = new ArrayList<Description>();
+      for (DescriptionType desc : descs) {
+
+         if (desc.getValue() == null) {
+            String warning = "Bad description - no description value; will be ignored. continuing ...";
+            LOG.warn(warning);
+            continue;
+         }
+
+         Locale loc = deriveLocale(desc.getLang());
+
+         DescriptionImpl d = new DescriptionImpl(loc, desc.getValue());
+         list.add(d);
+      }
+      return list;
+   }
+
+   /**
+    * User attributes
+    */
+   private void handleUA(List<UserAttributeType> uats) {
+      for (UserAttributeType uat : uats) {
+
+         // validate data
+         if ((uat.getName() == null) || (uat.getName().getValue() == null)) {
+            String warning = "Bad user attribute will be ignored. Name was null. Continuing ...";
+            LOG.warn(warning);
+            continue;
+         }
+
+         // set up the user attribute
+         UserAttributeImpl attr = new UserAttributeImpl(uat.getName()
+               .getValue());
+         for (Description desc : handleDescriptions(uat.getDescription())) {
+            attr.addDescription(desc);
+         }
+
+         // add it to the model
+         pad.addUserAttribute(attr);
+
+      }
+   }
+
+   /**
+    * Filters
+    */
+   private void handleFilters(List<FilterType> args) {
+      for (FilterType item : args) {
+
+         // validate data
+         if ((item.getFilterName() == null)
+               || (item.getFilterClass() == null)) {
+            String warning = "Bad Filter definition. name or class was null.";
+            LOG.warn(warning);
+            throw new IllegalArgumentException(warning);
+         }
+         String clsName = item.getFilterClass();
+         if (clsName != null && !clsName.equals("")) {
+            checkValidClass(clsName, PortletFilter.class,
+                  "Bad filter definition. Filter class is invalid: ");
+         }
+
+         // set up the custom portlet mode
+         Filter newitem = new FilterImpl(item.getFilterName());
+         newitem.setFilterClass(item.getFilterClass());
+         for (InitParam ip : handleInitParam(item.getInitParam())) {
+            newitem.addInitParam(ip);
+         }
+         for (String lc : item.getLifecycle()) {
+            newitem.addLifecycle(lc);
+         }
+         for (Description desc : handleDescriptions(item.getDescription())) {
+            newitem.addDescription(desc);
+         }
+         for (DisplayName dispName : handleDisplayNames(item.getDisplayName())) {
+            newitem.addDisplayName(dispName);
+         }
+
+         // add it to the model
+         pad.addFilter(newitem);
+
+      }
+   }
+
+   /**
+    * FilterMappings
+    */
+   private void handleFilterMappings(List<FilterMappingType> args) {
+      for (FilterMappingType item : args) {
+
+         // validate data
+         String fname = item.getFilterName();
+         if ((fname == null) || (item.getPortletName().size() == 0)) {
+            String warning = "Bad FilterMapping definition. Filter name or portlet name is null.";
+            LOG.warn(warning);
+            throw new IllegalArgumentException(warning);
+         }
+         if (pad.getFilter(fname) == null) {
+            String warning = "Bad FilterMapping definition. Filter definition not found: " + fname;
+            LOG.warn(warning);
+            throw new IllegalArgumentException(warning);
+         }
+         
+         // set up the filter mapping
+         FilterMapping newitem = new FilterMappingImpl(fname);
+         for (PortletNameType pnt : item.getPortletName()) {
+            String pname = pnt.getValue();
+            if (pad.getPortlet(pname) == null) {
+               String warning = "Bad FilterMapping definition. Portlet definition not found: " + pname;
+               LOG.warn(warning);
+               throw new IllegalArgumentException(warning);
+            }
+            newitem.addPortletName(pname);
+         }
+
+         // add it to the model
+         pad.addFilterMapping(newitem);
+
+      }
+   }
+
+   /**
+    * Listeners
+    */
+   private void handleListeners(List<ListenerType> args) {
+      for (ListenerType item : args) {
+
+         // validate data
+         if (item.getListenerClass() == null) {
+            String warning = "Bad Listener definition. Class was null.";
+            LOG.warn(warning);
+            throw new IllegalArgumentException(warning);
+         }
+         String clsName = item.getListenerClass();
+         if (clsName != null && !clsName.equals("")) {
+            checkValidClass(clsName, PortletURLGenerationListener.class,
+                  "Bad listener definition. Listener class is invalid: ");
+         }
+
+         // set up the custom portlet mode
+         Listener newitem = new ListenerImpl(item.getListenerClass());
+         for (Description desc : handleDescriptions(item.getDescription())) {
+            newitem.addDescription(desc);
+         }
+         for (DisplayName dispName : handleDisplayNames(item.getDisplayName())) {
+            newitem.addDisplayName(dispName);
+         }
+         
+         // add it to the model
+         pad.addListener(newitem);
+
+      }
+   }
+
+   /**
+    * Custom portlet modes
+    */
+   private void handleCPM(List<CustomPortletModeType> cpms) {
+      for (CustomPortletModeType cpm : cpms) {
+
+         // validate data
+         if ((cpm.getPortletMode() == null)
+               || (cpm.getPortletMode().getValue() == null)) {
+            String warning = "Bad custom portlet mode. Mode was null.";
+            LOG.warn(warning);
+            throw new IllegalArgumentException(warning);
+         } else {
+            String val = cpm.getPortletMode().getValue();
+            if (val.equalsIgnoreCase("view") || val.equalsIgnoreCase("edit")
+                  || val.equalsIgnoreCase("help")) {
+               String warning = "Bad custom portlet mode. Mode was: " + val;
+               LOG.warn(warning);
+               throw new IllegalArgumentException(warning);
+            }
+         }
+
+         // set up the custom portlet mode
+         CustomPortletMode pm = new CustomPortletModeImpl(cpm.getPortletMode()
+               .getValue());
+         for (Description desc : handleDescriptions(cpm.getDescription())) {
+            pm.addDescription(desc);
+         }
+         boolean isPortalManaged = true; // default is true
+         if (cpm.getPortalManaged() != null
+               && cpm.getPortalManaged().value() != null) {
+            isPortalManaged = cpm.getPortalManaged().value()
+                  .equalsIgnoreCase("true");
+         }
+         pm.setPortalManaged(isPortalManaged);
+
+         // add it to the model
+         pad.addCustomPortletMode(pm);
+
+      }
+   }
+
+   /**
+    * Custom window states
+    */
+   private void handleCWS(List<CustomWindowStateType> cwss) {
+      for (CustomWindowStateType cws : cwss) {
+
+         // validate data
+         if ((cws.getWindowState() == null)
+               || (cws.getWindowState().getValue() == null)) {
+            String warning = "Bad custom portlet mode. Mode was null.";
+            LOG.warn(warning);
+            throw new IllegalArgumentException(warning);
+         } else {
+            String val = cws.getWindowState().getValue();
+            if (val.equalsIgnoreCase("view") || val.equalsIgnoreCase("edit")
+                  || val.equalsIgnoreCase("help")) {
+               String warning = "Bad custom portlet mode. Mode was: " + val;
+               LOG.warn(warning);
+               throw new IllegalArgumentException(warning);
+            }
+         }
+
+         // set up the custom portlet mode
+         CustomWindowState ws = new CustomWindowStateImpl(cws.getWindowState()
+               .getValue());
+         for (Description desc : handleDescriptions(cws.getDescription())) {
+            ws.addDescription(desc);
+         }
+
+         // add it to the model
+         pad.addCustomWindowState(ws);
+
+      }
+
+   }
+
+   /**
+    * Security constraints
+    */
+   private void handleSC(List<SecurityConstraintType> scs) {
+      for (SecurityConstraintType sc : scs) {
+
+         // validate data
+         PortletCollectionType pct = sc.getPortletCollection();
+         if ((pct == null) || (pct.getPortletName() == null)
+               || (pct.getPortletName().size() == 0)) {
+            String warning = "Portlet collection is empty.";
+            LOG.warn(warning);
+            throw new IllegalArgumentException(warning);
+         } else {
+            for (PortletNameType pnt : pct.getPortletName()) {
+               if (!isValidIdentifier(pnt.getValue())) {
+                  String warning = "Bad portlet name: " + pnt.getValue();
+                  LOG.warn(warning);
+                  throw new IllegalArgumentException(warning);
+               }
+            }
+         }
+
+         UserDataConstraintType udc = sc.getUserDataConstraint();
+         if ((udc == null) || (udc.getTransportGuarantee() == null)
+               || (udc.getTransportGuarantee().value() == null)) {
+            String warning = "User data constraint contains null value.";
+            LOG.warn(warning);
+            throw new IllegalArgumentException(warning);
+         }
+
+         // set up the user data constraint
+         UserDataConstraint newudc = new UserDataConstraintImpl(udc
+               .getTransportGuarantee().value());
+         for (Description desc : handleDescriptions(udc.getDescription())) {
+            newudc.addDescription(desc);
+         }
+
+         // set up the security constraint
+         SecurityConstraint newsc = new SecurityConstraintImpl(newudc);
+         for (DisplayName dispName : handleDisplayNames(sc.getDisplayName())) {
+            newsc.addDisplayName(dispName);
+         }
+         for (PortletNameType portletName : pct.getPortletName()) {
+            newsc.addPortletName(portletName.getValue());
+         }
+
+         // add it to the model
+         pad.addSecurityConstraint(newsc);
+
+      }
+   }
+
+   private List<Supports> handleSupports(List<SupportsType> sts) {
+      ArrayList<Supports> newSupps = new ArrayList<Supports>();
+      for (SupportsType st : sts) {
+
+         // validate Mime type & portlet mode
+         MimeTypeType mtt = st.getMimeType();
+         if (mtt == null || mtt.getValue() == null) {
+            String warning = "Null Mime type, ignoring Supports block.";
+            LOG.warn(warning);
+            continue;
+         }
+         List<PortletModeType> pmlist = st.getPortletMode();
+         if (pmlist.size() == 0) {
+            String info = "No portlet modes found in Supports block.";
+            LOG.info(info);
+         }
+         List<WindowStateType> wslist = st.getWindowState();
+         if (wslist.size() == 0) {
+            String info = "No window states found in Supports block.";
+            LOG.info(info);
+         }
+
+         // set up Supports
+         Supports sup = new SupportsImpl(mtt.getValue());
+         for (PortletModeType item : pmlist) {
+            sup.addPortletMode(item.getValue());
+         }
+         for (WindowStateType item : wslist) {
+            sup.addWindowState(item.getValue());
+         }
+
+         // add to model
+         newSupps.add(sup);
+
+      }
+      return newSupps;
+   }
+
+   /**
+    * Init parameters
+    */
+   private List<InitParam> handleInitParam(List<InitParamType> parms) {
+      ArrayList<InitParam> newParms = new ArrayList<InitParam>();
+      for (InitParamType parm : parms) {
+
+         // validate data
+         if ((parm.getName() == null) || (parm.getName().getValue() == null)) {
+            String warning = "Bad init parameter. Parameter name was null.";
+            LOG.warn(warning);
+            throw new IllegalArgumentException(warning);
+         }
+
+         // set up the init parameter
+         String name = parm.getName().getValue();
+         String value = parm.getValue().getValue();
+         InitParam newp = new InitParamImpl(name, value);
+         for (Description desc : handleDescriptions(parm.getDescription())) {
+            newp.addDescription(desc);
+         }
+
+         newParms.add(newp);
+      }
+      return newParms;
+   }
+
+   /**
+    * Portlet preferences
+    */
+   private List<Preference> handlePreferences(List<PreferenceType> args) {
+      ArrayList<Preference> list = new ArrayList<Preference>();
+      for (PreferenceType item : args) {
+
+         // validate data
+         if ((item.getName() == null) || (item.getName().getValue() == null)) {
+            String warning = "Bad portlet preference. Ppreference name was null.";
+            LOG.warn(warning);
+            throw new IllegalArgumentException(warning);
+         }
+
+         // set up the preference
+         String name = item.getName().getValue();
+         List<ValueType> vals = item.getValue();
+         ArrayList<String> lines = new ArrayList<String>(16);
+         for (ValueType vt : vals) {
+            lines.add(vt.getValue());
+         }
+         boolean isRO = (item.getReadOnly().value().equalsIgnoreCase("true"));
+
+         Preference pref = new PreferenceImpl(name, isRO, lines);
+         list.add(pref);
+      }
+      return list;
+   }
+
+   private List<ContainerRuntimeOption> handleRTOptions(
+         List<ContainerRuntimeOptionType> args) {
+      ArrayList<ContainerRuntimeOption> list = new ArrayList<ContainerRuntimeOption>();
+      for (ContainerRuntimeOptionType arg : args) {
+
+         // validate data
+         if ((arg.getName() == null) || (arg.getName().getValue() == null)
+               || arg.getName().getValue().equals("")) {
+            String warning = "Bad container runtime option. Name was null.";
+            LOG.warn(warning);
+            throw new IllegalArgumentException(warning);
+         }
+
+         // set up the runtime option
+         String name = arg.getName().getValue();
+         List<ValueType> vals = arg.getValue();
+         ArrayList<String> lines = new ArrayList<String>(16);
+         for (ValueType vt : vals) {
+            lines.add(vt.getValue());
+         }
+
+         ContainerRuntimeOption item = new ContainerRuntimeOptionImpl(name,
+               lines);
+         list.add(item);
+
+      }
+      return list;
+   }
+
+   /**
+    * Security role references
+    */
+   private List<SecurityRoleRef> handleSecRoleRef(List<SecurityRoleRefType> args) {
+      ArrayList<SecurityRoleRef> list = new ArrayList<SecurityRoleRef>();
+      for (SecurityRoleRefType item : args) {
+
+         // validate data
+         if ((item.getRoleName() == null) || (item.getRoleLink() == null)
+               || (item.getRoleLink().getValue() == null)) {
+            String warning = "Bad security role reference. Name or link was null.";
+            LOG.warn(warning);
+            throw new IllegalArgumentException(warning);
+         }
+
+         // set up the role ref
+         String name = item.getRoleName();
+         String link = item.getRoleLink().getValue();
+         SecurityRoleRef srr = new SecurityRoleRefImpl(name);
+         srr.setRoleLink(link);
+         for (Description desc : handleDescriptions(item.getDescription())) {
+            srr.addDescription(desc);
+         }
+
+         list.add(srr);
+      }
+      return list;
+   }
+
+   /**
+    * Event definition references - supported publishing events & supported
+    * processing events
+    */
+   private List<EventDefinitionReference> handleEventDefRefs(
+         List<EventDefinitionReferenceType> args) {
+      ArrayList<EventDefinitionReference> list = new ArrayList<EventDefinitionReference>();
+      for (EventDefinitionReferenceType item : args) {
+
+         // validate data
+         if ((item.getName() == null) && (item.getQname() == null)) {
+            String warning = "Bad Even definition reference. Name and QName are null.";
+            LOG.warn(warning);
+            throw new IllegalArgumentException(warning);
+         }
+
+         // prepare the qname
+         String name = item.getName();
+         QName qname = item.getQname();
+         if (qname == null) {
+            qname = new QName(pad.getDefaultNamespace(), name);
+         }
+
+         if (pad.getEventDefinition(qname) == null) {
+            String warning = "Bad Event definition reference. No event definition found for qname: "
+                  + qname;
+            LOG.warn(warning);
+            throw new IllegalArgumentException(warning);
+         }
+
+         // set up the event def ref
+         EventDefinitionReference newedr = new EventDefinitionReferenceImpl(
+               qname);
+
+         list.add(newedr);
+      }
+      return list;
+   }
+
+   /**
+    * Event definitions
+    */
+   private List<EventDefinition> handleEventDefs(List<EventDefinitionType> args) {
+      ArrayList<EventDefinition> list = new ArrayList<EventDefinition>();
+      for (EventDefinitionType item : args) {
+
+         // validate data
+         if ((item.getName() == null) && (item.getQname() == null)) {
+            String warning = "Bad Event definition. Name and QName are null.";
+            LOG.warn(warning);
+            throw new IllegalArgumentException(warning);
+         }
+         String clsName = item.getValueType();
+         if (clsName != null && !clsName.equals("")) {
+            checkValidClass(clsName, null,
+                  "Bad Event definition. Payload type is invalid: ");
+         }
+
+         // prepare the qname
+         String name = item.getName();
+         QName qname = item.getQname();
+         if (qname == null) {
+            qname = new QName(pad.getDefaultNamespace(), name);
+         }
+
+         // set up the event definition
+         EventDefinition newed = new EventDefinitionImpl(qname);
+         if (clsName != null && clsName.length() > 0) {
+            newed.setValueType(clsName);
+         }
+         for (Description desc : handleDescriptions(item.getDescription())) {
+            newed.addDescription(desc);
+         }
+         for (QName qn : item.getAlias()) {
+            newed.addAlias(qn);
+         }
+
+         list.add(newed);
+      }
+      return list;
+   }
+
+   private List<PublicRenderParameter> handlePRPs(
+         List<PublicRenderParameterType> args) {
+      ArrayList<PublicRenderParameter> list = new ArrayList<PublicRenderParameter>();
+      for (PublicRenderParameterType item : args) {
+
+         // validate data
+         if ((item.getName() == null) && (item.getQname() == null)) {
+            String warning = "Bad public render parameter definition. Name and QName are null.";
+            LOG.warn(warning);
+            throw new IllegalArgumentException(warning);
+         }
+         String id = item.getIdentifier();
+         if ((id == null) || (id.length() == 0)) {
+            String warning = "Bad public render parameter definition. Identifier is null.";
+            LOG.warn(warning);
+            throw new IllegalArgumentException(warning);
+         }
+
+         // prepare the qname
+         String name = item.getName();
+         QName qname = item.getQname();
+         if (qname == null) {
+            qname = new QName(pad.getDefaultNamespace(), name);
+         }
+
+         // set up the prp definition
+         PublicRenderParameter newprp = new PublicRenderParameterImpl(qname, id);
+         for (Description desc : handleDescriptions(item.getDescription())) {
+            newprp.addDescription(desc);
+         }
+         for (QName qn : item.getAlias()) {
+            newprp.addAlias(qn);
+         }
+
+         list.add(newprp);
+      }
+      return list;
+
+   }
+
+   /**
+    * Handle Portlets
+    */
+   private void handlePortlets(List<PortletType> portlets) {
+      for (PortletType portlet : portlets) {
+
+         // validate portlet name & class
+         String warning;
+         String pn = portlet.getPortletName().getValue();
+         if (!isValidIdentifier(pn)) {
+            warning = "Bad portlet name: " + pn;
+            LOG.warn(warning);
+            throw new IllegalArgumentException(warning);
+         }
+
+         String clsName = portlet.getPortletClass();
+         checkValidClass(clsName, Portlet.class, "Bad portlet class: ");
+
+         // set up portlet definition
+
+         PortletDefinition pd = new PortletDefinitionImpl(pn, pad);
+         pd.setPortletClass(portlet.getPortletClass());
+
+         if (portlet.getResourceBundle() != null) {
+            pd.setResourceBundle(portlet.getResourceBundle().getValue());
+         }
+
+         if (portlet.getExpirationCache() != null) {
+            pd.setExpirationCache(portlet.getExpirationCache().getValue());
+         }
+
+         if (portlet.getCacheScope() != null) {
+            pd.setCacheScope(portlet.getCacheScope().getValue());
+         }
+
+         for (DisplayName dispName : handleDisplayNames(portlet
+               .getDisplayName())) {
+            pd.addDisplayName(dispName);
+         }
+
+         for (Description desc : handleDescriptions(portlet.getDescription())) {
+            pd.addDescription(desc);
+         }
+
+         for (Supports s : handleSupports(portlet.getSupports())) {
+            pd.addSupports(s);
+         }
+
+         PortletInfoType pit = portlet.getPortletInfo();
+         if (pit != null) {
+            if (pit.getTitle().getValue() == null) {
+               warning = "Portlet info section does not contain title. Ingoring ...";
+               LOG.warn(warning);
+            } else {
+               String title, st = null, kw = null;
+               title = pit.getTitle().getValue();
+               if (pit.getShortTitle() != null) {
+                  st = pit.getShortTitle().getValue();
+               }
+               if (pit.getKeywords() != null) {
+                  kw = pit.getKeywords().getValue();
+               }
+               PortletInfo info = new PortletInfoImpl(title, kw, st);
+               pd.setPortletInfo(info);
+            }
+         }
+
+         for (SupportedLocaleType slt : portlet.getSupportedLocale()) {
+            pd.addSupportedLocale(slt.getValue());
+         }
+
+         for (InitParam ip : handleInitParam(portlet.getInitParam())) {
+            pd.addInitParam(ip);
+         }
+
+         PortletPreferencesType prefs = portlet.getPortletPreferences();
+         if (prefs != null) {
+            Preferences newprefs = new PreferencesImpl();
+
+            clsName = prefs.getPreferencesValidator();
+            checkValidClass(clsName, PreferencesValidator.class,
+                  "Bad portlet preferences validator class: ");
+
+            newprefs.setPreferencesValidator(clsName);
+            for (Preference p : handlePreferences(prefs.getPreference())) {
+               newprefs.addPreference(p);
+            }
+            pd.setPortletPreferences(newprefs);
+         }
+
+         for (SecurityRoleRef srr : handleSecRoleRef(portlet
+               .getSecurityRoleRef())) {
+            pd.addSecurityRoleRef(srr);
+         }
+
+         for (ContainerRuntimeOption cro : handleRTOptions(portlet
+               .getContainerRuntimeOption())) {
+            pd.addContainerRuntimeOption(cro);
+         }
+
+         for (String prp : portlet.getSupportedPublicRenderParameter()) {
+            boolean ok = false;
+            for (PublicRenderParameter prpdef : pad.getPublicRenderParameters()) {
+               if (prpdef.getIdentifier().equals(prp)) {
+                  ok = true;
+               }
+            }
+            if (!ok) {
+               warning = "Public render parameter definition not found for: " + prp;
+               LOG.warn(warning);
+               throw new IllegalArgumentException(warning);
+            }
+            pd.addSupportedPublicRenderParameter(prp);
+         }
+
+         // Supported processing events
+         for (EventDefinitionReference edr : handleEventDefRefs(portlet
+               .getSupportedProcessingEvent())) {
+            pd.addSupportedProcessingEvent(edr);
+         }
+
+         // Supported publishing events
+         for (EventDefinitionReference edr : handleEventDefRefs(portlet
+               .getSupportedPublishingEvent())) {
+            pd.addSupportedPublishingEvent(edr);
+         }
+
+         pad.addPortlet(pd);
+
+      }
+   }
+
+}

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/bf15b331/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/ListenerImpl.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/ListenerImpl.java b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/ListenerImpl.java
new file mode 100644
index 0000000..499979f
--- /dev/null
+++ b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/ListenerImpl.java
@@ -0,0 +1,141 @@
+/*  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+
+package org.apache.pluto.container.om.portlet.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Locale;
+
+import org.apache.pluto.container.om.portlet.Description;
+import org.apache.pluto.container.om.portlet.DisplayName;
+import org.apache.pluto.container.om.portlet.Listener;
+
+/**
+ * A single event declaration
+ * 
+ * @author Scott Nicklous
+ */
+public class ListenerImpl implements Listener {
+   
+   private final List<Description> descs = new ArrayList<Description>();
+   private final List<DisplayName> dispNames = new ArrayList<DisplayName>();
+   private String listenerClass = "";
+
+   
+   /**
+    * Copy constructor
+    * 
+    * @param lis
+    */
+   public ListenerImpl(Listener lis) {
+      for (Description desc : lis.getDescriptions()) {
+         descs.add(new DescriptionImpl(desc));
+      }
+      for (DisplayName disp : lis.getDisplayNames()) {
+         dispNames.add(new DisplayNameImpl(disp));
+      }
+      listenerClass = lis.getListenerClass();
+   }
+   
+   /**
+    * Constructor
+    * @param fn   Listener name
+    */
+   public ListenerImpl(String cls) {
+      this.listenerClass = cls;
+   }
+
+   /* (non-Javadoc)
+    * @see org.apache.pluto.container.om.portlet.Listener#getDescription(java.util.Locale)
+    */
+   @Override
+   public Description getDescription(Locale locale) {
+      Description ret = null;
+      for (Description item : descs) {
+         if (item.getLocale().equals(locale)) {
+            ret = new DescriptionImpl(item);
+         }
+      }
+      return ret;
+   }
+
+   /* (non-Javadoc)
+    * @see org.apache.pluto.container.om.portlet.Listener#getDescriptions()
+    */
+   @Override
+   public List<Description> getDescriptions() {
+      return new ArrayList<Description>(descs);
+   }
+
+   /* (non-Javadoc)
+    * @see org.apache.pluto.container.om.portlet.Listener#addDescription(org.apache.pluto.container.om.portlet.Description)
+    */
+   @Override
+   public void addDescription(Description desc) {
+      descs.add(desc);
+   }
+
+   /* (non-Javadoc)
+    * @see org.apache.pluto.container.om.portlet.Listener#getDisplayName(java.util.Locale)
+    */
+   @Override
+   public DisplayName getDisplayName(Locale locale) {
+      DisplayName ret = null;
+      for (DisplayName item : dispNames) {
+         if (item.getLocale().equals(locale)) {
+            ret = new DisplayNameImpl(item);
+         }
+      }
+      return ret;
+   }
+
+   /* (non-Javadoc)
+    * @see org.apache.pluto.container.om.portlet.Listener#getDisplayNames()
+    */
+   @Override
+   public List<DisplayName> getDisplayNames() {
+      return new ArrayList<DisplayName>(dispNames);
+   }
+
+   /* (non-Javadoc)
+    * @see org.apache.pluto.container.om.portlet.Listener#addDisplayName(org.apache.pluto.container.om.portlet.DisplayName)
+    */
+   @Override
+   public void addDisplayName(DisplayName desc) {
+      dispNames.add(desc);
+   }
+
+   /* (non-Javadoc)
+    * @see org.apache.pluto.container.om.portlet.Listener#getListenerClass()
+    */
+   @Override
+   public String getListenerClass() {
+      return listenerClass;
+   }
+
+   /* (non-Javadoc)
+    * @see org.apache.pluto.container.om.portlet.Listener#setListenerClass(java.lang.String)
+    */
+   @Override
+   public void setListenerClass(String filterClass) {
+      listenerClass = filterClass;
+   }
+
+}

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/bf15b331/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/PortletApplicationDefinitionImpl.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/PortletApplicationDefinitionImpl.java b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/PortletApplicationDefinitionImpl.java
new file mode 100644
index 0000000..0adaf53
--- /dev/null
+++ b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/PortletApplicationDefinitionImpl.java
@@ -0,0 +1,489 @@
+/*  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+
+package org.apache.pluto.container.om.portlet.impl;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+import org.apache.pluto.container.om.portlet.ContainerRuntimeOption;
+import org.apache.pluto.container.om.portlet.CustomPortletMode;
+import org.apache.pluto.container.om.portlet.CustomWindowState;
+import org.apache.pluto.container.om.portlet.EventDefinition;
+import org.apache.pluto.container.om.portlet.Filter;
+import org.apache.pluto.container.om.portlet.FilterMapping;
+import org.apache.pluto.container.om.portlet.Listener;
+import org.apache.pluto.container.om.portlet.PortletApplicationDefinition;
+import org.apache.pluto.container.om.portlet.PortletDefinition;
+import org.apache.pluto.container.om.portlet.PublicRenderParameter;
+import org.apache.pluto.container.om.portlet.SecurityConstraint;
+import org.apache.pluto.container.om.portlet.UserAttribute;
+
+/**
+ * Portlet application definition
+ * 
+ * @author Scott Nicklous
+ */
+public class PortletApplicationDefinitionImpl implements
+      PortletApplicationDefinition {
+
+   private String id;
+   private String name;
+   private String contextPath;
+   private String version;
+   private String resourceBundle;
+   private String defaultNamespace;
+   
+   private final List<PublicRenderParameter> prps = new ArrayList<PublicRenderParameter>();
+   private final List<PortletDefinition> portlets = new ArrayList<PortletDefinition>();
+   private final List<EventDefinition> events =     new ArrayList<EventDefinition>();
+   private final List<CustomPortletMode> cpms =     new ArrayList<CustomPortletMode>();
+   private final List<CustomWindowState> cwss =     new ArrayList<CustomWindowState>();
+   private final List<UserAttribute> uattrs =       new ArrayList<UserAttribute>();
+   private final List<Filter> filters =             new ArrayList<Filter>();
+   private final List<FilterMapping> fmaps =        new ArrayList<FilterMapping>();
+   private final List<ContainerRuntimeOption> cros = new ArrayList<ContainerRuntimeOption>();
+   
+   // for the locale - encoding mappings from the web.xml
+   private final Map<Locale, String> localemap = new HashMap<Locale, String>();
+   
+   private final ArrayList<Listener> listeners = new ArrayList<Listener>();
+   private final ArrayList<SecurityConstraint> constraints = new ArrayList<SecurityConstraint>();
+
+   /**
+    * Default constructor
+    */
+   public PortletApplicationDefinitionImpl() {
+   }
+
+   /**
+    * Copy constructor. This class is written such that the accessors copy the 
+    * objects being returned, so the return values can be directly used in the
+    * copy constructor.
+    * 
+    * @param pad     The portlet application definition
+    */
+   public PortletApplicationDefinitionImpl(PortletApplicationDefinition pad) {
+      this.contextPath = pad.getContextPath();
+      this.id = pad.getId();
+      this.name = pad.getName();
+      this.version = pad.getVersion();
+      this.resourceBundle = pad.getResourceBundle();
+      this.defaultNamespace = pad.getDefaultNamespace();
+
+      for (PortletDefinition pd : pad.getPortlets()) {
+         portlets.add(pd);
+      }
+      for (EventDefinition item : pad.getEventDefinitions()) {
+         events.add(item);
+      }
+      for (PublicRenderParameter prp : pad.getPublicRenderParameters()) {
+         prps.add(prp);
+      }
+      for (CustomPortletMode cpm : pad.getCustomPortletModes()) {
+         cpms.add(cpm);
+      }
+      for (CustomWindowState item : pad.getCustomWindowStates()) {
+         cwss.add(item);
+      }
+      for (UserAttribute ua : pad.getUserAttributes()) {
+         uattrs.add(ua);
+      }
+      for (Filter f : pad.getFilters()) {
+         filters.add(f);
+      }
+      for (FilterMapping fm : pad.getFilterMappings()) {
+         fmaps.add(fm);
+      }
+      for (ContainerRuntimeOption cro : pad.getContainerRuntimeOptions()) {
+         cros.add(cro);
+      }
+      
+      localemap.putAll(pad.getLocaleEncodingMappings());
+      
+      if (pad.getListeners() != null) {
+         for (Listener l : pad.getListeners()) {
+            listeners.add(new ListenerImpl(l));
+         }
+      }
+      constraints.addAll(pad.getSecurityConstraints());
+      
+   }
+   
+   public String getId() {
+      return id;
+   }
+
+   public void setId(String id) {
+      this.id = id;
+   }
+   
+   /* (non-Javadoc)
+    * @see org.apache.pluto.container.om.portlet.PortletApplicationDefinition#getName()
+    */
+   @Override
+   public String getName() {
+      return name;
+   }
+
+   /* (non-Javadoc)
+    * @see org.apache.pluto.container.om.portlet.PortletApplicationDefinition#setName(java.lang.String)
+    */
+   @Override
+   public void setName(String name) {
+      this.name = name;
+   }
+
+   /* (non-Javadoc)
+    * @see org.apache.pluto.container.om.portlet.PortletApplicationDefinition#getContextPath()
+    */
+   @Override
+   public String getContextPath() {
+      return contextPath;
+   }
+
+   /* (non-Javadoc)
+    * @see org.apache.pluto.container.om.portlet.PortletApplicationDefinition#setContextPath(java.lang.String)
+    */
+   @Override
+   public void setContextPath(String contextPath) {
+      this.contextPath = contextPath;
+   }
+
+   /* (non-Javadoc)
+    * @see org.apache.pluto.container.om.portlet.PortletApplicationDefinition#getVersion()
+    */
+   @Override
+   public String getVersion() {
+      return version;
+   }
+
+   /* (non-Javadoc)
+    * @see org.apache.pluto.container.om.portlet.PortletApplicationDefinition#setVersion(java.lang.String)
+    */
+   @Override
+   public void setVersion(String version) {
+      this.version = version;
+   }
+
+   /* (non-Javadoc)
+    * @see org.apache.pluto.container.om.portlet.PortletApplicationDefinition#getResourceBundle()
+    */
+   @Override
+   public String getResourceBundle() {
+      return resourceBundle;
+   }
+
+   /* (non-Javadoc)
+    * @see org.apache.pluto.container.om.portlet.PortletApplicationDefinition#setResourceBundle(java.lang.String)
+    */
+   @Override
+   public void setResourceBundle(String resourceBundle) {
+      this.resourceBundle = resourceBundle;
+   }
+
+   /* (non-Javadoc)
+    * @see org.apache.pluto.container.om.portlet.PortletApplicationDefinition#getDefaultNamespace()
+    */
+   @Override
+   public String getDefaultNamespace() {
+      return defaultNamespace;
+   }
+
+   /* (non-Javadoc)
+    * @see org.apache.pluto.container.om.portlet.PortletApplicationDefinition#setDefaultNamespace(java.lang.String)
+    */
+   @Override
+   public void setDefaultNamespace(String defaultNamespace) {
+      this.defaultNamespace = defaultNamespace;
+   }
+
+   @Override
+   public PortletDefinition getPortlet(String portletName) {
+      PortletDefinition pd = null;
+      for (PortletDefinition item : portlets) {
+         if (item.getPortletName().equals(portletName)) {
+            pd = new PortletDefinitionImpl(item);
+         }
+      }
+      return pd;
+   }
+
+   @Override
+   public List<PortletDefinition> getPortlets() {
+      ArrayList<PortletDefinition> ret = new ArrayList<PortletDefinition>();
+      for (PortletDefinition pd : portlets) {
+         ret.add(new PortletDefinitionImpl(pd));
+      }
+      return ret;
+   }
+
+   @Override
+   public void addPortlet(PortletDefinition pd) {
+      portlets.add( pd);
+   }
+
+   @Override
+   public List<EventDefinition> getEventDefinitions() {
+      ArrayList<EventDefinition> items = new ArrayList<EventDefinition>();
+      for (EventDefinition item : events) {
+         items.add(new EventDefinitionImpl(item));
+      }
+      return items;
+   }
+
+   @Override
+   public EventDefinition getEventDefinition(QName qn) {
+      EventDefinition ret = null;
+      for (EventDefinition item : events) {
+         if (item.getQName().equals(qn)) {
+            ret = new EventDefinitionImpl(item);
+         }
+      }
+      return ret;
+   }
+
+   @Override
+   public void addEventDefinition(EventDefinition ed) {
+      events.add(ed);
+   }
+
+   @Override
+   public PublicRenderParameter getPublicRenderParameter(String identifier) {
+      PublicRenderParameter ret = null;
+      for (PublicRenderParameter prp : prps) {
+         if (prp.getIdentifier().equals(identifier)) {
+            ret = new PublicRenderParameterImpl(prp);
+         }
+      }
+      return ret;
+   }
+
+   @Override
+   public List<PublicRenderParameter> getPublicRenderParameters() {
+      ArrayList<PublicRenderParameter> items = new ArrayList<PublicRenderParameter>();
+      for (PublicRenderParameter item : prps) {
+         items.add(new PublicRenderParameterImpl(item));
+      }
+      return items;
+   }
+
+   @Override
+   public void addPublicRenderParameter(PublicRenderParameter prp) {
+      prps.add(prp);
+   }
+
+   @Override
+   public CustomPortletMode getCustomPortletMode(String arg) {
+      CustomPortletMode ret = null;
+      for (CustomPortletMode item : cpms) {
+         if (item.getPortletMode().equals(arg)) {
+            ret = new CustomPortletModeImpl(item);
+         }
+      }
+      return ret;
+   }
+
+   @Override
+   public List<CustomPortletMode> getCustomPortletModes() {
+      ArrayList<CustomPortletMode> items = new ArrayList<CustomPortletMode>();
+      for (CustomPortletMode item : cpms) {
+         items.add(new CustomPortletModeImpl(item));
+      }
+      return items;
+   }
+
+   @Override
+   public void addCustomPortletMode(CustomPortletMode cpm) {
+      cpms.add(cpm);
+   }
+
+   @Override
+   public CustomWindowState getCustomWindowState(String arg) {
+      CustomWindowState ret = null;
+      for (CustomWindowState item : cwss) {
+         if (item.getWindowState().equals(arg)) {
+            ret = new CustomWindowStateImpl(item);
+         }
+      }
+      return ret;
+   }
+
+   @Override
+   public List<CustomWindowState> getCustomWindowStates() {
+      ArrayList<CustomWindowState> items = new ArrayList<CustomWindowState>();
+      for (CustomWindowState item : cwss) {
+         items.add(new CustomWindowStateImpl(item));
+      }
+      return items;
+   }
+
+   @Override
+   public void addCustomWindowState(CustomWindowState cws) {
+      cwss.add(cws);
+   }
+
+   @Override
+   public UserAttribute getUserAttribute(String arg) {
+      UserAttribute ret = null;
+      for (UserAttribute item : uattrs) {
+         if (item.getName().equals(arg)) {
+            ret = new UserAttributeImpl(item);
+         }
+      }
+      return ret;
+   }
+
+   @Override
+   public List<UserAttribute> getUserAttributes() {
+      ArrayList<UserAttribute> items = new ArrayList<UserAttribute>();
+      for (UserAttribute item : uattrs) {
+         items.add(new UserAttributeImpl(item));
+      }
+      return items;
+   }
+
+   @Override
+   public void addUserAttribute(UserAttribute ua) {
+      uattrs.add(ua);
+   }
+
+   @Override
+   public Filter getFilter(String arg) {
+      Filter ret = null;
+      for (Filter item : filters) {
+         if (item.getFilterName().equals(arg)) {
+            ret = new FilterImpl(item);
+         }
+      }
+      return ret;
+   }
+
+   @Override
+   public List<Filter> getFilters() {
+      ArrayList<Filter> items = new ArrayList<Filter>();
+      for (Filter item : filters) {
+         items.add(new FilterImpl(item));
+      }
+      return items;
+   }
+
+   @Override
+   public void addFilter(Filter filter) {
+      filters.add(filter);
+   }
+
+   @Override
+   public FilterMapping getFilterMapping(String arg) {
+      FilterMapping ret = null;
+      for (FilterMapping item : fmaps) {
+         if (item.getFilterName().equals(arg)) {
+            ret = new FilterMappingImpl(item);
+         }
+      }
+      return ret;
+   }
+
+   @Override
+   public List<FilterMapping> getFilterMappings() {
+      ArrayList<FilterMapping> items = new ArrayList<FilterMapping>();
+      for (FilterMapping item : fmaps) {
+         items.add(new FilterMappingImpl(item));
+      }
+      return items;
+   }
+
+   @Override
+   public void addFilterMapping(FilterMapping fm) {
+      fmaps.add(fm);
+   }
+
+   @Override
+   public ContainerRuntimeOption getContainerRuntimeOption(String arg) {
+      ContainerRuntimeOption ret = null;
+      for (ContainerRuntimeOption item : cros) {
+         if (item.getName().equals(arg)) {
+            ret = new ContainerRuntimeOptionImpl(item);
+         }
+      }
+      return ret;
+   }
+
+   @Override
+   public List<ContainerRuntimeOption> getContainerRuntimeOptions() {
+      ArrayList<ContainerRuntimeOption> items = new ArrayList<ContainerRuntimeOption>();
+      for (ContainerRuntimeOption item : cros) {
+         items.add(new ContainerRuntimeOptionImpl(item));
+      }
+      return items;
+   }
+
+   @Override
+   public void addContainerRuntimeOption(ContainerRuntimeOption cro) {
+      cros.add(cro);
+   }
+
+   @Override
+   public List<Listener> getListeners() {
+      ArrayList<Listener> list = new ArrayList<Listener>();
+      for (Listener l : listeners) {
+         list.add(new ListenerImpl(l));
+      }
+      return list;
+   }
+
+   @Override
+   public void addListener(Listener listener) {
+      listeners.add(listener);
+   }
+
+   @Override
+   public List<SecurityConstraint> getSecurityConstraints() {
+      ArrayList<SecurityConstraint> scs = new ArrayList<SecurityConstraint>();
+      for (SecurityConstraint sc : constraints) {
+         scs.add(new SecurityConstraintImpl(sc));
+      }
+      return scs;
+   }
+
+   @Override
+   public void addSecurityConstraint(SecurityConstraint sc) {
+      constraints.add(sc);
+   }
+
+   @Override
+   public Map<Locale, String> getLocaleEncodingMappings() {
+      Map<Locale, String> lem = new HashMap<Locale, String>();
+      for (Locale l : localemap.keySet()) {
+         lem.put((Locale) l.clone(), localemap.get(l));
+      }
+      return lem;
+   }
+
+   @Override
+   public void addLocaleEncodingMapping(Locale locale, String encoding) {
+      localemap.put(locale, encoding);
+   }
+
+}

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/bf15b331/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/PortletDefinitionImpl.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/PortletDefinitionImpl.java b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/PortletDefinitionImpl.java
new file mode 100644
index 0000000..16b1c03
--- /dev/null
+++ b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/PortletDefinitionImpl.java
@@ -0,0 +1,488 @@
+/*  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+
+package org.apache.pluto.container.om.portlet.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Locale;
+
+import org.apache.pluto.container.om.portlet.ContainerRuntimeOption;
+import org.apache.pluto.container.om.portlet.Description;
+import org.apache.pluto.container.om.portlet.DisplayName;
+import org.apache.pluto.container.om.portlet.EventDefinitionReference;
+import org.apache.pluto.container.om.portlet.InitParam;
+import org.apache.pluto.container.om.portlet.PortletApplicationDefinition;
+import org.apache.pluto.container.om.portlet.PortletDefinition;
+import org.apache.pluto.container.om.portlet.PortletInfo;
+import org.apache.pluto.container.om.portlet.Preferences;
+import org.apache.pluto.container.om.portlet.SecurityRoleRef;
+import org.apache.pluto.container.om.portlet.Supports;
+
+/**
+ * @author Scott Nicklous
+ *
+ */
+public class PortletDefinitionImpl implements PortletDefinition {
+   
+   private PortletApplicationDefinition pad;
+   
+   private String portletName;
+   private String portletClass;
+   private String resourceBundle;
+   private String cacheScope;
+   
+   private int expirationCache;
+   
+   private PortletInfo info;
+   private Preferences prefs;
+   
+   private final List<String> supportedLocales = new ArrayList<String>();
+   private final List<String> pubParms = new ArrayList<String>();
+   
+   private final List<Description> descs = new ArrayList<Description>();
+   private final List<DisplayName> dispNames = new ArrayList<DisplayName>();
+
+   private final List<EventDefinitionReference> proEvtRefs = new ArrayList<EventDefinitionReference>();
+   private final List<EventDefinitionReference> pubEvtRefs =  new ArrayList<EventDefinitionReference>();
+
+   private final List<ContainerRuntimeOption> crtOptions = new ArrayList<ContainerRuntimeOption>();
+   
+   private final List<InitParam> iparms = new ArrayList<InitParam>(); 
+   private final List<SecurityRoleRef> secRefs = new ArrayList<SecurityRoleRef>(); 
+   private final List<Supports> supps = new ArrayList<Supports>(); 
+
+   /**
+    * Copy constructor
+    * @param pd   The portlet definition
+    */
+   public PortletDefinitionImpl(PortletDefinition pd) {
+      this.pad = pd.getApplication();        // intentionally not copied
+      this.portletName = pd.getPortletName();
+      this.portletClass = pd.getPortletClass();
+      this.resourceBundle = pd.getResourceBundle();
+      this.cacheScope = pd.getCacheScope();
+      this.expirationCache = pd.getExpirationCache();
+      
+      PortletInfo pi = pd.getPortletInfo();
+      this.info = (pi == null) ? null : new PortletInfoImpl(pi);
+      
+      Preferences prefs = pd.getPortletPreferences();
+      this.prefs = (prefs == null) ? null : new PreferencesImpl(prefs);
+      
+      this.supportedLocales.addAll(pd.getSupportedLocales());
+      this.pubParms.addAll(pd.getSupportedPublicRenderParameters());
+      
+      for (Description d : pd.getDescriptions()) {
+         this.descs.add(new DescriptionImpl(d));
+      }
+      for (DisplayName dn : pd.getDisplayNames()) {
+         this.dispNames.add(new DisplayNameImpl(dn));
+      }
+      for (EventDefinitionReference edr : pd.getSupportedProcessingEvents()) {
+         this.proEvtRefs.add(
+               new EventDefinitionReferenceImpl(edr));
+      }
+      for (EventDefinitionReference edr : pd.getSupportedPublishingEvents()) {
+         this.pubEvtRefs.add(
+               new EventDefinitionReferenceImpl(edr));
+      }
+      for (ContainerRuntimeOption crt : pd.getContainerRuntimeOptions()) {
+         this.crtOptions.add(new ContainerRuntimeOptionImpl(crt));
+      }
+      for (InitParam ip : pd.getInitParams()) {
+         this.iparms.add(new InitParamImpl(ip));
+      }
+      for (SecurityRoleRef srr : pd.getSecurityRoleRefs()) {
+         this.secRefs.add(new SecurityRoleRefImpl(srr));
+      }
+      for (Supports s : pd.getSupports()) {
+         this.supps.add(new SupportsImpl(s));
+      }
+   }
+   
+   /**
+    * Constructor
+    * @param pn      portlet name
+    * @param pad     portlet application
+    */
+   public PortletDefinitionImpl(String pn, PortletApplicationDefinition pad) {
+      this.portletName = pn;
+      this.pad = pad;
+   }
+
+   /* (non-Javadoc)
+    * @see org.apache.pluto.container.om.portlet.PortletDefinition#getPortletName()
+    */
+   @Override
+   public String getPortletName() {
+      return portletName;
+   }
+
+   /* (non-Javadoc)
+    * @see org.apache.pluto.container.om.portlet.PortletDefinition#getApplication()
+    */
+   @Override
+   public PortletApplicationDefinition getApplication() {
+      return pad;
+   }
+
+   /* (non-Javadoc)
+    * @see org.apache.pluto.container.om.portlet.PortletDefinition#getInitParam(java.lang.String)
+    */
+   @Override
+   public InitParam getInitParam(String paramName) {
+      InitParam ret = null;
+      for (InitParam item : iparms) {
+         if (item.getParamName().equals(paramName)) {
+            ret = new InitParamImpl(item);
+         }
+      }
+      return ret;
+   }
+
+   /* (non-Javadoc)
+    * @see org.apache.pluto.container.om.portlet.PortletDefinition#getInitParams()
+    */
+   @Override
+   public List<InitParam> getInitParams() {
+      ArrayList<InitParam> ips = new ArrayList<InitParam>();
+      for (InitParam ip : iparms) {
+         ips.add(new InitParamImpl(ip));
+      }
+      return ips;
+   }
+
+   /* (non-Javadoc)
+    * @see org.apache.pluto.container.om.portlet.PortletDefinition#addInitParam(java.lang.String)
+    */
+   @Override
+   public void addInitParam(InitParam ip) {
+      iparms.add(ip);
+   }
+
+   /* (non-Javadoc)
+    * @see org.apache.pluto.container.om.portlet.PortletDefinition#getPortletClass()
+    */
+   @Override
+   public String getPortletClass() {
+      return portletClass;
+   }
+
+   /* (non-Javadoc)
+    * @see org.apache.pluto.container.om.portlet.PortletDefinition#setPortletClass(java.lang.String)
+    */
+   @Override
+   public void setPortletClass(String portletClass) {
+      this.portletClass = portletClass;
+   }
+
+   /* (non-Javadoc)
+    * @see org.apache.pluto.container.om.portlet.PortletDefinition#getPortletInfo()
+    */
+   @Override
+   public PortletInfo getPortletInfo() {
+      return (info != null) ? new PortletInfoImpl(info) : null;
+   }
+
+   @Override
+   public void setPortletInfo(PortletInfo info) {
+      this.info = info;
+   }
+
+   /* (non-Javadoc)
+    * @see org.apache.pluto.container.om.portlet.PortletDefinition#getPortletPreferences()
+    */
+   @Override
+   public Preferences getPortletPreferences() {
+      return (prefs != null) ? new PreferencesImpl(prefs) : null;
+   }
+
+   @Override
+   public void setPortletPreferences(Preferences prefs) {
+      this.prefs = prefs;
+   }
+
+   /* (non-Javadoc)
+    * @see org.apache.pluto.container.om.portlet.PortletDefinition#getSupportedProcessingEvents()
+    */
+   @Override
+   public List<EventDefinitionReference> getSupportedProcessingEvents() {
+      return new ArrayList<EventDefinitionReference>(proEvtRefs);
+   }
+
+   /* (non-Javadoc)
+    * @see org.apache.pluto.container.om.portlet.PortletDefinition#addSupportedProcessingEvent(EventDefinitionReference)
+    */
+   @Override
+   public void addSupportedProcessingEvent(EventDefinitionReference edr) {
+      proEvtRefs.add(edr);
+   }
+
+   /* (non-Javadoc)
+    * @see org.apache.pluto.container.om.portlet.PortletDefinition#getSupportedPublishingEvents()
+    */
+   @Override
+   public List<EventDefinitionReference> getSupportedPublishingEvents() {
+      return new ArrayList<EventDefinitionReference>(pubEvtRefs);
+   }
+
+   /* (non-Javadoc)
+    * @see org.apache.pluto.container.om.portlet.PortletDefinition#addSupportedPublishingEvent(javax.xml.namespace.QName)
+    */
+   @Override
+   public void addSupportedPublishingEvent(EventDefinitionReference edr) {
+      pubEvtRefs.add(edr);
+   }
+
+   /* (non-Javadoc)
+    * @see org.apache.pluto.container.om.portlet.PortletDefinition#getSupportedPublicRenderParameters()
+    */
+   @Override
+   public List<String> getSupportedPublicRenderParameters() {
+      return new ArrayList<String>(pubParms);
+   }
+
+   /* (non-Javadoc)
+    * @see org.apache.pluto.container.om.portlet.PortletDefinition#addSupportedPublicRenderParameter(java.lang.String)
+    */
+   @Override
+   public void addSupportedPublicRenderParameter(String identifier) {
+      pubParms.add(identifier);
+   }
+
+   /* (non-Javadoc)
+    * @see org.apache.pluto.container.om.portlet.PortletDefinition#getResourceBundle()
+    */
+   @Override
+   public String getResourceBundle() {
+      return resourceBundle;
+   }
+
+   /* (non-Javadoc)
+    * @see org.apache.pluto.container.om.portlet.PortletDefinition#setResourceBundle(java.lang.String)
+    */
+   @Override
+   public void setResourceBundle(String resourceBundle) {
+      this.resourceBundle = resourceBundle;
+   }
+
+   /* (non-Javadoc)
+    * @see org.apache.pluto.container.om.portlet.PortletDefinition#getSecurityRoleRef(java.lang.String)
+    */
+   @Override
+   public SecurityRoleRef getSecurityRoleRef(String roleName) {
+      SecurityRoleRef ret = null;
+      for (SecurityRoleRef item : secRefs) {
+         if (item.getRoleName().equals(roleName)) {
+            ret = new SecurityRoleRefImpl(item);
+         }
+      }
+      return ret;
+   }
+
+   /* (non-Javadoc)
+    * @see org.apache.pluto.container.om.portlet.PortletDefinition#getSecurityRoleRefs()
+    */
+   @Override
+   public List<SecurityRoleRef> getSecurityRoleRefs() {
+      return new ArrayList<SecurityRoleRef>(secRefs);
+   }
+
+   /* (non-Javadoc)
+    * @see org.apache.pluto.container.om.portlet.PortletDefinition#addSecurityRoleRef(SecurityRoleRef)
+    */
+   @Override
+   public void addSecurityRoleRef(SecurityRoleRef srr) {
+      secRefs.add(srr);
+   }
+
+   /* (non-Javadoc)
+    * @see org.apache.pluto.container.om.portlet.PortletDefinition#getSupports(java.lang.String)
+    */
+   @Override
+   public Supports getSupports(String mimeType) {
+      Supports ret = null;
+      for (Supports item : supps) {
+         if (item.getMimeType().equals(mimeType)) {
+            ret = new SupportsImpl(item);
+         }
+      }
+      return ret;
+   }
+
+   /* (non-Javadoc)
+    * @see org.apache.pluto.container.om.portlet.PortletDefinition#getSupports()
+    */
+   @Override
+   public List<Supports> getSupports() {
+      return new ArrayList<Supports>(supps);
+   }
+
+   /* (non-Javadoc)
+    * @see org.apache.pluto.container.om.portlet.PortletDefinition#addSupports(java.lang.String)
+    */
+   @Override
+   public void addSupports(Supports supp) {
+      supps.add(supp);
+   }
+
+   /* (non-Javadoc)
+    * @see org.apache.pluto.container.om.portlet.PortletDefinition#getDescription(java.util.Locale)
+    */
+   @Override
+   public Description getDescription(Locale locale) {
+      Description ret = null;
+      for (Description item : descs) {
+         if (item.getLocale().equals(locale)) {
+            ret = new DescriptionImpl(item);
+         }
+      }
+      return ret;
+   }
+
+   /* (non-Javadoc)
+    * @see org.apache.pluto.container.om.portlet.PortletDefinition#getDescriptions()
+    */
+   @Override
+   public List<Description> getDescriptions() {
+      return new ArrayList<Description>(descs);
+   }
+
+   /* (non-Javadoc)
+    * @see org.apache.pluto.container.om.portlet.PortletDefinition#addDescription(org.apache.pluto.container.om.portlet.Description)
+    */
+   @Override
+   public void addDescription(Description desc) {
+      descs.add(desc);
+   }
+
+   /* (non-Javadoc)
+    * @see org.apache.pluto.container.om.portlet.PortletDefinition#getDisplayName(java.util.Locale)
+    */
+   @Override
+   public DisplayName getDisplayName(Locale locale) {
+      DisplayName ret = null;
+      for (DisplayName item : dispNames) {
+         if (item.getLocale().equals(locale)) {
+            ret = new DisplayNameImpl(item);
+         }
+      }
+      return ret;
+   }
+
+   /* (non-Javadoc)
+    * @see org.apache.pluto.container.om.portlet.PortletDefinition#getDisplayNames()
+    */
+   @Override
+   public List<DisplayName> getDisplayNames() {
+      return new ArrayList<DisplayName>(dispNames);
+   }
+
+   /* (non-Javadoc)
+    * @see org.apache.pluto.container.om.portlet.PortletDefinition#addDisplayName(org.apache.pluto.container.om.portlet.DisplayName)
+    */
+   @Override
+   public void addDisplayName(DisplayName desc) {
+      dispNames.add(desc);
+   }
+
+   /* (non-Javadoc)
+    * @see org.apache.pluto.container.om.portlet.PortletDefinition#getSupportedLocales()
+    */
+   @Override
+   public List<String> getSupportedLocales() {
+      return new ArrayList<String>(supportedLocales);
+   }
+
+   /* (non-Javadoc)
+    * @see org.apache.pluto.container.om.portlet.PortletDefinition#addSupportedLocale(java.lang.String)
+    */
+   @Override
+   public void addSupportedLocale(String lang) {
+      supportedLocales.add(lang);
+   }
+
+   /* (non-Javadoc)
+    * @see org.apache.pluto.container.om.portlet.PortletDefinition#getExpirationCache()
+    */
+   @Override
+   public int getExpirationCache() {
+      return expirationCache;
+   }
+
+   /* (non-Javadoc)
+    * @see org.apache.pluto.container.om.portlet.PortletDefinition#setExpirationCache(int)
+    */
+   @Override
+   public void setExpirationCache(int expirationCache) {
+      this.expirationCache = expirationCache;
+   }
+
+   /* (non-Javadoc)
+    * @see org.apache.pluto.container.om.portlet.PortletDefinition#getCacheScope()
+    */
+   @Override
+   public String getCacheScope() {
+      return cacheScope;
+   }
+
+   /* (non-Javadoc)
+    * @see org.apache.pluto.container.om.portlet.PortletDefinition#setCacheScope(java.lang.String)
+    */
+   @Override
+   public void setCacheScope(String cacheScope) {
+      this.cacheScope = cacheScope;
+   }
+
+   /* (non-Javadoc)
+    * @see org.apache.pluto.container.om.portlet.PortletDefinition#getContainerRuntimeOption(java.lang.String)
+    */
+   @Override
+   public ContainerRuntimeOption getContainerRuntimeOption(String name) {
+      ContainerRuntimeOption ret = null;
+      for (ContainerRuntimeOption item : crtOptions) {
+         if (item.getName().equals(name)) {
+            ret = new ContainerRuntimeOptionImpl(item);
+         }
+      }
+      return ret;
+   }
+
+   /* (non-Javadoc)
+    * @see org.apache.pluto.container.om.portlet.PortletDefinition#getContainerRuntimeOptions()
+    */
+   @Override
+   public List<ContainerRuntimeOption> getContainerRuntimeOptions() {
+      ArrayList<ContainerRuntimeOption> crtos = new ArrayList<ContainerRuntimeOption>();
+      for (ContainerRuntimeOption crto : crtOptions) {
+         crtos.add(new ContainerRuntimeOptionImpl(crto));
+      }
+      return crtos;
+   }
+
+   /* (non-Javadoc)
+    * @see org.apache.pluto.container.om.portlet.PortletDefinition#addContainerRuntimeOption(java.lang.String)
+    */
+   @Override
+   public void addContainerRuntimeOption(ContainerRuntimeOption cro) {
+      crtOptions.add(new ContainerRuntimeOptionImpl(cro));
+   }
+
+}

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/bf15b331/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/PortletInfoImpl.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/PortletInfoImpl.java b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/PortletInfoImpl.java
new file mode 100644
index 0000000..11e58e9
--- /dev/null
+++ b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/PortletInfoImpl.java
@@ -0,0 +1,106 @@
+/*  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+
+package org.apache.pluto.container.om.portlet.impl;
+
+import org.apache.pluto.container.om.portlet.PortletInfo;
+
+/**
+ * Portlet info
+ * 
+ * @author Scott Nicklous
+ *
+ */
+public class PortletInfoImpl implements PortletInfo {
+   
+   private String title;
+   private String keywords;
+   private String sTitle;
+   
+   
+   /**
+    * Copy constructor 
+    */
+   public PortletInfoImpl(PortletInfo pi) {
+      title = pi.getTitle();
+      keywords = pi.getKeywords();
+      sTitle = pi.getShortTitle();
+   }
+   
+   /**
+    * Constructor
+    * @param ti      title
+    * @param kw      keywords
+    * @param sti     short title
+    */
+   public PortletInfoImpl(String ti, String kw, String sti) {
+      title = ti;
+      keywords = kw;
+      sTitle = sti;
+   }
+
+   /* (non-Javadoc)
+    * @see org.apache.pluto.container.om.portlet.PortletInfo#getTitle()
+    */
+   @Override
+   public String getTitle() {
+      return title;
+   }
+
+   /* (non-Javadoc)
+    * @see org.apache.pluto.container.om.portlet.PortletInfo#setTitle(java.lang.String)
+    */
+   @Override
+   public void setTitle(String title) {
+      this.title = title;
+   }
+
+   /* (non-Javadoc)
+    * @see org.apache.pluto.container.om.portlet.PortletInfo#getKeywords()
+    */
+   @Override
+   public String getKeywords() {
+      return keywords;
+   }
+
+   /* (non-Javadoc)
+    * @see org.apache.pluto.container.om.portlet.PortletInfo#setKeywords(java.lang.String)
+    */
+   @Override
+   public void setKeywords(String keywords) {
+      this.keywords = keywords;
+   }
+
+   /* (non-Javadoc)
+    * @see org.apache.pluto.container.om.portlet.PortletInfo#getShortTitle()
+    */
+   @Override
+   public String getShortTitle() {
+      return sTitle;
+   }
+
+   /* (non-Javadoc)
+    * @see org.apache.pluto.container.om.portlet.PortletInfo#setShortTitle(java.lang.String)
+    */
+   @Override
+   public void setShortTitle(String shortTitle) {
+      sTitle = shortTitle;
+   }
+
+}

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/bf15b331/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/PreferenceImpl.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/PreferenceImpl.java b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/PreferenceImpl.java
new file mode 100644
index 0000000..215c927
--- /dev/null
+++ b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/PreferenceImpl.java
@@ -0,0 +1,104 @@
+/*  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+
+package org.apache.pluto.container.om.portlet.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.pluto.container.om.portlet.Preference;
+
+/**
+ * @author Scott Nicklous
+ *
+ */
+public class PreferenceImpl implements Preference {
+   
+   private String name;
+   private boolean isReadOnly;
+   private final ArrayList<String> values = new ArrayList<String>();
+   
+   public PreferenceImpl() {
+      name = "";
+      isReadOnly = false;
+   }
+   
+   /**
+    * Copy constructor
+    * @param pi
+    */
+   public PreferenceImpl(Preference pi) {
+      this.name = pi.getName();
+      this.isReadOnly = pi.isReadOnly();
+      this.values.addAll(pi.getValues());
+   }
+   
+   /**
+    * Basic Constructor
+    * @param name
+    * @param isRO
+    * @param vals
+    */
+   public PreferenceImpl(String name, boolean isRO, List<String> vals) {
+      this.name = name;
+      this.isReadOnly = isRO;
+      values.addAll(vals);
+   }
+
+   /* (non-Javadoc)
+    * @see org.apache.pluto.container.om.portlet.Preference#getName()
+    */
+   @Override
+   public String getName() {
+      return name;
+   }
+
+   /* (non-Javadoc)
+    * @see org.apache.pluto.container.om.portlet.Preference#getValues()
+    */
+   @Override
+   public List<String> getValues() {
+      return new ArrayList<String>(values);
+   }
+
+   /* (non-Javadoc)
+    * @see org.apache.pluto.container.om.portlet.Preference#addValue(java.lang.String)
+    */
+   @Override
+   public void addValue(String value) {
+      values.add(value);
+   }
+
+   /* (non-Javadoc)
+    * @see org.apache.pluto.container.om.portlet.Preference#isReadOnly()
+    */
+   @Override
+   public boolean isReadOnly() {
+      return isReadOnly;
+   }
+
+   /* (non-Javadoc)
+    * @see org.apache.pluto.container.om.portlet.Preference#setReadOnly(boolean)
+    */
+   @Override
+   public void setReadOnly(boolean readOnly) {
+      isReadOnly = readOnly;
+   }
+
+}

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/bf15b331/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/PreferencesImpl.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/PreferencesImpl.java b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/PreferencesImpl.java
new file mode 100644
index 0000000..9ad60f1
--- /dev/null
+++ b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/PreferencesImpl.java
@@ -0,0 +1,102 @@
+/*  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+
+package org.apache.pluto.container.om.portlet.impl;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+
+import org.apache.pluto.container.om.portlet.Preference;
+import org.apache.pluto.container.om.portlet.Preferences;
+
+/**
+ * @author Scott Nicklous
+ *
+ */
+public class PreferencesImpl implements Preferences {
+   
+   private final Map<String, Preference> prefs = new HashMap<String, Preference>();
+   private String prefVal;
+
+   /**
+    * Default constructor
+    */
+   public PreferencesImpl() {
+   }
+   
+   /**
+    * Copy constructor
+    * @param pr
+    */
+   public PreferencesImpl(Preferences pr) {
+      for (Preference pref : pr.getPortletPreferences()) {
+         prefs.put(pref.getName(), new PreferenceImpl(pref));
+      }
+      prefVal = pr.getPreferencesValidator();
+   }
+
+   /* (non-Javadoc)
+    * @see org.apache.pluto.container.om.portlet.Preferences#getPortletPreference(java.lang.String)
+    */
+   @Override
+   public Preference getPortletPreference(String name) {
+      Preference pref = (prefs.get(name) == null) ? 
+            null : new PreferenceImpl(prefs.get(name));
+      return pref;
+   }
+
+   /* (non-Javadoc)
+    * @see org.apache.pluto.container.om.portlet.Preferences#getPortletPreferences()
+    */
+   @Override
+   public List<Preference> getPortletPreferences() {
+      ArrayList<Preference> rPrefs = new ArrayList<Preference>();
+      for (Preference pref : prefs.values()) {
+         rPrefs.add(new PreferenceImpl(pref));
+      }
+      return rPrefs;
+   }
+
+   /* (non-Javadoc)
+    * @see org.apache.pluto.container.om.portlet.Preferences#addPreference(org.apache.pluto.container.om.portlet.Preference)
+    */
+   @Override
+   public void addPreference(Preference pref) {
+      prefs.put(pref.getName(), new PreferenceImpl(pref));
+   }
+
+   /* (non-Javadoc)
+    * @see org.apache.pluto.container.om.portlet.Preferences#getPreferencesValidator()
+    */
+   @Override
+   public String getPreferencesValidator() {
+      return prefVal;
+   }
+
+   /* (non-Javadoc)
+    * @see org.apache.pluto.container.om.portlet.Preferences#setPreferencesValidator(java.lang.String)
+    */
+   @Override
+   public void setPreferencesValidator(String preferencesValidator) {
+      prefVal = preferencesValidator;
+   }
+
+}

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/bf15b331/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/PublicRenderParameterImpl.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/PublicRenderParameterImpl.java b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/PublicRenderParameterImpl.java
new file mode 100644
index 0000000..2f23354
--- /dev/null
+++ b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/PublicRenderParameterImpl.java
@@ -0,0 +1,130 @@
+/*  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+
+package org.apache.pluto.container.om.portlet.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Locale;
+
+import javax.xml.namespace.QName;
+
+import org.apache.pluto.container.om.portlet.Description;
+import org.apache.pluto.container.om.portlet.PublicRenderParameter;
+
+/**
+ * Public render parameters
+ * 
+ * @author Scott Nicklous
+ *
+ */
+public class PublicRenderParameterImpl implements PublicRenderParameter {
+   
+   private QName qname;
+   private String id;
+   private final List<QName> aliases = new ArrayList<QName>();
+   private final List<Description> descs = new ArrayList<Description>();
+
+   /**
+    * Copy constructor
+    * @param edi
+    */
+   public PublicRenderParameterImpl(PublicRenderParameter pri) {
+      QName priqn = pri.getQName();
+      this.qname = new QName(priqn.getNamespaceURI(), priqn.getLocalPart());
+      this.id = pri.getIdentifier();
+      for (QName qn : pri.getAliases()) {
+         this.aliases.add(new QName(qn.getNamespaceURI(), qn.getLocalPart()));
+      }
+      for (Description desc : pri.getDescriptions()) {
+         descs.add(new DescriptionImpl(desc));
+      }
+   }
+   
+   /**
+    * Basic constructor
+    */
+   public PublicRenderParameterImpl(QName qn, String id) {
+      this.qname = qn;
+      this.id = id;
+   }
+
+   /* (non-Javadoc)
+    * @see org.apache.pluto.container.om.portlet.PublicRenderParameter#getQName()
+    */
+   @Override
+   public QName getQName() {
+      return qname;
+   }
+
+   /* (non-Javadoc)
+    * @see org.apache.pluto.container.om.portlet.PublicRenderParameter#getIdentifier()
+    */
+   @Override
+   public String getIdentifier() {
+      return id;
+   }
+
+   /* (non-Javadoc)
+    * @see org.apache.pluto.container.om.portlet.PublicRenderParameter#getDescription(java.util.Locale)
+    */
+   @Override
+   public Description getDescription(Locale locale) {
+      Description ret = null;
+      for (Description desc : descs) {
+         if (desc.getLocale().equals(locale)) {
+            ret = desc;
+         }
+      }
+      return ret;
+   }
+
+   /* (non-Javadoc)
+    * @see org.apache.pluto.container.om.portlet.PublicRenderParameter#getDescriptions()
+    */
+   @Override
+   public List<Description> getDescriptions() {
+      return new ArrayList<Description>(descs);
+   }
+
+   /* (non-Javadoc)
+    * @see org.apache.pluto.container.om.portlet.PublicRenderParameter#addDescription(org.apache.pluto.container.om.portlet.Description)
+    */
+   @Override
+   public void addDescription(Description desc) {
+      descs.add(desc);
+   }
+
+   /* (non-Javadoc)
+    * @see org.apache.pluto.container.om.portlet.PublicRenderParameter#getAliases()
+    */
+   @Override
+   public List<QName> getAliases() {
+      return new ArrayList<QName>(aliases);
+   }
+
+   /* (non-Javadoc)
+    * @see org.apache.pluto.container.om.portlet.PublicRenderParameter#addAlias(javax.xml.namespace.QName)
+    */
+   @Override
+   public void addAlias(QName qName) {
+      aliases.add(qName);
+   }
+
+}


Mime
View raw message