You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pluto-scm@portals.apache.org by ms...@apache.org on 2015/01/28 15:42:36 UTC
[01/14] portals-pluto git commit: work towards enabling v3 deployment
descriptor
Repository: portals-pluto
Updated Branches:
refs/heads/V3Prototype 49072ab4a -> acb93c676
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/a8bed7fb/pluto-container/src/main/java/org/apache/pluto/container/om/portlet20/impl/SecurityConstraintType.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet20/impl/SecurityConstraintType.java b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet20/impl/SecurityConstraintType.java
new file mode 100644
index 0000000..f9851f2
--- /dev/null
+++ b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet20/impl/SecurityConstraintType.java
@@ -0,0 +1,128 @@
+/*
+ * 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.portlet20.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Locale;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+import org.apache.pluto.container.om.portlet.DisplayName;
+import org.apache.pluto.container.om.portlet.SecurityConstraint;
+import org.apache.pluto.container.om.portlet.UserDataConstraint;
+
+/**
+ * The security-constraintType is used to associate intended security constraints with one or more portlets. Used in:
+ * portlet-app <p>Java class for security-constraintType complex type. <p>The following schema fragment specifies the
+ * expected content contained within this class.
+ *
+ * <pre>
+ * <complexType name="security-constraintType">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="display-name" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}display-nameType" maxOccurs="unbounded" minOccurs="0"/>
+ * <element name="portlet-collection" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}portlet-collectionType"/>
+ * <element name="user-data-constraint" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}user-data-constraintType"/>
+ * </sequence>
+ * <attribute name="id" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}string" />
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ * @version $Id$
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "security-constraintType", propOrder = { "displayName", "portletCollection", "userDataConstraint" })
+public class SecurityConstraintType implements SecurityConstraint
+{
+ @XmlElement(name = "display-name")
+ protected List<DisplayNameType> displayName;
+ @XmlElement(name = "portlet-collection", required = true)
+ protected PortletCollectionType portletCollection;
+ @XmlElement(name = "user-data-constraint", required = true)
+ protected UserDataConstraintType userDataConstraint;
+
+ public DisplayName getDisplayName(Locale locale)
+ {
+ for (DisplayName d : getDisplayNames())
+ {
+ if (d.getLocale().equals(locale))
+ {
+ return d;
+ }
+ }
+ return null;
+ }
+
+ public List<? extends DisplayName> getDisplayNames()
+ {
+ if (displayName == null)
+ {
+ displayName = new ArrayList<DisplayNameType>();
+ }
+ return displayName;
+ }
+
+ public DisplayName addDisplayName(String lang)
+ {
+ DisplayNameType d = new DisplayNameType();
+ d.setLang(lang);
+ if (getDisplayName(d.getLocale()) != null)
+ {
+ throw new IllegalArgumentException("DisplayName for language: "+d.getLocale()+" already defined");
+ }
+ getDisplayNames();
+ displayName.add(d);
+ return d;
+ }
+
+ public List<String> getPortletNames()
+ {
+ if (portletCollection == null)
+ {
+ portletCollection = new PortletCollectionType();
+ }
+ return portletCollection.getPortletNames();
+ }
+
+ public void addPortletName(String portletName)
+ {
+ for (String name : getPortletNames())
+ {
+ if (name.equals(portletName))
+ {
+ throw new IllegalArgumentException("Portlet name: "+name+" already defined");
+ }
+ }
+ portletCollection.getPortletNames().add(portletName);
+ }
+
+ public UserDataConstraint getUserDataConstraint()
+ {
+ if (userDataConstraint == null)
+ {
+ userDataConstraint = new UserDataConstraintType();
+ }
+ return userDataConstraint;
+ }
+}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/a8bed7fb/pluto-container/src/main/java/org/apache/pluto/container/om/portlet20/impl/SecurityRoleRefType.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet20/impl/SecurityRoleRefType.java b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet20/impl/SecurityRoleRefType.java
new file mode 100644
index 0000000..c9d1044
--- /dev/null
+++ b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet20/impl/SecurityRoleRefType.java
@@ -0,0 +1,125 @@
+/*
+ * 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.portlet20.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Locale;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+
+import org.apache.pluto.container.om.portlet.Description;
+import org.apache.pluto.container.om.portlet.SecurityRoleRef;
+
+/**
+ * The security-role-ref element contains the declaration of a security role reference in the code of the web
+ * application. The declaration consists of an optional description, the security role name used in the code, and an
+ * optional link to a security role. If the security role is not specified, the Deployer must choose an appropriate
+ * security role. The value of the role name element must be the String used as the parameter to the
+ * EJBContext.isCallerInRole(String roleName) method or the HttpServletRequest.isUserInRole(String role) method. Used
+ * in: portlet <p>Java class for security-role-refType complex type. <p>The following schema fragment specifies the
+ * expected content contained within this class.
+ *
+ * <pre>
+ * <complexType name="security-role-refType">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="description" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}descriptionType" maxOccurs="unbounded" minOccurs="0"/>
+ * <element name="role-name" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}role-nameType"/>
+ * <element name="role-link" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}role-linkType" minOccurs="0"/>
+ * </sequence>
+ * <attribute name="id" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}string" />
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ * @version $Id$
+*/
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "security-role-refType", propOrder = { "description", "roleName", "roleLink" })
+public class SecurityRoleRefType implements SecurityRoleRef
+{
+ @XmlElement(name = "description")
+ protected List<DescriptionType> description;
+ @XmlElement(name = "role-name", required = true)
+ @XmlJavaTypeAdapter(CollapsedStringAdapter.class)
+ protected String roleName;
+ @XmlElement(name = "role-link")
+ @XmlJavaTypeAdapter(value=CollapsedStringAdapter.class)
+ protected String roleLink;
+
+ public Description getDescription(Locale locale)
+ {
+ for (Description d : getDescriptions())
+ {
+ if (d.getLocale().equals(locale))
+ {
+ return d;
+ }
+ }
+ return null;
+ }
+
+ public List<? extends Description> getDescriptions()
+ {
+ if (description == null)
+ {
+ description = new ArrayList<DescriptionType>();
+ }
+ return description;
+ }
+
+ public Description addDescription(String lang)
+ {
+ DescriptionType d = new DescriptionType();
+ d.setLang(lang);
+ if (getDescription(d.getLocale()) != null)
+ {
+ throw new IllegalArgumentException("Description for language: "+d.getLocale()+" already defined");
+ }
+ getDescriptions();
+ description.add(d);
+ return d;
+ }
+
+ public String getRoleName()
+ {
+ return roleName;
+ }
+
+ public void setRoleName(String value)
+ {
+ roleName = value;
+ }
+
+ public String getRoleLink()
+ {
+ return roleLink;
+ }
+
+ public void setRoleLink(String value)
+ {
+ roleLink = value;
+ }
+}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/a8bed7fb/pluto-container/src/main/java/org/apache/pluto/container/om/portlet20/impl/SupportsType.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet20/impl/SupportsType.java b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet20/impl/SupportsType.java
new file mode 100644
index 0000000..74f9b66
--- /dev/null
+++ b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet20/impl/SupportsType.java
@@ -0,0 +1,118 @@
+/*
+ * 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.portlet20.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+
+import org.apache.pluto.container.om.portlet.Supports;
+
+/**
+ * Supports indicates the portlet modes a portlet supports for a specific content type. All portlets must support the
+ * view mode. Used in: portlet <p>Java class for supportsType complex type. <p>The following schema fragment specifies
+ * the expected content contained within this class.
+ *
+ * <pre>
+ * <complexType name="supportsType">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="mime-type" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}mime-typeType"/>
+ * <element name="portlet-mode" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}portlet-modeType" maxOccurs="unbounded" minOccurs="0"/>
+ * <element name="window-state" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}window-stateType" maxOccurs="unbounded" minOccurs="0"/>
+ * </sequence>
+ * <attribute name="id" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}string" />
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ * @version $Id$
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "supportsType", propOrder = { "mimeType", "portletMode", "windowState" })
+public class SupportsType implements Supports
+{
+ @XmlElement(name = "mime-type", required = true)
+ @XmlJavaTypeAdapter(value=CollapsedStringAdapter.class)
+ protected String mimeType;
+ @XmlElement(name = "portlet-mode")
+ @XmlJavaTypeAdapter(value=CollapsedStringAdapter.class)
+ protected List<String> portletMode;
+ @XmlElement(name = "window-state")
+ @XmlJavaTypeAdapter(value=CollapsedStringAdapter.class)
+ protected List<String> windowState;
+
+ public String getMimeType()
+ {
+ return mimeType;
+ }
+
+ public void setMimeType(String value)
+ {
+ mimeType = value;
+ }
+
+ public List<String> getPortletModes()
+ {
+ if (portletMode == null)
+ {
+ portletMode = new ArrayList<String>();
+ }
+ return portletMode;
+ }
+
+ public void addPortletMode(String name)
+ {
+ for (String mode : getPortletModes())
+ {
+ if (mode.equals(name))
+ {
+ throw new IllegalArgumentException("Portlet mode: "+name+" already defined");
+ }
+ }
+ portletMode.add(name);
+ }
+
+ public List<String> getWindowStates()
+ {
+ if (windowState == null)
+ {
+ windowState = new ArrayList<String>();
+ }
+ return windowState;
+ }
+
+ public void addWindowState(String name)
+ {
+ for (String state : getWindowStates())
+ {
+ if (state.equals(name))
+ {
+ throw new IllegalArgumentException("Window state: "+name+" already defined");
+ }
+ }
+ windowState.add(name);
+ }
+}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/a8bed7fb/pluto-container/src/main/java/org/apache/pluto/container/om/portlet20/impl/UserAttributeType.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet20/impl/UserAttributeType.java b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet20/impl/UserAttributeType.java
new file mode 100644
index 0000000..6b439c5
--- /dev/null
+++ b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet20/impl/UserAttributeType.java
@@ -0,0 +1,108 @@
+/*
+ * 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.portlet20.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Locale;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+
+import org.apache.pluto.container.om.portlet.Description;
+import org.apache.pluto.container.om.portlet.UserAttribute;
+
+/**
+ * User attribute defines a user specific attribute that the portlet application needs. The portlet within this
+ * application can access this attribute via the request parameter USER_INFO map. Used in: portlet-app <p>Java class
+ * for user-attributeType complex type. <p>The following schema fragment specifies the expected content contained
+ * within this class.
+ *
+ * <pre>
+ * <complexType name="user-attributeType">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="description" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}descriptionType" maxOccurs="unbounded" minOccurs="0"/>
+ * <element name="name" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}nameType"/>
+ * </sequence>
+ * <attribute name="id" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}string" />
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ * @version $Id$
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "user-attributeType", propOrder = { "description", "name" })
+public class UserAttributeType implements UserAttribute
+{
+ @XmlElement(name = "description")
+ protected List<DescriptionType> description;
+ @XmlElement(required = true)
+ @XmlJavaTypeAdapter(value=CollapsedStringAdapter.class)
+ protected String name;
+
+ public Description getDescription(Locale locale)
+ {
+ for (Description d : getDescriptions())
+ {
+ if (d.getLocale().equals(locale))
+ {
+ return d;
+ }
+ }
+ return null;
+ }
+
+ public List<? extends Description> getDescriptions()
+ {
+ if (description == null)
+ {
+ description = new ArrayList<DescriptionType>();
+ }
+ return description;
+ }
+
+ public Description addDescription(String lang)
+ {
+ DescriptionType d = new DescriptionType();
+ d.setLang(lang);
+ if (getDescription(d.getLocale()) != null)
+ {
+ throw new IllegalArgumentException("Description for language: "+d.getLocale()+" already defined");
+ }
+ getDescriptions();
+ description.add(d);
+ return d;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String value)
+ {
+ name = value;
+ }
+}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/a8bed7fb/pluto-container/src/main/java/org/apache/pluto/container/om/portlet20/impl/UserDataConstraintType.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet20/impl/UserDataConstraintType.java b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet20/impl/UserDataConstraintType.java
new file mode 100644
index 0000000..dccacc2
--- /dev/null
+++ b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet20/impl/UserDataConstraintType.java
@@ -0,0 +1,107 @@
+/*
+ * 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.portlet20.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Locale;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+
+import org.apache.pluto.container.om.portlet.Description;
+import org.apache.pluto.container.om.portlet.UserDataConstraint;
+
+/**
+ * The user-data-constraintType is used to indicate how data communicated between the client and portlet should be
+ * protected. Used in: security-constraint <p>Java class for user-data-constraintType complex type. <p>The following
+ * schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * <complexType name="user-data-constraintType">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="description" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}descriptionType" maxOccurs="unbounded" minOccurs="0"/>
+ * <element name="transport-guarantee" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}transport-guaranteeType"/>
+ * </sequence>
+ * <attribute name="id" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}string" />
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ * @version $Id$
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "user-data-constraintType", propOrder = { "description", "transportGuarantee" })
+public class UserDataConstraintType implements UserDataConstraint
+{
+ @XmlElement(name = "description")
+ protected List<DescriptionType> description;
+ @XmlElement(name = "transport-guarantee", required = true)
+ @XmlJavaTypeAdapter(value=CollapsedStringAdapter.class)
+ protected String transportGuarantee;
+
+ public Description getDescription(Locale locale)
+ {
+ for (Description d : getDescriptions())
+ {
+ if (d.getLocale().equals(locale))
+ {
+ return d;
+ }
+ }
+ return null;
+ }
+
+ public List<? extends Description> getDescriptions()
+ {
+ if (description == null)
+ {
+ description = new ArrayList<DescriptionType>();
+ }
+ return description;
+ }
+
+ public Description addDescription(String lang)
+ {
+ DescriptionType d = new DescriptionType();
+ d.setLang(lang);
+ if (getDescription(d.getLocale()) != null)
+ {
+ throw new IllegalArgumentException("Description for language: "+d.getLocale()+" already defined");
+ }
+ getDescriptions();
+ description.add(d);
+ return d;
+ }
+
+ public String getTransportGuarantee()
+ {
+ return transportGuarantee;
+ }
+
+ public void setTransportGuarantee(String value)
+ {
+ transportGuarantee = value;
+ }
+}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/a8bed7fb/pluto-container/src/main/java/org/apache/pluto/container/om/portlet20/impl/package-info.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet20/impl/package-info.java b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet20/impl/package-info.java
new file mode 100644
index 0000000..6796276
--- /dev/null
+++ b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet20/impl/package-info.java
@@ -0,0 +1,21 @@
+/*
+ * 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.
+ *
+ * @version $Id$
+ */
+@javax.xml.bind.annotation.XmlSchema(namespace = "http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
+package org.apache.pluto.container.om.portlet20.impl;
+
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/a8bed7fb/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/impl/resource/SupportedModesServiceImpl.java
----------------------------------------------------------------------
diff --git a/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/impl/resource/SupportedModesServiceImpl.java b/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/impl/resource/SupportedModesServiceImpl.java
index 2e60ba9..333dcc4 100644
--- a/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/impl/resource/SupportedModesServiceImpl.java
+++ b/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/impl/resource/SupportedModesServiceImpl.java
@@ -1,268 +1,269 @@
-/*
- * 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.driver.services.impl.resource;
-
-import org.apache.pluto.container.PortletContainerException;
-import org.apache.pluto.container.driver.PortletContextService;
-import org.apache.pluto.container.driver.PortletRegistryService;
-import org.apache.pluto.container.om.portlet.PortletApplicationDefinition;
-import org.apache.pluto.container.om.portlet.PortletDefinition;
-import org.apache.pluto.container.om.portlet.Supports;
-import org.apache.pluto.container.om.portlet.impl.CustomPortletModeType;
-import org.apache.pluto.driver.services.portal.PortletWindowConfig;
-import org.apache.pluto.driver.services.portal.PropertyConfigService;
-import org.apache.pluto.driver.services.portal.SupportedModesService;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.portlet.PortletConfig;
-import javax.portlet.PortletMode;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-
-/**
- * Allows clients to determine if a particular PortletMode is supported
- * by the portal, a particular portlet, or both.
- * <p/>
- * This implementation depends on {@link PropertyConfigService}.
- * <p/>
- * The service implementations are injected by Spring.
- *
- * @version $Id$
- * @since September 9, 2006
- */
-public class SupportedModesServiceImpl implements SupportedModesService
-{
- /**
- * Logger
- */
- private static final Logger LOG = LoggerFactory.getLogger(SupportedModesServiceImpl.class);
-
-
- /**
- * PortletMode objects supported by the portal
- */
- private Set<PortletMode> supportedPortletModesByPortal = new HashSet<PortletMode>();
-
- /**
- * PropertyConfig Service used to obtain supported portal modes
- */
- private final PropertyConfigService propertyService;
-
- private final PortletContextService portletContextService;
-
- /**
- * PortletRegistryService used to obtain PortletApplicationConfig objects
- */
- private final PortletRegistryService portletRegistry;
-
- /**
- * Constructs a SupportedModesService with its dependencies.
- *
- * @param propertyService the PropertyConfigService
- */
- public SupportedModesServiceImpl(PropertyConfigService propertyService, PortletContextService portletContextService, PortletRegistryService portletRegistry)
- {
- this.propertyService = propertyService;
- this.portletContextService = portletContextService;
- this.portletRegistry = portletRegistry;
- loadPortalModes();
- }
-
- // SupportedModesService Implementation -----------------
-
- public boolean isPortletModeSupported(String portletId, String mode)
- {
- return (isPortletModeSupportedByPortal(mode) &&
- isPortletModeSupportedByPortlet(portletId, mode)
- || isPortletManagedMode(portletId, mode));
- }
-
- public boolean isPortletModeSupportedByPortal(String mode)
- {
- return supportedPortletModesByPortal.contains(new PortletMode(mode));
- }
-
- public boolean isPortletModeSupportedByPortlet(String portletId, String mode)
- {
- String applicationId = PortletWindowConfig.parseContextPath(portletId);
- String applicationName = applicationId;
- String portletName = PortletWindowConfig.parsePortletName(portletId);
-
- try
- {
- if (portletRegistry == null)
- {
- LOG.error("Optional Portlet Registry Service not found.");
- throw new PortletContainerException("Optional Portlet Registry Service not found.");
- }
- PortletApplicationDefinition ctx = portletRegistry.getPortletApplication(applicationName);
- Iterator i = ctx.getPortlets().iterator();
- while (i.hasNext())
- {
- PortletDefinition dd = (PortletDefinition) i.next();
- if (portletName.equals(dd.getPortletName()))
- {
- Iterator i2 = dd.getSupports().iterator();
- while (i2.hasNext())
- {
- Supports sd = (Supports) i2.next();
- if (sd.getPortletModes() == null)
- {
- if (mode.equalsIgnoreCase(PortletMode.VIEW.toString()))
- return true;
- } else
- {
- Iterator pd = sd.getPortletModes().iterator();
- while (pd.hasNext())
- {
- if (mode.equalsIgnoreCase((String) pd.next()))
- {
- return true;
- }
- }
- }
- }
- }
- }
-
- } catch (PortletContainerException e)
- {
- LOG.error("Error determining mode support.", e);
- }
- LOG.info("Portlet mode '" + mode + "' not found for portletId: '" + portletId + "'");
- return false;
- }
-
- /**
- * Populates the supportedPortletModesByPortal set.
- */
- private void loadPortalModes()
- {
- // Add the PortletModes supported by the portal to the
- // supportedPortletModesByPortal set.
- LOG.debug("Loading supported portal modes...");
- Iterator modes = propertyService.getSupportedPortletModes().iterator();
- while (modes.hasNext())
- {
- String mode = (String) modes.next();
- LOG.debug("Loading mode [" + mode + "]");
- supportedPortletModesByPortal.add(new PortletMode(mode));
- }
- LOG.debug("Loaded [" + supportedPortletModesByPortal.size() + "] supported portal modes");
-
- }
-
-
- public boolean isPortletManagedMode(String portletId, String mode)
- {
- String applicationId = PortletWindowConfig.parseContextPath(portletId);
- String applicationName = applicationId;
-// if (applicationName.length() > 0)
-// {
-// applicationName = applicationName.substring(1);
-// }
- try
- {
- PortletApplicationDefinition portletApp = portletRegistry.getPortletApplication(applicationName);
- Iterator customModes = portletApp.getCustomPortletModes().iterator();
- while (customModes.hasNext())
- {
- CustomPortletModeType customMode = (CustomPortletModeType) customModes.next();
- boolean isPortletManagedMode = !customMode.isPortalManaged();
- if (isPortletManagedMode && customMode.getPortletMode().equalsIgnoreCase(mode))
- {
- return true;
- }
- }
- } catch (PortletContainerException e)
- {
- LOG.error("Error determining portlet managed mode support, so we assume that it is false.", e);
- }
-
-
- return false;
- }
-
-
- /**
- * Gets all modes supported by a portlet that are defined in the portlet's supports child element
- * in portlet.xml.
- *
- * @param portletId of interest.
- * @return all portlet modes supported by a portlet.
- */
- public Set<PortletMode> getSupportedPortletModes(String portletId) throws PortletContainerException
- {
- Set<PortletMode> modeSet = new HashSet<PortletMode>();
-
- String applicationId = PortletWindowConfig.parseContextPath(portletId);
- String applicationName = applicationId;
-// if (applicationName.length() > 0)
-// {
-// applicationName = applicationName.substring(1);
-// }
- String portletName = PortletWindowConfig.parsePortletName(portletId);
-
- if (portletRegistry == null)
- {
- LOG.error("Optional Portlet Registry Service not found.");
- throw new PortletContainerException("Optional Portlet Registry Service not found.");
- }
- PortletApplicationDefinition portletApp = portletRegistry.getPortletApplication(applicationName);
- Iterator i = portletApp.getPortlets().iterator();
- while (i.hasNext())
- {
- PortletDefinition dd = (PortletDefinition) i.next();
- if (portletName.equals(dd.getPortletName()))
- {
- Iterator i2 = dd.getSupports().iterator();
- while (i2.hasNext())
- {
- Supports sd = (Supports) i2.next();
- if (sd.getPortletModes() == null)
- {
- modeSet.add(PortletMode.VIEW);
- } else
- {
- Iterator<String> pd = sd.getPortletModes().iterator();
- while (pd.hasNext())
- {
- modeSet.add(new PortletMode(pd.next()));
- }
- }
- }
- }
- }
-
- return modeSet;
- }
-
- public PortletConfig getPortletConfig(String portletId) throws PortletContainerException
- {
- String applicationId = PortletWindowConfig.parseContextPath(portletId);
- String applicationName = applicationId;
-// if (applicationName.length() > 0)
-// {
-// applicationName = applicationName.substring(1);
-// }
- String portletName = PortletWindowConfig.parsePortletName(portletId);
-
- return portletContextService.getPortletConfig(applicationName, portletName);
- }
-}
+/*
+ * 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.driver.services.impl.resource;
+
+import org.apache.pluto.container.PortletContainerException;
+import org.apache.pluto.container.driver.PortletContextService;
+import org.apache.pluto.container.driver.PortletRegistryService;
+import org.apache.pluto.container.om.portlet.PortletApplicationDefinition;
+import org.apache.pluto.container.om.portlet.PortletDefinition;
+import org.apache.pluto.container.om.portlet.Supports;
+import org.apache.pluto.container.om.portlet20.impl.CustomPortletModeType;
+import org.apache.pluto.driver.services.portal.PortletWindowConfig;
+import org.apache.pluto.driver.services.portal.PropertyConfigService;
+import org.apache.pluto.driver.services.portal.SupportedModesService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.portlet.PortletConfig;
+import javax.portlet.PortletMode;
+
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+
+/**
+ * Allows clients to determine if a particular PortletMode is supported
+ * by the portal, a particular portlet, or both.
+ * <p/>
+ * This implementation depends on {@link PropertyConfigService}.
+ * <p/>
+ * The service implementations are injected by Spring.
+ *
+ * @version $Id$
+ * @since September 9, 2006
+ */
+public class SupportedModesServiceImpl implements SupportedModesService
+{
+ /**
+ * Logger
+ */
+ private static final Logger LOG = LoggerFactory.getLogger(SupportedModesServiceImpl.class);
+
+
+ /**
+ * PortletMode objects supported by the portal
+ */
+ private Set<PortletMode> supportedPortletModesByPortal = new HashSet<PortletMode>();
+
+ /**
+ * PropertyConfig Service used to obtain supported portal modes
+ */
+ private final PropertyConfigService propertyService;
+
+ private final PortletContextService portletContextService;
+
+ /**
+ * PortletRegistryService used to obtain PortletApplicationConfig objects
+ */
+ private final PortletRegistryService portletRegistry;
+
+ /**
+ * Constructs a SupportedModesService with its dependencies.
+ *
+ * @param propertyService the PropertyConfigService
+ */
+ public SupportedModesServiceImpl(PropertyConfigService propertyService, PortletContextService portletContextService, PortletRegistryService portletRegistry)
+ {
+ this.propertyService = propertyService;
+ this.portletContextService = portletContextService;
+ this.portletRegistry = portletRegistry;
+ loadPortalModes();
+ }
+
+ // SupportedModesService Implementation -----------------
+
+ public boolean isPortletModeSupported(String portletId, String mode)
+ {
+ return (isPortletModeSupportedByPortal(mode) &&
+ isPortletModeSupportedByPortlet(portletId, mode)
+ || isPortletManagedMode(portletId, mode));
+ }
+
+ public boolean isPortletModeSupportedByPortal(String mode)
+ {
+ return supportedPortletModesByPortal.contains(new PortletMode(mode));
+ }
+
+ public boolean isPortletModeSupportedByPortlet(String portletId, String mode)
+ {
+ String applicationId = PortletWindowConfig.parseContextPath(portletId);
+ String applicationName = applicationId;
+ String portletName = PortletWindowConfig.parsePortletName(portletId);
+
+ try
+ {
+ if (portletRegistry == null)
+ {
+ LOG.error("Optional Portlet Registry Service not found.");
+ throw new PortletContainerException("Optional Portlet Registry Service not found.");
+ }
+ PortletApplicationDefinition ctx = portletRegistry.getPortletApplication(applicationName);
+ Iterator i = ctx.getPortlets().iterator();
+ while (i.hasNext())
+ {
+ PortletDefinition dd = (PortletDefinition) i.next();
+ if (portletName.equals(dd.getPortletName()))
+ {
+ Iterator i2 = dd.getSupports().iterator();
+ while (i2.hasNext())
+ {
+ Supports sd = (Supports) i2.next();
+ if (sd.getPortletModes() == null)
+ {
+ if (mode.equalsIgnoreCase(PortletMode.VIEW.toString()))
+ return true;
+ } else
+ {
+ Iterator pd = sd.getPortletModes().iterator();
+ while (pd.hasNext())
+ {
+ if (mode.equalsIgnoreCase((String) pd.next()))
+ {
+ return true;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ } catch (PortletContainerException e)
+ {
+ LOG.error("Error determining mode support.", e);
+ }
+ LOG.info("Portlet mode '" + mode + "' not found for portletId: '" + portletId + "'");
+ return false;
+ }
+
+ /**
+ * Populates the supportedPortletModesByPortal set.
+ */
+ private void loadPortalModes()
+ {
+ // Add the PortletModes supported by the portal to the
+ // supportedPortletModesByPortal set.
+ LOG.debug("Loading supported portal modes...");
+ Iterator modes = propertyService.getSupportedPortletModes().iterator();
+ while (modes.hasNext())
+ {
+ String mode = (String) modes.next();
+ LOG.debug("Loading mode [" + mode + "]");
+ supportedPortletModesByPortal.add(new PortletMode(mode));
+ }
+ LOG.debug("Loaded [" + supportedPortletModesByPortal.size() + "] supported portal modes");
+
+ }
+
+
+ public boolean isPortletManagedMode(String portletId, String mode)
+ {
+ String applicationId = PortletWindowConfig.parseContextPath(portletId);
+ String applicationName = applicationId;
+// if (applicationName.length() > 0)
+// {
+// applicationName = applicationName.substring(1);
+// }
+ try
+ {
+ PortletApplicationDefinition portletApp = portletRegistry.getPortletApplication(applicationName);
+ Iterator customModes = portletApp.getCustomPortletModes().iterator();
+ while (customModes.hasNext())
+ {
+ CustomPortletModeType customMode = (CustomPortletModeType) customModes.next();
+ boolean isPortletManagedMode = !customMode.isPortalManaged();
+ if (isPortletManagedMode && customMode.getPortletMode().equalsIgnoreCase(mode))
+ {
+ return true;
+ }
+ }
+ } catch (PortletContainerException e)
+ {
+ LOG.error("Error determining portlet managed mode support, so we assume that it is false.", e);
+ }
+
+
+ return false;
+ }
+
+
+ /**
+ * Gets all modes supported by a portlet that are defined in the portlet's supports child element
+ * in portlet.xml.
+ *
+ * @param portletId of interest.
+ * @return all portlet modes supported by a portlet.
+ */
+ public Set<PortletMode> getSupportedPortletModes(String portletId) throws PortletContainerException
+ {
+ Set<PortletMode> modeSet = new HashSet<PortletMode>();
+
+ String applicationId = PortletWindowConfig.parseContextPath(portletId);
+ String applicationName = applicationId;
+// if (applicationName.length() > 0)
+// {
+// applicationName = applicationName.substring(1);
+// }
+ String portletName = PortletWindowConfig.parsePortletName(portletId);
+
+ if (portletRegistry == null)
+ {
+ LOG.error("Optional Portlet Registry Service not found.");
+ throw new PortletContainerException("Optional Portlet Registry Service not found.");
+ }
+ PortletApplicationDefinition portletApp = portletRegistry.getPortletApplication(applicationName);
+ Iterator i = portletApp.getPortlets().iterator();
+ while (i.hasNext())
+ {
+ PortletDefinition dd = (PortletDefinition) i.next();
+ if (portletName.equals(dd.getPortletName()))
+ {
+ Iterator i2 = dd.getSupports().iterator();
+ while (i2.hasNext())
+ {
+ Supports sd = (Supports) i2.next();
+ if (sd.getPortletModes() == null)
+ {
+ modeSet.add(PortletMode.VIEW);
+ } else
+ {
+ Iterator<String> pd = sd.getPortletModes().iterator();
+ while (pd.hasNext())
+ {
+ modeSet.add(new PortletMode(pd.next()));
+ }
+ }
+ }
+ }
+ }
+
+ return modeSet;
+ }
+
+ public PortletConfig getPortletConfig(String portletId) throws PortletContainerException
+ {
+ String applicationId = PortletWindowConfig.parseContextPath(portletId);
+ String applicationName = applicationId;
+// if (applicationName.length() > 0)
+// {
+// applicationName = applicationName.substring(1);
+// }
+ String portletName = PortletWindowConfig.parsePortletName(portletId);
+
+ return portletContextService.getPortletConfig(applicationName, portletName);
+ }
+}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/a8bed7fb/pluto-portal-driver/src/main/java/org/apache/pluto/driver/container/DefaultPortletPreferencesService.java
----------------------------------------------------------------------
diff --git a/pluto-portal-driver/src/main/java/org/apache/pluto/driver/container/DefaultPortletPreferencesService.java b/pluto-portal-driver/src/main/java/org/apache/pluto/driver/container/DefaultPortletPreferencesService.java
index d60ece2..c108438 100644
--- a/pluto-portal-driver/src/main/java/org/apache/pluto/driver/container/DefaultPortletPreferencesService.java
+++ b/pluto-portal-driver/src/main/java/org/apache/pluto/driver/container/DefaultPortletPreferencesService.java
@@ -1,260 +1,260 @@
-/*
- * 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.driver.container;
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.portlet.PortletRequest;
-import javax.portlet.PreferencesValidator;
-import javax.portlet.ValidatorException;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.apache.pluto.container.PortletPreference;
-import org.apache.pluto.container.PortletContainerException;
-import org.apache.pluto.container.PortletPreferencesService;
-import org.apache.pluto.container.PortletWindow;
-import org.apache.pluto.container.impl.PortletPreferenceImpl;
-import org.apache.pluto.container.om.portlet.PortletDefinition;
-import org.apache.pluto.container.om.portlet.Preference;
-import org.apache.pluto.container.om.portlet.Preferences;
-
-/**
- * Default implementation of the portlet preferences service. The portlet
- * preferences service is a singleton held by the pluto portlet container.
- *
- * @see javax.portlet.PortletPreferences
- * @see org.apache.pluto.container.impl.PortletPreferencesImpl
- * @see javax.portlet.PortletPreferences
- *
- */
-public class DefaultPortletPreferencesService
-implements PortletPreferencesService {
-
- /** Logger. */
- private static final Logger LOG = LoggerFactory.getLogger(
- DefaultPortletPreferencesService.class);
-
-
- // Private Member Variables ------------------------------------------------
-
- /**
- * The in-memory portlet preferences storage: key is the preference name as
- * a string, value is an array of PortletPreference objects.
- */
- private Map<String,Map<String,PortletPreference>> storage = new HashMap<String,Map<String,PortletPreference>>();
-
- /**
- * The preferences validator cache: key is the portlet definition, value is
- * the portlet preferences validator instance.
- */
- private Map<PortletDefinition, PreferencesValidator> cache = new HashMap<PortletDefinition, PreferencesValidator>();
-
-
- // Constructor -------------------------------------------------------------
-
- /**
- * Default no-arg constructor.
- */
- public DefaultPortletPreferencesService() {
- // Do nothing.
- }
-
-
- // PortletPreferencesService Impl ------------------------------------------
-
- /**
- * Returns a map of default preferences for a PortletWindow. The default
- * preferences are retrieved from the portlet application descriptor.
- * <p>
- * Data retrieved from <code>portlet.xml</code> are injected into the domain
- * object <code>PortletPreference</code>. This method converts the domain
- * objects into <code>PortletPreference</code> objects.
- * </p>
- * <p>
- * Note that if no value is bound to a given preference key,
- * <code>PortletPreference.getValues()</code> will return an empty string
- * list, but the value array of <code>PortletPreference</code> should be set
- * to null (instead of an empty array).
- * </p>
- * <p>
- * This method never returns null, but the values held by PortletPreference
- * may be null.
- * </p>
- * @return the default preferences set
- *
- * @see org.apache.pluto.container.om.portlet.impl.PreferenceType
- */
- public Map<String,PortletPreference> getDefaultPreferences( PortletWindow portletWindow,
- PortletRequest request )
- throws PortletContainerException {
- Map<String,PortletPreference> preferences = null;
- PortletDefinition portlet = portletWindow.getPortletDefinition();
- Preferences prefs = portlet.getPortletPreferences();
- if (prefs != null && prefs.getPortletPreferences() != null) {
- preferences = new HashMap<String,PortletPreference>(prefs.getPortletPreferences().size());
- for (Preference pref : prefs.getPortletPreferences()) {
- String[] values = null;
- if (pref.getValues() != null && pref.getValues().size() > 0) {
- values = pref.getValues().toArray(new String[pref.getValues().size()]);
- }
- preferences.put(pref.getName(), new PortletPreferenceImpl(pref.getName(), values, pref.isReadOnly()));
- }
- }
- return preferences;
- }
-
- /**
- * Returns the stored portlet preferences map. The preferences managed by
- * this service should be protected from being directly accessed, so this
- * method returns a cloned copy of the stored preferences.
- *
- * @param portletWindow the portlet window.
- * @param request the portlet request from which the remote user is retrieved.
- * @return a copy of the stored portlet preferences map.
- * @throws PortletContainerException
- */
- public Map<String,PortletPreference> getStoredPreferences(
- PortletWindow portletWindow,
- PortletRequest request)
- throws PortletContainerException {
- String key = getFormattedKey(portletWindow, request);
- Map<String,PortletPreference> preferences = storage.get(key);
- if (preferences == null) {
- if (LOG.isDebugEnabled()) {
- LOG.debug("No portlet preferences found for: " + key);
- }
- return Collections.emptyMap();
- } else {
- if (LOG.isDebugEnabled()) {
- LOG.debug("Got " + preferences.size() + " stored preferences.");
- }
- return clonePreferences(preferences);
- }
- }
-
- /**
- * Stores the portlet preferences to the in-memory storage. This method
- * should be invoked after the portlet preferences are validated by the
- * preference validator (if defined).
- * <p>
- * The preferences managed by this service should be protected from being
- * directly accessed, so this method clones the passed-in preferences map
- * and saves it.
- * </p>
- *
- * @see javax.portlet.PortletPreferences#store()
- *
- * @param portletWindow the portlet window
- * @param request the portlet request from which the remote user is retrieved.
- * @param preferences the portlet preferences to store.
- * @throws PortletContainerException
- */
- public void store(PortletWindow portletWindow,
- PortletRequest request,
- Map<String,PortletPreference> preferences)
- throws PortletContainerException {
- String key = getFormattedKey(portletWindow, request);
- storage.put(key, clonePreferences(preferences));
- if (LOG.isDebugEnabled()) {
- LOG.debug("Portlet preferences stored for: " + key);
- }
- }
-
-
- // Private Methods ---------------------------------------------------------
-
- /**
- * Formats the preference key for the portlet preference using specified
- * portlet window and remote user.
- * @param portletWindow the portlet window.
- * @param request the remote request.
- */
- private String getFormattedKey(PortletWindow portletWindow,
- PortletRequest request) {
- StringBuffer buffer = new StringBuffer();
- buffer.append("user=").append(request.getRemoteUser()).append(";");
- buffer.append("portletName=").append(portletWindow.getPortletDefinition().getPortletName());
- return buffer.toString();
- }
-
- /**
- * Clones a PortletPreference map. This method performs a deep clone on
- * the passed-in portlet preferences map. Every PortletPreference object
- * in the map are cloned (via the <code>PortletPreference.clone()</code>
- * method) and injected into the new map.
- *
- * @param preferences the portlet preferences map to clone.
- * @return a deep-cloned copy of the portlet preferences map.
- */
- private Map<String,PortletPreference> clonePreferences(
- Map <String,PortletPreference> preferences) {
- if (preferences == null) {
- return null;
- }
- Map <String,PortletPreference> copy =
- new HashMap<String,PortletPreference>(preferences.size());
- for (PortletPreference p : preferences.values()) {
- copy.put(p.getName(), p.clone());
- }
- return copy;
- }
-
- public PreferencesValidator getPreferencesValidator(PortletDefinition portletDD)
- throws ValidatorException {
-
- // Try to retrieve the validator from cache.
- PreferencesValidator validator = cache.get(portletDD);
- if (validator != null) {
- return validator;
- }
-
- // Try to construct the validator instance for the portlet definition.
- Preferences portletPreferencesDD = portletDD.getPortletPreferences();
-
- if (portletPreferencesDD != null) {
- String className = portletPreferencesDD.getPreferencesValidator();
- if (className != null) {
- if (LOG.isDebugEnabled()) {
- LOG.debug("Creating preferences validator: " + className);
- }
- ClassLoader loader = Thread.currentThread().getContextClassLoader();
- try {
- Class<?> clazz = loader.loadClass(className);
- validator = (PreferencesValidator) clazz.newInstance();
- cache.put(portletDD, validator);
- } catch (InstantiationException ex) {
- LOG.error("Error instantiating validator.", ex);
- throw new ValidatorException(ex, null);
- } catch (IllegalAccessException ex) {
- LOG.error("Error instantiating validator.", ex);
- throw new ValidatorException(ex, null);
- } catch (ClassNotFoundException ex) {
- LOG.error("Error instantiating validator.", ex);
- throw new ValidatorException(ex, null);
- } catch (ClassCastException ex) {
- LOG.error("Error casting instance to PreferencesValidator.", ex);
- throw new ValidatorException(ex, null);
- }
- }
- }
- return validator;
- }
-
-}
+/*
+ * 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.driver.container;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.portlet.PortletRequest;
+import javax.portlet.PreferencesValidator;
+import javax.portlet.ValidatorException;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.apache.pluto.container.PortletPreference;
+import org.apache.pluto.container.PortletContainerException;
+import org.apache.pluto.container.PortletPreferencesService;
+import org.apache.pluto.container.PortletWindow;
+import org.apache.pluto.container.impl.PortletPreferenceImpl;
+import org.apache.pluto.container.om.portlet.PortletDefinition;
+import org.apache.pluto.container.om.portlet.Preference;
+import org.apache.pluto.container.om.portlet.Preferences;
+
+/**
+ * Default implementation of the portlet preferences service. The portlet
+ * preferences service is a singleton held by the pluto portlet container.
+ *
+ * @see javax.portlet.PortletPreferences
+ * @see org.apache.pluto.container.impl.PortletPreferencesImpl
+ * @see javax.portlet.PortletPreferences
+ *
+ */
+public class DefaultPortletPreferencesService
+implements PortletPreferencesService {
+
+ /** Logger. */
+ private static final Logger LOG = LoggerFactory.getLogger(
+ DefaultPortletPreferencesService.class);
+
+
+ // Private Member Variables ------------------------------------------------
+
+ /**
+ * The in-memory portlet preferences storage: key is the preference name as
+ * a string, value is an array of PortletPreference objects.
+ */
+ private Map<String,Map<String,PortletPreference>> storage = new HashMap<String,Map<String,PortletPreference>>();
+
+ /**
+ * The preferences validator cache: key is the portlet definition, value is
+ * the portlet preferences validator instance.
+ */
+ private Map<PortletDefinition, PreferencesValidator> cache = new HashMap<PortletDefinition, PreferencesValidator>();
+
+
+ // Constructor -------------------------------------------------------------
+
+ /**
+ * Default no-arg constructor.
+ */
+ public DefaultPortletPreferencesService() {
+ // Do nothing.
+ }
+
+
+ // PortletPreferencesService Impl ------------------------------------------
+
+ /**
+ * Returns a map of default preferences for a PortletWindow. The default
+ * preferences are retrieved from the portlet application descriptor.
+ * <p>
+ * Data retrieved from <code>portlet.xml</code> are injected into the domain
+ * object <code>PortletPreference</code>. This method converts the domain
+ * objects into <code>PortletPreference</code> objects.
+ * </p>
+ * <p>
+ * Note that if no value is bound to a given preference key,
+ * <code>PortletPreference.getValues()</code> will return an empty string
+ * list, but the value array of <code>PortletPreference</code> should be set
+ * to null (instead of an empty array).
+ * </p>
+ * <p>
+ * This method never returns null, but the values held by PortletPreference
+ * may be null.
+ * </p>
+ * @return the default preferences set
+ *
+ * @see org.apache.pluto.container.om.portlet20.impl.PreferenceType
+ */
+ public Map<String,PortletPreference> getDefaultPreferences( PortletWindow portletWindow,
+ PortletRequest request )
+ throws PortletContainerException {
+ Map<String,PortletPreference> preferences = null;
+ PortletDefinition portlet = portletWindow.getPortletDefinition();
+ Preferences prefs = portlet.getPortletPreferences();
+ if (prefs != null && prefs.getPortletPreferences() != null) {
+ preferences = new HashMap<String,PortletPreference>(prefs.getPortletPreferences().size());
+ for (Preference pref : prefs.getPortletPreferences()) {
+ String[] values = null;
+ if (pref.getValues() != null && pref.getValues().size() > 0) {
+ values = pref.getValues().toArray(new String[pref.getValues().size()]);
+ }
+ preferences.put(pref.getName(), new PortletPreferenceImpl(pref.getName(), values, pref.isReadOnly()));
+ }
+ }
+ return preferences;
+ }
+
+ /**
+ * Returns the stored portlet preferences map. The preferences managed by
+ * this service should be protected from being directly accessed, so this
+ * method returns a cloned copy of the stored preferences.
+ *
+ * @param portletWindow the portlet window.
+ * @param request the portlet request from which the remote user is retrieved.
+ * @return a copy of the stored portlet preferences map.
+ * @throws PortletContainerException
+ */
+ public Map<String,PortletPreference> getStoredPreferences(
+ PortletWindow portletWindow,
+ PortletRequest request)
+ throws PortletContainerException {
+ String key = getFormattedKey(portletWindow, request);
+ Map<String,PortletPreference> preferences = storage.get(key);
+ if (preferences == null) {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("No portlet preferences found for: " + key);
+ }
+ return Collections.emptyMap();
+ } else {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Got " + preferences.size() + " stored preferences.");
+ }
+ return clonePreferences(preferences);
+ }
+ }
+
+ /**
+ * Stores the portlet preferences to the in-memory storage. This method
+ * should be invoked after the portlet preferences are validated by the
+ * preference validator (if defined).
+ * <p>
+ * The preferences managed by this service should be protected from being
+ * directly accessed, so this method clones the passed-in preferences map
+ * and saves it.
+ * </p>
+ *
+ * @see javax.portlet.PortletPreferences#store()
+ *
+ * @param portletWindow the portlet window
+ * @param request the portlet request from which the remote user is retrieved.
+ * @param preferences the portlet preferences to store.
+ * @throws PortletContainerException
+ */
+ public void store(PortletWindow portletWindow,
+ PortletRequest request,
+ Map<String,PortletPreference> preferences)
+ throws PortletContainerException {
+ String key = getFormattedKey(portletWindow, request);
+ storage.put(key, clonePreferences(preferences));
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Portlet preferences stored for: " + key);
+ }
+ }
+
+
+ // Private Methods ---------------------------------------------------------
+
+ /**
+ * Formats the preference key for the portlet preference using specified
+ * portlet window and remote user.
+ * @param portletWindow the portlet window.
+ * @param request the remote request.
+ */
+ private String getFormattedKey(PortletWindow portletWindow,
+ PortletRequest request) {
+ StringBuffer buffer = new StringBuffer();
+ buffer.append("user=").append(request.getRemoteUser()).append(";");
+ buffer.append("portletName=").append(portletWindow.getPortletDefinition().getPortletName());
+ return buffer.toString();
+ }
+
+ /**
+ * Clones a PortletPreference map. This method performs a deep clone on
+ * the passed-in portlet preferences map. Every PortletPreference object
+ * in the map are cloned (via the <code>PortletPreference.clone()</code>
+ * method) and injected into the new map.
+ *
+ * @param preferences the portlet preferences map to clone.
+ * @return a deep-cloned copy of the portlet preferences map.
+ */
+ private Map<String,PortletPreference> clonePreferences(
+ Map <String,PortletPreference> preferences) {
+ if (preferences == null) {
+ return null;
+ }
+ Map <String,PortletPreference> copy =
+ new HashMap<String,PortletPreference>(preferences.size());
+ for (PortletPreference p : preferences.values()) {
+ copy.put(p.getName(), p.clone());
+ }
+ return copy;
+ }
+
+ public PreferencesValidator getPreferencesValidator(PortletDefinition portletDD)
+ throws ValidatorException {
+
+ // Try to retrieve the validator from cache.
+ PreferencesValidator validator = cache.get(portletDD);
+ if (validator != null) {
+ return validator;
+ }
+
+ // Try to construct the validator instance for the portlet definition.
+ Preferences portletPreferencesDD = portletDD.getPortletPreferences();
+
+ if (portletPreferencesDD != null) {
+ String className = portletPreferencesDD.getPreferencesValidator();
+ if (className != null) {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Creating preferences validator: " + className);
+ }
+ ClassLoader loader = Thread.currentThread().getContextClassLoader();
+ try {
+ Class<?> clazz = loader.loadClass(className);
+ validator = (PreferencesValidator) clazz.newInstance();
+ cache.put(portletDD, validator);
+ } catch (InstantiationException ex) {
+ LOG.error("Error instantiating validator.", ex);
+ throw new ValidatorException(ex, null);
+ } catch (IllegalAccessException ex) {
+ LOG.error("Error instantiating validator.", ex);
+ throw new ValidatorException(ex, null);
+ } catch (ClassNotFoundException ex) {
+ LOG.error("Error instantiating validator.", ex);
+ throw new ValidatorException(ex, null);
+ } catch (ClassCastException ex) {
+ LOG.error("Error casting instance to PreferencesValidator.", ex);
+ throw new ValidatorException(ex, null);
+ }
+ }
+ }
+ return validator;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/a8bed7fb/pluto-portal-driver/src/test/java/org/apache/pluto/driver/container/ResourceBundleFactoryTest.java
----------------------------------------------------------------------
diff --git a/pluto-portal-driver/src/test/java/org/apache/pluto/driver/container/ResourceBundleFactoryTest.java b/pluto-portal-driver/src/test/java/org/apache/pluto/driver/container/ResourceBundleFactoryTest.java
index e41f32f..8654d4b 100644
--- a/pluto-portal-driver/src/test/java/org/apache/pluto/driver/container/ResourceBundleFactoryTest.java
+++ b/pluto-portal-driver/src/test/java/org/apache/pluto/driver/container/ResourceBundleFactoryTest.java
@@ -1,132 +1,132 @@
-/*
- * 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.driver.container;
-
-import java.util.ListResourceBundle;
-import java.util.Locale;
-import java.util.ResourceBundle;
-
-import junit.framework.Assert;
-
-import org.apache.pluto.container.om.portlet.PortletDefinition;
-import org.apache.pluto.container.om.portlet.PortletInfo;
-import org.apache.pluto.container.om.portlet.impl.PortletType;
-import org.apache.pluto.driver.container.ResourceBundleFactory;
-
-/**
- * Unit test for the resource bundle factory.
- * @since Jul 30, 2005
- */
-public class ResourceBundleFactoryTest extends PlutoTestCase {
-
- private PortletDefinition validDD;
-
- public void setUp() throws Exception {
- super.setUp();
-
- validDD = new PortletType();
-
- PortletInfo info = validDD.getPortletInfo();
- info.setTitle("Info Title");
- info.setShortTitle("Info Short Title");
- info.setKeywords("Info Keywords");
- validDD.setResourceBundle(TestResourceBundle.class.getName());
- }
-
- public void tearDown() throws Exception {
- super.setUp();
- validDD = null;
- }
-
- public void testGetBundleAllSpecified() {
- ResourceBundleFactory factory = new ResourceBundleFactory(validDD, validDD.getPortletInfo());
- ResourceBundle bundle = factory.getResourceBundle(Locale.getDefault());
-
- Assert.assertEquals("Bundle Title", bundle.getString("javax.portlet.title"));
- Assert.assertEquals("Bundle Short Title", bundle.getString("javax.portlet.short-title"));
- Assert.assertEquals("Bundle Keywords", bundle.getString("javax.portlet.keywords"));
- }
-
- public void testGetResourceBundleNoBundle() {
- validDD.setResourceBundle(null);
- ResourceBundleFactory factory = new ResourceBundleFactory(validDD, validDD.getPortletInfo());
- ResourceBundle bundle = factory.getResourceBundle(Locale.getDefault());
-
- Assert.assertEquals("Info Title", bundle.getString("javax.portlet.title"));
- Assert.assertEquals("Info Short Title", bundle.getString("javax.portlet.short-title"));
- Assert.assertEquals("Info Keywords", bundle.getString("javax.portlet.keywords"));
- }
-
- public void testGetResourceBundleNoInfo() {
- ResourceBundleFactory factory = new ResourceBundleFactory(validDD, validDD.getPortletInfo());
- ResourceBundle bundle = factory.getResourceBundle(Locale.getDefault());
-
- Assert.assertEquals("Bundle Title", bundle.getString("javax.portlet.title"));
- Assert.assertEquals("Bundle Short Title", bundle.getString("javax.portlet.short-title"));
- Assert.assertEquals("Bundle Keywords", bundle.getString("javax.portlet.keywords"));
- }
-
- public void testGetResourceBundleNoBundleNullValues() {
- validDD.setResourceBundle(null);
- validDD.getPortletInfo().setTitle(null);
- validDD.getPortletInfo().setShortTitle(null);
- validDD.getPortletInfo().setKeywords(null);
- ResourceBundleFactory factory = new ResourceBundleFactory(validDD, validDD.getPortletInfo());
- ResourceBundle bundle = factory.getResourceBundle(Locale.getDefault());
-
- try {
- Assert.assertEquals(null, bundle.getString("javax.portlet.title"));
- fail("Exception should have been thrown.");
- }
- catch(Throwable t) {
-
- }
-
- try {
- Assert.assertEquals(null, bundle.getString("javax.portlet.short-title"));
- fail("Exception should have been throw.");
- }
- catch(Throwable t) {
-
- }
-
- try {
- Assert.assertEquals(null, bundle.getString("javax.portlet.keywords"));
- fail("Exception should have been thrown.");
- }
- catch(Throwable t) {
-
- }
- }
-
-
- public static class TestResourceBundle extends ListResourceBundle {
-
- private Object[][] contents = {
- {"javax.portlet.title", "Bundle Title"},
- {"javax.portlet.short-title", "Bundle Short Title"},
- {"javax.portlet.keywords", "Bundle Keywords"}
- };
-
- protected Object[][] getContents() {
- return contents;
- }
- }
-
-
-
-}
+/*
+ * 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.driver.container;
+
+import java.util.ListResourceBundle;
+import java.util.Locale;
+import java.util.ResourceBundle;
+
+import junit.framework.Assert;
+
+import org.apache.pluto.container.om.portlet.PortletDefinition;
+import org.apache.pluto.container.om.portlet.PortletInfo;
+import org.apache.pluto.container.om.portlet20.impl.PortletType;
+import org.apache.pluto.driver.container.ResourceBundleFactory;
+
+/**
+ * Unit test for the resource bundle factory.
+ * @since Jul 30, 2005
+ */
+public class ResourceBundleFactoryTest extends PlutoTestCase {
+
+ private PortletDefinition validDD;
+
+ public void setUp() throws Exception {
+ super.setUp();
+
+ validDD = new PortletType();
+
+ PortletInfo info = validDD.getPortletInfo();
+ info.setTitle("Info Title");
+ info.setShortTitle("Info Short Title");
+ info.setKeywords("Info Keywords");
+ validDD.setResourceBundle(TestResourceBundle.class.getName());
+ }
+
+ public void tearDown() throws Exception {
+ super.setUp();
+ validDD = null;
+ }
+
+ public void testGetBundleAllSpecified() {
+ ResourceBundleFactory factory = new ResourceBundleFactory(validDD, validDD.getPortletInfo());
+ ResourceBundle bundle = factory.getResourceBundle(Locale.getDefault());
+
+ Assert.assertEquals("Bundle Title", bundle.getString("javax.portlet.title"));
+ Assert.assertEquals("Bundle Short Title", bundle.getString("javax.portlet.short-title"));
+ Assert.assertEquals("Bundle Keywords", bundle.getString("javax.portlet.keywords"));
+ }
+
+ public void testGetResourceBundleNoBundle() {
+ validDD.setResourceBundle(null);
+ ResourceBundleFactory factory = new ResourceBundleFactory(validDD, validDD.getPortletInfo());
+ ResourceBundle bundle = factory.getResourceBundle(Locale.getDefault());
+
+ Assert.assertEquals("Info Title", bundle.getString("javax.portlet.title"));
+ Assert.assertEquals("Info Short Title", bundle.getString("javax.portlet.short-title"));
+ Assert.assertEquals("Info Keywords", bundle.getString("javax.portlet.keywords"));
+ }
+
+ public void testGetResourceBundleNoInfo() {
+ ResourceBundleFactory factory = new ResourceBundleFactory(validDD, validDD.getPortletInfo());
+ ResourceBundle bundle = factory.getResourceBundle(Locale.getDefault());
+
+ Assert.assertEquals("Bundle Title", bundle.getString("javax.portlet.title"));
+ Assert.assertEquals("Bundle Short Title", bundle.getString("javax.portlet.short-title"));
+ Assert.assertEquals("Bundle Keywords", bundle.getString("javax.portlet.keywords"));
+ }
+
+ public void testGetResourceBundleNoBundleNullValues() {
+ validDD.setResourceBundle(null);
+ validDD.getPortletInfo().setTitle(null);
+ validDD.getPortletInfo().setShortTitle(null);
+ validDD.getPortletInfo().setKeywords(null);
+ ResourceBundleFactory factory = new ResourceBundleFactory(validDD, validDD.getPortletInfo());
+ ResourceBundle bundle = factory.getResourceBundle(Locale.getDefault());
+
+ try {
+ Assert.assertEquals(null, bundle.getString("javax.portlet.title"));
+ fail("Exception should have been thrown.");
+ }
+ catch(Throwable t) {
+
+ }
+
+ try {
+ Assert.assertEquals(null, bundle.getString("javax.portlet.short-title"));
+ fail("Exception should have been throw.");
+ }
+ catch(Throwable t) {
+
+ }
+
+ try {
+ Assert.assertEquals(null, bundle.getString("javax.portlet.keywords"));
+ fail("Exception should have been thrown.");
+ }
+ catch(Throwable t) {
+
+ }
+ }
+
+
+ public static class TestResourceBundle extends ListResourceBundle {
+
+ private Object[][] contents = {
+ {"javax.portlet.title", "Bundle Title"},
+ {"javax.portlet.short-title", "Bundle Short Title"},
+ {"javax.portlet.keywords", "Bundle Keywords"}
+ };
+
+ protected Object[][] getContents() {
+ return contents;
+ }
+ }
+
+
+
+}
[08/14] portals-pluto git commit: Initial adaptation of Container
JAXB code allowing a v3.0 deployement descriptor to be read
Posted by ms...@apache.org.
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/d2574528/pluto-container/src/main/java/org/apache/pluto/container/om/portlet30/impl/UserDataConstraintType.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet30/impl/UserDataConstraintType.java b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet30/impl/UserDataConstraintType.java
new file mode 100644
index 0000000..2eaf68c
--- /dev/null
+++ b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet30/impl/UserDataConstraintType.java
@@ -0,0 +1,107 @@
+/*
+ * 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.portlet30.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Locale;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+
+import org.apache.pluto.container.om.portlet.Description;
+import org.apache.pluto.container.om.portlet.UserDataConstraint;
+
+/**
+ * The user-data-constraintType is used to indicate how data communicated between the client and portlet should be
+ * protected. Used in: security-constraint <p>Java class for user-data-constraintType complex type. <p>The following
+ * schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * <complexType name="user-data-constraintType">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="description" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}descriptionType" maxOccurs="unbounded" minOccurs="0"/>
+ * <element name="transport-guarantee" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}transport-guaranteeType"/>
+ * </sequence>
+ * <attribute name="id" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}string" />
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ * @version $Id$
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "user-data-constraintType", propOrder = { "description", "transportGuarantee" })
+public class UserDataConstraintType implements UserDataConstraint
+{
+ @XmlElement(name = "description")
+ protected List<DescriptionType> description;
+ @XmlElement(name = "transport-guarantee", required = true)
+ @XmlJavaTypeAdapter(value=CollapsedStringAdapter.class)
+ protected String transportGuarantee;
+
+ public Description getDescription(Locale locale)
+ {
+ for (Description d : getDescriptions())
+ {
+ if (d.getLocale().equals(locale))
+ {
+ return d;
+ }
+ }
+ return null;
+ }
+
+ public List<? extends Description> getDescriptions()
+ {
+ if (description == null)
+ {
+ description = new ArrayList<DescriptionType>();
+ }
+ return description;
+ }
+
+ public Description addDescription(String lang)
+ {
+ DescriptionType d = new DescriptionType();
+ d.setLang(lang);
+ if (getDescription(d.getLocale()) != null)
+ {
+ throw new IllegalArgumentException("Description for language: "+d.getLocale()+" already defined");
+ }
+ getDescriptions();
+ description.add(d);
+ return d;
+ }
+
+ public String getTransportGuarantee()
+ {
+ return transportGuarantee;
+ }
+
+ public void setTransportGuarantee(String value)
+ {
+ transportGuarantee = value;
+ }
+}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/d2574528/pluto-container/src/main/java/org/apache/pluto/container/om/portlet30/impl/package-info.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet30/impl/package-info.java b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet30/impl/package-info.java
new file mode 100644
index 0000000..2d2d07e
--- /dev/null
+++ b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet30/impl/package-info.java
@@ -0,0 +1,21 @@
+/*
+ * 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.
+ *
+ * @version $Id$
+ */
+@javax.xml.bind.annotation.XmlSchema(namespace = "http://java.sun.com/xml/ns/portlet/portlet-app_3_0.xsd", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
+package org.apache.pluto.container.om.portlet30.impl;
+
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/d2574528/pluto-container/src/main/resources/org/apache/pluto/container/impl/portlet-app_3_0.xsd
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/resources/org/apache/pluto/container/impl/portlet-app_3_0.xsd b/pluto-container/src/main/resources/org/apache/pluto/container/impl/portlet-app_3_0.xsd
new file mode 100644
index 0000000..65ccac8
--- /dev/null
+++ b/pluto-container/src/main/resources/org/apache/pluto/container/impl/portlet-app_3_0.xsd
@@ -0,0 +1,830 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:portlet="http://java.sun.com/xml/ns/portlet/portlet-app_3_0.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://java.sun.com/xml/ns/portlet/portlet-app_3_0.xsd" elementFormDefault="qualified" attributeFormDefault="unqualified" version="3.0" xml:lang="en">
+ <annotation>
+ <documentation>
+ This is the XML Schema for the Portlet 3.0 deployment descriptor.
+ </documentation>
+ </annotation>
+ <annotation>
+ <documentation>
+ The following conventions apply to all J2EE
+ deployment descriptor elements unless indicated otherwise.
+ - In elements that specify a pathname to a file within the
+ same JAR file, relative filenames (i.e., those not
+ starting with "/") are considered relative to the root of
+ the JAR file's namespace. Absolute filenames (i.e., those
+ starting with "/") also specify names in the root of the
+ JAR file's namespace. In general, relative names are
+ preferred. The exception is .war files where absolute
+ names are preferred for consistency with the Servlet API.
+ </documentation>
+ </annotation>
+ <!-- *********************************************************** -->
+ <import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="http://www.w3.org/2001/xml.xsd"/>
+ <element name="portlet-app" type="portlet:portlet-appType">
+ <annotation>
+ <documentation>
+ The portlet-app element is the root of the deployment descriptor
+ for a portlet application. This element has a required attribute version
+ to specify to which version of the schema the deployment descriptor
+ conforms. In order to be a valid JSR 286 portlet application the version
+ must have the value "3.0".
+ </documentation>
+ </annotation>
+ <unique name="portlet-name-uniqueness">
+ <annotation>
+ <documentation>
+ The portlet element contains the name of a portlet.
+ This name must be unique within the portlet application.
+ </documentation>
+ </annotation>
+ <selector xpath="portlet:portlet"/>
+ <field xpath="portlet:portlet-name"/>
+ </unique>
+ <unique name="custom-portlet-mode-uniqueness">
+ <annotation>
+ <documentation>
+ The custom-portlet-mode element contains the portlet-mode.
+ This portlet mode must be unique within the portlet application.
+ </documentation>
+ </annotation>
+ <selector xpath="portlet:custom-portlet-mode"/>
+ <field xpath="portlet:portlet-mode"/>
+ </unique>
+ <unique name="custom-window-state-uniqueness">
+ <annotation>
+ <documentation>
+ The custom-window-state element contains the window-state.
+ This window state must be unique within the portlet application.
+ </documentation>
+ </annotation>
+ <selector xpath="portlet:custom-window-state"/>
+ <field xpath="portlet:window-state"/>
+ </unique>
+ <unique name="user-attribute-name-uniqueness">
+ <annotation>
+ <documentation>
+ The user-attribute element contains the name the attribute.
+ This name must be unique within the portlet application.
+ </documentation>
+ </annotation>
+ <selector xpath="portlet:user-attribute"/>
+ <field xpath="portlet:name"/>
+ </unique>
+ <unique name="filter-name-uniqueness">
+ <annotation>
+ <documentation>
+ The filter element contains the name of a filter.
+ The name must be unique within the portlet application.
+ </documentation>
+ </annotation>
+ <selector xpath="portlet:filter"/>
+ <field xpath="portlet:filter-name"/>
+ </unique>
+ </element>
+ <complexType name="portlet-appType">
+ <sequence>
+ <element name="portlet" type="portlet:portletType" minOccurs="0" maxOccurs="unbounded">
+ <unique name="init-param-name-uniqueness">
+ <annotation>
+ <documentation>
+ The init-param element contains the name the attribute.
+ This name must be unique within the portlet.
+ </documentation>
+ </annotation>
+ <selector xpath="portlet:init-param"/>
+ <field xpath="portlet:name"/>
+ </unique>
+ <unique name="supports-mime-type-uniqueness">
+ <annotation>
+ <documentation>
+ The supports element contains the supported mime-type.
+ This mime type must be unique within the portlet.
+ </documentation>
+ </annotation>
+ <selector xpath="portlet:supports"/>
+ <field xpath="mime-type"/>
+ </unique>
+ <unique name="preference-name-uniqueness">
+ <annotation>
+ <documentation>
+ The preference element contains the name the preference.
+ This name must be unique within the portlet.
+ </documentation>
+ </annotation>
+ <selector xpath="portlet:portlet-preferences/portlet:preference"/>
+ <field xpath="portlet:name"/>
+ </unique>
+ <unique name="security-role-ref-name-uniqueness">
+ <annotation>
+ <documentation>
+ The security-role-ref element contains the role-name.
+ This role name must be unique within the portlet.
+ </documentation>
+ </annotation>
+ <selector xpath="portlet:security-role-ref"/>
+ <field xpath="portlet:role-name"/>
+ </unique>
+ </element>
+ <element name="custom-portlet-mode" type="portlet:custom-portlet-modeType" minOccurs="0" maxOccurs="unbounded"/>
+ <element name="custom-window-state" type="portlet:custom-window-stateType" minOccurs="0" maxOccurs="unbounded"/>
+ <element name="user-attribute" type="portlet:user-attributeType" minOccurs="0" maxOccurs="unbounded"/>
+ <element name="security-constraint" type="portlet:security-constraintType" minOccurs="0" maxOccurs="unbounded"/>
+ <element name="resource-bundle" type="portlet:resource-bundleType" minOccurs="0"/>
+ <element name="filter" type="portlet:filterType" minOccurs="0" maxOccurs="unbounded"/>
+ <element name="filter-mapping" type="portlet:filter-mappingType" minOccurs="0" maxOccurs="unbounded"/>
+ <element name="default-namespace" type="xs:anyURI" minOccurs="0"/>
+ <element name="event-definition" type="portlet:event-definitionType" minOccurs="0" maxOccurs="unbounded"/>
+ <element name="public-render-parameter" type="portlet:public-render-parameterType" minOccurs="0" maxOccurs="unbounded"/>
+ <element name="listener" type="portlet:listenerType" minOccurs="0" maxOccurs="unbounded"/>
+ <element name="container-runtime-option" type="portlet:container-runtime-optionType" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="version" type="portlet:string" use="required"/>
+ <attribute name="id" type="portlet:string" use="optional"/>
+ </complexType>
+ <complexType name="cache-scopeType">
+ <annotation>
+ <documentation>
+ Caching scope, allowed values are "private" indicating that the content should not be shared
+ across users and "public" indicating that the content may be shared across users.
+ The default value if not present is "private".
+ Used in: portlet
+ </documentation>
+ </annotation>
+ <simpleContent>
+ <extension base="portlet:string"/>
+ </simpleContent>
+ </complexType>
+ <complexType name="custom-portlet-modeType">
+ <annotation>
+ <documentation>
+ A custom portlet mode that one or more portlets in
+ this portlet application supports.
+ If the portal does not need to provide some management functionality
+ for this portlet mode, the portal-managed element needs to be set
+ to "false", otherwise to "true". Default is "true".
+ Used in: portlet-app
+ </documentation>
+ </annotation>
+ <sequence>
+ <element name="description" type="portlet:descriptionType" minOccurs="0" maxOccurs="unbounded"/>
+ <element name="portlet-mode" type="portlet:portlet-modeType"/>
+ <element name="portal-managed" type="portlet:portal-managedType" minOccurs="0"/>
+ </sequence>
+ <attribute name="id" type="portlet:string" use="optional"/>
+ </complexType>
+ <complexType name="custom-window-stateType">
+ <annotation>
+ <documentation>
+ A custom window state that one or more portlets in this
+ portlet application supports.
+ Used in: portlet-app
+ </documentation>
+ </annotation>
+ <sequence>
+ <element name="description" type="portlet:descriptionType" minOccurs="0" maxOccurs="unbounded"/>
+ <element name="window-state" type="portlet:window-stateType"/>
+ </sequence>
+ <attribute name="id" type="portlet:string" use="optional"/>
+ </complexType>
+ <complexType name="expiration-cacheType">
+ <annotation>
+ <documentation>
+ Expiration-time defines the time in seconds after which the portlet output expires.
+ -1 indicates that the output never expires.
+ Used in: portlet
+ </documentation>
+ </annotation>
+ <simpleContent>
+ <extension base="int"/>
+ </simpleContent>
+ </complexType>
+ <complexType name="init-paramType">
+ <annotation>
+ <documentation>
+ The init-param element contains a name/value pair as an
+ initialization param of the portlet
+ Used in:portlet
+ </documentation>
+ </annotation>
+ <sequence>
+ <element name="description" type="portlet:descriptionType" minOccurs="0" maxOccurs="unbounded"/>
+ <element name="name" type="portlet:nameType"/>
+ <element name="value" type="portlet:valueType"/>
+ </sequence>
+ <attribute name="id" type="portlet:string" use="optional"/>
+ </complexType>
+ <complexType name="keywordsType">
+ <annotation>
+ <documentation>
+ Locale specific keywords associated with this portlet.
+ The kewords are separated by commas.
+ Used in: portlet-info
+ </documentation>
+ </annotation>
+ <simpleContent>
+ <extension base="portlet:string"/>
+ </simpleContent>
+ </complexType>
+ <complexType name="mime-typeType">
+ <annotation>
+ <documentation>
+ MIME type name, e.g. "text/html".
+ The MIME type may also contain the wildcard
+ character '*', like "text/*" or "*/*".
+ Used in: supports
+ </documentation>
+ </annotation>
+ <simpleContent>
+ <extension base="portlet:string"/>
+ </simpleContent>
+ </complexType>
+ <complexType name="nameType">
+ <annotation>
+ <documentation>
+ The name element contains the name of a parameter.
+ Used in: init-param, ...
+ </documentation>
+ </annotation>
+ <simpleContent>
+ <extension base="portlet:string"/>
+ </simpleContent>
+ </complexType>
+ <complexType name="portletType">
+ <annotation>
+ <documentation>
+ The portlet element contains the declarative data of a portlet.
+ Used in: portlet-app
+ </documentation>
+ </annotation>
+ <sequence>
+ <element name="description" type="portlet:descriptionType" minOccurs="0" maxOccurs="unbounded"/>
+ <element name="portlet-name" type="portlet:portlet-nameType"/>
+ <element name="display-name" type="portlet:display-nameType" minOccurs="0" maxOccurs="unbounded"/>
+ <element name="portlet-class" type="portlet:portlet-classType"/>
+ <element name="init-param" type="portlet:init-paramType" minOccurs="0" maxOccurs="unbounded"/>
+ <element name="expiration-cache" type="portlet:expiration-cacheType" minOccurs="0"/>
+ <element name="cache-scope" type="portlet:cache-scopeType" minOccurs="0"/>
+ <element name="supports" type="portlet:supportsType" maxOccurs="unbounded"/>
+ <element name="supported-locale" type="portlet:supported-localeType" minOccurs="0" maxOccurs="unbounded"/>
+ <element name="resource-bundle" type="portlet:resource-bundleType" minOccurs="0"/>
+ <element name="portlet-info" type="portlet:portlet-infoType" minOccurs="0"/>
+ <element name="portlet-preferences" type="portlet:portlet-preferencesType" minOccurs="0"/>
+ <element name="security-role-ref" type="portlet:security-role-refType" minOccurs="0" maxOccurs="unbounded"/>
+ <element name="supported-processing-event" type="portlet:event-definition-referenceType" minOccurs="0" maxOccurs="unbounded"/>
+ <element name="supported-publishing-event" type="portlet:event-definition-referenceType" minOccurs="0" maxOccurs="unbounded"/>
+ <element name="supported-public-render-parameter" type="portlet:string" minOccurs="0" maxOccurs="unbounded"/>
+ <element name="container-runtime-option" type="portlet:container-runtime-optionType" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="id" type="portlet:string" use="optional"/>
+ </complexType>
+ <simpleType name="portlet-classType">
+ <annotation>
+ <documentation>
+ The portlet-class element contains the fully
+ qualified class name of the portlet.
+ Used in: portlet
+ </documentation>
+ </annotation>
+ <restriction base="portlet:fully-qualified-classType"/>
+ </simpleType>
+ <complexType name="container-runtime-optionType">
+ <annotation>
+ <documentation>
+ The container-runtime-option element contains settings
+ for the portlet container that the portlet expects to be honored
+ at runtime. These settings may re-define default portlet container
+ behavior, like the javax.portlet.escapeXml setting that disables
+ XML encoding of URLs produced by the portlet tag library as
+ default.
+ Names with the javax.portlet prefix are reserved for the Java
+ Portlet Specification.
+ Used in: portlet-app, portlet
+ </documentation>
+ </annotation>
+ <sequence>
+ <element name="name" type="portlet:nameType"/>
+ <element name="value" type="portlet:valueType" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ <complexType name="filter-mappingType">
+ <annotation>
+ <documentation>
+ Declaration of the filter mappings in this portlet
+ application is done by using filter-mappingType.
+ The container uses the filter-mapping
+ declarations to decide which filters to apply to a request,
+ and in what order. To determine which filters to
+ apply it matches filter-mapping declarations on the
+ portlet-name and the lifecyle phase defined in the
+ filter element. The order in which filters are invoked
+ is the order in which filter-mapping declarations
+ that match appear in the list of filter-mapping elements.
+ Used in: portlet-app
+ </documentation>
+ </annotation>
+ <sequence>
+ <element name="filter-name" type="portlet:filter-nameType"/>
+ <element name="portlet-name" type="portlet:portlet-nameType" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ <complexType name="filterType">
+ <annotation>
+ <documentation>
+ The filter element specifies a filter that can transform the
+ content of portlet requests and portlet responses.
+ Filters can access the initialization parameters declared in
+ the deployment descriptor at runtime via the FilterConfig
+ interface.
+ A filter can be restricted to one or more lifecycle phases
+ of the portlet. Valid entries for lifecycle are:
+ ACTION_PHASE, EVENT_PHASE, RENDER_PHASE,
+ RESOURCE_PHASE
+ Used in: portlet-app
+ </documentation>
+ </annotation>
+ <sequence>
+ <element name="description" type="portlet:descriptionType" minOccurs="0" maxOccurs="unbounded"/>
+ <element name="display-name" type="portlet:display-nameType" minOccurs="0" maxOccurs="unbounded"/>
+ <element name="filter-name" type="portlet:filter-nameType"/>
+ <element name="filter-class" type="portlet:fully-qualified-classType"/>
+ <element name="lifecycle" type="portlet:string" maxOccurs="unbounded"/>
+ <element name="init-param" type="portlet:init-paramType" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ <complexType name="portlet-collectionType">
+ <annotation>
+ <documentation>
+ The portlet-collectionType is used to identify a subset
+ of portlets within a portlet application to which a
+ security constraint applies.
+ Used in: security-constraint
+ </documentation>
+ </annotation>
+ <sequence>
+ <element name="portlet-name" type="portlet:portlet-nameType" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ <complexType name="event-definitionType">
+ <annotation>
+ <documentation>
+ The event-definitionType is used to declare events the portlet can either
+ receive or emit.
+ The name must be unique and must be the one the
+ portlet is using in its code for referencing this event.
+ Used in: portlet-app
+ </documentation>
+ </annotation>
+ <sequence>
+ <element name="description" type="portlet:descriptionType" minOccurs="0" maxOccurs="unbounded"/>
+ <choice>
+ <element name="qname" type="xs:QName"/>
+ <element name="name" type="xs:NCName"/>
+ </choice>
+ <element name="alias" type="xs:QName" minOccurs="0" maxOccurs="unbounded"/>
+ <element name="value-type" type="portlet:fully-qualified-classType" minOccurs="0"/>
+ </sequence>
+ <attribute name="id" type="portlet:string" use="optional"/>
+ </complexType>
+ <complexType name="event-definition-referenceType">
+ <annotation>
+ <documentation>
+ The event-definition-referenceType is used to reference events
+ declared with the event-definition element at application level.
+ Used in: portlet
+ </documentation>
+ </annotation>
+ <choice>
+ <element name="qname" type="xs:QName"/>
+ <element name="name" type="xs:NCName"/>
+ </choice>
+ <attribute name="id" type="portlet:string" use="optional"/>
+ </complexType>
+ <complexType name="listenerType">
+ <annotation>
+ <documentation>
+ The listenerType is used to declare listeners for this portlet application.
+ Used in: portlet-app
+ </documentation>
+ </annotation>
+ <sequence>
+ <element name="description" type="portlet:descriptionType" minOccurs="0" maxOccurs="unbounded"/>
+ <element name="display-name" type="portlet:display-nameType" minOccurs="0" maxOccurs="unbounded"/>
+ <element name="listener-class" type="portlet:fully-qualified-classType"/>
+ </sequence>
+ <attribute name="id" type="portlet:string" use="optional"/>
+ </complexType>
+ <complexType name="portlet-infoType">
+ <sequence>
+ <element name="title" type="portlet:titleType" minOccurs="0"/>
+ <element name="short-title" type="portlet:short-titleType" minOccurs="0"/>
+ <element name="keywords" type="portlet:keywordsType" minOccurs="0"/>
+ </sequence>
+ <attribute name="id" type="portlet:string" use="optional"/>
+ </complexType>
+ <simpleType name="portal-managedType">
+ <annotation>
+ <documentation>
+ portal-managed indicates if a custom portlet mode
+ needs to be managed by the portal or not.
+ Per default all custom portlet modes are portal managed.
+ Valid values are:
+ - true for portal-managed
+ - false for not portal managed
+ Used in: custom-portlet-modes
+ </documentation>
+ </annotation>
+ <restriction base="portlet:string">
+ <enumeration value="true"/>
+ <enumeration value="false"/>
+ </restriction>
+ </simpleType>
+ <complexType name="portlet-modeType">
+ <annotation>
+ <documentation>
+ Portlet modes. The specification pre-defines the following values
+ as valid portlet mode constants:
+ "edit", "help", "view".
+ Portlet mode names are not case sensitive.
+ Used in: custom-portlet-mode, supports
+ </documentation>
+ </annotation>
+ <simpleContent>
+ <extension base="portlet:string"/>
+ </simpleContent>
+ </complexType>
+ <complexType name="portlet-nameType">
+ <annotation>
+ <documentation>
+ The portlet-name element contains the canonical name of the
+ portlet. Each portlet name is unique within the portlet
+ application.
+ Used in: portlet, filter-mapping
+ </documentation>
+ </annotation>
+ <simpleContent>
+ <extension base="portlet:string"/>
+ </simpleContent>
+ </complexType>
+ <complexType name="portlet-preferencesType">
+ <annotation>
+ <documentation>
+ Portlet persistent preference store.
+ Used in: portlet
+ </documentation>
+ </annotation>
+ <sequence>
+ <element name="preference" type="portlet:preferenceType" minOccurs="0" maxOccurs="unbounded"/>
+ <element name="preferences-validator" type="portlet:preferences-validatorType" minOccurs="0"/>
+ </sequence>
+ <attribute name="id" type="portlet:string" use="optional"/>
+ </complexType>
+ <complexType name="preferenceType">
+ <annotation>
+ <documentation>
+ Persistent preference values that may be used for customization
+ and personalization by the portlet.
+ Used in: portlet-preferences
+ </documentation>
+ </annotation>
+ <sequence>
+ <element name="name" type="portlet:nameType"/>
+ <element name="value" type="portlet:valueType" minOccurs="0" maxOccurs="unbounded"/>
+ <element name="read-only" type="portlet:read-onlyType" minOccurs="0"/>
+ </sequence>
+ <attribute name="id" type="portlet:string" use="optional"/>
+ </complexType>
+ <simpleType name="preferences-validatorType">
+ <annotation>
+ <documentation>
+ The class specified under preferences-validator implements
+ the PreferencesValidator interface to validate the
+ preferences settings.
+ Used in: portlet-preferences
+ </documentation>
+ </annotation>
+ <restriction base="portlet:fully-qualified-classType"/>
+ </simpleType>
+ <simpleType name="read-onlyType">
+ <annotation>
+ <documentation>
+ read-only indicates that a setting cannot
+ be changed in any of the standard portlet modes
+ ("view","edit" or "help").
+ Per default all preferences are modifiable.
+ Valid values are:
+ - true for read-only
+ - false for modifiable
+ Used in: preferences
+ </documentation>
+ </annotation>
+ <restriction base="portlet:string">
+ <enumeration value="true"/>
+ <enumeration value="false"/>
+ </restriction>
+ </simpleType>
+ <complexType name="resource-bundleType">
+ <annotation>
+ <documentation>
+ Name of the resource bundle containing the language specific
+ portlet informations in different languages (Filename without
+ the language specific part (e.g. _en) and the ending (.properties).
+ Used in: portlet-info
+ </documentation>
+ </annotation>
+ <simpleContent>
+ <extension base="portlet:string"/>
+ </simpleContent>
+ </complexType>
+ <complexType name="role-linkType">
+ <annotation>
+ <documentation>
+ The role-link element is a reference to a defined security role.
+ The role-link element must contain the name of one of the
+ security roles defined in the security-role elements.
+ Used in: security-role-ref
+ </documentation>
+ </annotation>
+ <simpleContent>
+ <extension base="portlet:string"/>
+ </simpleContent>
+ </complexType>
+ <complexType name="security-constraintType">
+ <annotation>
+ <documentation>
+ The security-constraintType is used to associate
+ intended security constraints with one or more portlets.
+ Used in: portlet-app
+ </documentation>
+ </annotation>
+ <sequence>
+ <element name="display-name" type="portlet:display-nameType" minOccurs="0" maxOccurs="unbounded"/>
+ <element name="portlet-collection" type="portlet:portlet-collectionType"/>
+ <element name="user-data-constraint" type="portlet:user-data-constraintType"/>
+ </sequence>
+ <attribute name="id" type="portlet:string" use="optional"/>
+ </complexType>
+ <complexType name="security-role-refType">
+ <annotation>
+ <documentation>
+ The security-role-ref element contains the declaration of a
+ security role reference in the code of the web application. The
+ declaration consists of an optional description, the security
+ role name used in the code, and an optional link to a security
+ role. If the security role is not specified, the Deployer must
+ choose an appropriate security role.
+ The value of the role name element must be the String used
+ as the parameter to the
+ EJBContext.isCallerInRole(String roleName) method
+ or the HttpServletRequest.isUserInRole(String role) method.
+ Used in: portlet
+ </documentation>
+ </annotation>
+ <sequence>
+ <element name="description" type="portlet:descriptionType" minOccurs="0" maxOccurs="unbounded"/>
+ <element name="role-name" type="portlet:role-nameType"/>
+ <element name="role-link" type="portlet:role-linkType" minOccurs="0"/>
+ </sequence>
+ <attribute name="id" type="portlet:string" use="optional"/>
+ </complexType>
+ <complexType name="public-render-parameterType">
+ <annotation>
+ <documentation>
+ The public-render-parameters defines a render parameter that is allowed to be public
+ and thus be shared with other portlets.
+ The identifier must be used for referencing this public render parameter in the portlet code.
+ Used in: portlet-app
+ </documentation>
+ </annotation>
+ <sequence>
+ <element name="description" type="portlet:descriptionType" minOccurs="0" maxOccurs="unbounded"/>
+ <element name="identifier" type="portlet:string"/>
+ <choice>
+ <element name="qname" type="xs:QName"/>
+ <element name="name" type="xs:NCName"/>
+ </choice>
+ <element name="alias" type="xs:QName" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="id" type="portlet:string" use="optional"/>
+ </complexType>
+ <complexType name="short-titleType">
+ <annotation>
+ <documentation>
+ Locale specific short version of the static title.
+ Used in: portlet-info
+ </documentation>
+ </annotation>
+ <simpleContent>
+ <extension base="portlet:string"/>
+ </simpleContent>
+ </complexType>
+ <complexType name="supportsType">
+ <annotation>
+ <documentation>
+ Supports indicates the portlet modes a
+ portlet supports for a specific content type. All portlets must
+ support the view mode.
+ Used in: portlet
+ </documentation>
+ </annotation>
+ <sequence>
+ <element name="mime-type" type="portlet:mime-typeType"/>
+ <element name="portlet-mode" type="portlet:portlet-modeType" minOccurs="0" maxOccurs="unbounded"/>
+ <element name="window-state" type="portlet:window-stateType" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="id" type="portlet:string" use="optional"/>
+ </complexType>
+ <complexType name="supported-localeType">
+ <annotation>
+ <documentation>
+ Indicated the locales the portlet supports.
+ Used in: portlet
+ </documentation>
+ </annotation>
+ <simpleContent>
+ <extension base="portlet:string"/>
+ </simpleContent>
+ </complexType>
+ <complexType name="titleType">
+ <annotation>
+ <documentation>
+ Locale specific static title for this portlet.
+ Used in: portlet-info
+ </documentation>
+ </annotation>
+ <simpleContent>
+ <extension base="portlet:string"/>
+ </simpleContent>
+ </complexType>
+ <simpleType name="transport-guaranteeType">
+ <annotation>
+ <documentation>
+ The transport-guaranteeType specifies that
+ the communication between client and portlet should
+ be NONE, INTEGRAL, or CONFIDENTIAL.
+ NONE means that the portlet does not
+ require any transport guarantees. A value of
+ INTEGRAL means that the portlet requires that the
+ data sent between the client and portlet be sent in
+ such a way that it can't be changed in transit.
+ CONFIDENTIAL means that the portlet requires
+ that the data be transmitted in a fashion that
+ prevents other entities from observing the contents
+ of the transmission.
+ In most cases, the presence of the INTEGRAL or
+ CONFIDENTIAL flag will indicate that the use
+ of SSL is required.
+ Used in: user-data-constraint
+ </documentation>
+ </annotation>
+ <restriction base="portlet:string">
+ <enumeration value="NONE"/>
+ <enumeration value="INTEGRAL"/>
+ <enumeration value="CONFIDENTIAL"/>
+ </restriction>
+ </simpleType>
+ <complexType name="user-attributeType">
+ <annotation>
+ <documentation>
+ User attribute defines a user specific attribute that the
+ portlet application needs. The portlet within this application
+ can access this attribute via the request parameter USER_INFO
+ map.
+ Used in: portlet-app
+ </documentation>
+ </annotation>
+ <sequence>
+ <element name="description" type="portlet:descriptionType" minOccurs="0" maxOccurs="unbounded"/>
+ <element name="name" type="portlet:nameType"/>
+ </sequence>
+ <attribute name="id" type="portlet:string" use="optional"/>
+ </complexType>
+ <complexType name="user-data-constraintType">
+ <annotation>
+ <documentation>
+ The user-data-constraintType is used to indicate how
+ data communicated between the client and portlet should be
+ protected.
+ Used in: security-constraint
+ </documentation>
+ </annotation>
+ <sequence>
+ <element name="description" type="portlet:descriptionType" minOccurs="0" maxOccurs="unbounded"/>
+ <element name="transport-guarantee" type="portlet:transport-guaranteeType"/>
+ </sequence>
+ <attribute name="id" type="portlet:string" use="optional"/>
+ </complexType>
+ <complexType name="valueType">
+ <annotation>
+ <documentation>
+ The value element contains the value of a parameter.
+ Used in: init-param
+ </documentation>
+ </annotation>
+ <simpleContent>
+ <extension base="portlet:string"/>
+ </simpleContent>
+ </complexType>
+ <complexType name="window-stateType">
+ <annotation>
+ <documentation>
+ Portlet window state. Window state names are not case sensitive.
+ Used in: custom-window-state
+ </documentation>
+ </annotation>
+ <simpleContent>
+ <extension base="portlet:string"/>
+ </simpleContent>
+ </complexType>
+ <!--- everything below is copied from j2ee_1_4.xsd -->
+ <complexType name="descriptionType">
+ <annotation>
+ <documentation>
+ The description element is used to provide text describing the
+ parent element. The description element should include any
+ information that the portlet application war file producer wants
+ to provide to the consumer of the portlet application war file
+ (i.e., to the Deployer). Typically, the tools used by the
+ portlet application war file consumer will display the
+ description when processing the parent element that contains the
+ description. It has an optional attribute xml:lang to indicate
+ which language is used in the description according to
+ RFC 1766 (http://www.ietf.org/rfc/rfc1766.txt). The default
+ value of this attribute is English(“en”).
+ Used in: init-param, portlet, portlet-app, security-role
+ </documentation>
+ </annotation>
+ <simpleContent>
+ <extension base="portlet:string">
+ <attribute ref="xml:lang"/>
+ </extension>
+ </simpleContent>
+ </complexType>
+ <complexType name="display-nameType">
+ <annotation>
+ <documentation>
+ The display-name type contains a short name that is intended
+ to be displayed by tools. It is used by display-name
+ elements. The display name need not be unique.
+ Example:
+ ...
+ <display-name xml:lang="en">Employee Self Service</display-name>
+
+ It has an optional attribute xml:lang to indicate
+ which language is used in the description according to
+ RFC 1766 (http://www.ietf.org/rfc/rfc1766.txt). The default
+ value of this attribute is English(“en”).
+ </documentation>
+ </annotation>
+ <simpleContent>
+ <extension base="portlet:string">
+ <attribute ref="xml:lang"/>
+ </extension>
+ </simpleContent>
+ </complexType>
+ <simpleType name="fully-qualified-classType">
+ <annotation>
+ <documentation>
+ The elements that use this type designate the name of a
+ Java class or interface.
+ </documentation>
+ </annotation>
+ <restriction base="portlet:string"/>
+ </simpleType>
+ <simpleType name="role-nameType">
+ <annotation>
+ <documentation>
+ The role-nameType designates the name of a security role.
+
+ The name must conform to the lexical rules for an NMTOKEN.
+ </documentation>
+ </annotation>
+ <restriction base="NMTOKEN"/>
+ </simpleType>
+ <simpleType name="string">
+ <annotation>
+ <documentation>
+ This is a special string datatype that is defined by JavaEE
+ as a base type for defining collapsed strings. When
+ schemas require trailing/leading space elimination as
+ well as collapsing the existing whitespace, this base
+ type may be used.
+ </documentation>
+ </annotation>
+ <restriction base="string">
+ <whiteSpace value="collapse"/>
+ </restriction>
+ </simpleType>
+ <simpleType name="filter-nameType">
+ <annotation>
+ <documentation>
+ The logical name of the filter is declare
+ by using filter-nameType. This name is used to map the
+ filter. Each filter name is unique within the portlet
+ application.
+ Used in: filter, filter-mapping
+ </documentation>
+ </annotation>
+ <restriction base="portlet:string"/>
+ </simpleType>
+</schema>
[13/14] portals-pluto git commit: Changed portlet hub demo portlet
version to v3.0
Posted by ms...@apache.org.
Changed portlet hub demo portlet version to v3.0
Project: http://git-wip-us.apache.org/repos/asf/portals-pluto/repo
Commit: http://git-wip-us.apache.org/repos/asf/portals-pluto/commit/676a5ec5
Tree: http://git-wip-us.apache.org/repos/asf/portals-pluto/tree/676a5ec5
Diff: http://git-wip-us.apache.org/repos/asf/portals-pluto/diff/676a5ec5
Branch: refs/heads/V3Prototype
Commit: 676a5ec55bfef008919c82fab406275ccf2632d8
Parents: e92c13c
Author: Scott Nicklous <ms...@apache.org>
Authored: Wed Jan 28 13:50:42 2015 +0100
Committer: Scott Nicklous <ms...@apache.org>
Committed: Wed Jan 28 13:50:42 2015 +0100
----------------------------------------------------------------------
PortletHubDemo/src/main/webapp/WEB-INF/portlet.xml | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/676a5ec5/PortletHubDemo/src/main/webapp/WEB-INF/portlet.xml
----------------------------------------------------------------------
diff --git a/PortletHubDemo/src/main/webapp/WEB-INF/portlet.xml b/PortletHubDemo/src/main/webapp/WEB-INF/portlet.xml
index ed46720..f81145e 100644
--- a/PortletHubDemo/src/main/webapp/WEB-INF/portlet.xml
+++ b/PortletHubDemo/src/main/webapp/WEB-INF/portlet.xml
@@ -1,8 +1,8 @@
-<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
+<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_3_0.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:rp="http://www.apache.org/portals/pluto/pub-render-params/ResourcePortlet"
- xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
- version="2.0"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_3_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_3_0.xsd"
+ version="3.0"
id="ph.resource.portlet">
<portlet>
<portlet-name>PH-ResourcePortlet-PRP</portlet-name>
[04/14] portals-pluto git commit: work towards enabling v3 deployment
descriptor
Posted by ms...@apache.org.
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/a8bed7fb/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/ListenerType.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/ListenerType.java b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/ListenerType.java
deleted file mode 100644
index 94195b3..0000000
--- a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/ListenerType.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * 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.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlType;
-
-import org.apache.pluto.container.om.portlet.Description;
-import org.apache.pluto.container.om.portlet.DisplayName;
-import org.apache.pluto.container.om.portlet.Listener;
-
-/**
- * The listenerType is used to declare listeners for this portlet application. Used in: portlet-app <p>Java class for
- * listenerType complex type. <p>The following schema fragment specifies the expected content contained within this
- * class.
- *
- * <pre>
- * <complexType name="listenerType">
- * <complexContent>
- * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * <sequence>
- * <element name="description" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}descriptionType" maxOccurs="unbounded" minOccurs="0"/>
- * <element name="display-name" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}display-nameType" maxOccurs="unbounded" minOccurs="0"/>
- * <element name="listener-class" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}fully-qualified-classType"/>
- * </sequence>
- * <attribute name="id" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}string" />
- * </restriction>
- * </complexContent>
- * </complexType>
- * </pre>
- *
- * @version $Id$
- */
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "listenerType", propOrder = { "description", "displayName", "listenerClass" })
-public class ListenerType implements Listener
-{
- @XmlElement(name = "description")
- protected List<DescriptionType> description;
- @XmlElement(name = "display-name")
- protected List<DisplayNameType> displayName;
- @XmlElement(name = "listener-class", required = true)
- protected String listenerClass;
-
- public Description getDescription(Locale locale)
- {
- for (Description d : getDescriptions())
- {
- if (d.getLocale().equals(locale))
- {
- return d;
- }
- }
- return null;
- }
-
- public List<? extends Description> getDescriptions()
- {
- if (description == null)
- {
- description = new ArrayList<DescriptionType>();
- }
- return description;
- }
-
- public Description addDescription(String lang)
- {
- DescriptionType d = new DescriptionType();
- d.setLang(lang);
- if (getDescription(d.getLocale()) != null)
- {
- throw new IllegalArgumentException("Description for language: "+d.getLocale()+" already defined");
- }
- getDescriptions();
- description.add(d);
- return d;
- }
-
- public DisplayName getDisplayName(Locale locale)
- {
- for (DisplayName d : getDisplayNames())
- {
- if (d.getLocale().equals(locale))
- {
- return d;
- }
- }
- return null;
- }
-
- public List<? extends DisplayName> getDisplayNames()
- {
- if (displayName == null)
- {
- displayName = new ArrayList<DisplayNameType>();
- }
- return displayName;
- }
-
- public DisplayName addDisplayName(String lang)
- {
- DisplayNameType d = new DisplayNameType();
- d.setLang(lang);
- if (getDisplayName(d.getLocale()) != null)
- {
- throw new IllegalArgumentException("DisplayName for language: "+d.getLocale()+" already defined");
- }
- getDisplayNames();
- displayName.add(d);
- return d;
- }
-
- public String getListenerClass()
- {
- return listenerClass;
- }
-
- public void setListenerClass(String value)
- {
- listenerClass = value;
- }
-}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/a8bed7fb/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/ObjectFactory.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/ObjectFactory.java b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/ObjectFactory.java
deleted file mode 100644
index e5a2152..0000000
--- a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/ObjectFactory.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * 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 javax.xml.bind.JAXBElement;
-import javax.xml.bind.annotation.XmlElementDecl;
-import javax.xml.bind.annotation.XmlRegistry;
-import javax.xml.namespace.QName;
-
-/**
- * This object contains factory methods for each Java content interface and Java element interface generated in the
- * org.apache.pluto.descriptors.portlet20 package. <p>An ObjectFactory allows you to programatically construct new
- * instances of the Java representation for XML content. The Java representation of XML content can consist of schema
- * derived interfaces and classes representing the binding of schema type definitions, element declarations and model
- * groups. Factory methods for each of these are provided in this class.
- *
- * @version $Id$
- */
-@XmlRegistry
-public class ObjectFactory
-{
- private final static QName _PortletApp_QNAME = new QName("http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd",
- "portlet-app");
-
- public ObjectFactory()
- {
- }
-
- public PortletAppType createPortletApp()
- {
- return new PortletAppType();
- }
-
- @XmlElementDecl(namespace = "http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd", name = "portlet-app")
- public JAXBElement<PortletAppType> createPortletApp(PortletAppType value)
- {
- return new JAXBElement<PortletAppType>(_PortletApp_QNAME, PortletAppType.class, null, value);
- }
-}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/a8bed7fb/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/PortletAppType.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/PortletAppType.java b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/PortletAppType.java
deleted file mode 100644
index d61e51b..0000000
--- a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/PortletAppType.java
+++ /dev/null
@@ -1,549 +0,0 @@
-/*
- * 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.XMLConstants;
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlAttribute;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlSchemaType;
-import javax.xml.bind.annotation.XmlTransient;
-import javax.xml.bind.annotation.XmlType;
-import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
-import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
-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;
-
-/**
- * <p>Java class for portlet-appType complex type. <p>The following schema fragment specifies the expected content
- * contained within this class.
- *
- * <pre>
- * <complexType name="portlet-appType">
- * <complexContent>
- * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * <sequence>
- * <element name="portlet" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}portletType" maxOccurs="unbounded" minOccurs="0"/>
- * <element name="custom-portlet-mode" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}custom-portlet-modeType" maxOccurs="unbounded" minOccurs="0"/>
- * <element name="custom-window-state" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}custom-window-stateType" maxOccurs="unbounded" minOccurs="0"/>
- * <element name="user-attribute" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}user-attributeType" maxOccurs="unbounded" minOccurs="0"/>
- * <element name="security-constraint" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}security-constraintType" maxOccurs="unbounded" minOccurs="0"/>
- * <element name="resource-bundle" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}resource-bundleType" minOccurs="0"/>
- * <element name="filter" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}filterType" maxOccurs="unbounded" minOccurs="0"/>
- * <element name="filter-mapping" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}filter-mappingType" maxOccurs="unbounded" minOccurs="0"/>
- * <element name="default-namespace" type="{http://www.w3.org/2001/XMLSchema}anyURI" minOccurs="0"/>
- * <element name="event-definition" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}event-definitionType" maxOccurs="unbounded" minOccurs="0"/>
- * <element name="public-render-parameter" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}public-render-parameterType" maxOccurs="unbounded" minOccurs="0"/>
- * <element name="listener" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}listenerType" maxOccurs="unbounded" minOccurs="0"/>
- * <element name="container-runtime-option" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}container-runtime-optionType" maxOccurs="unbounded" minOccurs="0"/>
- * </sequence>
- * <attribute name="version" use="required" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}string" />
- * <attribute name="id" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}string" />
- * </restriction>
- * </complexContent>
- * </complexType>
- * </pre>
- *
- * @version $Id$
- */
-@XmlRootElement(name = "portlet-app")
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "portlet-appType", propOrder = { "portlet", "customPortletMode", "customWindowState", "userAttribute",
- "securityConstraint", "resourceBundle", "filter", "filterMapping",
- "defaultNamespace", "eventDefinition", "publicRenderParameter",
- "listener", "containerRuntimeOption" })
-public class PortletAppType implements PortletApplicationDefinition
-{
- @XmlElement(name = "portlet")
- protected List<PortletType> portlet;
- @XmlElement(name = "custom-portlet-mode")
- protected List<CustomPortletModeType> customPortletMode;
- @XmlElement(name = "custom-window-state")
- protected List<CustomWindowStateType> customWindowState;
- @XmlElement(name = "user-attribute")
- protected List<UserAttributeType> userAttribute;
- @XmlElement(name = "security-constraint")
- protected List<SecurityConstraintType> securityConstraint;
- @XmlElement(name = "resource-bundle")
- @XmlJavaTypeAdapter(value=CollapsedStringAdapter.class)
- protected String resourceBundle;
- @XmlElement(name = "filter")
- protected List<FilterType> filter;
- @XmlElement(name = "filter-mapping")
- protected List<FilterMappingType> filterMapping;
- @XmlElement(name = "default-namespace")
- @XmlSchemaType(name = "anyURI")
- protected String defaultNamespace;
- @XmlElement(name = "event-definition")
- protected List<EventDefinitionType> eventDefinition;
- @XmlElement(name = "public-render-parameter")
- protected List<PublicRenderParameterType> publicRenderParameter;
- @XmlElement(name = "listener")
- protected List<ListenerType> listener;
- @XmlElement(name = "container-runtime-option")
- protected List<ContainerRuntimeOptionType> containerRuntimeOption;
- @XmlAttribute(required = true)
- protected String version = JSR_286_VERSION;
-
- @XmlTransient
- protected String name;
- @XmlTransient
- protected String contextPath;
- @XmlTransient
- protected Map<Locale, String> localeEncodingMappings;
-
- public String getName()
- {
- return name;
- }
-
- public void setName(String name)
- {
- this.name = name;
- }
-
- public String getContextPath()
- {
- return contextPath;
- }
-
- public void setContextPath(String contextPath)
- {
- this.contextPath = contextPath;
- }
-
- public PortletDefinition getPortlet(String portletName)
- {
- for (PortletDefinition pd : getPortlets())
- {
- if (pd.getPortletName().equals(portletName))
- {
- return pd;
- }
- }
- return null;
- }
-
- public List<? extends PortletDefinition> getPortlets()
- {
- if (portlet == null)
- {
- portlet = new ArrayList<PortletType>();
- }
- return portlet;
- }
-
- public PortletDefinition addPortlet(String portletName)
- {
- if (getPortlet(portletName) != null)
- {
- throw new IllegalArgumentException("Portlet with name: "+portletName+" already defined");
- }
- PortletType p = new PortletType();
- p.setPortletName(portletName);
- p.setApplication(this);
- portlet.add(p);
- return p;
- }
-
- public CustomPortletMode getCustomPortletMode(String name)
- {
- for (CustomPortletMode cpm : getCustomPortletModes())
- {
- if (cpm.getPortletMode().equalsIgnoreCase(name))
- {
- return cpm;
- }
- }
- return null;
- }
-
- public List<? extends CustomPortletMode> getCustomPortletModes()
- {
- if (customPortletMode == null)
- {
- customPortletMode = new ArrayList<CustomPortletModeType>();
- }
- return customPortletMode;
- }
-
- public CustomPortletMode addCustomPortletMode(String name)
- {
- if (getCustomPortletMode(name) != null)
- {
- throw new IllegalArgumentException("Custom PortletMode with mode name: "+name+" already defined");
- }
- CustomPortletModeType cpm = new CustomPortletModeType();
- cpm.setPortletMode(name);
- customPortletMode.add(cpm);
- return cpm;
- }
-
- public CustomWindowState getCustomWindowState(String name)
- {
- for (CustomWindowState cws : getCustomWindowStates())
- {
- if (cws.getWindowState().equalsIgnoreCase(name))
- {
- return cws;
- }
- }
- return null;
- }
-
- public List<? extends CustomWindowState> getCustomWindowStates()
- {
- if (customWindowState == null)
- {
- customWindowState = new ArrayList<CustomWindowStateType>();
- }
- return customWindowState;
- }
-
- public CustomWindowState addCustomWindowState(String name)
- {
- if (getCustomWindowState(name) != null)
- {
- throw new IllegalArgumentException("Custom WindowState with state name: "+name+" already defined");
- }
- CustomWindowStateType cws = new CustomWindowStateType();
- cws.setWindowState(name);
- customWindowState.add(cws);
- return cws;
- }
-
- public UserAttribute getUserAttribute(String name)
- {
- for (UserAttribute ua : getUserAttributes())
- {
- if (ua.getName().equals(name))
- {
- return ua;
- }
- }
- return null;
- }
-
- public List<? extends UserAttribute> getUserAttributes()
- {
- if (userAttribute == null)
- {
- userAttribute = new ArrayList<UserAttributeType>();
- }
- return userAttribute;
- }
-
- public UserAttribute addUserAttribute(String name)
- {
- if (getUserAttribute(name) != null)
- {
- throw new IllegalArgumentException("User attribute with name: "+name+" already defined");
- }
- UserAttributeType ua = new UserAttributeType();
- ua.setName(name);
- userAttribute.add(ua);
- return ua;
- }
-
- public List<? extends SecurityConstraint> getSecurityConstraints()
- {
- if (securityConstraint == null)
- {
- securityConstraint = new ArrayList<SecurityConstraintType>();
- }
- return securityConstraint;
- }
-
- public SecurityConstraint addSecurityConstraint(String transportGuarantee)
- {
- SecurityConstraintType sc = new SecurityConstraintType();
- ((UserDataConstraintType)sc.getUserDataConstraint()).setTransportGuarantee(transportGuarantee);
- getSecurityConstraints();
- securityConstraint.add(sc);
- return sc;
- }
-
- public String getResourceBundle()
- {
- return resourceBundle;
- }
-
- public void setResourceBundle(String value)
- {
- resourceBundle = value;
- }
-
- public Filter getFilter(String name)
- {
- for (Filter f : getFilters())
- {
- if (f.getFilterName().equals(name))
- {
- return f;
- }
- }
- return null;
- }
-
- public List<? extends Filter> getFilters()
- {
- if (filter == null)
- {
- filter = new ArrayList<FilterType>();
- }
- return filter;
- }
-
- public Filter addFilter(String name)
- {
- if (getFilter(name) != null)
- {
- throw new IllegalArgumentException("Filter with name: "+name+" already defined");
- }
- FilterType f = new FilterType();
- f.setFilterName(name);
- filter.add(f);
- return f;
- }
-
- public FilterMapping getFilterMapping(String name)
- {
- for (FilterMapping f : getFilterMappings())
- {
- if (f.getFilterName().equals(name))
- {
- return f;
- }
- }
- return null;
- }
-
- public List<? extends FilterMapping> getFilterMappings()
- {
- if (filterMapping == null)
- {
- filterMapping = new ArrayList<FilterMappingType>();
- }
- return filterMapping;
- }
-
- public FilterMapping addFilterMapping(String name)
- {
- if (getFilterMapping(name) != null)
- {
- throw new IllegalArgumentException("Filtermapping for filter: "+name+" already defined");
- }
- FilterMappingType fm = new FilterMappingType();
- fm.setFilterName(name);
- filterMapping.add(fm);
- return fm;
- }
-
- public String getDefaultNamespace()
- {
- return defaultNamespace != null ? defaultNamespace : XMLConstants.NULL_NS_URI;
- }
-
- public void setDefaultNamespace(String value)
- {
- defaultNamespace = value;
- }
-
- public List<? extends EventDefinition> getEventDefinitions()
- {
- if (eventDefinition == null)
- {
- eventDefinition = new ArrayList<EventDefinitionType>();
- }
- return eventDefinition;
- }
-
- public EventDefinition addEventDefinition(String name)
- {
- // TODO: check duplicates (complication: set of qname and name)
- EventDefinitionType ed = new EventDefinitionType();
- ed.setName(name);
- eventDefinition.add(ed);
- return ed;
- }
-
- public EventDefinition addEventDefinition(QName qname)
- {
- // TODO: check duplicates (complication: set of qname and name)
- EventDefinitionType ed = new EventDefinitionType();
- ed.setQName(qname);
- eventDefinition.add(ed);
- return ed;
- }
-
- public PublicRenderParameter getPublicRenderParameter(String identifier)
- {
- for (PublicRenderParameter prp : getPublicRenderParameters())
- {
- if (prp.getIdentifier().equals(identifier))
- {
- return prp;
- }
- }
- return null;
- }
-
- public List<? extends PublicRenderParameter> getPublicRenderParameters()
- {
- if (publicRenderParameter == null)
- {
- publicRenderParameter = new ArrayList<PublicRenderParameterType>();
- }
- return publicRenderParameter;
- }
-
- public PublicRenderParameter addPublicRenderParameter(String name, String identifier)
- {
- if (getPublicRenderParameter(identifier) != null)
- {
- throw new IllegalArgumentException("PublicRenderParameter with identifier: "+identifier+" already defined");
- }
- // TODO: check duplicates on name|qname?
- PublicRenderParameterType p = new PublicRenderParameterType();
- p.setName(name);
- p.setIdentifier(identifier);
- publicRenderParameter.add(p);
- return p;
- }
-
- public PublicRenderParameter addPublicRenderParameter(QName qname, String identifier)
- {
- if (getPublicRenderParameter(identifier) != null)
- {
- throw new IllegalArgumentException("PublicRenderParameter with identifier: "+identifier+" already defined");
- }
- // TODO: check duplicates on name|qname?
- PublicRenderParameterType p = new PublicRenderParameterType();
- p.setQName(qname);
- p.setIdentifier(identifier);
- publicRenderParameter.add(p);
- return p;
- }
-
- public List<? extends Listener> getListeners()
- {
- if (listener == null)
- {
- listener = new ArrayList<ListenerType>();
- }
- return listener;
- }
-
- public Listener addListener(String listenerClass)
- {
- for (Listener l : getListeners())
- {
- if (l.getListenerClass().equals(listenerClass))
- {
- throw new IllegalArgumentException("Listener of class: "+listenerClass+" already defined");
- }
- }
- ListenerType l = new ListenerType();
- l.setListenerClass(listenerClass);
- listener.add(l);
- return l;
- }
-
- public ContainerRuntimeOption getContainerRuntimeOption(String name)
- {
- for (ContainerRuntimeOption cro : getContainerRuntimeOptions())
- {
- if (cro.getName().equals(name))
- {
- return cro;
- }
- }
- return null;
- }
-
- public List<? extends ContainerRuntimeOption> getContainerRuntimeOptions()
- {
- if (containerRuntimeOption == null)
- {
- containerRuntimeOption = new ArrayList<ContainerRuntimeOptionType>();
- }
- return containerRuntimeOption;
- }
-
- public ContainerRuntimeOption addContainerRuntimeOption(String name)
- {
- if (getContainerRuntimeOption(name) != null)
- {
- throw new IllegalArgumentException("Container runtime option with name: "+name+" already defined");
- }
- ContainerRuntimeOptionType cro = new ContainerRuntimeOptionType();
- cro.setName(name);
- containerRuntimeOption.add(cro);
- return cro;
- }
-
- public String getVersion()
- {
- return version;
- }
-
- public void setVersion(String value)
- {
- if (JSR_168_VERSION.equals(value) || JSR_286_VERSION.equals(value))
- {
- version = value;
- }
- else
- {
- throw new IllegalArgumentException("Application descriptor version: "+value+" unsupported.");
- }
- }
-
- public Map<Locale, String> getLocaleEncodingMappings()
- {
- if (localeEncodingMappings == null)
- {
- localeEncodingMappings = new HashMap<Locale,String>();
- }
- return localeEncodingMappings;
- }
-
- public void addLocaleEncodingMapping(Locale locale, String encoding)
- {
- getLocaleEncodingMappings().put(locale, encoding);
- }
-}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/a8bed7fb/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/PortletCollectionType.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/PortletCollectionType.java b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/PortletCollectionType.java
deleted file mode 100644
index 2768655..0000000
--- a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/PortletCollectionType.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * 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 javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlType;
-import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
-import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
-
-/**
- * The portlet-collectionType is used to identify a subset of portlets within a portlet application to which a security
- * constraint applies. Used in: security-constraint <p>Java class for portlet-collectionType complex type. <p>The
- * following schema fragment specifies the expected content contained within this class.
- *
- * <pre>
- * <complexType name="portlet-collectionType">
- * <complexContent>
- * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * <sequence>
- * <element name="portlet-name" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}portlet-nameType" maxOccurs="unbounded"/>
- * </sequence>
- * </restriction>
- * </complexContent>
- * </complexType>
- * </pre>
- *
- * @version $Id$
- */
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "portlet-collectionType", propOrder = { "portletName" })
-public class PortletCollectionType
-{
- @XmlElement(name = "portlet-name", required = true)
- @XmlJavaTypeAdapter(value=CollapsedStringAdapter.class)
- protected List<String> portletName;
-
- public List<String> getPortletNames()
- {
- if (portletName == null)
- {
- portletName = new ArrayList<String>();
- }
- return portletName;
- }
-}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/a8bed7fb/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/PortletInfoType.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/PortletInfoType.java b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/PortletInfoType.java
deleted file mode 100644
index e4e23c1..0000000
--- a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/PortletInfoType.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * 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 javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlType;
-import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
-import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
-
-import org.apache.pluto.container.om.portlet.PortletInfo;
-
-/**
- * <p>Java class for portlet-infoType complex type. <p>The following schema fragment specifies the expected content
- * contained within this class.
- *
- * <pre>
- * <complexType name="portlet-infoType">
- * <complexContent>
- * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * <sequence>
- * <element name="title" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}titleType" minOccurs="0"/>
- * <element name="short-title" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}short-titleType" minOccurs="0"/>
- * <element name="keywords" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}keywordsType" minOccurs="0"/>
- * </sequence>
- * <attribute name="id" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}string" />
- * </restriction>
- * </complexContent>
- * </complexType>
- * </pre>
- *
- * @version $Id$
- */
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "portlet-infoType", propOrder = { "title", "shortTitle", "keywords" })
-public class PortletInfoType implements PortletInfo
-{
- @XmlElement (name = "title")
- @XmlJavaTypeAdapter(value=CollapsedStringAdapter.class)
- protected String title;
- @XmlElement(name = "short-title")
- @XmlJavaTypeAdapter(value=CollapsedStringAdapter.class)
- protected String shortTitle;
- @XmlElement(name = "keywords")
- @XmlJavaTypeAdapter(value=CollapsedStringAdapter.class)
- protected String keywords;
-
- public String getTitle()
- {
- return title;
- }
-
- public void setTitle(String value)
- {
- title = value;
- }
-
- public String getShortTitle()
- {
- return shortTitle;
- }
-
- public void setShortTitle(String value)
- {
- shortTitle = value;
- }
-
- public String getKeywords()
- {
- return keywords;
- }
-
- public void setKeywords(String value)
- {
- keywords = value;
- }
-}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/a8bed7fb/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/PortletPreferencesType.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/PortletPreferencesType.java b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/PortletPreferencesType.java
deleted file mode 100644
index 78a7927..0000000
--- a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/PortletPreferencesType.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * 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 javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlType;
-
-import org.apache.pluto.container.om.portlet.Preference;
-import org.apache.pluto.container.om.portlet.Preferences;
-
-/**
- * Portlet persistent preference store. Used in: portlet <p>Java class for portlet-preferencesType complex type. <p>The
- * following schema fragment specifies the expected content contained within this class.
- *
- * <pre>
- * <complexType name="portlet-preferencesType">
- * <complexContent>
- * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * <sequence>
- * <element name="preference" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}preferenceType" maxOccurs="unbounded" minOccurs="0"/>
- * <element name="preferences-validator" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}preferences-validatorType" minOccurs="0"/>
- * </sequence>
- * <attribute name="id" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}string" />
- * </restriction>
- * </complexContent>
- * </complexType>
- * </pre>
- *
- * @version $Id$
- */
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "portlet-preferencesType", propOrder = { "preference", "preferencesValidator" })
-public class PortletPreferencesType implements Preferences
-{
- @XmlElement(name = "preference")
- protected List<PreferenceType> preference;
- @XmlElement(name = "preferences-validator")
- protected String preferencesValidator;
-
- public Preference getPortletPreference(String name)
- {
- for (Preference p : getPortletPreferences())
- {
- if (p.getName().equals(name))
- {
- return p;
- }
- }
- return null;
- }
-
- public List<? extends Preference> getPortletPreferences()
- {
- if (preference == null)
- {
- preference = new ArrayList<PreferenceType>();
- }
- return preference;
- }
-
- public Preference addPreference(String name)
- {
- if (getPortletPreference(name) != null)
- {
- throw new IllegalArgumentException("Portlet preference with name: "+name+" already defined");
- }
- PreferenceType pref = new PreferenceType();
- pref.setName(name);
- preference.add(pref);
- return pref;
- }
-
- public String getPreferencesValidator()
- {
- return preferencesValidator;
- }
-
- public void setPreferencesValidator(String value)
- {
- preferencesValidator = value;
- }
-}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/a8bed7fb/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/PortletType.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/PortletType.java b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/PortletType.java
deleted file mode 100644
index 0c967cc..0000000
--- a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/PortletType.java
+++ /dev/null
@@ -1,521 +0,0 @@
-/*
- * 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.bind.Unmarshaller;
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlTransient;
-import javax.xml.bind.annotation.XmlType;
-import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
-import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
-import javax.xml.namespace.QName;
-
-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;
-
-/**
- * The portlet element contains the declarative data of a portlet. Used in: portlet-app <p>Java class for portletType
- * complex type. <p>The following schema fragment specifies the expected content contained within this class.
- *
- * <pre>
- * <complexType name="portletType">
- * <complexContent>
- * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * <sequence>
- * <element name="description" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}descriptionType" maxOccurs="unbounded" minOccurs="0"/>
- * <element name="portlet-name" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}portlet-nameType"/>
- * <element name="display-name" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}display-nameType" maxOccurs="unbounded" minOccurs="0"/>
- * <element name="portlet-class" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}portlet-classType"/>
- * <element name="init-param" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}init-paramType" maxOccurs="unbounded" minOccurs="0"/>
- * <element name="expiration-cache" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}expiration-cacheType" minOccurs="0"/>
- * <element name="cache-scope" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}cache-scopeType" minOccurs="0"/>
- * <element name="supports" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}supportsType" maxOccurs="unbounded"/>
- * <element name="supported-locale" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}supported-localeType" maxOccurs="unbounded" minOccurs="0"/>
- * <element name="resource-bundle" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}resource-bundleType" minOccurs="0"/>
- * <element name="portlet-info" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}portlet-infoType" minOccurs="0"/>
- * <element name="portlet-preferences" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}portlet-preferencesType" minOccurs="0"/>
- * <element name="security-role-ref" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}security-role-refType" maxOccurs="unbounded" minOccurs="0"/>
- * <element name="supported-processing-event" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}event-definition-referenceType" maxOccurs="unbounded" minOccurs="0"/>
- * <element name="supported-publishing-event" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}event-definition-referenceType" maxOccurs="unbounded" minOccurs="0"/>
- * <element name="supported-public-render-parameter" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}string" maxOccurs="unbounded" minOccurs="0"/>
- * <element name="container-runtime-option" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}container-runtime-optionType" maxOccurs="unbounded" minOccurs="0"/>
- * </sequence>
- * <attribute name="id" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}string" />
- * </restriction>
- * </complexContent>
- * </complexType>
- * </pre>
- *
- * @version $Id$
- */
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "portletType", propOrder = { "description", "portletName", "displayName", "portletClass", "initParam",
- "expirationCache", "cacheScope", "supports", "supportedLocale",
- "resourceBundle", "portletInfo", "portletPreferences", "securityRoleRef",
- "supportedProcessingEvent", "supportedPublishingEvent",
- "supportedPublicRenderParameter", "containerRuntimeOption" })
-public class PortletType implements PortletDefinition
-{
- @XmlElement(name = "description")
- protected List<DescriptionType> description;
- @XmlElement(name = "portlet-name", required = true)
- @XmlJavaTypeAdapter(value=CollapsedStringAdapter.class)
- protected String portletName;
- @XmlElement(name = "display-name")
- protected List<DisplayNameType> displayName;
- @XmlElement(name = "portlet-class", required = true)
- @XmlJavaTypeAdapter(value=CollapsedStringAdapter.class)
- protected String portletClass;
- @XmlElement(name = "init-param")
- protected List<InitParamType> initParam;
- @XmlElement(name = "expiration-cache")
- protected Integer expirationCache;
- @XmlElement(name = "cache-scope")
- @XmlJavaTypeAdapter(value=CollapsedStringAdapter.class)
- protected String cacheScope;
- @XmlElement(required = true)
- protected List<SupportsType> supports;
- @XmlElement(name = "supported-locale")
- @XmlJavaTypeAdapter(value=CollapsedStringAdapter.class)
- protected List<String> supportedLocale;
- @XmlElement(name = "resource-bundle")
- @XmlJavaTypeAdapter(value=CollapsedStringAdapter.class)
- protected String resourceBundle;
- @XmlElement(name = "portlet-info")
- protected PortletInfoType portletInfo;
- @XmlElement(name = "portlet-preferences")
- protected PortletPreferencesType portletPreferences;
- @XmlElement(name = "security-role-ref")
- protected List<SecurityRoleRefType> securityRoleRef;
- @XmlElement(name = "supported-processing-event")
- protected List<EventDefinitionReferenceType> supportedProcessingEvent;
- @XmlElement(name = "supported-publishing-event")
- protected List<EventDefinitionReferenceType> supportedPublishingEvent;
- @XmlElement(name = "supported-public-render-parameter")
- protected List<String> supportedPublicRenderParameter;
- @XmlElement(name = "container-runtime-option")
- protected List<ContainerRuntimeOptionType> containerRuntimeOption;
-
- @XmlTransient
- private PortletApplicationDefinition application;
-
- public PortletType()
- {
- }
-
- public PortletApplicationDefinition getApplication()
- {
- return application;
- }
-
- public void setApplication(PortletApplicationDefinition app)
- {
- this.application = app;
- }
-
- public Description getDescription(Locale locale)
- {
- for (Description d : getDescriptions())
- {
- if (d.getLocale().equals(locale))
- {
- return d;
- }
- }
- return null;
- }
-
- public List<? extends Description> getDescriptions()
- {
- if (description == null)
- {
- description = new ArrayList<DescriptionType>();
- }
- return description;
- }
-
- public Description addDescription(String lang)
- {
- DescriptionType d = new DescriptionType();
- d.setLang(lang);
- if (getDescription(d.getLocale()) != null)
- {
- throw new IllegalArgumentException("Description for language: "+d.getLocale()+" already defined");
- }
- getDescriptions();
- description.add(d);
- return d;
- }
-
- public DisplayName getDisplayName(Locale locale)
- {
- for (DisplayName d : getDisplayNames())
- {
- if (d.getLocale().equals(locale))
- {
- return d;
- }
- }
- return null;
- }
-
- public List<? extends DisplayName> getDisplayNames()
- {
- if (displayName == null)
- {
- displayName = new ArrayList<DisplayNameType>();
- }
- return displayName;
- }
-
- public DisplayName addDisplayName(String lang)
- {
- DisplayNameType d = new DisplayNameType();
- d.setLang(lang);
- if (getDisplayName(d.getLocale()) != null)
- {
- throw new IllegalArgumentException("DisplayName for language: "+d.getLocale()+" already defined");
- }
- getDisplayNames();
- displayName.add(d);
- return d;
- }
-
- public String getPortletName()
- {
- return portletName;
- }
-
- public void setPortletName(String value)
- {
- portletName = value;
- }
-
- public String getPortletClass()
- {
- return portletClass;
- }
-
- public void setPortletClass(String value)
- {
- portletClass = value;
- }
-
- public InitParam getInitParam(String name)
- {
- for (InitParam param : getInitParams())
- {
- if (param.getParamName().equals(name))
- {
- return param;
- }
- }
- return null;
- }
-
- public List<? extends InitParam> getInitParams()
- {
- if (initParam == null)
- {
- initParam = new ArrayList<InitParamType>();
- }
- return initParam;
- }
-
- public InitParam addInitParam(String paramName)
- {
- if (getInitParam(paramName) != null)
- {
- throw new IllegalArgumentException("Init parameter: "+paramName+" already defined");
- }
- InitParamType param = new InitParamType();
- param.setParamName(paramName);
- getInitParams();
- initParam.add(param);
- return param;
- }
-
- public int getExpirationCache()
- {
- return expirationCache != null ? expirationCache.intValue() : 0;
- }
-
- public void setExpirationCache(int value)
- {
- expirationCache = new Integer(value);
- }
-
- /**
- * Caching scope, allowed values are "private" indicating that the content should not be shared across users and
- * "public" indicating that the content may be shared across users. The default value if not present is "private".
- */
- public String getCacheScope()
- {
- return cacheScope != null ? cacheScope : "private";
- }
-
- public void setCacheScope(String cacheScope)
- {
- this.cacheScope = cacheScope;
- }
-
- public Supports getSupports(String mimeType)
- {
- for (Supports s : getSupports())
- {
- if (s.getMimeType().equals(mimeType))
- {
- return s;
- }
- }
- return null;
- }
-
- public List<? extends Supports> getSupports()
- {
- if (supports == null)
- {
- supports = new ArrayList<SupportsType>();
- }
- return supports;
- }
-
- public Supports addSupports(String mimeType)
- {
- if (getSupports(mimeType) != null)
- {
- throw new IllegalArgumentException("Supports for mime type: "+mimeType+" already defined");
- }
- SupportsType s = new SupportsType();
- s.setMimeType(mimeType);
- supports.add(s);
- return s;
- }
-
- public List<String> getSupportedLocales()
- {
- if (supportedLocale == null)
- {
- supportedLocale = new ArrayList<String>();
- }
- return supportedLocale;
- }
-
- public void addSupportedLocale(String lang)
- {
- for (String l : getSupportedLocales())
- {
- if (l.equals(lang))
- {
- throw new IllegalArgumentException("Supported locale: "+lang+" already defined");
- }
- }
- supportedLocale.add(lang);
- }
-
- public String getResourceBundle()
- {
- return resourceBundle;
- }
-
- public void setResourceBundle(String value)
- {
- resourceBundle = value;
- }
-
- public PortletInfo getPortletInfo()
- {
- if (portletInfo == null)
- {
- portletInfo = new PortletInfoType();
- }
- return portletInfo;
- }
-
- public Preferences getPortletPreferences()
- {
- if (portletPreferences == null)
- {
- portletPreferences = new PortletPreferencesType();
- }
- return portletPreferences;
- }
-
- public SecurityRoleRef getSecurityRoleRef(String roleName)
- {
- for (SecurityRoleRef ref : getSecurityRoleRefs())
- {
- if (ref.getRoleName().equals(roleName))
- {
- return ref;
- }
- }
- return null;
- }
-
- public List<? extends SecurityRoleRef> getSecurityRoleRefs()
- {
- if (securityRoleRef == null)
- {
- securityRoleRef = new ArrayList<SecurityRoleRefType>();
- }
- return securityRoleRef;
- }
-
- public SecurityRoleRef addSecurityRoleRef(String roleName)
- {
- if (getSecurityRoleRef(roleName) != null)
- {
- throw new IllegalArgumentException("Security role reference for role: "+roleName+" already defined");
- }
- SecurityRoleRefType srr = new SecurityRoleRefType();
- srr.setRoleName(roleName);
- securityRoleRef.add(srr);
- return srr;
- }
-
- public List<? extends EventDefinitionReference> getSupportedProcessingEvents()
- {
- if (supportedProcessingEvent == null)
- {
- supportedProcessingEvent = new ArrayList<EventDefinitionReferenceType>();
- }
- return supportedProcessingEvent;
- }
-
- public EventDefinitionReference addSupportedProcessingEvent(QName qname)
- {
- // TODO: check duplicates
- getSupportedProcessingEvents();
- EventDefinitionReferenceType edr = new EventDefinitionReferenceType();
- edr.setQName(qname);
- supportedProcessingEvent.add(edr);
- return edr;
- }
-
- public EventDefinitionReference addSupportedProcessingEvent(String name)
- {
- // TODO check duplicates
- getSupportedProcessingEvents();
- EventDefinitionReferenceType edr = new EventDefinitionReferenceType();
- edr.setName(name);
- supportedProcessingEvent.add(edr);
- return edr;
- }
-
- public List<? extends EventDefinitionReference> getSupportedPublishingEvents()
- {
- if (supportedPublishingEvent == null)
- {
- supportedPublishingEvent = new ArrayList<EventDefinitionReferenceType>();
- }
- return supportedPublishingEvent;
- }
-
- public EventDefinitionReference addSupportedPublishingEvent(QName qname)
- {
- // TODO: check duplicates
- getSupportedPublishingEvents();
- EventDefinitionReferenceType edr = new EventDefinitionReferenceType();
- edr.setQName(qname);
- supportedPublishingEvent.add(edr);
- return edr;
- }
-
- public EventDefinitionReference addSupportedPublishingEvent(String name)
- {
- // TODO check duplicates
- getSupportedPublishingEvents();
- EventDefinitionReferenceType edr = new EventDefinitionReferenceType();
- edr.setName(name);
- supportedPublishingEvent.add(edr);
- return edr;
- }
-
- public List<String> getSupportedPublicRenderParameters()
- {
- if (supportedPublicRenderParameter == null)
- {
- supportedPublicRenderParameter = new ArrayList<String>();
- }
- return supportedPublicRenderParameter;
- }
-
- public void addSupportedPublicRenderParameter(String identifier)
- {
- for (String ident : getSupportedPublicRenderParameters())
- {
- if (ident.equals(identifier))
- {
- throw new IllegalArgumentException("Support for public render parameter with identifier: "+identifier+" already defined");
- }
- }
- supportedPublicRenderParameter.add(identifier);
- }
-
- public ContainerRuntimeOption getContainerRuntimeOption(String name)
- {
- for (ContainerRuntimeOption cro : getContainerRuntimeOptions())
- {
- if (cro.getName().equals(name))
- {
- return cro;
- }
- }
- return null;
- }
-
- public List<? extends ContainerRuntimeOption> getContainerRuntimeOptions()
- {
- if (containerRuntimeOption == null)
- {
- containerRuntimeOption = new ArrayList<ContainerRuntimeOptionType>();
- }
- return containerRuntimeOption;
- }
-
- public ContainerRuntimeOption addContainerRuntimeOption(String name)
- {
- if (getContainerRuntimeOption(name) != null)
- {
- throw new IllegalArgumentException("Container runtime option with name: "+name+" already defined");
- }
- ContainerRuntimeOptionType cro = new ContainerRuntimeOptionType();
- cro.setName(name);
- containerRuntimeOption.add(cro);
- return cro;
- }
-
- public void afterUnmarshal(Unmarshaller u, Object parent) {
- application = (PortletApplicationDefinition)parent;
- }
-}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/a8bed7fb/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/PreferenceType.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/PreferenceType.java b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/PreferenceType.java
deleted file mode 100644
index 8cef36b..0000000
--- a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/PreferenceType.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * 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 javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlType;
-import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
-import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
-
-import org.apache.pluto.container.om.portlet.Preference;
-
-/**
- * Persistent preference values that may be used for customization and personalization by the portlet. Used in:
- * portlet-preferences <p>Java class for preferenceType complex type. <p>The following schema fragment specifies the
- * expected content contained within this class.
- *
- * <pre>
- * <complexType name="preferenceType">
- * <complexContent>
- * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * <sequence>
- * <element name="name" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}nameType"/>
- * <element name="value" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}valueType" maxOccurs="unbounded" minOccurs="0"/>
- * <element name="read-only" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}read-onlyType" minOccurs="0"/>
- * </sequence>
- * <attribute name="id" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}string" />
- * </restriction>
- * </complexContent>
- * </complexType>
- * </pre>
- *
- * @version $Id$
- */
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "preferenceType", propOrder = { "name", "value", "readOnly" })
-public class PreferenceType implements Preference
-{
- @XmlElement(required = true)
- @XmlJavaTypeAdapter(value=CollapsedStringAdapter.class)
- protected String name;
- @XmlJavaTypeAdapter(value=CollapsedStringAdapter.class)
- protected List<String> value;
- @XmlElement(name = "read-only")
- protected Boolean readOnly;
-
- public String getName()
- {
- return name;
- }
-
- public void setName(String value)
- {
- name = value;
- }
-
- public List<String> getValues()
- {
- if (value == null)
- {
- value = new ArrayList<String>();
- }
- return value;
- }
-
- public void addValue(String value)
- {
- getValues().add(value);
- }
-
- public boolean isReadOnly()
- {
- return readOnly != null ? readOnly.booleanValue() : false;
- }
-
- public void setReadOnly(boolean value)
- {
- readOnly = value ? Boolean.TRUE : Boolean.FALSE;
- }
-}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/a8bed7fb/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/PublicRenderParameterType.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/PublicRenderParameterType.java b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/PublicRenderParameterType.java
deleted file mode 100644
index 1364476..0000000
--- a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/PublicRenderParameterType.java
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- * 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.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlSchemaType;
-import javax.xml.bind.annotation.XmlType;
-import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
-import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
-import javax.xml.namespace.QName;
-
-import org.apache.pluto.container.om.portlet.Description;
-import org.apache.pluto.container.om.portlet.PublicRenderParameter;
-
-/**
- * The public-render-parameters defines a render parameter that is allowed to be public and thus be shared with other
- * portlets. The identifier must be used for referencing this public render parameter in the portlet code. Used in:
- * portlet-app <p>Java class for public-render-parameterType complex type. <p>The following schema fragment specifies
- * the expected content contained within this class.
- *
- * <pre>
- * <complexType name="public-render-parameterType">
- * <complexContent>
- * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * <sequence>
- * <element name="description" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}descriptionType" maxOccurs="unbounded" minOccurs="0"/>
- * <element name="identifier" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}string"/>
- * <choice>
- * <element name="qname" type="{http://www.w3.org/2001/XMLSchema}QName"/>
- * <element name="name" type="{http://www.w3.org/2001/XMLSchema}NCName"/>
- * </choice>
- * <element name="alias" type="{http://www.w3.org/2001/XMLSchema}QName" maxOccurs="unbounded" minOccurs="0"/>
- * </sequence>
- * <attribute name="id" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}string" />
- * </restriction>
- * </complexContent>
- * </complexType>
- * </pre>
- *
- * @version $Id$
- */
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "public-render-parameterType", propOrder = { "description", "identifier", "qname", "name", "alias" })
-public class PublicRenderParameterType implements PublicRenderParameter
-{
- @XmlElement(name = "description")
- protected List<DescriptionType> description;
- @XmlElement(required = true)
- protected String identifier;
- protected QName qname;
- @XmlJavaTypeAdapter(CollapsedStringAdapter.class)
- @XmlSchemaType(name = "NCName")
- protected String name;
- protected List<QName> alias;
-
- public Description getDescription(Locale locale)
- {
- for (Description d : getDescriptions())
- {
- if (d.getLocale().equals(locale))
- {
- return d;
- }
- }
- return null;
- }
-
- public List<? extends Description> getDescriptions()
- {
- if (description == null)
- {
- description = new ArrayList<DescriptionType>();
- }
- return description;
- }
-
- public Description addDescription(String lang)
- {
- DescriptionType d = new DescriptionType();
- d.setLang(lang);
- if (getDescription(d.getLocale()) != null)
- {
- throw new IllegalArgumentException("Description for language: "+d.getLocale()+" already defined");
- }
- getDescriptions();
- description.add(d);
- return d;
- }
-
- public String getIdentifier()
- {
- return identifier;
- }
-
- public void setIdentifier(String value)
- {
- identifier = value;
- }
-
- public QName getQName()
- {
- return qname;
- }
-
- public void setQName(QName value)
- {
- qname = value;
- name = null;
- }
-
- public String getName()
- {
- return name;
- }
-
- public void setName(String value)
- {
- name = value;
- qname = null;
- }
-
- public List<QName> getAliases()
- {
- if (alias == null)
- {
- alias = new ArrayList<QName>();
- }
- return alias;
- }
-
- public void addAlias(QName alias)
- {
- // TODO: check duplicates
- getAliases().add(alias);
- }
-}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/a8bed7fb/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/SecurityConstraintType.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/SecurityConstraintType.java b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/SecurityConstraintType.java
deleted file mode 100644
index c0fb86c..0000000
--- a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/SecurityConstraintType.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * 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.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlType;
-
-import org.apache.pluto.container.om.portlet.DisplayName;
-import org.apache.pluto.container.om.portlet.SecurityConstraint;
-import org.apache.pluto.container.om.portlet.UserDataConstraint;
-
-/**
- * The security-constraintType is used to associate intended security constraints with one or more portlets. Used in:
- * portlet-app <p>Java class for security-constraintType complex type. <p>The following schema fragment specifies the
- * expected content contained within this class.
- *
- * <pre>
- * <complexType name="security-constraintType">
- * <complexContent>
- * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * <sequence>
- * <element name="display-name" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}display-nameType" maxOccurs="unbounded" minOccurs="0"/>
- * <element name="portlet-collection" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}portlet-collectionType"/>
- * <element name="user-data-constraint" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}user-data-constraintType"/>
- * </sequence>
- * <attribute name="id" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}string" />
- * </restriction>
- * </complexContent>
- * </complexType>
- * </pre>
- *
- * @version $Id$
- */
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "security-constraintType", propOrder = { "displayName", "portletCollection", "userDataConstraint" })
-public class SecurityConstraintType implements SecurityConstraint
-{
- @XmlElement(name = "display-name")
- protected List<DisplayNameType> displayName;
- @XmlElement(name = "portlet-collection", required = true)
- protected PortletCollectionType portletCollection;
- @XmlElement(name = "user-data-constraint", required = true)
- protected UserDataConstraintType userDataConstraint;
-
- public DisplayName getDisplayName(Locale locale)
- {
- for (DisplayName d : getDisplayNames())
- {
- if (d.getLocale().equals(locale))
- {
- return d;
- }
- }
- return null;
- }
-
- public List<? extends DisplayName> getDisplayNames()
- {
- if (displayName == null)
- {
- displayName = new ArrayList<DisplayNameType>();
- }
- return displayName;
- }
-
- public DisplayName addDisplayName(String lang)
- {
- DisplayNameType d = new DisplayNameType();
- d.setLang(lang);
- if (getDisplayName(d.getLocale()) != null)
- {
- throw new IllegalArgumentException("DisplayName for language: "+d.getLocale()+" already defined");
- }
- getDisplayNames();
- displayName.add(d);
- return d;
- }
-
- public List<String> getPortletNames()
- {
- if (portletCollection == null)
- {
- portletCollection = new PortletCollectionType();
- }
- return portletCollection.getPortletNames();
- }
-
- public void addPortletName(String portletName)
- {
- for (String name : getPortletNames())
- {
- if (name.equals(portletName))
- {
- throw new IllegalArgumentException("Portlet name: "+name+" already defined");
- }
- }
- portletCollection.getPortletNames().add(portletName);
- }
-
- public UserDataConstraint getUserDataConstraint()
- {
- if (userDataConstraint == null)
- {
- userDataConstraint = new UserDataConstraintType();
- }
- return userDataConstraint;
- }
-}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/a8bed7fb/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/SecurityRoleRefType.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/SecurityRoleRefType.java b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/SecurityRoleRefType.java
deleted file mode 100644
index f7f6ea0..0000000
--- a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/SecurityRoleRefType.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * 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.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlType;
-import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
-import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
-
-import org.apache.pluto.container.om.portlet.Description;
-import org.apache.pluto.container.om.portlet.SecurityRoleRef;
-
-/**
- * The security-role-ref element contains the declaration of a security role reference in the code of the web
- * application. The declaration consists of an optional description, the security role name used in the code, and an
- * optional link to a security role. If the security role is not specified, the Deployer must choose an appropriate
- * security role. The value of the role name element must be the String used as the parameter to the
- * EJBContext.isCallerInRole(String roleName) method or the HttpServletRequest.isUserInRole(String role) method. Used
- * in: portlet <p>Java class for security-role-refType complex type. <p>The following schema fragment specifies the
- * expected content contained within this class.
- *
- * <pre>
- * <complexType name="security-role-refType">
- * <complexContent>
- * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * <sequence>
- * <element name="description" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}descriptionType" maxOccurs="unbounded" minOccurs="0"/>
- * <element name="role-name" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}role-nameType"/>
- * <element name="role-link" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}role-linkType" minOccurs="0"/>
- * </sequence>
- * <attribute name="id" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}string" />
- * </restriction>
- * </complexContent>
- * </complexType>
- * </pre>
- *
- * @version $Id$
-*/
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "security-role-refType", propOrder = { "description", "roleName", "roleLink" })
-public class SecurityRoleRefType implements SecurityRoleRef
-{
- @XmlElement(name = "description")
- protected List<DescriptionType> description;
- @XmlElement(name = "role-name", required = true)
- @XmlJavaTypeAdapter(CollapsedStringAdapter.class)
- protected String roleName;
- @XmlElement(name = "role-link")
- @XmlJavaTypeAdapter(value=CollapsedStringAdapter.class)
- protected String roleLink;
-
- public Description getDescription(Locale locale)
- {
- for (Description d : getDescriptions())
- {
- if (d.getLocale().equals(locale))
- {
- return d;
- }
- }
- return null;
- }
-
- public List<? extends Description> getDescriptions()
- {
- if (description == null)
- {
- description = new ArrayList<DescriptionType>();
- }
- return description;
- }
-
- public Description addDescription(String lang)
- {
- DescriptionType d = new DescriptionType();
- d.setLang(lang);
- if (getDescription(d.getLocale()) != null)
- {
- throw new IllegalArgumentException("Description for language: "+d.getLocale()+" already defined");
- }
- getDescriptions();
- description.add(d);
- return d;
- }
-
- public String getRoleName()
- {
- return roleName;
- }
-
- public void setRoleName(String value)
- {
- roleName = value;
- }
-
- public String getRoleLink()
- {
- return roleLink;
- }
-
- public void setRoleLink(String value)
- {
- roleLink = value;
- }
-}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/a8bed7fb/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/SupportsType.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/SupportsType.java b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/SupportsType.java
deleted file mode 100644
index f540ae6..0000000
--- a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/SupportsType.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * 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 javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlType;
-import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
-import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
-
-import org.apache.pluto.container.om.portlet.Supports;
-
-/**
- * Supports indicates the portlet modes a portlet supports for a specific content type. All portlets must support the
- * view mode. Used in: portlet <p>Java class for supportsType complex type. <p>The following schema fragment specifies
- * the expected content contained within this class.
- *
- * <pre>
- * <complexType name="supportsType">
- * <complexContent>
- * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * <sequence>
- * <element name="mime-type" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}mime-typeType"/>
- * <element name="portlet-mode" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}portlet-modeType" maxOccurs="unbounded" minOccurs="0"/>
- * <element name="window-state" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}window-stateType" maxOccurs="unbounded" minOccurs="0"/>
- * </sequence>
- * <attribute name="id" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}string" />
- * </restriction>
- * </complexContent>
- * </complexType>
- * </pre>
- *
- * @version $Id$
- */
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "supportsType", propOrder = { "mimeType", "portletMode", "windowState" })
-public class SupportsType implements Supports
-{
- @XmlElement(name = "mime-type", required = true)
- @XmlJavaTypeAdapter(value=CollapsedStringAdapter.class)
- protected String mimeType;
- @XmlElement(name = "portlet-mode")
- @XmlJavaTypeAdapter(value=CollapsedStringAdapter.class)
- protected List<String> portletMode;
- @XmlElement(name = "window-state")
- @XmlJavaTypeAdapter(value=CollapsedStringAdapter.class)
- protected List<String> windowState;
-
- public String getMimeType()
- {
- return mimeType;
- }
-
- public void setMimeType(String value)
- {
- mimeType = value;
- }
-
- public List<String> getPortletModes()
- {
- if (portletMode == null)
- {
- portletMode = new ArrayList<String>();
- }
- return portletMode;
- }
-
- public void addPortletMode(String name)
- {
- for (String mode : getPortletModes())
- {
- if (mode.equals(name))
- {
- throw new IllegalArgumentException("Portlet mode: "+name+" already defined");
- }
- }
- portletMode.add(name);
- }
-
- public List<String> getWindowStates()
- {
- if (windowState == null)
- {
- windowState = new ArrayList<String>();
- }
- return windowState;
- }
-
- public void addWindowState(String name)
- {
- for (String state : getWindowStates())
- {
- if (state.equals(name))
- {
- throw new IllegalArgumentException("Window state: "+name+" already defined");
- }
- }
- windowState.add(name);
- }
-}
[05/14] portals-pluto git commit: work towards enabling v3 deployment
descriptor
Posted by ms...@apache.org.
work towards enabling v3 deployment descriptor
Project: http://git-wip-us.apache.org/repos/asf/portals-pluto/repo
Commit: http://git-wip-us.apache.org/repos/asf/portals-pluto/commit/a8bed7fb
Tree: http://git-wip-us.apache.org/repos/asf/portals-pluto/tree/a8bed7fb
Diff: http://git-wip-us.apache.org/repos/asf/portals-pluto/diff/a8bed7fb
Branch: refs/heads/V3Prototype
Commit: a8bed7fbd333a5d97506c802ec621b679ef9bb7a
Parents: 49072ab
Author: Scott Nicklous <ms...@apache.org>
Authored: Tue Jan 27 22:14:22 2015 +0100
Committer: Scott Nicklous <ms...@apache.org>
Committed: Tue Jan 27 22:14:22 2015 +0100
----------------------------------------------------------------------
.../impl/PortletAppDescriptorServiceImpl.java | 726 +++++++-------
.../impl/ContainerRuntimeOptionType.java | 87 --
.../om/portlet/impl/CustomPortletModeType.java | 121 ---
.../om/portlet/impl/CustomWindowStateType.java | 107 ---
.../om/portlet/impl/DescriptionType.java | 120 ---
.../om/portlet/impl/DisplayNameType.java | 122 ---
.../impl/EventDefinitionReferenceType.java | 85 --
.../om/portlet/impl/EventDefinitionType.java | 161 ----
.../om/portlet/impl/FilterMappingType.java | 88 --
.../container/om/portlet/impl/FilterType.java | 214 -----
.../om/portlet/impl/InitParamType.java | 121 ---
.../container/om/portlet/impl/ListenerType.java | 142 ---
.../om/portlet/impl/ObjectFactory.java | 53 --
.../om/portlet/impl/PortletAppType.java | 549 -----------
.../om/portlet/impl/PortletCollectionType.java | 64 --
.../om/portlet/impl/PortletInfoType.java | 92 --
.../om/portlet/impl/PortletPreferencesType.java | 101 --
.../container/om/portlet/impl/PortletType.java | 521 ----------
.../om/portlet/impl/PreferenceType.java | 98 --
.../portlet/impl/PublicRenderParameterType.java | 156 ---
.../om/portlet/impl/SecurityConstraintType.java | 128 ---
.../om/portlet/impl/SecurityRoleRefType.java | 125 ---
.../container/om/portlet/impl/SupportsType.java | 118 ---
.../om/portlet/impl/UserAttributeType.java | 108 ---
.../om/portlet/impl/UserDataConstraintType.java | 107 ---
.../container/om/portlet/impl/package-info.java | 21 -
.../om/portlet10/impl/PortletAppType.java | 942 +++++++++----------
.../impl/ContainerRuntimeOptionType.java | 87 ++
.../portlet20/impl/CustomPortletModeType.java | 121 +++
.../portlet20/impl/CustomWindowStateType.java | 107 +++
.../om/portlet20/impl/DescriptionType.java | 120 +++
.../om/portlet20/impl/DisplayNameType.java | 122 +++
.../impl/EventDefinitionReferenceType.java | 85 ++
.../om/portlet20/impl/EventDefinitionType.java | 161 ++++
.../om/portlet20/impl/FilterMappingType.java | 88 ++
.../container/om/portlet20/impl/FilterType.java | 214 +++++
.../om/portlet20/impl/InitParamType.java | 121 +++
.../om/portlet20/impl/ListenerType.java | 142 +++
.../om/portlet20/impl/ObjectFactory.java | 53 ++
.../om/portlet20/impl/PortletAppType.java | 549 +++++++++++
.../portlet20/impl/PortletCollectionType.java | 64 ++
.../om/portlet20/impl/PortletInfoType.java | 92 ++
.../portlet20/impl/PortletPreferencesType.java | 101 ++
.../om/portlet20/impl/PortletType.java | 521 ++++++++++
.../om/portlet20/impl/PreferenceType.java | 98 ++
.../impl/PublicRenderParameterType.java | 156 +++
.../portlet20/impl/SecurityConstraintType.java | 128 +++
.../om/portlet20/impl/SecurityRoleRefType.java | 125 +++
.../om/portlet20/impl/SupportsType.java | 118 +++
.../om/portlet20/impl/UserAttributeType.java | 108 +++
.../portlet20/impl/UserDataConstraintType.java | 107 +++
.../om/portlet20/impl/package-info.java | 21 +
.../resource/SupportedModesServiceImpl.java | 537 +++++------
.../DefaultPortletPreferencesService.java | 520 +++++-----
.../container/ResourceBundleFactoryTest.java | 264 +++---
55 files changed, 5104 insertions(+), 5103 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/a8bed7fb/pluto-container/src/main/java/org/apache/pluto/container/impl/PortletAppDescriptorServiceImpl.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/impl/PortletAppDescriptorServiceImpl.java b/pluto-container/src/main/java/org/apache/pluto/container/impl/PortletAppDescriptorServiceImpl.java
index 09a501b..397df22 100644
--- a/pluto-container/src/main/java/org/apache/pluto/container/impl/PortletAppDescriptorServiceImpl.java
+++ b/pluto-container/src/main/java/org/apache/pluto/container/impl/PortletAppDescriptorServiceImpl.java
@@ -1,363 +1,363 @@
-/*
- * 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.impl;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.Iterator;
-import java.util.Locale;
-import java.util.regex.Pattern;
-
-import javax.xml.XMLConstants;
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBElement;
-import javax.xml.bind.JAXBException;
-import javax.xml.bind.Marshaller;
-import javax.xml.bind.Unmarshaller;
-import javax.xml.bind.helpers.DefaultValidationEventHandler;
-import javax.xml.namespace.NamespaceContext;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.events.XMLEvent;
-import javax.xml.stream.util.StreamReaderDelegate;
-import javax.xml.xpath.XPath;
-import javax.xml.xpath.XPathConstants;
-import javax.xml.xpath.XPathFactory;
-
-import org.apache.pluto.container.PortletAppDescriptorService;
-import org.apache.pluto.container.om.portlet.PortletApplicationDefinition;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.NodeList;
-import org.xml.sax.EntityResolver;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-
-/**
- * JAXB implementation of the xml2java binding
- * @author <a href="mailto:chrisra@cs.uni-jena.de">Christian Raschka</a>
- */
-
-public class PortletAppDescriptorServiceImpl implements PortletAppDescriptorService{
-
- private static class WebAppDtdEntityResolver implements EntityResolver {
- public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException
- {
- if (systemId.equals("http://java.sun.com/dtd/web-app_2_3.dtd"))
- {
- return new InputSource(getClass().getResourceAsStream("web-app_2_3.dtd"));
- }
- return null;
- }
- }
-
- private static class NamespaceOverridingStreamReaderDelegate extends StreamReaderDelegate {
- private String adjustedNamespaceURI = null;
-
- private NamespaceOverridingStreamReaderDelegate(XMLStreamReader reader) {
- super(reader);
- }
-
- @Override
- public int next() throws XMLStreamException
- {
- int eventCode = super.next();
- if (eventCode == XMLEvent.START_ELEMENT && "portlet-app".equals(getLocalName()))
- {
- String version = getAttributeValue(null, "version");
- if ("1.0".equals(version))
- {
- adjustedNamespaceURI = "http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd";
- }
- else if ("2.0".equals(version))
- {
- adjustedNamespaceURI = "http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd";
- }
- }
- return eventCode;
- }
-
- @Override
- public String getNamespaceURI()
- {
- String namespaceURI = super.getNamespaceURI();
- return (namespaceURI != null ? namespaceURI : adjustedNamespaceURI);
- }
- }
-
- private static class XPathNamespaceContext implements NamespaceContext
- {
- private String namespaceURI;
- private String prefix;
-
- public XPathNamespaceContext(String prefix)
- {
- this(prefix,XMLConstants.XML_NS_URI);
- }
-
- public XPathNamespaceContext(String prefix, String namespaceURI)
- {
- this.prefix = prefix;
- this.namespaceURI = namespaceURI;
- }
-
- public String getNamespaceURI(String prefix)
- {
- if (prefix == null)
- {
- throw new NullPointerException("Null prefix");
- }
- else if (this.prefix.equals(prefix))
- {
- return namespaceURI;
- }
- else if ("xml".equals(prefix))
- {
- return XMLConstants.XML_NS_URI;
- }
- return XMLConstants.NULL_NS_URI;
- }
-
- public String getPrefix(String namespaceURI)
- {
- throw new UnsupportedOperationException();
- }
-
- public Iterator<?> getPrefixes(String namespaceURI)
- {
- throw new UnsupportedOperationException();
- }
- }
-
- public static Locale convertStringToLocale(String lang)
- {
- if (lang == null)
- {
- return null;
- }
- String country = "";
- String variant = "";
- String[] localeArray = LOCALE_SPLIT.split(lang);
- for (int i = 0; i < localeArray.length; i++)
- {
- if (i == 0)
- {
- lang = localeArray[i];
- }
- else if (i == 1)
- {
- country = localeArray[i];
- }
- else if (i == 2)
- {
- variant = localeArray[i];
- }
- }
- return new Locale(lang, country, variant);
- }
-
- private static final Pattern LOCALE_SPLIT = Pattern.compile("[-|_]");
- private static final String NAMESPACE_PREFIX = "xp";
-
- private final JAXBContext jaxbContext;
-
- public PortletAppDescriptorServiceImpl() {
- ClassLoader containerClassLoader = PortletAppDescriptorServiceImpl.class.getClassLoader();
- try {
- jaxbContext = JAXBContext.newInstance(org.apache.pluto.container.om.portlet10.impl.ObjectFactory.class.getPackage().getName() + ":" +
- org.apache.pluto.container.om.portlet.impl.ObjectFactory.class.getPackage().getName(),
- containerClassLoader);
- }
- catch (JAXBException e) {
- throw new IllegalStateException("Failed to initialize JAXBContext for reading and writing portlet descriptors", e);
- }
- }
-
- /**
- * Read the Web Application Deployment Descriptor.
- *
- * @return WebAppDD instance representing the descriptor.
- * @throws java.io.IOException
- */
- public PortletApplicationDefinition read(String name, String contextPath, InputStream in) throws IOException
- {
- if (in == null) {
- throw new IOException("Cannot read from a null InputStream");
- }
-
- final XMLInputFactory xmlInputFactory = getXmlInputFactory();
-
- //Generate an xml stream reader for the input stream
- final XMLStreamReader streamReader;
- try {
- streamReader = xmlInputFactory.createXMLStreamReader(in);
- }
- catch (XMLStreamException e) {
- final IOException ioe = new IOException(e.getLocalizedMessage());
- ioe.initCause(e);
- throw ioe;
- }
-
- //Wrap the stream reader to make sure the namespace gets setup correctly
- final XMLStreamReader delegatingStreamReader = new NamespaceOverridingStreamReaderDelegate(streamReader);
-
- //Unmarshall the stream
- final JAXBElement<?> app;
- try {
- final Unmarshaller unmarshaller = this.jaxbContext.createUnmarshaller();
- unmarshaller.setEventHandler(new DefaultValidationEventHandler());
- app = (JAXBElement<?>) unmarshaller.unmarshal(delegatingStreamReader);
- }
- catch (JAXBException e) {
- final IOException ioe = new IOException(e.getMessage());
- ioe.initCause(e);
- throw ioe;
- }
-
- PortletApplicationDefinition pad = null;
- if (app.getValue() instanceof org.apache.pluto.container.om.portlet10.impl.PortletAppType)
- {
- pad = ((org.apache.pluto.container.om.portlet10.impl.PortletAppType)app.getValue()).upgrade();
- }
- else
- {
- pad = (PortletApplicationDefinition)app.getValue();
- }
-
- pad.setName(name);
- pad.setContextPath(contextPath);
-
- return pad;
- }
-
- public void mergeWebDescriptor(PortletApplicationDefinition pa, InputStream webDescriptor) throws Exception
- {
- final DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
- documentBuilderFactory.setNamespaceAware(true);
- final DocumentBuilder builder = documentBuilderFactory.newDocumentBuilder();
- builder.setEntityResolver(new WebAppDtdEntityResolver());
-
- final Document document = builder.parse(webDescriptor);
- final Element root = document.getDocumentElement();
- final String namespace = root.getNamespaceURI();
-
- final XPathFactory xpathFactory = XPathFactory.newInstance();
- final XPath xpath = xpathFactory.newXPath();
-
- String prefix;
- if(namespace!= null && namespace.length() > 0)
- {
- prefix = NAMESPACE_PREFIX+":";
- xpath.setNamespaceContext(new XPathNamespaceContext(NAMESPACE_PREFIX, namespace));
- }
- else
- {
- prefix = XMLConstants.DEFAULT_NS_PREFIX;
- xpath.setNamespaceContext(new XPathNamespaceContext(XMLConstants.DEFAULT_NS_PREFIX));
- }
-
- NodeList nodes;
- NodeList children;
- Element element;
-
- // retrieve locale-encoding-mapping
- nodes = (NodeList)xpath.evaluate("/"+prefix+"web-app/"+prefix+"locale-encoding-mapping-list/"+prefix+"locale-encoding-mapping", document, XPathConstants.NODESET);
- if (nodes != null)
- {
- String locale;
- String encoding;
-
- for (int i = 0, nsize = nodes.getLength(); i < nsize; i++)
- {
- element = (Element)nodes.item(i);
- children = element.getElementsByTagName("locale");
- if (children != null && children.getLength() != 0)
- {
- locale = children.item(0).getTextContent().trim();
- if (locale.length() > 0)
- {
-
- children = element.getElementsByTagName("encoding");
- if (children != null && children.getLength() != 0)
- {
- encoding = children.item(0).getTextContent().trim();
- if (encoding.length() > 0)
- {
- pa.getLocaleEncodingMappings().put(convertStringToLocale(locale), encoding);
- }
- }
- }
- }
- }
- }
- }
-
- /**
- * Write the deployment descriptor.
- * @param app
- * @throws java.io.IOException
- */
- public void write(PortletApplicationDefinition app, OutputStream out) throws IOException {
- try {
- final Object src;
- if (PortletApplicationDefinition.JSR_168_VERSION.equals(app.getVersion()))
- {
- src = new org.apache.pluto.container.om.portlet10.impl.PortletAppType(app);
- }
- else
- {
- src = app;
- }
- final Marshaller marshaller = this.jaxbContext.createMarshaller();
- marshaller.setEventHandler(new DefaultValidationEventHandler());
- marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
- marshaller.marshal(src,out);
- }
- catch (JAXBException jaxbEx){
- final IOException ioe = new IOException(jaxbEx.getMessage());
- ioe.initCause(jaxbEx);
- throw ioe;
- }
- catch(Exception me) {
- final IOException ioe = new IOException(me.getLocalizedMessage());
- ioe.initCause(me);
- throw ioe;
- }
- }
-
- protected XMLInputFactory getXmlInputFactory() {
- final ClassLoader portalClassLoader = this.getClass().getClassLoader();
- final Thread currentThread = Thread.currentThread();
- final ClassLoader contextClassLoader = currentThread.getContextClassLoader();
-
- if (portalClassLoader == contextClassLoader) {
- return XMLInputFactory.newInstance();
- }
-
- try {
- currentThread.setContextClassLoader(portalClassLoader);
- return XMLInputFactory.newInstance();
- }
- finally {
- currentThread.setContextClassLoader(contextClassLoader);
- }
- }
-}
+/*
+ * 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.impl;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.Iterator;
+import java.util.Locale;
+import java.util.regex.Pattern;
+
+import javax.xml.XMLConstants;
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Marshaller;
+import javax.xml.bind.Unmarshaller;
+import javax.xml.bind.helpers.DefaultValidationEventHandler;
+import javax.xml.namespace.NamespaceContext;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.events.XMLEvent;
+import javax.xml.stream.util.StreamReaderDelegate;
+import javax.xml.xpath.XPath;
+import javax.xml.xpath.XPathConstants;
+import javax.xml.xpath.XPathFactory;
+
+import org.apache.pluto.container.PortletAppDescriptorService;
+import org.apache.pluto.container.om.portlet.PortletApplicationDefinition;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+import org.xml.sax.EntityResolver;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+/**
+ * JAXB implementation of the xml2java binding
+ * @author <a href="mailto:chrisra@cs.uni-jena.de">Christian Raschka</a>
+ */
+
+public class PortletAppDescriptorServiceImpl implements PortletAppDescriptorService{
+
+ private static class WebAppDtdEntityResolver implements EntityResolver {
+ public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException
+ {
+ if (systemId.equals("http://java.sun.com/dtd/web-app_2_3.dtd"))
+ {
+ return new InputSource(getClass().getResourceAsStream("web-app_2_3.dtd"));
+ }
+ return null;
+ }
+ }
+
+ private static class NamespaceOverridingStreamReaderDelegate extends StreamReaderDelegate {
+ private String adjustedNamespaceURI = null;
+
+ private NamespaceOverridingStreamReaderDelegate(XMLStreamReader reader) {
+ super(reader);
+ }
+
+ @Override
+ public int next() throws XMLStreamException
+ {
+ int eventCode = super.next();
+ if (eventCode == XMLEvent.START_ELEMENT && "portlet-app".equals(getLocalName()))
+ {
+ String version = getAttributeValue(null, "version");
+ if ("1.0".equals(version))
+ {
+ adjustedNamespaceURI = "http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd";
+ }
+ else if ("2.0".equals(version))
+ {
+ adjustedNamespaceURI = "http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd";
+ }
+ }
+ return eventCode;
+ }
+
+ @Override
+ public String getNamespaceURI()
+ {
+ String namespaceURI = super.getNamespaceURI();
+ return (namespaceURI != null ? namespaceURI : adjustedNamespaceURI);
+ }
+ }
+
+ private static class XPathNamespaceContext implements NamespaceContext
+ {
+ private String namespaceURI;
+ private String prefix;
+
+ public XPathNamespaceContext(String prefix)
+ {
+ this(prefix,XMLConstants.XML_NS_URI);
+ }
+
+ public XPathNamespaceContext(String prefix, String namespaceURI)
+ {
+ this.prefix = prefix;
+ this.namespaceURI = namespaceURI;
+ }
+
+ public String getNamespaceURI(String prefix)
+ {
+ if (prefix == null)
+ {
+ throw new NullPointerException("Null prefix");
+ }
+ else if (this.prefix.equals(prefix))
+ {
+ return namespaceURI;
+ }
+ else if ("xml".equals(prefix))
+ {
+ return XMLConstants.XML_NS_URI;
+ }
+ return XMLConstants.NULL_NS_URI;
+ }
+
+ public String getPrefix(String namespaceURI)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public Iterator<?> getPrefixes(String namespaceURI)
+ {
+ throw new UnsupportedOperationException();
+ }
+ }
+
+ public static Locale convertStringToLocale(String lang)
+ {
+ if (lang == null)
+ {
+ return null;
+ }
+ String country = "";
+ String variant = "";
+ String[] localeArray = LOCALE_SPLIT.split(lang);
+ for (int i = 0; i < localeArray.length; i++)
+ {
+ if (i == 0)
+ {
+ lang = localeArray[i];
+ }
+ else if (i == 1)
+ {
+ country = localeArray[i];
+ }
+ else if (i == 2)
+ {
+ variant = localeArray[i];
+ }
+ }
+ return new Locale(lang, country, variant);
+ }
+
+ private static final Pattern LOCALE_SPLIT = Pattern.compile("[-|_]");
+ private static final String NAMESPACE_PREFIX = "xp";
+
+ private final JAXBContext jaxbContext;
+
+ public PortletAppDescriptorServiceImpl() {
+ ClassLoader containerClassLoader = PortletAppDescriptorServiceImpl.class.getClassLoader();
+ try {
+ jaxbContext = JAXBContext.newInstance(org.apache.pluto.container.om.portlet10.impl.ObjectFactory.class.getPackage().getName() + ":" +
+ org.apache.pluto.container.om.portlet20.impl.ObjectFactory.class.getPackage().getName(),
+ containerClassLoader);
+ }
+ catch (JAXBException e) {
+ throw new IllegalStateException("Failed to initialize JAXBContext for reading and writing portlet descriptors", e);
+ }
+ }
+
+ /**
+ * Read the Web Application Deployment Descriptor.
+ *
+ * @return WebAppDD instance representing the descriptor.
+ * @throws java.io.IOException
+ */
+ public PortletApplicationDefinition read(String name, String contextPath, InputStream in) throws IOException
+ {
+ if (in == null) {
+ throw new IOException("Cannot read from a null InputStream");
+ }
+
+ final XMLInputFactory xmlInputFactory = getXmlInputFactory();
+
+ //Generate an xml stream reader for the input stream
+ final XMLStreamReader streamReader;
+ try {
+ streamReader = xmlInputFactory.createXMLStreamReader(in);
+ }
+ catch (XMLStreamException e) {
+ final IOException ioe = new IOException(e.getLocalizedMessage());
+ ioe.initCause(e);
+ throw ioe;
+ }
+
+ //Wrap the stream reader to make sure the namespace gets setup correctly
+ final XMLStreamReader delegatingStreamReader = new NamespaceOverridingStreamReaderDelegate(streamReader);
+
+ //Unmarshall the stream
+ final JAXBElement<?> app;
+ try {
+ final Unmarshaller unmarshaller = this.jaxbContext.createUnmarshaller();
+ unmarshaller.setEventHandler(new DefaultValidationEventHandler());
+ app = (JAXBElement<?>) unmarshaller.unmarshal(delegatingStreamReader);
+ }
+ catch (JAXBException e) {
+ final IOException ioe = new IOException(e.getMessage());
+ ioe.initCause(e);
+ throw ioe;
+ }
+
+ PortletApplicationDefinition pad = null;
+ if (app.getValue() instanceof org.apache.pluto.container.om.portlet10.impl.PortletAppType)
+ {
+ pad = ((org.apache.pluto.container.om.portlet10.impl.PortletAppType)app.getValue()).upgrade();
+ }
+ else
+ {
+ pad = (PortletApplicationDefinition)app.getValue();
+ }
+
+ pad.setName(name);
+ pad.setContextPath(contextPath);
+
+ return pad;
+ }
+
+ public void mergeWebDescriptor(PortletApplicationDefinition pa, InputStream webDescriptor) throws Exception
+ {
+ final DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
+ documentBuilderFactory.setNamespaceAware(true);
+ final DocumentBuilder builder = documentBuilderFactory.newDocumentBuilder();
+ builder.setEntityResolver(new WebAppDtdEntityResolver());
+
+ final Document document = builder.parse(webDescriptor);
+ final Element root = document.getDocumentElement();
+ final String namespace = root.getNamespaceURI();
+
+ final XPathFactory xpathFactory = XPathFactory.newInstance();
+ final XPath xpath = xpathFactory.newXPath();
+
+ String prefix;
+ if(namespace!= null && namespace.length() > 0)
+ {
+ prefix = NAMESPACE_PREFIX+":";
+ xpath.setNamespaceContext(new XPathNamespaceContext(NAMESPACE_PREFIX, namespace));
+ }
+ else
+ {
+ prefix = XMLConstants.DEFAULT_NS_PREFIX;
+ xpath.setNamespaceContext(new XPathNamespaceContext(XMLConstants.DEFAULT_NS_PREFIX));
+ }
+
+ NodeList nodes;
+ NodeList children;
+ Element element;
+
+ // retrieve locale-encoding-mapping
+ nodes = (NodeList)xpath.evaluate("/"+prefix+"web-app/"+prefix+"locale-encoding-mapping-list/"+prefix+"locale-encoding-mapping", document, XPathConstants.NODESET);
+ if (nodes != null)
+ {
+ String locale;
+ String encoding;
+
+ for (int i = 0, nsize = nodes.getLength(); i < nsize; i++)
+ {
+ element = (Element)nodes.item(i);
+ children = element.getElementsByTagName("locale");
+ if (children != null && children.getLength() != 0)
+ {
+ locale = children.item(0).getTextContent().trim();
+ if (locale.length() > 0)
+ {
+
+ children = element.getElementsByTagName("encoding");
+ if (children != null && children.getLength() != 0)
+ {
+ encoding = children.item(0).getTextContent().trim();
+ if (encoding.length() > 0)
+ {
+ pa.getLocaleEncodingMappings().put(convertStringToLocale(locale), encoding);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Write the deployment descriptor.
+ * @param app
+ * @throws java.io.IOException
+ */
+ public void write(PortletApplicationDefinition app, OutputStream out) throws IOException {
+ try {
+ final Object src;
+ if (PortletApplicationDefinition.JSR_168_VERSION.equals(app.getVersion()))
+ {
+ src = new org.apache.pluto.container.om.portlet10.impl.PortletAppType(app);
+ }
+ else
+ {
+ src = app;
+ }
+ final Marshaller marshaller = this.jaxbContext.createMarshaller();
+ marshaller.setEventHandler(new DefaultValidationEventHandler());
+ marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
+ marshaller.marshal(src,out);
+ }
+ catch (JAXBException jaxbEx){
+ final IOException ioe = new IOException(jaxbEx.getMessage());
+ ioe.initCause(jaxbEx);
+ throw ioe;
+ }
+ catch(Exception me) {
+ final IOException ioe = new IOException(me.getLocalizedMessage());
+ ioe.initCause(me);
+ throw ioe;
+ }
+ }
+
+ protected XMLInputFactory getXmlInputFactory() {
+ final ClassLoader portalClassLoader = this.getClass().getClassLoader();
+ final Thread currentThread = Thread.currentThread();
+ final ClassLoader contextClassLoader = currentThread.getContextClassLoader();
+
+ if (portalClassLoader == contextClassLoader) {
+ return XMLInputFactory.newInstance();
+ }
+
+ try {
+ currentThread.setContextClassLoader(portalClassLoader);
+ return XMLInputFactory.newInstance();
+ }
+ finally {
+ currentThread.setContextClassLoader(contextClassLoader);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/a8bed7fb/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/ContainerRuntimeOptionType.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/ContainerRuntimeOptionType.java b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/ContainerRuntimeOptionType.java
deleted file mode 100644
index 36e5d66..0000000
--- a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/ContainerRuntimeOptionType.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * 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 javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlType;
-import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
-import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
-
-import org.apache.pluto.container.om.portlet.ContainerRuntimeOption;
-
-/**
- * The container-runtime-option element contains settings for the portlet container that the portlet expects to be
- * honored at runtime. These settings may re-define default portlet container behavior, like the javax.portlet.escapeXml
- * setting that disables XML encoding of URLs produced by the portlet tag library as default. Names with the
- * javax.portlet prefix are reserved for the Java Portlet Specification. Used in: portlet-app, portlet <p>Java class
- * for container-runtime-optionType complex type. <p>The following schema fragment specifies the expected content
- * contained within this class.
- *
- * <pre>
- * <complexType name="container-runtime-optionType">
- * <complexContent>
- * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * <sequence>
- * <element name="name" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}nameType"/>
- * <element name="value" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}valueType" maxOccurs="unbounded" minOccurs="0"/>
- * </sequence>
- * </restriction>
- * </complexContent>
- * </complexType>
- * </pre>
- *
- * @version $Id$
- */
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "container-runtime-optionType", propOrder = { "name", "value" })
-public class ContainerRuntimeOptionType implements ContainerRuntimeOption
-{
- @XmlElement(required = true)
- @XmlJavaTypeAdapter(value=CollapsedStringAdapter.class)
- protected String name;
- @XmlJavaTypeAdapter(value=CollapsedStringAdapter.class)
- protected List<String> value;
-
- public String getName()
- {
- return name;
- }
-
- public void setName(String value)
- {
- name = value;
- }
-
- public List<String> getValues()
- {
- if (value == null)
- {
- value = new ArrayList<String>();
- }
- return value;
- }
-
- public void addValue(String value)
- {
- getValues().add(value);
- }
-}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/a8bed7fb/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/CustomPortletModeType.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/CustomPortletModeType.java b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/CustomPortletModeType.java
deleted file mode 100644
index cc2db06..0000000
--- a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/CustomPortletModeType.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * 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.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlType;
-import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
-import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
-
-import org.apache.pluto.container.om.portlet.CustomPortletMode;
-import org.apache.pluto.container.om.portlet.Description;
-
-/**
- * A custom portlet mode that one or more portlets in this portlet application supports. If the portal does not need to
- * provide some management functionality for this portlet mode, the portal-managed element needs to be set to "false",
- * otherwise to "true". Default is "true". Used in: portlet-app <p>Java class for custom-portlet-modeType complex type.
- * <p>The following schema fragment specifies the expected content contained within this class.
- *
- * <pre>
- * <complexType name="custom-portlet-modeType">
- * <complexContent>
- * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * <sequence>
- * <element name="description" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}descriptionType" maxOccurs="unbounded" minOccurs="0"/>
- * <element name="portlet-mode" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}portlet-modeType"/>
- * <element name="portal-managed" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}portal-managedType" minOccurs="0"/>
- * </sequence>
- * <attribute name="id" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}string" />
- * </restriction>
- * </complexContent>
- * </complexType>
- * </pre>
- *
- * @version $Id$
- */
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "custom-portlet-modeType", propOrder = { "description", "portletMode", "portalManaged" })
-public class CustomPortletModeType implements CustomPortletMode
-{
- @XmlElement(name = "description")
- protected List<DescriptionType> description;
- @XmlElement(name = "portlet-mode", required = true)
- @XmlJavaTypeAdapter(value=CollapsedStringAdapter.class)
- protected String portletMode;
- @XmlElement(name = "portal-managed")
- protected Boolean portalManaged;
-
- public Description getDescription(Locale locale)
- {
- for (Description d : getDescriptions())
- {
- if (d.getLocale().equals(locale))
- {
- return d;
- }
- }
- return null;
- }
-
- public List<? extends Description> getDescriptions()
- {
- if (description == null)
- {
- description = new ArrayList<DescriptionType>();
- }
- return description;
- }
-
- public Description addDescription(String lang)
- {
- DescriptionType d = new DescriptionType();
- d.setLang(lang);
- if (getDescription(d.getLocale()) != null)
- {
- throw new IllegalArgumentException("Description for language: "+d.getLocale()+" already defined");
- }
- getDescriptions();
- description.add(d);
- return d;
- }
-
- public String getPortletMode()
- {
- return portletMode != null ? portletMode.toLowerCase() : null;
- }
-
- public void setPortletMode(String value)
- {
- portletMode = value.toLowerCase();
- }
-
- public boolean isPortalManaged()
- {
- return portalManaged != null ? portalManaged.booleanValue() : true;
- }
-
- public void setPortalManaged(boolean value)
- {
- portalManaged = value ? Boolean.TRUE : Boolean.FALSE;
- }
-}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/a8bed7fb/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/CustomWindowStateType.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/CustomWindowStateType.java b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/CustomWindowStateType.java
deleted file mode 100644
index 0454c0b..0000000
--- a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/CustomWindowStateType.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * 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.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlType;
-import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
-import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
-
-import org.apache.pluto.container.om.portlet.CustomWindowState;
-import org.apache.pluto.container.om.portlet.Description;
-
-/**
- * A custom window state that one or more portlets in this portlet application supports. Used in: portlet-app <p>Java
- * class for custom-window-stateType complex type. <p>The following schema fragment specifies the expected content
- * contained within this class.
- *
- * <pre>
- * <complexType name="custom-window-stateType">
- * <complexContent>
- * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * <sequence>
- * <element name="description" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}descriptionType" maxOccurs="unbounded" minOccurs="0"/>
- * <element name="window-state" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}window-stateType"/>
- * </sequence>
- * <attribute name="id" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}string" />
- * </restriction>
- * </complexContent>
- * </complexType>
- * </pre>
- *
- * @version $Id$
- */
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "custom-window-stateType", propOrder = { "description", "windowState" })
-public class CustomWindowStateType implements CustomWindowState
-{
- @XmlElement(name = "description")
- protected List<DescriptionType> description;
- @XmlElement(name = "window-state", required = true)
- @XmlJavaTypeAdapter(value=CollapsedStringAdapter.class)
- protected String windowState;
-
- public Description getDescription(Locale locale)
- {
- for (Description d : getDescriptions())
- {
- if (d.getLocale().equals(locale))
- {
- return d;
- }
- }
- return null;
- }
-
- public List<? extends Description> getDescriptions()
- {
- if (description == null)
- {
- description = new ArrayList<DescriptionType>();
- }
- return description;
- }
-
- public Description addDescription(String lang)
- {
- DescriptionType d = new DescriptionType();
- d.setLang(lang);
- if (getDescription(d.getLocale()) != null)
- {
- throw new IllegalArgumentException("Description for language: "+d.getLocale()+" already defined");
- }
- getDescriptions();
- description.add(d);
- return d;
- }
-
- public String getWindowState()
- {
- return windowState != null ? windowState.toLowerCase() : null;
- }
-
- public void setWindowState(String value)
- {
- windowState = value.toLowerCase();
- }
-}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/a8bed7fb/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/DescriptionType.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/DescriptionType.java b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/DescriptionType.java
deleted file mode 100644
index 5e8613f..0000000
--- a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/DescriptionType.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * 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.Locale;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlAttribute;
-import javax.xml.bind.annotation.XmlTransient;
-import javax.xml.bind.annotation.XmlType;
-import javax.xml.bind.annotation.XmlValue;
-import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
-import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
-
-import org.apache.pluto.container.om.portlet.Description;
-
-/**
- * The description element is used to provide text describing the parent element. The description element should include
- * any information that the portlet application war file producer wants to provide to the consumer of the portlet
- * application war file (i.e., to the Deployer). Typically, the tools used by the portlet application war file consumer
- * will display the description when processing the parent element that contains the description. It has an optional
- * attribute xml:lang to indicate which language is used in the description according to RFC 1766
- * (http://www.ietf.org/rfc/rfc1766.txt). The default value of this attribute is English(“en”). Used in: init-param,
- * portlet, portlet-app, security-role <p>Java class for descriptionType complex type. <p>The following schema
- * fragment specifies the expected content contained within this class.
- *
- * <pre>
- * <complexType name="descriptionType">
- * <simpleContent>
- * <extension base="<http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd>string">
- * <attribute ref="{http://www.w3.org/XML/1998/namespace}lang"/>
- * </extension>
- * </simpleContent>
- * </complexType>
- * </pre>
- *
- * @version $Id$
- */
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "descriptionType", propOrder = { "value" })
-public class DescriptionType implements Description
-{
- @XmlValue
- @XmlJavaTypeAdapter(value=CollapsedStringAdapter.class)
- protected String value;
- @XmlAttribute(namespace = "http://www.w3.org/XML/1998/namespace")
- protected String lang = null;
- @XmlTransient
- protected Locale locale;
-
- public String getDescription()
- {
- return value;
- }
-
- public void setDescription(String value)
- {
- this.value = value;
- }
-
- public String getLang()
- {
- return lang == null ? Locale.ENGLISH.toString() : lang;
- }
-
- public void setLang(String value)
- {
- lang = value;
- deriveLocale();
- }
-
- public Locale getLocale()
- {
- return locale == null ? deriveLocale() : locale;
- }
-
- protected Locale deriveLocale()
- {
- Locale locale = null;
- String lang = this.getLang();
- if (lang != null)
- {
- String country = "";
- String variant = "";
- String[] localeArray = lang.split("[-|_]");
- for (int i = 0; i < localeArray.length; i++)
- {
- if (i == 0)
- {
- lang = localeArray[i];
- }
- else if (i == 1)
- {
- country = localeArray[i];
- }
- else if (i == 2)
- {
- variant = localeArray[i];
- }
- }
- locale = new Locale(lang, country, variant);
- }
- return this.locale = locale;
- }
-}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/a8bed7fb/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/DisplayNameType.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/DisplayNameType.java b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/DisplayNameType.java
deleted file mode 100644
index 4b72a3f..0000000
--- a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/DisplayNameType.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * 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.Locale;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlAttribute;
-import javax.xml.bind.annotation.XmlTransient;
-import javax.xml.bind.annotation.XmlType;
-import javax.xml.bind.annotation.XmlValue;
-import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
-import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
-
-import org.apache.pluto.container.om.portlet.DisplayName;
-
-/**
- * The display-name type contains a short name that is intended to be displayed by tools. It is used by display-name
- * elements. The display name need not be unique. Example: ...
- *
- * <pre>
- * <?xml version="1.0" encoding="UTF-8"?><display-name xmlns="http://www.w3.org/2001/XMLSchema" xmlns:portlet="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" xml:lang="en">Employee Self Service</display-name>
- * </pre>
- *
- * It has an optional attribute xml:lang to indicate which language is used in the description according to RFC 1766
- * (http://www.ietf.org/rfc/rfc1766.txt). The default value of this attribute is English(“en”). <p>Java class for
- * display-nameType complex type. <p>The following schema fragment specifies the expected content contained within this
- * class.
- *
- * <pre>
- * <complexType name="display-nameType">
- * <simpleContent>
- * <extension base="<http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd>string">
- * <attribute ref="{http://www.w3.org/XML/1998/namespace}lang"/>
- * </extension>
- * </simpleContent>
- * </complexType>
- * </pre>
- *
- * @version $Id$
- */
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "display-nameType", propOrder = { "value" })
-public class DisplayNameType implements DisplayName
-{
- @XmlValue
- @XmlJavaTypeAdapter(value=CollapsedStringAdapter.class)
- protected String value;
- @XmlAttribute(namespace = "http://www.w3.org/XML/1998/namespace")
- protected String lang = null;
- @XmlTransient
- protected Locale locale;
-
- public String getDisplayName()
- {
- return value;
- }
-
- public void setDisplayName(String value)
- {
- this.value = value;
- }
-
- public String getLang()
- {
- return lang == null ? Locale.ENGLISH.toString() : lang;
- }
-
- public void setLang(String value)
- {
- lang = value;
- }
-
- public Locale getLocale()
- {
- return locale == null ? deriveLocale() : locale;
- }
-
- protected Locale deriveLocale()
- {
- Locale locale = null;
- String lang = this.getLang();
- if (lang != null)
- {
- String country = "";
- String variant = "";
- String[] localeArray = lang.split("[-|_]");
- for (int i = 0; i < localeArray.length; i++)
- {
- if (i == 0)
- {
- lang = localeArray[i];
- }
- else if (i == 1)
- {
- country = localeArray[i];
- }
- else if (i == 2)
- {
- variant = localeArray[i];
- }
- }
- locale = new Locale(lang, country, variant);
- }
- return this.locale = locale;
- }
-}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/a8bed7fb/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/EventDefinitionReferenceType.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/EventDefinitionReferenceType.java b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/EventDefinitionReferenceType.java
deleted file mode 100644
index 454fc11..0000000
--- a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/EventDefinitionReferenceType.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * 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 javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlSchemaType;
-import javax.xml.bind.annotation.XmlType;
-import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
-import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
-import javax.xml.namespace.QName;
-
-import org.apache.pluto.container.om.portlet.EventDefinitionReference;
-
-/**
- * The event-definition-referenceType is used to reference events declared with the event-definition element at
- * application level. Used in: portlet <p>Java class for event-definition-referenceType complex type. <p>The following
- * schema fragment specifies the expected content contained within this class.
- *
- * <pre>
- * <complexType name="event-definition-referenceType">
- * <complexContent>
- * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * <choice>
- * <element name="qname" type="{http://www.w3.org/2001/XMLSchema}QName"/>
- * <element name="name" type="{http://www.w3.org/2001/XMLSchema}NCName"/>
- * </choice>
- * <attribute name="id" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}string" />
- * </restriction>
- * </complexContent>
- * </complexType>
- * </pre>
- *
- * @version $Id$
- */
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "event-definition-referenceType", propOrder = { "qname", "name" })
-public class EventDefinitionReferenceType implements EventDefinitionReference
-{
- protected QName qname;
- @XmlJavaTypeAdapter(CollapsedStringAdapter.class)
- @XmlSchemaType(name = "NCName")
- protected String name;
-
- public QName getQName()
- {
- return qname;
- }
-
- public void setQName(QName value)
- {
- qname = value;
- name = null;
- }
-
- public String getName()
- {
- return name;
- }
-
- public void setName(String value)
- {
- name = value;
- qname = null;
- }
-
- public QName getQualifiedName(String defaultNamespace)
- {
- return qname != null ? qname : name != null ? new QName(defaultNamespace, name) : null;
- }
-}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/a8bed7fb/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/EventDefinitionType.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/EventDefinitionType.java b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/EventDefinitionType.java
deleted file mode 100644
index d5c743a..0000000
--- a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/EventDefinitionType.java
+++ /dev/null
@@ -1,161 +0,0 @@
-/*
- * 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.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlSchemaType;
-import javax.xml.bind.annotation.XmlType;
-import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
-import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
-import javax.xml.namespace.QName;
-
-import org.apache.pluto.container.om.portlet.Description;
-import org.apache.pluto.container.om.portlet.EventDefinition;
-
-/**
- * The event-definitionType is used to declare events the portlet can either receive or emit. The name must be unique
- * and must be the one the portlet is using in its code for referencing this event. Used in: portlet-app <p>Java class
- * for event-definitionType complex type. <p>The following schema fragment specifies the expected content contained
- * within this class.
- *
- * <pre>
- * <complexType name="event-definitionType">
- * <complexContent>
- * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * <sequence>
- * <element name="description" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}descriptionType" maxOccurs="unbounded" minOccurs="0"/>
- * <choice>
- * <element name="qname" type="{http://www.w3.org/2001/XMLSchema}QName"/>
- * <element name="name" type="{http://www.w3.org/2001/XMLSchema}NCName"/>
- * </choice>
- * <element name="alias" type="{http://www.w3.org/2001/XMLSchema}QName" maxOccurs="unbounded" minOccurs="0"/>
- * <element name="value-type" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}fully-qualified-classType" minOccurs="0"/>
- * </sequence>
- * <attribute name="id" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}string" />
- * </restriction>
- * </complexContent>
- * </complexType>
- * </pre>
- *
- * @version $Id$
- */
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "event-definitionType", propOrder = { "description", "qname", "name", "alias", "valueType" })
-public class EventDefinitionType implements EventDefinition
-{
- @XmlElement(name = "description")
- protected List<DescriptionType> description;
- protected QName qname;
- @XmlJavaTypeAdapter(CollapsedStringAdapter.class)
- @XmlSchemaType(name = "NCName")
- protected String name;
- protected List<QName> alias;
- @XmlElement(name = "value-type")
- protected String valueType;
-
- public Description getDescription(Locale locale)
- {
- for (Description d : getDescriptions())
- {
- if (d.getLocale().equals(locale))
- {
- return d;
- }
- }
- return null;
- }
-
- public List<? extends Description> getDescriptions()
- {
- if (description == null)
- {
- description = new ArrayList<DescriptionType>();
- }
- return description;
- }
-
- public Description addDescription(String lang)
- {
- DescriptionType d = new DescriptionType();
- d.setLang(lang);
- if (getDescription(d.getLocale()) != null)
- {
- throw new IllegalArgumentException("Description for language: "+d.getLocale()+" already defined");
- }
- getDescriptions();
- description.add(d);
- return d;
- }
-
- public QName getQName()
- {
- return qname;
- }
-
- public void setQName(QName value)
- {
- qname = value;
- name = null;
- }
-
- public String getName()
- {
- return name;
- }
-
- public void setName(String value)
- {
- name = value;
- qname = null;
- }
-
- public List<QName> getAliases()
- {
- if (alias == null)
- {
- alias = new ArrayList<QName>();
- }
- return alias;
- }
-
- public void addAlias(QName alias)
- {
- // TODO: check for duplicates
- getAliases().add(alias);
- }
-
- public String getValueType()
- {
- return valueType;
- }
-
- public void setValueType(String value)
- {
- valueType = value;
- }
-
- public QName getQualifiedName(String defaultNamespace)
- {
- return qname != null ? qname : name != null ? new QName(defaultNamespace, name) : null;
- }
-}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/a8bed7fb/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/FilterMappingType.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/FilterMappingType.java b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/FilterMappingType.java
deleted file mode 100644
index b66661d..0000000
--- a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/FilterMappingType.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * 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 javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlType;
-import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
-import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
-
-import org.apache.pluto.container.om.portlet.FilterMapping;
-
-/**
- * Declaration of the filter mappings in this portlet application is done by using filter-mappingType. The container
- * uses the filter-mapping declarations to decide which filters to apply to a request, and in what order. To determine
- * which filters to apply it matches filter-mapping declarations on the portlet-name and the lifecyle phase defined in
- * the filter element. The order in which filters are invoked is the order in which filter-mapping declarations that
- * match appear in the list of filter-mapping elements. Used in: portlet-app <p>Java class for filter-mappingType
- * complex type. <p>The following schema fragment specifies the expected content contained within this class.
- *
- * <pre>
- * <complexType name="filter-mappingType">
- * <complexContent>
- * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * <sequence>
- * <element name="filter-name" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}filter-nameType"/>
- * <element name="portlet-name" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}portlet-nameType" maxOccurs="unbounded"/>
- * </sequence>
- * </restriction>
- * </complexContent>
- * </complexType>
- * </pre>
- *
- * @version $Id$
- */
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "filter-mappingType", propOrder = { "filterName", "portletName" })
-public class FilterMappingType implements FilterMapping
-{
- @XmlElement(name = "filter-name", required = true)
- protected String filterName;
- @XmlElement(name = "portlet-name", required = true)
- @XmlJavaTypeAdapter(value=CollapsedStringAdapter.class)
- protected List<String> portletName;
-
- public String getFilterName()
- {
- return filterName;
- }
-
- public void setFilterName(String value)
- {
- filterName = value;
- }
-
- public List<String> getPortletNames()
- {
- if (portletName == null)
- {
- portletName = new ArrayList<String>();
- }
- return portletName;
- }
-
- public void addPortletName(String name)
- {
- // TODO: check for duplicates
- getPortletNames().add(name);
- }
-}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/a8bed7fb/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/FilterType.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/FilterType.java b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/FilterType.java
deleted file mode 100644
index 5e377f9..0000000
--- a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/FilterType.java
+++ /dev/null
@@ -1,214 +0,0 @@
-/*
- * 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.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlType;
-
-import org.apache.pluto.container.om.portlet.Description;
-import org.apache.pluto.container.om.portlet.DisplayName;
-import org.apache.pluto.container.om.portlet.Filter;
-import org.apache.pluto.container.om.portlet.InitParam;
-
-/**
- * The filter element specifies a filter that can transform the content of portlet requests and portlet responses.
- * Filters can access the initialization parameters declared in the deployment descriptor at runtime via the
- * FilterConfig interface. A filter can be restricted to one or more lifecycle phases of the portlet. Valid entries for
- * lifecycle are: ACTION_PHASE, EVENT_PHASE, RENDER_PHASE, RESOURCE_PHASE Used in: portlet-app <p>Java class for
- * filterType complex type. <p>The following schema fragment specifies the expected content contained within this
- * class.
- *
- * <pre>
- * <complexType name="filterType">
- * <complexContent>
- * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * <sequence>
- * <element name="description" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}descriptionType" maxOccurs="unbounded" minOccurs="0"/>
- * <element name="display-name" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}display-nameType" maxOccurs="unbounded" minOccurs="0"/>
- * <element name="filter-name" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}filter-nameType"/>
- * <element name="filter-class" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}fully-qualified-classType"/>
- * <element name="lifecycle" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}string" maxOccurs="unbounded"/>
- * <element name="init-param" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}init-paramType" maxOccurs="unbounded" minOccurs="0"/>
- * </sequence>
- * </restriction>
- * </complexContent>
- * </complexType>
- * </pre>
- *
- * @version $Id$
- */
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "filterType", propOrder = { "description", "displayName", "filterName", "filterClass", "lifecycle",
- "initParam" })
-public class FilterType implements Filter
-{
- @XmlElement(name = "description")
- protected List<DescriptionType> description;
- @XmlElement(name = "display-name")
- protected List<DisplayNameType> displayName;
- @XmlElement(name = "filter-name", required = true)
- protected String filterName;
- @XmlElement(name = "filter-class", required = true)
- protected String filterClass;
- @XmlElement(required = true)
- protected List<String> lifecycle;
- @XmlElement(name = "init-param")
- protected List<InitParamType> initParam;
-
- public Description getDescription(Locale locale)
- {
- for (Description d : getDescriptions())
- {
- if (d.getLocale().equals(locale))
- {
- return d;
- }
- }
- return null;
- }
-
- public List<? extends Description> getDescriptions()
- {
- if (description == null)
- {
- description = new ArrayList<DescriptionType>();
- }
- return description;
- }
-
- public Description addDescription(String lang)
- {
- DescriptionType d = new DescriptionType();
- d.setLang(lang);
- if (getDescription(d.getLocale()) != null)
- {
- throw new IllegalArgumentException("Description for language: "+d.getLocale()+" already defined");
- }
- getDescriptions();
- description.add(d);
- return d;
- }
-
- public DisplayName getDisplayName(Locale locale)
- {
- for (DisplayName d : getDisplayNames())
- {
- if (d.getLocale().equals(locale))
- {
- return d;
- }
- }
- return null;
- }
-
- public List<? extends DisplayName> getDisplayNames()
- {
- if (displayName == null)
- {
- displayName = new ArrayList<DisplayNameType>();
- }
- return displayName;
- }
-
- public DisplayName addDisplayName(String lang)
- {
- DisplayNameType d = new DisplayNameType();
- d.setLang(lang);
- if (getDisplayName(d.getLocale()) != null)
- {
- throw new IllegalArgumentException("DisplayName for language: "+d.getLocale()+" already defined");
- }
- getDisplayNames();
- displayName.add(d);
- return d;
- }
-
- public String getFilterName()
- {
- return filterName;
- }
-
- public void setFilterName(String value)
- {
- filterName = value;
- }
-
- public String getFilterClass()
- {
- return filterClass;
- }
-
- public void setFilterClass(String value)
- {
- filterClass = value;
- }
-
- public List<String> getLifecycles()
- {
- 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;
- }
-
- public List<? extends InitParam> getInitParams()
- {
- if (initParam == null)
- {
- initParam = new ArrayList<InitParamType>();
- }
- return initParam;
- }
-
- public InitParam addInitParam(String paramName)
- {
- if (getInitParam(paramName) != null)
- {
- throw new IllegalArgumentException("Init parameter: "+paramName+" already defined");
- }
- InitParamType param = new InitParamType();
- param.setParamName(paramName);
- getInitParams();
- initParam.add(param);
- return param;
- }
-}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/a8bed7fb/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/InitParamType.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/InitParamType.java b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/InitParamType.java
deleted file mode 100644
index fe1d48a..0000000
--- a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/InitParamType.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * 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.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlType;
-import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
-import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
-
-import org.apache.pluto.container.om.portlet.Description;
-import org.apache.pluto.container.om.portlet.InitParam;
-
-/**
- * The init-param element contains a name/value pair as an initialization param of the portlet Used in:portlet <p>Java
- * class for init-paramType complex type. <p>The following schema fragment specifies the expected content contained
- * within this class.
- *
- * <pre>
- * <complexType name="init-paramType">
- * <complexContent>
- * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * <sequence>
- * <element name="description" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}descriptionType" maxOccurs="unbounded" minOccurs="0"/>
- * <element name="name" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}nameType"/>
- * <element name="value" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}valueType"/>
- * </sequence>
- * <attribute name="id" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}string" />
- * </restriction>
- * </complexContent>
- * </complexType>
- * </pre>
- *
- * @version $Id$
- */
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "init-paramType", propOrder = { "description", "name", "value" })
-public class InitParamType implements InitParam
-{
- @XmlElement(name = "description")
- protected List<DescriptionType> description;
- @XmlElement(required = true)
- @XmlJavaTypeAdapter(value=CollapsedStringAdapter.class)
- protected String name;
- @XmlElement(required = true)
- @XmlJavaTypeAdapter(value=CollapsedStringAdapter.class)
- protected String value;
-
- public Description getDescription(Locale locale)
- {
- for (Description d : getDescriptions())
- {
- if (d.getLocale().equals(locale))
- {
- return d;
- }
- }
- return null;
- }
-
- public List<? extends Description> getDescriptions()
- {
- if (description == null)
- {
- description = new ArrayList<DescriptionType>();
- }
- return description;
- }
-
- public Description addDescription(String lang)
- {
- DescriptionType d = new DescriptionType();
- d.setLang(lang);
- if (getDescription(d.getLocale()) != null)
- {
- throw new IllegalArgumentException("Description for language: "+d.getLocale()+" already defined");
- }
- getDescriptions();
- description.add(d);
- return d;
- }
-
- public String getParamName()
- {
- return name;
- }
-
- public void setParamName(String value)
- {
- name = value;
- }
-
- public String getParamValue()
- {
- return value;
- }
-
- public void setParamValue(String value)
- {
- this.value = value;
- }
-}
[09/14] portals-pluto git commit: Initial adaptation of Container
JAXB code allowing a v3.0 deployement descriptor to be read
Posted by ms...@apache.org.
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/d2574528/pluto-container/src/main/java/org/apache/pluto/container/om/portlet30/impl/PortletAppType.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet30/impl/PortletAppType.java b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet30/impl/PortletAppType.java
new file mode 100644
index 0000000..551e01d
--- /dev/null
+++ b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet30/impl/PortletAppType.java
@@ -0,0 +1,551 @@
+/*
+ * 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.portlet30.impl;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+
+import javax.xml.XMLConstants;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlSchemaType;
+import javax.xml.bind.annotation.XmlTransient;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+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;
+
+/**
+ * <p>Java class for portlet-appType complex type. <p>The following schema fragment specifies the expected content
+ * contained within this class.
+ *
+ * <pre>
+ * <complexType name="portlet-appType">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="portlet" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}portletType" maxOccurs="unbounded" minOccurs="0"/>
+ * <element name="custom-portlet-mode" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}custom-portlet-modeType" maxOccurs="unbounded" minOccurs="0"/>
+ * <element name="custom-window-state" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}custom-window-stateType" maxOccurs="unbounded" minOccurs="0"/>
+ * <element name="user-attribute" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}user-attributeType" maxOccurs="unbounded" minOccurs="0"/>
+ * <element name="security-constraint" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}security-constraintType" maxOccurs="unbounded" minOccurs="0"/>
+ * <element name="resource-bundle" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}resource-bundleType" minOccurs="0"/>
+ * <element name="filter" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}filterType" maxOccurs="unbounded" minOccurs="0"/>
+ * <element name="filter-mapping" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}filter-mappingType" maxOccurs="unbounded" minOccurs="0"/>
+ * <element name="default-namespace" type="{http://www.w3.org/2001/XMLSchema}anyURI" minOccurs="0"/>
+ * <element name="event-definition" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}event-definitionType" maxOccurs="unbounded" minOccurs="0"/>
+ * <element name="public-render-parameter" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}public-render-parameterType" maxOccurs="unbounded" minOccurs="0"/>
+ * <element name="listener" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}listenerType" maxOccurs="unbounded" minOccurs="0"/>
+ * <element name="container-runtime-option" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}container-runtime-optionType" maxOccurs="unbounded" minOccurs="0"/>
+ * </sequence>
+ * <attribute name="version" use="required" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}string" />
+ * <attribute name="id" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}string" />
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ * @version $Id$
+ */
+@XmlRootElement(name = "portlet-app")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "portlet-appType", propOrder = { "portlet", "customPortletMode", "customWindowState", "userAttribute",
+ "securityConstraint", "resourceBundle", "filter", "filterMapping",
+ "defaultNamespace", "eventDefinition", "publicRenderParameter",
+ "listener", "containerRuntimeOption" })
+public class PortletAppType implements PortletApplicationDefinition
+{
+ @XmlElement(name = "portlet")
+ protected List<PortletType> portlet;
+ @XmlElement(name = "custom-portlet-mode")
+ protected List<CustomPortletModeType> customPortletMode;
+ @XmlElement(name = "custom-window-state")
+ protected List<CustomWindowStateType> customWindowState;
+ @XmlElement(name = "user-attribute")
+ protected List<UserAttributeType> userAttribute;
+ @XmlElement(name = "security-constraint")
+ protected List<SecurityConstraintType> securityConstraint;
+ @XmlElement(name = "resource-bundle")
+ @XmlJavaTypeAdapter(value=CollapsedStringAdapter.class)
+ protected String resourceBundle;
+ @XmlElement(name = "filter")
+ protected List<FilterType> filter;
+ @XmlElement(name = "filter-mapping")
+ protected List<FilterMappingType> filterMapping;
+ @XmlElement(name = "default-namespace")
+ @XmlSchemaType(name = "anyURI")
+ protected String defaultNamespace;
+ @XmlElement(name = "event-definition")
+ protected List<EventDefinitionType> eventDefinition;
+ @XmlElement(name = "public-render-parameter")
+ protected List<PublicRenderParameterType> publicRenderParameter;
+ @XmlElement(name = "listener")
+ protected List<ListenerType> listener;
+ @XmlElement(name = "container-runtime-option")
+ protected List<ContainerRuntimeOptionType> containerRuntimeOption;
+ @XmlAttribute(required = true)
+ protected String version = JSR_362_VERSION;
+
+ @XmlTransient
+ protected String name;
+ @XmlTransient
+ protected String contextPath;
+ @XmlTransient
+ protected Map<Locale, String> localeEncodingMappings;
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ public String getContextPath()
+ {
+ return contextPath;
+ }
+
+ public void setContextPath(String contextPath)
+ {
+ this.contextPath = contextPath;
+ }
+
+ public PortletDefinition getPortlet(String portletName)
+ {
+ for (PortletDefinition pd : getPortlets())
+ {
+ if (pd.getPortletName().equals(portletName))
+ {
+ return pd;
+ }
+ }
+ return null;
+ }
+
+ public List<? extends PortletDefinition> getPortlets()
+ {
+ if (portlet == null)
+ {
+ portlet = new ArrayList<PortletType>();
+ }
+ return portlet;
+ }
+
+ public PortletDefinition addPortlet(String portletName)
+ {
+ if (getPortlet(portletName) != null)
+ {
+ throw new IllegalArgumentException("Portlet with name: "+portletName+" already defined");
+ }
+ PortletType p = new PortletType();
+ p.setPortletName(portletName);
+ p.setApplication(this);
+ portlet.add(p);
+ return p;
+ }
+
+ public CustomPortletMode getCustomPortletMode(String name)
+ {
+ for (CustomPortletMode cpm : getCustomPortletModes())
+ {
+ if (cpm.getPortletMode().equalsIgnoreCase(name))
+ {
+ return cpm;
+ }
+ }
+ return null;
+ }
+
+ public List<? extends CustomPortletMode> getCustomPortletModes()
+ {
+ if (customPortletMode == null)
+ {
+ customPortletMode = new ArrayList<CustomPortletModeType>();
+ }
+ return customPortletMode;
+ }
+
+ public CustomPortletMode addCustomPortletMode(String name)
+ {
+ if (getCustomPortletMode(name) != null)
+ {
+ throw new IllegalArgumentException("Custom PortletMode with mode name: "+name+" already defined");
+ }
+ CustomPortletModeType cpm = new CustomPortletModeType();
+ cpm.setPortletMode(name);
+ customPortletMode.add(cpm);
+ return cpm;
+ }
+
+ public CustomWindowState getCustomWindowState(String name)
+ {
+ for (CustomWindowState cws : getCustomWindowStates())
+ {
+ if (cws.getWindowState().equalsIgnoreCase(name))
+ {
+ return cws;
+ }
+ }
+ return null;
+ }
+
+ public List<? extends CustomWindowState> getCustomWindowStates()
+ {
+ if (customWindowState == null)
+ {
+ customWindowState = new ArrayList<CustomWindowStateType>();
+ }
+ return customWindowState;
+ }
+
+ public CustomWindowState addCustomWindowState(String name)
+ {
+ if (getCustomWindowState(name) != null)
+ {
+ throw new IllegalArgumentException("Custom WindowState with state name: "+name+" already defined");
+ }
+ CustomWindowStateType cws = new CustomWindowStateType();
+ cws.setWindowState(name);
+ customWindowState.add(cws);
+ return cws;
+ }
+
+ public UserAttribute getUserAttribute(String name)
+ {
+ for (UserAttribute ua : getUserAttributes())
+ {
+ if (ua.getName().equals(name))
+ {
+ return ua;
+ }
+ }
+ return null;
+ }
+
+ public List<? extends UserAttribute> getUserAttributes()
+ {
+ if (userAttribute == null)
+ {
+ userAttribute = new ArrayList<UserAttributeType>();
+ }
+ return userAttribute;
+ }
+
+ public UserAttribute addUserAttribute(String name)
+ {
+ if (getUserAttribute(name) != null)
+ {
+ throw new IllegalArgumentException("User attribute with name: "+name+" already defined");
+ }
+ UserAttributeType ua = new UserAttributeType();
+ ua.setName(name);
+ userAttribute.add(ua);
+ return ua;
+ }
+
+ public List<? extends SecurityConstraint> getSecurityConstraints()
+ {
+ if (securityConstraint == null)
+ {
+ securityConstraint = new ArrayList<SecurityConstraintType>();
+ }
+ return securityConstraint;
+ }
+
+ public SecurityConstraint addSecurityConstraint(String transportGuarantee)
+ {
+ SecurityConstraintType sc = new SecurityConstraintType();
+ ((UserDataConstraintType)sc.getUserDataConstraint()).setTransportGuarantee(transportGuarantee);
+ getSecurityConstraints();
+ securityConstraint.add(sc);
+ return sc;
+ }
+
+ public String getResourceBundle()
+ {
+ return resourceBundle;
+ }
+
+ public void setResourceBundle(String value)
+ {
+ resourceBundle = value;
+ }
+
+ public Filter getFilter(String name)
+ {
+ for (Filter f : getFilters())
+ {
+ if (f.getFilterName().equals(name))
+ {
+ return f;
+ }
+ }
+ return null;
+ }
+
+ public List<? extends Filter> getFilters()
+ {
+ if (filter == null)
+ {
+ filter = new ArrayList<FilterType>();
+ }
+ return filter;
+ }
+
+ public Filter addFilter(String name)
+ {
+ if (getFilter(name) != null)
+ {
+ throw new IllegalArgumentException("Filter with name: "+name+" already defined");
+ }
+ FilterType f = new FilterType();
+ f.setFilterName(name);
+ filter.add(f);
+ return f;
+ }
+
+ public FilterMapping getFilterMapping(String name)
+ {
+ for (FilterMapping f : getFilterMappings())
+ {
+ if (f.getFilterName().equals(name))
+ {
+ return f;
+ }
+ }
+ return null;
+ }
+
+ public List<? extends FilterMapping> getFilterMappings()
+ {
+ if (filterMapping == null)
+ {
+ filterMapping = new ArrayList<FilterMappingType>();
+ }
+ return filterMapping;
+ }
+
+ public FilterMapping addFilterMapping(String name)
+ {
+ if (getFilterMapping(name) != null)
+ {
+ throw new IllegalArgumentException("Filtermapping for filter: "+name+" already defined");
+ }
+ FilterMappingType fm = new FilterMappingType();
+ fm.setFilterName(name);
+ filterMapping.add(fm);
+ return fm;
+ }
+
+ public String getDefaultNamespace()
+ {
+ return defaultNamespace != null ? defaultNamespace : XMLConstants.NULL_NS_URI;
+ }
+
+ public void setDefaultNamespace(String value)
+ {
+ defaultNamespace = value;
+ }
+
+ public List<? extends EventDefinition> getEventDefinitions()
+ {
+ if (eventDefinition == null)
+ {
+ eventDefinition = new ArrayList<EventDefinitionType>();
+ }
+ return eventDefinition;
+ }
+
+ public EventDefinition addEventDefinition(String name)
+ {
+ // TODO: check duplicates (complication: set of qname and name)
+ EventDefinitionType ed = new EventDefinitionType();
+ ed.setName(name);
+ eventDefinition.add(ed);
+ return ed;
+ }
+
+ public EventDefinition addEventDefinition(QName qname)
+ {
+ // TODO: check duplicates (complication: set of qname and name)
+ EventDefinitionType ed = new EventDefinitionType();
+ ed.setQName(qname);
+ eventDefinition.add(ed);
+ return ed;
+ }
+
+ public PublicRenderParameter getPublicRenderParameter(String identifier)
+ {
+ for (PublicRenderParameter prp : getPublicRenderParameters())
+ {
+ if (prp.getIdentifier().equals(identifier))
+ {
+ return prp;
+ }
+ }
+ return null;
+ }
+
+ public List<? extends PublicRenderParameter> getPublicRenderParameters()
+ {
+ if (publicRenderParameter == null)
+ {
+ publicRenderParameter = new ArrayList<PublicRenderParameterType>();
+ }
+ return publicRenderParameter;
+ }
+
+ public PublicRenderParameter addPublicRenderParameter(String name, String identifier)
+ {
+ if (getPublicRenderParameter(identifier) != null)
+ {
+ throw new IllegalArgumentException("PublicRenderParameter with identifier: "+identifier+" already defined");
+ }
+ // TODO: check duplicates on name|qname?
+ PublicRenderParameterType p = new PublicRenderParameterType();
+ p.setName(name);
+ p.setIdentifier(identifier);
+ publicRenderParameter.add(p);
+ return p;
+ }
+
+ public PublicRenderParameter addPublicRenderParameter(QName qname, String identifier)
+ {
+ if (getPublicRenderParameter(identifier) != null)
+ {
+ throw new IllegalArgumentException("PublicRenderParameter with identifier: "+identifier+" already defined");
+ }
+ // TODO: check duplicates on name|qname?
+ PublicRenderParameterType p = new PublicRenderParameterType();
+ p.setQName(qname);
+ p.setIdentifier(identifier);
+ publicRenderParameter.add(p);
+ return p;
+ }
+
+ public List<? extends Listener> getListeners()
+ {
+ if (listener == null)
+ {
+ listener = new ArrayList<ListenerType>();
+ }
+ return listener;
+ }
+
+ public Listener addListener(String listenerClass)
+ {
+ for (Listener l : getListeners())
+ {
+ if (l.getListenerClass().equals(listenerClass))
+ {
+ throw new IllegalArgumentException("Listener of class: "+listenerClass+" already defined");
+ }
+ }
+ ListenerType l = new ListenerType();
+ l.setListenerClass(listenerClass);
+ listener.add(l);
+ return l;
+ }
+
+ public ContainerRuntimeOption getContainerRuntimeOption(String name)
+ {
+ for (ContainerRuntimeOption cro : getContainerRuntimeOptions())
+ {
+ if (cro.getName().equals(name))
+ {
+ return cro;
+ }
+ }
+ return null;
+ }
+
+ public List<? extends ContainerRuntimeOption> getContainerRuntimeOptions()
+ {
+ if (containerRuntimeOption == null)
+ {
+ containerRuntimeOption = new ArrayList<ContainerRuntimeOptionType>();
+ }
+ return containerRuntimeOption;
+ }
+
+ public ContainerRuntimeOption addContainerRuntimeOption(String name)
+ {
+ if (getContainerRuntimeOption(name) != null)
+ {
+ throw new IllegalArgumentException("Container runtime option with name: "+name+" already defined");
+ }
+ ContainerRuntimeOptionType cro = new ContainerRuntimeOptionType();
+ cro.setName(name);
+ containerRuntimeOption.add(cro);
+ return cro;
+ }
+
+ public String getVersion()
+ {
+ return version;
+ }
+
+ public void setVersion(String value)
+ {
+ if (JSR_168_VERSION.equals(value)
+ || JSR_286_VERSION.equals(value)
+ || JSR_362_VERSION.equals(value))
+ {
+ version = value;
+ }
+ else
+ {
+ throw new IllegalArgumentException("Application descriptor version: "+value+" unsupported.");
+ }
+ }
+
+ public Map<Locale, String> getLocaleEncodingMappings()
+ {
+ if (localeEncodingMappings == null)
+ {
+ localeEncodingMappings = new HashMap<Locale,String>();
+ }
+ return localeEncodingMappings;
+ }
+
+ public void addLocaleEncodingMapping(Locale locale, String encoding)
+ {
+ getLocaleEncodingMappings().put(locale, encoding);
+ }
+}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/d2574528/pluto-container/src/main/java/org/apache/pluto/container/om/portlet30/impl/PortletCollectionType.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet30/impl/PortletCollectionType.java b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet30/impl/PortletCollectionType.java
new file mode 100644
index 0000000..db6ca0b
--- /dev/null
+++ b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet30/impl/PortletCollectionType.java
@@ -0,0 +1,64 @@
+/*
+ * 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.portlet30.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+
+/**
+ * The portlet-collectionType is used to identify a subset of portlets within a portlet application to which a security
+ * constraint applies. Used in: security-constraint <p>Java class for portlet-collectionType complex type. <p>The
+ * following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * <complexType name="portlet-collectionType">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="portlet-name" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}portlet-nameType" maxOccurs="unbounded"/>
+ * </sequence>
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ * @version $Id$
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "portlet-collectionType", propOrder = { "portletName" })
+public class PortletCollectionType
+{
+ @XmlElement(name = "portlet-name", required = true)
+ @XmlJavaTypeAdapter(value=CollapsedStringAdapter.class)
+ protected List<String> portletName;
+
+ public List<String> getPortletNames()
+ {
+ if (portletName == null)
+ {
+ portletName = new ArrayList<String>();
+ }
+ return portletName;
+ }
+}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/d2574528/pluto-container/src/main/java/org/apache/pluto/container/om/portlet30/impl/PortletInfoType.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet30/impl/PortletInfoType.java b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet30/impl/PortletInfoType.java
new file mode 100644
index 0000000..16c33e5
--- /dev/null
+++ b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet30/impl/PortletInfoType.java
@@ -0,0 +1,92 @@
+/*
+ * 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.portlet30.impl;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+
+import org.apache.pluto.container.om.portlet.PortletInfo;
+
+/**
+ * <p>Java class for portlet-infoType complex type. <p>The following schema fragment specifies the expected content
+ * contained within this class.
+ *
+ * <pre>
+ * <complexType name="portlet-infoType">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="title" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}titleType" minOccurs="0"/>
+ * <element name="short-title" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}short-titleType" minOccurs="0"/>
+ * <element name="keywords" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}keywordsType" minOccurs="0"/>
+ * </sequence>
+ * <attribute name="id" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}string" />
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ * @version $Id$
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "portlet-infoType", propOrder = { "title", "shortTitle", "keywords" })
+public class PortletInfoType implements PortletInfo
+{
+ @XmlElement (name = "title")
+ @XmlJavaTypeAdapter(value=CollapsedStringAdapter.class)
+ protected String title;
+ @XmlElement(name = "short-title")
+ @XmlJavaTypeAdapter(value=CollapsedStringAdapter.class)
+ protected String shortTitle;
+ @XmlElement(name = "keywords")
+ @XmlJavaTypeAdapter(value=CollapsedStringAdapter.class)
+ protected String keywords;
+
+ public String getTitle()
+ {
+ return title;
+ }
+
+ public void setTitle(String value)
+ {
+ title = value;
+ }
+
+ public String getShortTitle()
+ {
+ return shortTitle;
+ }
+
+ public void setShortTitle(String value)
+ {
+ shortTitle = value;
+ }
+
+ public String getKeywords()
+ {
+ return keywords;
+ }
+
+ public void setKeywords(String value)
+ {
+ keywords = value;
+ }
+}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/d2574528/pluto-container/src/main/java/org/apache/pluto/container/om/portlet30/impl/PortletPreferencesType.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet30/impl/PortletPreferencesType.java b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet30/impl/PortletPreferencesType.java
new file mode 100644
index 0000000..9e4625e
--- /dev/null
+++ b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet30/impl/PortletPreferencesType.java
@@ -0,0 +1,101 @@
+/*
+ * 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.portlet30.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+import org.apache.pluto.container.om.portlet.Preference;
+import org.apache.pluto.container.om.portlet.Preferences;
+
+/**
+ * Portlet persistent preference store. Used in: portlet <p>Java class for portlet-preferencesType complex type. <p>The
+ * following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * <complexType name="portlet-preferencesType">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="preference" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}preferenceType" maxOccurs="unbounded" minOccurs="0"/>
+ * <element name="preferences-validator" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}preferences-validatorType" minOccurs="0"/>
+ * </sequence>
+ * <attribute name="id" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}string" />
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ * @version $Id$
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "portlet-preferencesType", propOrder = { "preference", "preferencesValidator" })
+public class PortletPreferencesType implements Preferences
+{
+ @XmlElement(name = "preference")
+ protected List<PreferenceType> preference;
+ @XmlElement(name = "preferences-validator")
+ protected String preferencesValidator;
+
+ public Preference getPortletPreference(String name)
+ {
+ for (Preference p : getPortletPreferences())
+ {
+ if (p.getName().equals(name))
+ {
+ return p;
+ }
+ }
+ return null;
+ }
+
+ public List<? extends Preference> getPortletPreferences()
+ {
+ if (preference == null)
+ {
+ preference = new ArrayList<PreferenceType>();
+ }
+ return preference;
+ }
+
+ public Preference addPreference(String name)
+ {
+ if (getPortletPreference(name) != null)
+ {
+ throw new IllegalArgumentException("Portlet preference with name: "+name+" already defined");
+ }
+ PreferenceType pref = new PreferenceType();
+ pref.setName(name);
+ preference.add(pref);
+ return pref;
+ }
+
+ public String getPreferencesValidator()
+ {
+ return preferencesValidator;
+ }
+
+ public void setPreferencesValidator(String value)
+ {
+ preferencesValidator = value;
+ }
+}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/d2574528/pluto-container/src/main/java/org/apache/pluto/container/om/portlet30/impl/PortletType.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet30/impl/PortletType.java b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet30/impl/PortletType.java
new file mode 100644
index 0000000..5989eea
--- /dev/null
+++ b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet30/impl/PortletType.java
@@ -0,0 +1,521 @@
+/*
+ * 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.portlet30.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Locale;
+
+import javax.xml.bind.Unmarshaller;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlTransient;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+import javax.xml.namespace.QName;
+
+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;
+
+/**
+ * The portlet element contains the declarative data of a portlet. Used in: portlet-app <p>Java class for portletType
+ * complex type. <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * <complexType name="portletType">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="description" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}descriptionType" maxOccurs="unbounded" minOccurs="0"/>
+ * <element name="portlet-name" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}portlet-nameType"/>
+ * <element name="display-name" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}display-nameType" maxOccurs="unbounded" minOccurs="0"/>
+ * <element name="portlet-class" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}portlet-classType"/>
+ * <element name="init-param" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}init-paramType" maxOccurs="unbounded" minOccurs="0"/>
+ * <element name="expiration-cache" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}expiration-cacheType" minOccurs="0"/>
+ * <element name="cache-scope" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}cache-scopeType" minOccurs="0"/>
+ * <element name="supports" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}supportsType" maxOccurs="unbounded"/>
+ * <element name="supported-locale" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}supported-localeType" maxOccurs="unbounded" minOccurs="0"/>
+ * <element name="resource-bundle" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}resource-bundleType" minOccurs="0"/>
+ * <element name="portlet-info" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}portlet-infoType" minOccurs="0"/>
+ * <element name="portlet-preferences" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}portlet-preferencesType" minOccurs="0"/>
+ * <element name="security-role-ref" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}security-role-refType" maxOccurs="unbounded" minOccurs="0"/>
+ * <element name="supported-processing-event" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}event-definition-referenceType" maxOccurs="unbounded" minOccurs="0"/>
+ * <element name="supported-publishing-event" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}event-definition-referenceType" maxOccurs="unbounded" minOccurs="0"/>
+ * <element name="supported-public-render-parameter" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}string" maxOccurs="unbounded" minOccurs="0"/>
+ * <element name="container-runtime-option" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}container-runtime-optionType" maxOccurs="unbounded" minOccurs="0"/>
+ * </sequence>
+ * <attribute name="id" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}string" />
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ * @version $Id$
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "portletType", propOrder = { "description", "portletName", "displayName", "portletClass", "initParam",
+ "expirationCache", "cacheScope", "supports", "supportedLocale",
+ "resourceBundle", "portletInfo", "portletPreferences", "securityRoleRef",
+ "supportedProcessingEvent", "supportedPublishingEvent",
+ "supportedPublicRenderParameter", "containerRuntimeOption" })
+public class PortletType implements PortletDefinition
+{
+ @XmlElement(name = "description")
+ protected List<DescriptionType> description;
+ @XmlElement(name = "portlet-name", required = true)
+ @XmlJavaTypeAdapter(value=CollapsedStringAdapter.class)
+ protected String portletName;
+ @XmlElement(name = "display-name")
+ protected List<DisplayNameType> displayName;
+ @XmlElement(name = "portlet-class", required = true)
+ @XmlJavaTypeAdapter(value=CollapsedStringAdapter.class)
+ protected String portletClass;
+ @XmlElement(name = "init-param")
+ protected List<InitParamType> initParam;
+ @XmlElement(name = "expiration-cache")
+ protected Integer expirationCache;
+ @XmlElement(name = "cache-scope")
+ @XmlJavaTypeAdapter(value=CollapsedStringAdapter.class)
+ protected String cacheScope;
+ @XmlElement(required = true)
+ protected List<SupportsType> supports;
+ @XmlElement(name = "supported-locale")
+ @XmlJavaTypeAdapter(value=CollapsedStringAdapter.class)
+ protected List<String> supportedLocale;
+ @XmlElement(name = "resource-bundle")
+ @XmlJavaTypeAdapter(value=CollapsedStringAdapter.class)
+ protected String resourceBundle;
+ @XmlElement(name = "portlet-info")
+ protected PortletInfoType portletInfo;
+ @XmlElement(name = "portlet-preferences")
+ protected PortletPreferencesType portletPreferences;
+ @XmlElement(name = "security-role-ref")
+ protected List<SecurityRoleRefType> securityRoleRef;
+ @XmlElement(name = "supported-processing-event")
+ protected List<EventDefinitionReferenceType> supportedProcessingEvent;
+ @XmlElement(name = "supported-publishing-event")
+ protected List<EventDefinitionReferenceType> supportedPublishingEvent;
+ @XmlElement(name = "supported-public-render-parameter")
+ protected List<String> supportedPublicRenderParameter;
+ @XmlElement(name = "container-runtime-option")
+ protected List<ContainerRuntimeOptionType> containerRuntimeOption;
+
+ @XmlTransient
+ private PortletApplicationDefinition application;
+
+ public PortletType()
+ {
+ }
+
+ public PortletApplicationDefinition getApplication()
+ {
+ return application;
+ }
+
+ public void setApplication(PortletApplicationDefinition app)
+ {
+ this.application = app;
+ }
+
+ public Description getDescription(Locale locale)
+ {
+ for (Description d : getDescriptions())
+ {
+ if (d.getLocale().equals(locale))
+ {
+ return d;
+ }
+ }
+ return null;
+ }
+
+ public List<? extends Description> getDescriptions()
+ {
+ if (description == null)
+ {
+ description = new ArrayList<DescriptionType>();
+ }
+ return description;
+ }
+
+ public Description addDescription(String lang)
+ {
+ DescriptionType d = new DescriptionType();
+ d.setLang(lang);
+ if (getDescription(d.getLocale()) != null)
+ {
+ throw new IllegalArgumentException("Description for language: "+d.getLocale()+" already defined");
+ }
+ getDescriptions();
+ description.add(d);
+ return d;
+ }
+
+ public DisplayName getDisplayName(Locale locale)
+ {
+ for (DisplayName d : getDisplayNames())
+ {
+ if (d.getLocale().equals(locale))
+ {
+ return d;
+ }
+ }
+ return null;
+ }
+
+ public List<? extends DisplayName> getDisplayNames()
+ {
+ if (displayName == null)
+ {
+ displayName = new ArrayList<DisplayNameType>();
+ }
+ return displayName;
+ }
+
+ public DisplayName addDisplayName(String lang)
+ {
+ DisplayNameType d = new DisplayNameType();
+ d.setLang(lang);
+ if (getDisplayName(d.getLocale()) != null)
+ {
+ throw new IllegalArgumentException("DisplayName for language: "+d.getLocale()+" already defined");
+ }
+ getDisplayNames();
+ displayName.add(d);
+ return d;
+ }
+
+ public String getPortletName()
+ {
+ return portletName;
+ }
+
+ public void setPortletName(String value)
+ {
+ portletName = value;
+ }
+
+ public String getPortletClass()
+ {
+ return portletClass;
+ }
+
+ public void setPortletClass(String value)
+ {
+ portletClass = value;
+ }
+
+ public InitParam getInitParam(String name)
+ {
+ for (InitParam param : getInitParams())
+ {
+ if (param.getParamName().equals(name))
+ {
+ return param;
+ }
+ }
+ return null;
+ }
+
+ public List<? extends InitParam> getInitParams()
+ {
+ if (initParam == null)
+ {
+ initParam = new ArrayList<InitParamType>();
+ }
+ return initParam;
+ }
+
+ public InitParam addInitParam(String paramName)
+ {
+ if (getInitParam(paramName) != null)
+ {
+ throw new IllegalArgumentException("Init parameter: "+paramName+" already defined");
+ }
+ InitParamType param = new InitParamType();
+ param.setParamName(paramName);
+ getInitParams();
+ initParam.add(param);
+ return param;
+ }
+
+ public int getExpirationCache()
+ {
+ return expirationCache != null ? expirationCache.intValue() : 0;
+ }
+
+ public void setExpirationCache(int value)
+ {
+ expirationCache = new Integer(value);
+ }
+
+ /**
+ * Caching scope, allowed values are "private" indicating that the content should not be shared across users and
+ * "public" indicating that the content may be shared across users. The default value if not present is "private".
+ */
+ public String getCacheScope()
+ {
+ return cacheScope != null ? cacheScope : "private";
+ }
+
+ public void setCacheScope(String cacheScope)
+ {
+ this.cacheScope = cacheScope;
+ }
+
+ public Supports getSupports(String mimeType)
+ {
+ for (Supports s : getSupports())
+ {
+ if (s.getMimeType().equals(mimeType))
+ {
+ return s;
+ }
+ }
+ return null;
+ }
+
+ public List<? extends Supports> getSupports()
+ {
+ if (supports == null)
+ {
+ supports = new ArrayList<SupportsType>();
+ }
+ return supports;
+ }
+
+ public Supports addSupports(String mimeType)
+ {
+ if (getSupports(mimeType) != null)
+ {
+ throw new IllegalArgumentException("Supports for mime type: "+mimeType+" already defined");
+ }
+ SupportsType s = new SupportsType();
+ s.setMimeType(mimeType);
+ supports.add(s);
+ return s;
+ }
+
+ public List<String> getSupportedLocales()
+ {
+ if (supportedLocale == null)
+ {
+ supportedLocale = new ArrayList<String>();
+ }
+ return supportedLocale;
+ }
+
+ public void addSupportedLocale(String lang)
+ {
+ for (String l : getSupportedLocales())
+ {
+ if (l.equals(lang))
+ {
+ throw new IllegalArgumentException("Supported locale: "+lang+" already defined");
+ }
+ }
+ supportedLocale.add(lang);
+ }
+
+ public String getResourceBundle()
+ {
+ return resourceBundle;
+ }
+
+ public void setResourceBundle(String value)
+ {
+ resourceBundle = value;
+ }
+
+ public PortletInfo getPortletInfo()
+ {
+ if (portletInfo == null)
+ {
+ portletInfo = new PortletInfoType();
+ }
+ return portletInfo;
+ }
+
+ public Preferences getPortletPreferences()
+ {
+ if (portletPreferences == null)
+ {
+ portletPreferences = new PortletPreferencesType();
+ }
+ return portletPreferences;
+ }
+
+ public SecurityRoleRef getSecurityRoleRef(String roleName)
+ {
+ for (SecurityRoleRef ref : getSecurityRoleRefs())
+ {
+ if (ref.getRoleName().equals(roleName))
+ {
+ return ref;
+ }
+ }
+ return null;
+ }
+
+ public List<? extends SecurityRoleRef> getSecurityRoleRefs()
+ {
+ if (securityRoleRef == null)
+ {
+ securityRoleRef = new ArrayList<SecurityRoleRefType>();
+ }
+ return securityRoleRef;
+ }
+
+ public SecurityRoleRef addSecurityRoleRef(String roleName)
+ {
+ if (getSecurityRoleRef(roleName) != null)
+ {
+ throw new IllegalArgumentException("Security role reference for role: "+roleName+" already defined");
+ }
+ SecurityRoleRefType srr = new SecurityRoleRefType();
+ srr.setRoleName(roleName);
+ securityRoleRef.add(srr);
+ return srr;
+ }
+
+ public List<? extends EventDefinitionReference> getSupportedProcessingEvents()
+ {
+ if (supportedProcessingEvent == null)
+ {
+ supportedProcessingEvent = new ArrayList<EventDefinitionReferenceType>();
+ }
+ return supportedProcessingEvent;
+ }
+
+ public EventDefinitionReference addSupportedProcessingEvent(QName qname)
+ {
+ // TODO: check duplicates
+ getSupportedProcessingEvents();
+ EventDefinitionReferenceType edr = new EventDefinitionReferenceType();
+ edr.setQName(qname);
+ supportedProcessingEvent.add(edr);
+ return edr;
+ }
+
+ public EventDefinitionReference addSupportedProcessingEvent(String name)
+ {
+ // TODO check duplicates
+ getSupportedProcessingEvents();
+ EventDefinitionReferenceType edr = new EventDefinitionReferenceType();
+ edr.setName(name);
+ supportedProcessingEvent.add(edr);
+ return edr;
+ }
+
+ public List<? extends EventDefinitionReference> getSupportedPublishingEvents()
+ {
+ if (supportedPublishingEvent == null)
+ {
+ supportedPublishingEvent = new ArrayList<EventDefinitionReferenceType>();
+ }
+ return supportedPublishingEvent;
+ }
+
+ public EventDefinitionReference addSupportedPublishingEvent(QName qname)
+ {
+ // TODO: check duplicates
+ getSupportedPublishingEvents();
+ EventDefinitionReferenceType edr = new EventDefinitionReferenceType();
+ edr.setQName(qname);
+ supportedPublishingEvent.add(edr);
+ return edr;
+ }
+
+ public EventDefinitionReference addSupportedPublishingEvent(String name)
+ {
+ // TODO check duplicates
+ getSupportedPublishingEvents();
+ EventDefinitionReferenceType edr = new EventDefinitionReferenceType();
+ edr.setName(name);
+ supportedPublishingEvent.add(edr);
+ return edr;
+ }
+
+ public List<String> getSupportedPublicRenderParameters()
+ {
+ if (supportedPublicRenderParameter == null)
+ {
+ supportedPublicRenderParameter = new ArrayList<String>();
+ }
+ return supportedPublicRenderParameter;
+ }
+
+ public void addSupportedPublicRenderParameter(String identifier)
+ {
+ for (String ident : getSupportedPublicRenderParameters())
+ {
+ if (ident.equals(identifier))
+ {
+ throw new IllegalArgumentException("Support for public render parameter with identifier: "+identifier+" already defined");
+ }
+ }
+ supportedPublicRenderParameter.add(identifier);
+ }
+
+ public ContainerRuntimeOption getContainerRuntimeOption(String name)
+ {
+ for (ContainerRuntimeOption cro : getContainerRuntimeOptions())
+ {
+ if (cro.getName().equals(name))
+ {
+ return cro;
+ }
+ }
+ return null;
+ }
+
+ public List<? extends ContainerRuntimeOption> getContainerRuntimeOptions()
+ {
+ if (containerRuntimeOption == null)
+ {
+ containerRuntimeOption = new ArrayList<ContainerRuntimeOptionType>();
+ }
+ return containerRuntimeOption;
+ }
+
+ public ContainerRuntimeOption addContainerRuntimeOption(String name)
+ {
+ if (getContainerRuntimeOption(name) != null)
+ {
+ throw new IllegalArgumentException("Container runtime option with name: "+name+" already defined");
+ }
+ ContainerRuntimeOptionType cro = new ContainerRuntimeOptionType();
+ cro.setName(name);
+ containerRuntimeOption.add(cro);
+ return cro;
+ }
+
+ public void afterUnmarshal(Unmarshaller u, Object parent) {
+ application = (PortletApplicationDefinition)parent;
+ }
+}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/d2574528/pluto-container/src/main/java/org/apache/pluto/container/om/portlet30/impl/PreferenceType.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet30/impl/PreferenceType.java b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet30/impl/PreferenceType.java
new file mode 100644
index 0000000..daa0b54
--- /dev/null
+++ b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet30/impl/PreferenceType.java
@@ -0,0 +1,98 @@
+/*
+ * 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.portlet30.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+
+import org.apache.pluto.container.om.portlet.Preference;
+
+/**
+ * Persistent preference values that may be used for customization and personalization by the portlet. Used in:
+ * portlet-preferences <p>Java class for preferenceType complex type. <p>The following schema fragment specifies the
+ * expected content contained within this class.
+ *
+ * <pre>
+ * <complexType name="preferenceType">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="name" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}nameType"/>
+ * <element name="value" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}valueType" maxOccurs="unbounded" minOccurs="0"/>
+ * <element name="read-only" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}read-onlyType" minOccurs="0"/>
+ * </sequence>
+ * <attribute name="id" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}string" />
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ * @version $Id$
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "preferenceType", propOrder = { "name", "value", "readOnly" })
+public class PreferenceType implements Preference
+{
+ @XmlElement(required = true)
+ @XmlJavaTypeAdapter(value=CollapsedStringAdapter.class)
+ protected String name;
+ @XmlJavaTypeAdapter(value=CollapsedStringAdapter.class)
+ protected List<String> value;
+ @XmlElement(name = "read-only")
+ protected Boolean readOnly;
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String value)
+ {
+ name = value;
+ }
+
+ public List<String> getValues()
+ {
+ if (value == null)
+ {
+ value = new ArrayList<String>();
+ }
+ return value;
+ }
+
+ public void addValue(String value)
+ {
+ getValues().add(value);
+ }
+
+ public boolean isReadOnly()
+ {
+ return readOnly != null ? readOnly.booleanValue() : false;
+ }
+
+ public void setReadOnly(boolean value)
+ {
+ readOnly = value ? Boolean.TRUE : Boolean.FALSE;
+ }
+}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/d2574528/pluto-container/src/main/java/org/apache/pluto/container/om/portlet30/impl/PublicRenderParameterType.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet30/impl/PublicRenderParameterType.java b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet30/impl/PublicRenderParameterType.java
new file mode 100644
index 0000000..21e42a7
--- /dev/null
+++ b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet30/impl/PublicRenderParameterType.java
@@ -0,0 +1,156 @@
+/*
+ * 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.portlet30.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Locale;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlSchemaType;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+import javax.xml.namespace.QName;
+
+import org.apache.pluto.container.om.portlet.Description;
+import org.apache.pluto.container.om.portlet.PublicRenderParameter;
+
+/**
+ * The public-render-parameters defines a render parameter that is allowed to be public and thus be shared with other
+ * portlets. The identifier must be used for referencing this public render parameter in the portlet code. Used in:
+ * portlet-app <p>Java class for public-render-parameterType complex type. <p>The following schema fragment specifies
+ * the expected content contained within this class.
+ *
+ * <pre>
+ * <complexType name="public-render-parameterType">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="description" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}descriptionType" maxOccurs="unbounded" minOccurs="0"/>
+ * <element name="identifier" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}string"/>
+ * <choice>
+ * <element name="qname" type="{http://www.w3.org/2001/XMLSchema}QName"/>
+ * <element name="name" type="{http://www.w3.org/2001/XMLSchema}NCName"/>
+ * </choice>
+ * <element name="alias" type="{http://www.w3.org/2001/XMLSchema}QName" maxOccurs="unbounded" minOccurs="0"/>
+ * </sequence>
+ * <attribute name="id" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}string" />
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ * @version $Id$
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "public-render-parameterType", propOrder = { "description", "identifier", "qname", "name", "alias" })
+public class PublicRenderParameterType implements PublicRenderParameter
+{
+ @XmlElement(name = "description")
+ protected List<DescriptionType> description;
+ @XmlElement(required = true)
+ protected String identifier;
+ protected QName qname;
+ @XmlJavaTypeAdapter(CollapsedStringAdapter.class)
+ @XmlSchemaType(name = "NCName")
+ protected String name;
+ protected List<QName> alias;
+
+ public Description getDescription(Locale locale)
+ {
+ for (Description d : getDescriptions())
+ {
+ if (d.getLocale().equals(locale))
+ {
+ return d;
+ }
+ }
+ return null;
+ }
+
+ public List<? extends Description> getDescriptions()
+ {
+ if (description == null)
+ {
+ description = new ArrayList<DescriptionType>();
+ }
+ return description;
+ }
+
+ public Description addDescription(String lang)
+ {
+ DescriptionType d = new DescriptionType();
+ d.setLang(lang);
+ if (getDescription(d.getLocale()) != null)
+ {
+ throw new IllegalArgumentException("Description for language: "+d.getLocale()+" already defined");
+ }
+ getDescriptions();
+ description.add(d);
+ return d;
+ }
+
+ public String getIdentifier()
+ {
+ return identifier;
+ }
+
+ public void setIdentifier(String value)
+ {
+ identifier = value;
+ }
+
+ public QName getQName()
+ {
+ return qname;
+ }
+
+ public void setQName(QName value)
+ {
+ qname = value;
+ name = null;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String value)
+ {
+ name = value;
+ qname = null;
+ }
+
+ public List<QName> getAliases()
+ {
+ if (alias == null)
+ {
+ alias = new ArrayList<QName>();
+ }
+ return alias;
+ }
+
+ public void addAlias(QName alias)
+ {
+ // TODO: check duplicates
+ getAliases().add(alias);
+ }
+}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/d2574528/pluto-container/src/main/java/org/apache/pluto/container/om/portlet30/impl/SecurityConstraintType.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet30/impl/SecurityConstraintType.java b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet30/impl/SecurityConstraintType.java
new file mode 100644
index 0000000..c7377ba
--- /dev/null
+++ b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet30/impl/SecurityConstraintType.java
@@ -0,0 +1,128 @@
+/*
+ * 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.portlet30.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Locale;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+import org.apache.pluto.container.om.portlet.DisplayName;
+import org.apache.pluto.container.om.portlet.SecurityConstraint;
+import org.apache.pluto.container.om.portlet.UserDataConstraint;
+
+/**
+ * The security-constraintType is used to associate intended security constraints with one or more portlets. Used in:
+ * portlet-app <p>Java class for security-constraintType complex type. <p>The following schema fragment specifies the
+ * expected content contained within this class.
+ *
+ * <pre>
+ * <complexType name="security-constraintType">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="display-name" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}display-nameType" maxOccurs="unbounded" minOccurs="0"/>
+ * <element name="portlet-collection" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}portlet-collectionType"/>
+ * <element name="user-data-constraint" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}user-data-constraintType"/>
+ * </sequence>
+ * <attribute name="id" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}string" />
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ * @version $Id$
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "security-constraintType", propOrder = { "displayName", "portletCollection", "userDataConstraint" })
+public class SecurityConstraintType implements SecurityConstraint
+{
+ @XmlElement(name = "display-name")
+ protected List<DisplayNameType> displayName;
+ @XmlElement(name = "portlet-collection", required = true)
+ protected PortletCollectionType portletCollection;
+ @XmlElement(name = "user-data-constraint", required = true)
+ protected UserDataConstraintType userDataConstraint;
+
+ public DisplayName getDisplayName(Locale locale)
+ {
+ for (DisplayName d : getDisplayNames())
+ {
+ if (d.getLocale().equals(locale))
+ {
+ return d;
+ }
+ }
+ return null;
+ }
+
+ public List<? extends DisplayName> getDisplayNames()
+ {
+ if (displayName == null)
+ {
+ displayName = new ArrayList<DisplayNameType>();
+ }
+ return displayName;
+ }
+
+ public DisplayName addDisplayName(String lang)
+ {
+ DisplayNameType d = new DisplayNameType();
+ d.setLang(lang);
+ if (getDisplayName(d.getLocale()) != null)
+ {
+ throw new IllegalArgumentException("DisplayName for language: "+d.getLocale()+" already defined");
+ }
+ getDisplayNames();
+ displayName.add(d);
+ return d;
+ }
+
+ public List<String> getPortletNames()
+ {
+ if (portletCollection == null)
+ {
+ portletCollection = new PortletCollectionType();
+ }
+ return portletCollection.getPortletNames();
+ }
+
+ public void addPortletName(String portletName)
+ {
+ for (String name : getPortletNames())
+ {
+ if (name.equals(portletName))
+ {
+ throw new IllegalArgumentException("Portlet name: "+name+" already defined");
+ }
+ }
+ portletCollection.getPortletNames().add(portletName);
+ }
+
+ public UserDataConstraint getUserDataConstraint()
+ {
+ if (userDataConstraint == null)
+ {
+ userDataConstraint = new UserDataConstraintType();
+ }
+ return userDataConstraint;
+ }
+}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/d2574528/pluto-container/src/main/java/org/apache/pluto/container/om/portlet30/impl/SecurityRoleRefType.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet30/impl/SecurityRoleRefType.java b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet30/impl/SecurityRoleRefType.java
new file mode 100644
index 0000000..0b1b693
--- /dev/null
+++ b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet30/impl/SecurityRoleRefType.java
@@ -0,0 +1,125 @@
+/*
+ * 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.portlet30.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Locale;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+
+import org.apache.pluto.container.om.portlet.Description;
+import org.apache.pluto.container.om.portlet.SecurityRoleRef;
+
+/**
+ * The security-role-ref element contains the declaration of a security role reference in the code of the web
+ * application. The declaration consists of an optional description, the security role name used in the code, and an
+ * optional link to a security role. If the security role is not specified, the Deployer must choose an appropriate
+ * security role. The value of the role name element must be the String used as the parameter to the
+ * EJBContext.isCallerInRole(String roleName) method or the HttpServletRequest.isUserInRole(String role) method. Used
+ * in: portlet <p>Java class for security-role-refType complex type. <p>The following schema fragment specifies the
+ * expected content contained within this class.
+ *
+ * <pre>
+ * <complexType name="security-role-refType">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="description" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}descriptionType" maxOccurs="unbounded" minOccurs="0"/>
+ * <element name="role-name" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}role-nameType"/>
+ * <element name="role-link" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}role-linkType" minOccurs="0"/>
+ * </sequence>
+ * <attribute name="id" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}string" />
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ * @version $Id$
+*/
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "security-role-refType", propOrder = { "description", "roleName", "roleLink" })
+public class SecurityRoleRefType implements SecurityRoleRef
+{
+ @XmlElement(name = "description")
+ protected List<DescriptionType> description;
+ @XmlElement(name = "role-name", required = true)
+ @XmlJavaTypeAdapter(CollapsedStringAdapter.class)
+ protected String roleName;
+ @XmlElement(name = "role-link")
+ @XmlJavaTypeAdapter(value=CollapsedStringAdapter.class)
+ protected String roleLink;
+
+ public Description getDescription(Locale locale)
+ {
+ for (Description d : getDescriptions())
+ {
+ if (d.getLocale().equals(locale))
+ {
+ return d;
+ }
+ }
+ return null;
+ }
+
+ public List<? extends Description> getDescriptions()
+ {
+ if (description == null)
+ {
+ description = new ArrayList<DescriptionType>();
+ }
+ return description;
+ }
+
+ public Description addDescription(String lang)
+ {
+ DescriptionType d = new DescriptionType();
+ d.setLang(lang);
+ if (getDescription(d.getLocale()) != null)
+ {
+ throw new IllegalArgumentException("Description for language: "+d.getLocale()+" already defined");
+ }
+ getDescriptions();
+ description.add(d);
+ return d;
+ }
+
+ public String getRoleName()
+ {
+ return roleName;
+ }
+
+ public void setRoleName(String value)
+ {
+ roleName = value;
+ }
+
+ public String getRoleLink()
+ {
+ return roleLink;
+ }
+
+ public void setRoleLink(String value)
+ {
+ roleLink = value;
+ }
+}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/d2574528/pluto-container/src/main/java/org/apache/pluto/container/om/portlet30/impl/SupportsType.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet30/impl/SupportsType.java b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet30/impl/SupportsType.java
new file mode 100644
index 0000000..2771dd5
--- /dev/null
+++ b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet30/impl/SupportsType.java
@@ -0,0 +1,118 @@
+/*
+ * 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.portlet30.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+
+import org.apache.pluto.container.om.portlet.Supports;
+
+/**
+ * Supports indicates the portlet modes a portlet supports for a specific content type. All portlets must support the
+ * view mode. Used in: portlet <p>Java class for supportsType complex type. <p>The following schema fragment specifies
+ * the expected content contained within this class.
+ *
+ * <pre>
+ * <complexType name="supportsType">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="mime-type" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}mime-typeType"/>
+ * <element name="portlet-mode" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}portlet-modeType" maxOccurs="unbounded" minOccurs="0"/>
+ * <element name="window-state" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}window-stateType" maxOccurs="unbounded" minOccurs="0"/>
+ * </sequence>
+ * <attribute name="id" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}string" />
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ * @version $Id$
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "supportsType", propOrder = { "mimeType", "portletMode", "windowState" })
+public class SupportsType implements Supports
+{
+ @XmlElement(name = "mime-type", required = true)
+ @XmlJavaTypeAdapter(value=CollapsedStringAdapter.class)
+ protected String mimeType;
+ @XmlElement(name = "portlet-mode")
+ @XmlJavaTypeAdapter(value=CollapsedStringAdapter.class)
+ protected List<String> portletMode;
+ @XmlElement(name = "window-state")
+ @XmlJavaTypeAdapter(value=CollapsedStringAdapter.class)
+ protected List<String> windowState;
+
+ public String getMimeType()
+ {
+ return mimeType;
+ }
+
+ public void setMimeType(String value)
+ {
+ mimeType = value;
+ }
+
+ public List<String> getPortletModes()
+ {
+ if (portletMode == null)
+ {
+ portletMode = new ArrayList<String>();
+ }
+ return portletMode;
+ }
+
+ public void addPortletMode(String name)
+ {
+ for (String mode : getPortletModes())
+ {
+ if (mode.equals(name))
+ {
+ throw new IllegalArgumentException("Portlet mode: "+name+" already defined");
+ }
+ }
+ portletMode.add(name);
+ }
+
+ public List<String> getWindowStates()
+ {
+ if (windowState == null)
+ {
+ windowState = new ArrayList<String>();
+ }
+ return windowState;
+ }
+
+ public void addWindowState(String name)
+ {
+ for (String state : getWindowStates())
+ {
+ if (state.equals(name))
+ {
+ throw new IllegalArgumentException("Window state: "+name+" already defined");
+ }
+ }
+ windowState.add(name);
+ }
+}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/d2574528/pluto-container/src/main/java/org/apache/pluto/container/om/portlet30/impl/UserAttributeType.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet30/impl/UserAttributeType.java b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet30/impl/UserAttributeType.java
new file mode 100644
index 0000000..27fd61f
--- /dev/null
+++ b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet30/impl/UserAttributeType.java
@@ -0,0 +1,108 @@
+/*
+ * 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.portlet30.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Locale;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+
+import org.apache.pluto.container.om.portlet.Description;
+import org.apache.pluto.container.om.portlet.UserAttribute;
+
+/**
+ * User attribute defines a user specific attribute that the portlet application needs. The portlet within this
+ * application can access this attribute via the request parameter USER_INFO map. Used in: portlet-app <p>Java class
+ * for user-attributeType complex type. <p>The following schema fragment specifies the expected content contained
+ * within this class.
+ *
+ * <pre>
+ * <complexType name="user-attributeType">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="description" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}descriptionType" maxOccurs="unbounded" minOccurs="0"/>
+ * <element name="name" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}nameType"/>
+ * </sequence>
+ * <attribute name="id" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}string" />
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ * @version $Id$
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "user-attributeType", propOrder = { "description", "name" })
+public class UserAttributeType implements UserAttribute
+{
+ @XmlElement(name = "description")
+ protected List<DescriptionType> description;
+ @XmlElement(required = true)
+ @XmlJavaTypeAdapter(value=CollapsedStringAdapter.class)
+ protected String name;
+
+ public Description getDescription(Locale locale)
+ {
+ for (Description d : getDescriptions())
+ {
+ if (d.getLocale().equals(locale))
+ {
+ return d;
+ }
+ }
+ return null;
+ }
+
+ public List<? extends Description> getDescriptions()
+ {
+ if (description == null)
+ {
+ description = new ArrayList<DescriptionType>();
+ }
+ return description;
+ }
+
+ public Description addDescription(String lang)
+ {
+ DescriptionType d = new DescriptionType();
+ d.setLang(lang);
+ if (getDescription(d.getLocale()) != null)
+ {
+ throw new IllegalArgumentException("Description for language: "+d.getLocale()+" already defined");
+ }
+ getDescriptions();
+ description.add(d);
+ return d;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String value)
+ {
+ name = value;
+ }
+}
[10/14] portals-pluto git commit: Initial adaptation of Container
JAXB code allowing a v3.0 deployement descriptor to be read
Posted by ms...@apache.org.
Initial adaptation of Container JAXB code allowing a v3.0 deployement descriptor to be read
Project: http://git-wip-us.apache.org/repos/asf/portals-pluto/repo
Commit: http://git-wip-us.apache.org/repos/asf/portals-pluto/commit/d2574528
Tree: http://git-wip-us.apache.org/repos/asf/portals-pluto/tree/d2574528
Diff: http://git-wip-us.apache.org/repos/asf/portals-pluto/diff/d2574528
Branch: refs/heads/V3Prototype
Commit: d2574528c7b36cf8550da4d17692748b79ab0900
Parents: cea47a7
Author: Scott Nicklous <ms...@apache.org>
Authored: Wed Jan 28 11:45:54 2015 +0100
Committer: Scott Nicklous <ms...@apache.org>
Committed: Wed Jan 28 11:45:54 2015 +0100
----------------------------------------------------------------------
.../src/main/webapp/WEB-INF/jsp/view-isp.jsp | 30 +-
.../src/main/webapp/WEB-INF/portlet.xml | 6 +-
.../portlet/PortletApplicationDefinition.java | 179 ++--
.../impl/PortletAppDescriptorServiceImpl.java | 7 +-
.../om/portlet20/impl/PortletAppType.java | 4 +-
.../impl/ContainerRuntimeOptionType.java | 87 ++
.../portlet30/impl/CustomPortletModeType.java | 121 +++
.../portlet30/impl/CustomWindowStateType.java | 107 +++
.../om/portlet30/impl/DescriptionType.java | 120 +++
.../om/portlet30/impl/DisplayNameType.java | 122 +++
.../impl/EventDefinitionReferenceType.java | 85 ++
.../om/portlet30/impl/EventDefinitionType.java | 161 ++++
.../om/portlet30/impl/FilterMappingType.java | 88 ++
.../container/om/portlet30/impl/FilterType.java | 214 +++++
.../om/portlet30/impl/InitParamType.java | 121 +++
.../om/portlet30/impl/ListenerType.java | 142 ++++
.../om/portlet30/impl/ObjectFactory.java | 53 ++
.../om/portlet30/impl/PortletAppType.java | 551 ++++++++++++
.../portlet30/impl/PortletCollectionType.java | 64 ++
.../om/portlet30/impl/PortletInfoType.java | 92 ++
.../portlet30/impl/PortletPreferencesType.java | 101 +++
.../om/portlet30/impl/PortletType.java | 521 ++++++++++++
.../om/portlet30/impl/PreferenceType.java | 98 +++
.../impl/PublicRenderParameterType.java | 156 ++++
.../portlet30/impl/SecurityConstraintType.java | 128 +++
.../om/portlet30/impl/SecurityRoleRefType.java | 125 +++
.../om/portlet30/impl/SupportsType.java | 118 +++
.../om/portlet30/impl/UserAttributeType.java | 108 +++
.../portlet30/impl/UserDataConstraintType.java | 107 +++
.../om/portlet30/impl/package-info.java | 21 +
.../pluto/container/impl/portlet-app_3_0.xsd | 830 +++++++++++++++++++
31 files changed, 4558 insertions(+), 109 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/d2574528/PortletV3Demo/src/main/webapp/WEB-INF/jsp/view-isp.jsp
----------------------------------------------------------------------
diff --git a/PortletV3Demo/src/main/webapp/WEB-INF/jsp/view-isp.jsp b/PortletV3Demo/src/main/webapp/WEB-INF/jsp/view-isp.jsp
index 675fe32..ed90d92 100644
--- a/PortletV3Demo/src/main/webapp/WEB-INF/jsp/view-isp.jsp
+++ b/PortletV3Demo/src/main/webapp/WEB-INF/jsp/view-isp.jsp
@@ -77,27 +77,27 @@ limitations under the License.
},
// function to select the proper image depending on radio button or dropdown display
- selectImage = function (seltype, imgName) {
+ selectImage = function (seltype, photo) {
var ii, f = document.getElementById(fid);
- if (!imgName) {
- imgName = 'default';
+ if (!photo) {
+ photo = 'default';
}
if (seltype === 'radio') {
- for (ii=0; ii < f.imgName.length; ii++) {
- if (f.imgName[ii].value === imgName) {
- console.log("ISP: image clicked: " + imgName);
- f.imgName[ii].checked = true;
+ for (ii=0; ii < f.photo.length; ii++) {
+ if (f.photo[ii].value === photo) {
+ console.log("ISP: image clicked: " + photo);
+ f.photo[ii].checked = true;
} else {
- f.imgName[ii].checked = false;
+ f.photo[ii].checked = false;
}
}
} else {
- for (ii=0; ii < f.imgName.length; ii++) {
- if (f.imgName[ii].value === imgName) {
- console.log("ISP: image selected: " + imgName);
- f.imgName[ii].selected = true;
+ for (ii=0; ii < f.photo.length; ii++) {
+ if (f.photo[ii].value === photo) {
+ console.log("ISP: image selected: " + photo);
+ f.photo[ii].selected = true;
}
}
}
@@ -123,9 +123,9 @@ limitations under the License.
// default is radio buttons
var ii, f = document.getElementById(fid);
if (newST === 'radio') {
- for (ii=0; ii < f.imgName.length; ii++) {
- console.log("ISP: adding selection handler for: " + f.imgName[ii].value);
- f.imgName[ii].onclick = handleImgRadio;
+ for (ii=0; ii < f.photo.length; ii++) {
+ console.log("ISP: adding selection handler for: " + f.photo[ii].value);
+ f.photo[ii].onclick = handleImgRadio;
}
} else if (newST === 'dropdown') {
console.log("ISP: adding selection handler to dropdown list element: " + selBox);
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/d2574528/PortletV3Demo/src/main/webapp/WEB-INF/portlet.xml
----------------------------------------------------------------------
diff --git a/PortletV3Demo/src/main/webapp/WEB-INF/portlet.xml b/PortletV3Demo/src/main/webapp/WEB-INF/portlet.xml
index 62ef563..1b7f4e7 100644
--- a/PortletV3Demo/src/main/webapp/WEB-INF/portlet.xml
+++ b/PortletV3Demo/src/main/webapp/WEB-INF/portlet.xml
@@ -1,8 +1,8 @@
-<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
+<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_3_0.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:rp="http://www.apache.org/portals/pluto/pub-render-params/ResourcePortlet"
- xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
- version="2.0"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_3_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_3_0.xsd"
+ version="3.0"
id="v3.demo.portlet">
<portlet>
<portlet-name>V3ImageViewer</portlet-name>
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/d2574528/pluto-container-api/src/main/java/org/apache/pluto/container/om/portlet/PortletApplicationDefinition.java
----------------------------------------------------------------------
diff --git a/pluto-container-api/src/main/java/org/apache/pluto/container/om/portlet/PortletApplicationDefinition.java b/pluto-container-api/src/main/java/org/apache/pluto/container/om/portlet/PortletApplicationDefinition.java
index f19fcd3..8f98611 100644
--- a/pluto-container-api/src/main/java/org/apache/pluto/container/om/portlet/PortletApplicationDefinition.java
+++ b/pluto-container-api/src/main/java/org/apache/pluto/container/om/portlet/PortletApplicationDefinition.java
@@ -1,90 +1,91 @@
-/*
- * 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;
-
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-
-import javax.xml.namespace.QName;
-
-public interface PortletApplicationDefinition {
-
- String JSR_168_VERSION = "1.0";
- String JSR_286_VERSION = "2.0";
-
- String getName();
- void setName(String name);
-
- String getContextPath();
- void setContextPath(String contextPath);
-
- PortletDefinition getPortlet(String portletName);
- List<? extends PortletDefinition> getPortlets();
- PortletDefinition addPortlet(String name);
-
- List<? extends EventDefinition> getEventDefinitions();
- EventDefinition addEventDefinition(String name);
- EventDefinition addEventDefinition(QName qname);
-
- PublicRenderParameter getPublicRenderParameter(String identifier);
- List<? extends PublicRenderParameter> getPublicRenderParameters();
- PublicRenderParameter addPublicRenderParameter(String name, String identifier);
- PublicRenderParameter addPublicRenderParameter(QName qname, String identifier);
-
- String getVersion();
- void setVersion(String version);
-
- CustomPortletMode getCustomPortletMode(String name);
- List<? extends CustomPortletMode> getCustomPortletModes();
- CustomPortletMode addCustomPortletMode(String name);
-
- CustomWindowState getCustomWindowState(String name);
- List<? extends CustomWindowState> getCustomWindowStates();
- CustomWindowState addCustomWindowState(String name);
-
- UserAttribute getUserAttribute(String name);
- List<? extends UserAttribute> getUserAttributes();
- UserAttribute addUserAttribute(String name);
-
- List<? extends SecurityConstraint> getSecurityConstraints();
- SecurityConstraint addSecurityConstraint(String transportGuarantee);
-
- String getResourceBundle();
- void setResourceBundle(String resourceBundle);
-
- Filter getFilter(String filterName);
- List<? extends Filter> getFilters();
- Filter addFilter(String filterName);
-
- FilterMapping getFilterMapping(String filterName);
- List<? extends FilterMapping> getFilterMappings();
- FilterMapping addFilterMapping(String filterName);
-
- List<? extends Listener> getListeners();
- Listener addListener(String listenerClass);
-
- String getDefaultNamespace();
- void setDefaultNamespace(String defaultNamespace);
-
- ContainerRuntimeOption getContainerRuntimeOption(String name);
- List<? extends ContainerRuntimeOption> getContainerRuntimeOptions();
- ContainerRuntimeOption addContainerRuntimeOption(String name);
-
- Map<Locale, String> getLocaleEncodingMappings();
- void addLocaleEncodingMapping(Locale locale, String encoding);
+/*
+ * 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;
+
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+public interface PortletApplicationDefinition {
+
+ String JSR_168_VERSION = "1.0";
+ String JSR_286_VERSION = "2.0";
+ String JSR_362_VERSION = "3.0";
+
+ String getName();
+ void setName(String name);
+
+ String getContextPath();
+ void setContextPath(String contextPath);
+
+ PortletDefinition getPortlet(String portletName);
+ List<? extends PortletDefinition> getPortlets();
+ PortletDefinition addPortlet(String name);
+
+ List<? extends EventDefinition> getEventDefinitions();
+ EventDefinition addEventDefinition(String name);
+ EventDefinition addEventDefinition(QName qname);
+
+ PublicRenderParameter getPublicRenderParameter(String identifier);
+ List<? extends PublicRenderParameter> getPublicRenderParameters();
+ PublicRenderParameter addPublicRenderParameter(String name, String identifier);
+ PublicRenderParameter addPublicRenderParameter(QName qname, String identifier);
+
+ String getVersion();
+ void setVersion(String version);
+
+ CustomPortletMode getCustomPortletMode(String name);
+ List<? extends CustomPortletMode> getCustomPortletModes();
+ CustomPortletMode addCustomPortletMode(String name);
+
+ CustomWindowState getCustomWindowState(String name);
+ List<? extends CustomWindowState> getCustomWindowStates();
+ CustomWindowState addCustomWindowState(String name);
+
+ UserAttribute getUserAttribute(String name);
+ List<? extends UserAttribute> getUserAttributes();
+ UserAttribute addUserAttribute(String name);
+
+ List<? extends SecurityConstraint> getSecurityConstraints();
+ SecurityConstraint addSecurityConstraint(String transportGuarantee);
+
+ String getResourceBundle();
+ void setResourceBundle(String resourceBundle);
+
+ Filter getFilter(String filterName);
+ List<? extends Filter> getFilters();
+ Filter addFilter(String filterName);
+
+ FilterMapping getFilterMapping(String filterName);
+ List<? extends FilterMapping> getFilterMappings();
+ FilterMapping addFilterMapping(String filterName);
+
+ List<? extends Listener> getListeners();
+ Listener addListener(String listenerClass);
+
+ String getDefaultNamespace();
+ void setDefaultNamespace(String defaultNamespace);
+
+ ContainerRuntimeOption getContainerRuntimeOption(String name);
+ List<? extends ContainerRuntimeOption> getContainerRuntimeOptions();
+ ContainerRuntimeOption addContainerRuntimeOption(String name);
+
+ Map<Locale, String> getLocaleEncodingMappings();
+ void addLocaleEncodingMapping(Locale locale, String encoding);
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/d2574528/pluto-container/src/main/java/org/apache/pluto/container/impl/PortletAppDescriptorServiceImpl.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/impl/PortletAppDescriptorServiceImpl.java b/pluto-container/src/main/java/org/apache/pluto/container/impl/PortletAppDescriptorServiceImpl.java
index 397df22..1464ec9 100644
--- a/pluto-container/src/main/java/org/apache/pluto/container/impl/PortletAppDescriptorServiceImpl.java
+++ b/pluto-container/src/main/java/org/apache/pluto/container/impl/PortletAppDescriptorServiceImpl.java
@@ -91,6 +91,10 @@ public class PortletAppDescriptorServiceImpl implements PortletAppDescriptorServ
{
adjustedNamespaceURI = "http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd";
}
+ else if ("3.0".equals(version))
+ {
+ adjustedNamespaceURI = "http://java.sun.com/xml/ns/portlet/portlet-app_3_0.xsd";
+ }
}
return eventCode;
}
@@ -183,7 +187,8 @@ public class PortletAppDescriptorServiceImpl implements PortletAppDescriptorServ
ClassLoader containerClassLoader = PortletAppDescriptorServiceImpl.class.getClassLoader();
try {
jaxbContext = JAXBContext.newInstance(org.apache.pluto.container.om.portlet10.impl.ObjectFactory.class.getPackage().getName() + ":" +
- org.apache.pluto.container.om.portlet20.impl.ObjectFactory.class.getPackage().getName(),
+ org.apache.pluto.container.om.portlet20.impl.ObjectFactory.class.getPackage().getName() + ":" +
+ org.apache.pluto.container.om.portlet30.impl.ObjectFactory.class.getPackage().getName(),
containerClassLoader);
}
catch (JAXBException e) {
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/d2574528/pluto-container/src/main/java/org/apache/pluto/container/om/portlet20/impl/PortletAppType.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet20/impl/PortletAppType.java b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet20/impl/PortletAppType.java
index b3b473a..348a451 100644
--- a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet20/impl/PortletAppType.java
+++ b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet20/impl/PortletAppType.java
@@ -523,7 +523,9 @@ public class PortletAppType implements PortletApplicationDefinition
public void setVersion(String value)
{
- if (JSR_168_VERSION.equals(value) || JSR_286_VERSION.equals(value))
+ if (JSR_168_VERSION.equals(value)
+ || JSR_286_VERSION.equals(value)
+ || JSR_362_VERSION.equals(value))
{
version = value;
}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/d2574528/pluto-container/src/main/java/org/apache/pluto/container/om/portlet30/impl/ContainerRuntimeOptionType.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet30/impl/ContainerRuntimeOptionType.java b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet30/impl/ContainerRuntimeOptionType.java
new file mode 100644
index 0000000..0f75ef3
--- /dev/null
+++ b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet30/impl/ContainerRuntimeOptionType.java
@@ -0,0 +1,87 @@
+/*
+ * 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.portlet30.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+
+import org.apache.pluto.container.om.portlet.ContainerRuntimeOption;
+
+/**
+ * The container-runtime-option element contains settings for the portlet container that the portlet expects to be
+ * honored at runtime. These settings may re-define default portlet container behavior, like the javax.portlet.escapeXml
+ * setting that disables XML encoding of URLs produced by the portlet tag library as default. Names with the
+ * javax.portlet prefix are reserved for the Java Portlet Specification. Used in: portlet-app, portlet <p>Java class
+ * for container-runtime-optionType complex type. <p>The following schema fragment specifies the expected content
+ * contained within this class.
+ *
+ * <pre>
+ * <complexType name="container-runtime-optionType">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="name" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}nameType"/>
+ * <element name="value" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}valueType" maxOccurs="unbounded" minOccurs="0"/>
+ * </sequence>
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ * @version $Id$
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "container-runtime-optionType", propOrder = { "name", "value" })
+public class ContainerRuntimeOptionType implements ContainerRuntimeOption
+{
+ @XmlElement(required = true)
+ @XmlJavaTypeAdapter(value=CollapsedStringAdapter.class)
+ protected String name;
+ @XmlJavaTypeAdapter(value=CollapsedStringAdapter.class)
+ protected List<String> value;
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String value)
+ {
+ name = value;
+ }
+
+ public List<String> getValues()
+ {
+ if (value == null)
+ {
+ value = new ArrayList<String>();
+ }
+ return value;
+ }
+
+ public void addValue(String value)
+ {
+ getValues().add(value);
+ }
+}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/d2574528/pluto-container/src/main/java/org/apache/pluto/container/om/portlet30/impl/CustomPortletModeType.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet30/impl/CustomPortletModeType.java b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet30/impl/CustomPortletModeType.java
new file mode 100644
index 0000000..6499712
--- /dev/null
+++ b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet30/impl/CustomPortletModeType.java
@@ -0,0 +1,121 @@
+/*
+ * 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.portlet30.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Locale;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+
+import org.apache.pluto.container.om.portlet.CustomPortletMode;
+import org.apache.pluto.container.om.portlet.Description;
+
+/**
+ * A custom portlet mode that one or more portlets in this portlet application supports. If the portal does not need to
+ * provide some management functionality for this portlet mode, the portal-managed element needs to be set to "false",
+ * otherwise to "true". Default is "true". Used in: portlet-app <p>Java class for custom-portlet-modeType complex type.
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * <complexType name="custom-portlet-modeType">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="description" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}descriptionType" maxOccurs="unbounded" minOccurs="0"/>
+ * <element name="portlet-mode" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}portlet-modeType"/>
+ * <element name="portal-managed" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}portal-managedType" minOccurs="0"/>
+ * </sequence>
+ * <attribute name="id" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}string" />
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ * @version $Id$
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "custom-portlet-modeType", propOrder = { "description", "portletMode", "portalManaged" })
+public class CustomPortletModeType implements CustomPortletMode
+{
+ @XmlElement(name = "description")
+ protected List<DescriptionType> description;
+ @XmlElement(name = "portlet-mode", required = true)
+ @XmlJavaTypeAdapter(value=CollapsedStringAdapter.class)
+ protected String portletMode;
+ @XmlElement(name = "portal-managed")
+ protected Boolean portalManaged;
+
+ public Description getDescription(Locale locale)
+ {
+ for (Description d : getDescriptions())
+ {
+ if (d.getLocale().equals(locale))
+ {
+ return d;
+ }
+ }
+ return null;
+ }
+
+ public List<? extends Description> getDescriptions()
+ {
+ if (description == null)
+ {
+ description = new ArrayList<DescriptionType>();
+ }
+ return description;
+ }
+
+ public Description addDescription(String lang)
+ {
+ DescriptionType d = new DescriptionType();
+ d.setLang(lang);
+ if (getDescription(d.getLocale()) != null)
+ {
+ throw new IllegalArgumentException("Description for language: "+d.getLocale()+" already defined");
+ }
+ getDescriptions();
+ description.add(d);
+ return d;
+ }
+
+ public String getPortletMode()
+ {
+ return portletMode != null ? portletMode.toLowerCase() : null;
+ }
+
+ public void setPortletMode(String value)
+ {
+ portletMode = value.toLowerCase();
+ }
+
+ public boolean isPortalManaged()
+ {
+ return portalManaged != null ? portalManaged.booleanValue() : true;
+ }
+
+ public void setPortalManaged(boolean value)
+ {
+ portalManaged = value ? Boolean.TRUE : Boolean.FALSE;
+ }
+}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/d2574528/pluto-container/src/main/java/org/apache/pluto/container/om/portlet30/impl/CustomWindowStateType.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet30/impl/CustomWindowStateType.java b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet30/impl/CustomWindowStateType.java
new file mode 100644
index 0000000..80a1c92
--- /dev/null
+++ b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet30/impl/CustomWindowStateType.java
@@ -0,0 +1,107 @@
+/*
+ * 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.portlet30.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Locale;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+
+import org.apache.pluto.container.om.portlet.CustomWindowState;
+import org.apache.pluto.container.om.portlet.Description;
+
+/**
+ * A custom window state that one or more portlets in this portlet application supports. Used in: portlet-app <p>Java
+ * class for custom-window-stateType complex type. <p>The following schema fragment specifies the expected content
+ * contained within this class.
+ *
+ * <pre>
+ * <complexType name="custom-window-stateType">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="description" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}descriptionType" maxOccurs="unbounded" minOccurs="0"/>
+ * <element name="window-state" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}window-stateType"/>
+ * </sequence>
+ * <attribute name="id" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}string" />
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ * @version $Id$
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "custom-window-stateType", propOrder = { "description", "windowState" })
+public class CustomWindowStateType implements CustomWindowState
+{
+ @XmlElement(name = "description")
+ protected List<DescriptionType> description;
+ @XmlElement(name = "window-state", required = true)
+ @XmlJavaTypeAdapter(value=CollapsedStringAdapter.class)
+ protected String windowState;
+
+ public Description getDescription(Locale locale)
+ {
+ for (Description d : getDescriptions())
+ {
+ if (d.getLocale().equals(locale))
+ {
+ return d;
+ }
+ }
+ return null;
+ }
+
+ public List<? extends Description> getDescriptions()
+ {
+ if (description == null)
+ {
+ description = new ArrayList<DescriptionType>();
+ }
+ return description;
+ }
+
+ public Description addDescription(String lang)
+ {
+ DescriptionType d = new DescriptionType();
+ d.setLang(lang);
+ if (getDescription(d.getLocale()) != null)
+ {
+ throw new IllegalArgumentException("Description for language: "+d.getLocale()+" already defined");
+ }
+ getDescriptions();
+ description.add(d);
+ return d;
+ }
+
+ public String getWindowState()
+ {
+ return windowState != null ? windowState.toLowerCase() : null;
+ }
+
+ public void setWindowState(String value)
+ {
+ windowState = value.toLowerCase();
+ }
+}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/d2574528/pluto-container/src/main/java/org/apache/pluto/container/om/portlet30/impl/DescriptionType.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet30/impl/DescriptionType.java b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet30/impl/DescriptionType.java
new file mode 100644
index 0000000..6c86768
--- /dev/null
+++ b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet30/impl/DescriptionType.java
@@ -0,0 +1,120 @@
+/*
+ * 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.portlet30.impl;
+
+import java.util.Locale;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlTransient;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.XmlValue;
+import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+
+import org.apache.pluto.container.om.portlet.Description;
+
+/**
+ * The description element is used to provide text describing the parent element. The description element should include
+ * any information that the portlet application war file producer wants to provide to the consumer of the portlet
+ * application war file (i.e., to the Deployer). Typically, the tools used by the portlet application war file consumer
+ * will display the description when processing the parent element that contains the description. It has an optional
+ * attribute xml:lang to indicate which language is used in the description according to RFC 1766
+ * (http://www.ietf.org/rfc/rfc1766.txt). The default value of this attribute is English(“en�?). Used in: init-param,
+ * portlet, portlet-app, security-role <p>Java class for descriptionType complex type. <p>The following schema
+ * fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * <complexType name="descriptionType">
+ * <simpleContent>
+ * <extension base="<http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd>string">
+ * <attribute ref="{http://www.w3.org/XML/1998/namespace}lang"/>
+ * </extension>
+ * </simpleContent>
+ * </complexType>
+ * </pre>
+ *
+ * @version $Id$
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "descriptionType", propOrder = { "value" })
+public class DescriptionType implements Description
+{
+ @XmlValue
+ @XmlJavaTypeAdapter(value=CollapsedStringAdapter.class)
+ protected String value;
+ @XmlAttribute(namespace = "http://www.w3.org/XML/1998/namespace")
+ protected String lang = null;
+ @XmlTransient
+ protected Locale locale;
+
+ public String getDescription()
+ {
+ return value;
+ }
+
+ public void setDescription(String value)
+ {
+ this.value = value;
+ }
+
+ public String getLang()
+ {
+ return lang == null ? Locale.ENGLISH.toString() : lang;
+ }
+
+ public void setLang(String value)
+ {
+ lang = value;
+ deriveLocale();
+ }
+
+ public Locale getLocale()
+ {
+ return locale == null ? deriveLocale() : locale;
+ }
+
+ protected Locale deriveLocale()
+ {
+ Locale locale = null;
+ String lang = this.getLang();
+ if (lang != null)
+ {
+ String country = "";
+ String variant = "";
+ String[] localeArray = lang.split("[-|_]");
+ for (int i = 0; i < localeArray.length; i++)
+ {
+ if (i == 0)
+ {
+ lang = localeArray[i];
+ }
+ else if (i == 1)
+ {
+ country = localeArray[i];
+ }
+ else if (i == 2)
+ {
+ variant = localeArray[i];
+ }
+ }
+ locale = new Locale(lang, country, variant);
+ }
+ return this.locale = locale;
+ }
+}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/d2574528/pluto-container/src/main/java/org/apache/pluto/container/om/portlet30/impl/DisplayNameType.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet30/impl/DisplayNameType.java b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet30/impl/DisplayNameType.java
new file mode 100644
index 0000000..ae3fbbd
--- /dev/null
+++ b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet30/impl/DisplayNameType.java
@@ -0,0 +1,122 @@
+/*
+ * 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.portlet30.impl;
+
+import java.util.Locale;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlTransient;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.XmlValue;
+import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+
+import org.apache.pluto.container.om.portlet.DisplayName;
+
+/**
+ * The display-name type contains a short name that is intended to be displayed by tools. It is used by display-name
+ * elements. The display name need not be unique. Example: ...
+ *
+ * <pre>
+ * <?xml version="1.0" encoding="UTF-8"?><display-name xmlns="http://www.w3.org/2001/XMLSchema" xmlns:portlet="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" xml:lang="en">Employee Self Service</display-name>
+ * </pre>
+ *
+ * It has an optional attribute xml:lang to indicate which language is used in the description according to RFC 1766
+ * (http://www.ietf.org/rfc/rfc1766.txt). The default value of this attribute is English(“en�?). <p>Java class for
+ * display-nameType complex type. <p>The following schema fragment specifies the expected content contained within this
+ * class.
+ *
+ * <pre>
+ * <complexType name="display-nameType">
+ * <simpleContent>
+ * <extension base="<http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd>string">
+ * <attribute ref="{http://www.w3.org/XML/1998/namespace}lang"/>
+ * </extension>
+ * </simpleContent>
+ * </complexType>
+ * </pre>
+ *
+ * @version $Id$
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "display-nameType", propOrder = { "value" })
+public class DisplayNameType implements DisplayName
+{
+ @XmlValue
+ @XmlJavaTypeAdapter(value=CollapsedStringAdapter.class)
+ protected String value;
+ @XmlAttribute(namespace = "http://www.w3.org/XML/1998/namespace")
+ protected String lang = null;
+ @XmlTransient
+ protected Locale locale;
+
+ public String getDisplayName()
+ {
+ return value;
+ }
+
+ public void setDisplayName(String value)
+ {
+ this.value = value;
+ }
+
+ public String getLang()
+ {
+ return lang == null ? Locale.ENGLISH.toString() : lang;
+ }
+
+ public void setLang(String value)
+ {
+ lang = value;
+ }
+
+ public Locale getLocale()
+ {
+ return locale == null ? deriveLocale() : locale;
+ }
+
+ protected Locale deriveLocale()
+ {
+ Locale locale = null;
+ String lang = this.getLang();
+ if (lang != null)
+ {
+ String country = "";
+ String variant = "";
+ String[] localeArray = lang.split("[-|_]");
+ for (int i = 0; i < localeArray.length; i++)
+ {
+ if (i == 0)
+ {
+ lang = localeArray[i];
+ }
+ else if (i == 1)
+ {
+ country = localeArray[i];
+ }
+ else if (i == 2)
+ {
+ variant = localeArray[i];
+ }
+ }
+ locale = new Locale(lang, country, variant);
+ }
+ return this.locale = locale;
+ }
+}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/d2574528/pluto-container/src/main/java/org/apache/pluto/container/om/portlet30/impl/EventDefinitionReferenceType.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet30/impl/EventDefinitionReferenceType.java b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet30/impl/EventDefinitionReferenceType.java
new file mode 100644
index 0000000..81679fa
--- /dev/null
+++ b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet30/impl/EventDefinitionReferenceType.java
@@ -0,0 +1,85 @@
+/*
+ * 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.portlet30.impl;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlSchemaType;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+import javax.xml.namespace.QName;
+
+import org.apache.pluto.container.om.portlet.EventDefinitionReference;
+
+/**
+ * The event-definition-referenceType is used to reference events declared with the event-definition element at
+ * application level. Used in: portlet <p>Java class for event-definition-referenceType complex type. <p>The following
+ * schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * <complexType name="event-definition-referenceType">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <choice>
+ * <element name="qname" type="{http://www.w3.org/2001/XMLSchema}QName"/>
+ * <element name="name" type="{http://www.w3.org/2001/XMLSchema}NCName"/>
+ * </choice>
+ * <attribute name="id" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}string" />
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ * @version $Id$
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "event-definition-referenceType", propOrder = { "qname", "name" })
+public class EventDefinitionReferenceType implements EventDefinitionReference
+{
+ protected QName qname;
+ @XmlJavaTypeAdapter(CollapsedStringAdapter.class)
+ @XmlSchemaType(name = "NCName")
+ protected String name;
+
+ public QName getQName()
+ {
+ return qname;
+ }
+
+ public void setQName(QName value)
+ {
+ qname = value;
+ name = null;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String value)
+ {
+ name = value;
+ qname = null;
+ }
+
+ public QName getQualifiedName(String defaultNamespace)
+ {
+ return qname != null ? qname : name != null ? new QName(defaultNamespace, name) : null;
+ }
+}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/d2574528/pluto-container/src/main/java/org/apache/pluto/container/om/portlet30/impl/EventDefinitionType.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet30/impl/EventDefinitionType.java b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet30/impl/EventDefinitionType.java
new file mode 100644
index 0000000..237fff4
--- /dev/null
+++ b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet30/impl/EventDefinitionType.java
@@ -0,0 +1,161 @@
+/*
+ * 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.portlet30.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Locale;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlSchemaType;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+import javax.xml.namespace.QName;
+
+import org.apache.pluto.container.om.portlet.Description;
+import org.apache.pluto.container.om.portlet.EventDefinition;
+
+/**
+ * The event-definitionType is used to declare events the portlet can either receive or emit. The name must be unique
+ * and must be the one the portlet is using in its code for referencing this event. Used in: portlet-app <p>Java class
+ * for event-definitionType complex type. <p>The following schema fragment specifies the expected content contained
+ * within this class.
+ *
+ * <pre>
+ * <complexType name="event-definitionType">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="description" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}descriptionType" maxOccurs="unbounded" minOccurs="0"/>
+ * <choice>
+ * <element name="qname" type="{http://www.w3.org/2001/XMLSchema}QName"/>
+ * <element name="name" type="{http://www.w3.org/2001/XMLSchema}NCName"/>
+ * </choice>
+ * <element name="alias" type="{http://www.w3.org/2001/XMLSchema}QName" maxOccurs="unbounded" minOccurs="0"/>
+ * <element name="value-type" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}fully-qualified-classType" minOccurs="0"/>
+ * </sequence>
+ * <attribute name="id" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}string" />
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ * @version $Id$
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "event-definitionType", propOrder = { "description", "qname", "name", "alias", "valueType" })
+public class EventDefinitionType implements EventDefinition
+{
+ @XmlElement(name = "description")
+ protected List<DescriptionType> description;
+ protected QName qname;
+ @XmlJavaTypeAdapter(CollapsedStringAdapter.class)
+ @XmlSchemaType(name = "NCName")
+ protected String name;
+ protected List<QName> alias;
+ @XmlElement(name = "value-type")
+ protected String valueType;
+
+ public Description getDescription(Locale locale)
+ {
+ for (Description d : getDescriptions())
+ {
+ if (d.getLocale().equals(locale))
+ {
+ return d;
+ }
+ }
+ return null;
+ }
+
+ public List<? extends Description> getDescriptions()
+ {
+ if (description == null)
+ {
+ description = new ArrayList<DescriptionType>();
+ }
+ return description;
+ }
+
+ public Description addDescription(String lang)
+ {
+ DescriptionType d = new DescriptionType();
+ d.setLang(lang);
+ if (getDescription(d.getLocale()) != null)
+ {
+ throw new IllegalArgumentException("Description for language: "+d.getLocale()+" already defined");
+ }
+ getDescriptions();
+ description.add(d);
+ return d;
+ }
+
+ public QName getQName()
+ {
+ return qname;
+ }
+
+ public void setQName(QName value)
+ {
+ qname = value;
+ name = null;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String value)
+ {
+ name = value;
+ qname = null;
+ }
+
+ public List<QName> getAliases()
+ {
+ if (alias == null)
+ {
+ alias = new ArrayList<QName>();
+ }
+ return alias;
+ }
+
+ public void addAlias(QName alias)
+ {
+ // TODO: check for duplicates
+ getAliases().add(alias);
+ }
+
+ public String getValueType()
+ {
+ return valueType;
+ }
+
+ public void setValueType(String value)
+ {
+ valueType = value;
+ }
+
+ public QName getQualifiedName(String defaultNamespace)
+ {
+ return qname != null ? qname : name != null ? new QName(defaultNamespace, name) : null;
+ }
+}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/d2574528/pluto-container/src/main/java/org/apache/pluto/container/om/portlet30/impl/FilterMappingType.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet30/impl/FilterMappingType.java b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet30/impl/FilterMappingType.java
new file mode 100644
index 0000000..e2c7815
--- /dev/null
+++ b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet30/impl/FilterMappingType.java
@@ -0,0 +1,88 @@
+/*
+ * 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.portlet30.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+
+import org.apache.pluto.container.om.portlet.FilterMapping;
+
+/**
+ * Declaration of the filter mappings in this portlet application is done by using filter-mappingType. The container
+ * uses the filter-mapping declarations to decide which filters to apply to a request, and in what order. To determine
+ * which filters to apply it matches filter-mapping declarations on the portlet-name and the lifecyle phase defined in
+ * the filter element. The order in which filters are invoked is the order in which filter-mapping declarations that
+ * match appear in the list of filter-mapping elements. Used in: portlet-app <p>Java class for filter-mappingType
+ * complex type. <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * <complexType name="filter-mappingType">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="filter-name" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}filter-nameType"/>
+ * <element name="portlet-name" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}portlet-nameType" maxOccurs="unbounded"/>
+ * </sequence>
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ * @version $Id$
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "filter-mappingType", propOrder = { "filterName", "portletName" })
+public class FilterMappingType implements FilterMapping
+{
+ @XmlElement(name = "filter-name", required = true)
+ protected String filterName;
+ @XmlElement(name = "portlet-name", required = true)
+ @XmlJavaTypeAdapter(value=CollapsedStringAdapter.class)
+ protected List<String> portletName;
+
+ public String getFilterName()
+ {
+ return filterName;
+ }
+
+ public void setFilterName(String value)
+ {
+ filterName = value;
+ }
+
+ public List<String> getPortletNames()
+ {
+ if (portletName == null)
+ {
+ portletName = new ArrayList<String>();
+ }
+ return portletName;
+ }
+
+ public void addPortletName(String name)
+ {
+ // TODO: check for duplicates
+ getPortletNames().add(name);
+ }
+}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/d2574528/pluto-container/src/main/java/org/apache/pluto/container/om/portlet30/impl/FilterType.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet30/impl/FilterType.java b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet30/impl/FilterType.java
new file mode 100644
index 0000000..ff13368
--- /dev/null
+++ b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet30/impl/FilterType.java
@@ -0,0 +1,214 @@
+/*
+ * 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.portlet30.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Locale;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+import org.apache.pluto.container.om.portlet.Description;
+import org.apache.pluto.container.om.portlet.DisplayName;
+import org.apache.pluto.container.om.portlet.Filter;
+import org.apache.pluto.container.om.portlet.InitParam;
+
+/**
+ * The filter element specifies a filter that can transform the content of portlet requests and portlet responses.
+ * Filters can access the initialization parameters declared in the deployment descriptor at runtime via the
+ * FilterConfig interface. A filter can be restricted to one or more lifecycle phases of the portlet. Valid entries for
+ * lifecycle are: ACTION_PHASE, EVENT_PHASE, RENDER_PHASE, RESOURCE_PHASE Used in: portlet-app <p>Java class for
+ * filterType complex type. <p>The following schema fragment specifies the expected content contained within this
+ * class.
+ *
+ * <pre>
+ * <complexType name="filterType">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="description" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}descriptionType" maxOccurs="unbounded" minOccurs="0"/>
+ * <element name="display-name" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}display-nameType" maxOccurs="unbounded" minOccurs="0"/>
+ * <element name="filter-name" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}filter-nameType"/>
+ * <element name="filter-class" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}fully-qualified-classType"/>
+ * <element name="lifecycle" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}string" maxOccurs="unbounded"/>
+ * <element name="init-param" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}init-paramType" maxOccurs="unbounded" minOccurs="0"/>
+ * </sequence>
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ * @version $Id$
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "filterType", propOrder = { "description", "displayName", "filterName", "filterClass", "lifecycle",
+ "initParam" })
+public class FilterType implements Filter
+{
+ @XmlElement(name = "description")
+ protected List<DescriptionType> description;
+ @XmlElement(name = "display-name")
+ protected List<DisplayNameType> displayName;
+ @XmlElement(name = "filter-name", required = true)
+ protected String filterName;
+ @XmlElement(name = "filter-class", required = true)
+ protected String filterClass;
+ @XmlElement(required = true)
+ protected List<String> lifecycle;
+ @XmlElement(name = "init-param")
+ protected List<InitParamType> initParam;
+
+ public Description getDescription(Locale locale)
+ {
+ for (Description d : getDescriptions())
+ {
+ if (d.getLocale().equals(locale))
+ {
+ return d;
+ }
+ }
+ return null;
+ }
+
+ public List<? extends Description> getDescriptions()
+ {
+ if (description == null)
+ {
+ description = new ArrayList<DescriptionType>();
+ }
+ return description;
+ }
+
+ public Description addDescription(String lang)
+ {
+ DescriptionType d = new DescriptionType();
+ d.setLang(lang);
+ if (getDescription(d.getLocale()) != null)
+ {
+ throw new IllegalArgumentException("Description for language: "+d.getLocale()+" already defined");
+ }
+ getDescriptions();
+ description.add(d);
+ return d;
+ }
+
+ public DisplayName getDisplayName(Locale locale)
+ {
+ for (DisplayName d : getDisplayNames())
+ {
+ if (d.getLocale().equals(locale))
+ {
+ return d;
+ }
+ }
+ return null;
+ }
+
+ public List<? extends DisplayName> getDisplayNames()
+ {
+ if (displayName == null)
+ {
+ displayName = new ArrayList<DisplayNameType>();
+ }
+ return displayName;
+ }
+
+ public DisplayName addDisplayName(String lang)
+ {
+ DisplayNameType d = new DisplayNameType();
+ d.setLang(lang);
+ if (getDisplayName(d.getLocale()) != null)
+ {
+ throw new IllegalArgumentException("DisplayName for language: "+d.getLocale()+" already defined");
+ }
+ getDisplayNames();
+ displayName.add(d);
+ return d;
+ }
+
+ public String getFilterName()
+ {
+ return filterName;
+ }
+
+ public void setFilterName(String value)
+ {
+ filterName = value;
+ }
+
+ public String getFilterClass()
+ {
+ return filterClass;
+ }
+
+ public void setFilterClass(String value)
+ {
+ filterClass = value;
+ }
+
+ public List<String> getLifecycles()
+ {
+ 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;
+ }
+
+ public List<? extends InitParam> getInitParams()
+ {
+ if (initParam == null)
+ {
+ initParam = new ArrayList<InitParamType>();
+ }
+ return initParam;
+ }
+
+ public InitParam addInitParam(String paramName)
+ {
+ if (getInitParam(paramName) != null)
+ {
+ throw new IllegalArgumentException("Init parameter: "+paramName+" already defined");
+ }
+ InitParamType param = new InitParamType();
+ param.setParamName(paramName);
+ getInitParams();
+ initParam.add(param);
+ return param;
+ }
+}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/d2574528/pluto-container/src/main/java/org/apache/pluto/container/om/portlet30/impl/InitParamType.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet30/impl/InitParamType.java b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet30/impl/InitParamType.java
new file mode 100644
index 0000000..f0fc42f
--- /dev/null
+++ b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet30/impl/InitParamType.java
@@ -0,0 +1,121 @@
+/*
+ * 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.portlet30.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Locale;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+
+import org.apache.pluto.container.om.portlet.Description;
+import org.apache.pluto.container.om.portlet.InitParam;
+
+/**
+ * The init-param element contains a name/value pair as an initialization param of the portlet Used in:portlet <p>Java
+ * class for init-paramType complex type. <p>The following schema fragment specifies the expected content contained
+ * within this class.
+ *
+ * <pre>
+ * <complexType name="init-paramType">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="description" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}descriptionType" maxOccurs="unbounded" minOccurs="0"/>
+ * <element name="name" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}nameType"/>
+ * <element name="value" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}valueType"/>
+ * </sequence>
+ * <attribute name="id" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}string" />
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ * @version $Id$
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "init-paramType", propOrder = { "description", "name", "value" })
+public class InitParamType implements InitParam
+{
+ @XmlElement(name = "description")
+ protected List<DescriptionType> description;
+ @XmlElement(required = true)
+ @XmlJavaTypeAdapter(value=CollapsedStringAdapter.class)
+ protected String name;
+ @XmlElement(required = true)
+ @XmlJavaTypeAdapter(value=CollapsedStringAdapter.class)
+ protected String value;
+
+ public Description getDescription(Locale locale)
+ {
+ for (Description d : getDescriptions())
+ {
+ if (d.getLocale().equals(locale))
+ {
+ return d;
+ }
+ }
+ return null;
+ }
+
+ public List<? extends Description> getDescriptions()
+ {
+ if (description == null)
+ {
+ description = new ArrayList<DescriptionType>();
+ }
+ return description;
+ }
+
+ public Description addDescription(String lang)
+ {
+ DescriptionType d = new DescriptionType();
+ d.setLang(lang);
+ if (getDescription(d.getLocale()) != null)
+ {
+ throw new IllegalArgumentException("Description for language: "+d.getLocale()+" already defined");
+ }
+ getDescriptions();
+ description.add(d);
+ return d;
+ }
+
+ public String getParamName()
+ {
+ return name;
+ }
+
+ public void setParamName(String value)
+ {
+ name = value;
+ }
+
+ public String getParamValue()
+ {
+ return value;
+ }
+
+ public void setParamValue(String value)
+ {
+ this.value = value;
+ }
+}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/d2574528/pluto-container/src/main/java/org/apache/pluto/container/om/portlet30/impl/ListenerType.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet30/impl/ListenerType.java b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet30/impl/ListenerType.java
new file mode 100644
index 0000000..b98b3fb
--- /dev/null
+++ b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet30/impl/ListenerType.java
@@ -0,0 +1,142 @@
+/*
+ * 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.portlet30.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Locale;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+import org.apache.pluto.container.om.portlet.Description;
+import org.apache.pluto.container.om.portlet.DisplayName;
+import org.apache.pluto.container.om.portlet.Listener;
+
+/**
+ * The listenerType is used to declare listeners for this portlet application. Used in: portlet-app <p>Java class for
+ * listenerType complex type. <p>The following schema fragment specifies the expected content contained within this
+ * class.
+ *
+ * <pre>
+ * <complexType name="listenerType">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="description" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}descriptionType" maxOccurs="unbounded" minOccurs="0"/>
+ * <element name="display-name" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}display-nameType" maxOccurs="unbounded" minOccurs="0"/>
+ * <element name="listener-class" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}fully-qualified-classType"/>
+ * </sequence>
+ * <attribute name="id" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}string" />
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ * @version $Id$
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "listenerType", propOrder = { "description", "displayName", "listenerClass" })
+public class ListenerType implements Listener
+{
+ @XmlElement(name = "description")
+ protected List<DescriptionType> description;
+ @XmlElement(name = "display-name")
+ protected List<DisplayNameType> displayName;
+ @XmlElement(name = "listener-class", required = true)
+ protected String listenerClass;
+
+ public Description getDescription(Locale locale)
+ {
+ for (Description d : getDescriptions())
+ {
+ if (d.getLocale().equals(locale))
+ {
+ return d;
+ }
+ }
+ return null;
+ }
+
+ public List<? extends Description> getDescriptions()
+ {
+ if (description == null)
+ {
+ description = new ArrayList<DescriptionType>();
+ }
+ return description;
+ }
+
+ public Description addDescription(String lang)
+ {
+ DescriptionType d = new DescriptionType();
+ d.setLang(lang);
+ if (getDescription(d.getLocale()) != null)
+ {
+ throw new IllegalArgumentException("Description for language: "+d.getLocale()+" already defined");
+ }
+ getDescriptions();
+ description.add(d);
+ return d;
+ }
+
+ public DisplayName getDisplayName(Locale locale)
+ {
+ for (DisplayName d : getDisplayNames())
+ {
+ if (d.getLocale().equals(locale))
+ {
+ return d;
+ }
+ }
+ return null;
+ }
+
+ public List<? extends DisplayName> getDisplayNames()
+ {
+ if (displayName == null)
+ {
+ displayName = new ArrayList<DisplayNameType>();
+ }
+ return displayName;
+ }
+
+ public DisplayName addDisplayName(String lang)
+ {
+ DisplayNameType d = new DisplayNameType();
+ d.setLang(lang);
+ if (getDisplayName(d.getLocale()) != null)
+ {
+ throw new IllegalArgumentException("DisplayName for language: "+d.getLocale()+" already defined");
+ }
+ getDisplayNames();
+ displayName.add(d);
+ return d;
+ }
+
+ public String getListenerClass()
+ {
+ return listenerClass;
+ }
+
+ public void setListenerClass(String value)
+ {
+ listenerClass = value;
+ }
+}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/d2574528/pluto-container/src/main/java/org/apache/pluto/container/om/portlet30/impl/ObjectFactory.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet30/impl/ObjectFactory.java b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet30/impl/ObjectFactory.java
new file mode 100644
index 0000000..73ed471
--- /dev/null
+++ b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet30/impl/ObjectFactory.java
@@ -0,0 +1,53 @@
+/*
+ * 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.portlet30.impl;
+
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.annotation.XmlElementDecl;
+import javax.xml.bind.annotation.XmlRegistry;
+import javax.xml.namespace.QName;
+
+/**
+ * This object contains factory methods for each Java content interface and Java element interface generated in the
+ * org.apache.pluto.descriptors.portlet30 package. <p>An ObjectFactory allows you to programatically construct new
+ * instances of the Java representation for XML content. The Java representation of XML content can consist of schema
+ * derived interfaces and classes representing the binding of schema type definitions, element declarations and model
+ * groups. Factory methods for each of these are provided in this class.
+ *
+ * @version $Id$
+ */
+@XmlRegistry
+public class ObjectFactory
+{
+ private final static QName _PortletApp_QNAME = new QName("http://java.sun.com/xml/ns/portlet/portlet-app_3_0.xsd",
+ "portlet-app");
+
+ public ObjectFactory()
+ {
+ }
+
+ public PortletAppType createPortletApp()
+ {
+ return new PortletAppType();
+ }
+
+ @XmlElementDecl(namespace = "http://java.sun.com/xml/ns/portlet/portlet-app_3_0.xsd", name = "portlet-app")
+ public JAXBElement<PortletAppType> createPortletApp(PortletAppType value)
+ {
+ return new JAXBElement<PortletAppType>(_PortletApp_QNAME, PortletAppType.class, null, value);
+ }
+}
[11/14] portals-pluto git commit: Fixed problem with portlet hub
implementation history management
Posted by ms...@apache.org.
Fixed problem with portlet hub implementation history management
Project: http://git-wip-us.apache.org/repos/asf/portals-pluto/repo
Commit: http://git-wip-us.apache.org/repos/asf/portals-pluto/commit/419045cb
Tree: http://git-wip-us.apache.org/repos/asf/portals-pluto/tree/419045cb
Diff: http://git-wip-us.apache.org/repos/asf/portals-pluto/diff/419045cb
Branch: refs/heads/V3Prototype
Commit: 419045cb9549e2d9f0f14af7f9694e64a08a2676
Parents: e6cdc82
Author: Scott Nicklous <ms...@apache.org>
Authored: Wed Jan 28 12:55:41 2015 +0100
Committer: Scott Nicklous <ms...@apache.org>
Committed: Wed Jan 28 12:55:41 2015 +0100
----------------------------------------------------------------------
pluto-portal/src/main/webapp/portletHubImpl.js | 48 ++-------------------
1 file changed, 4 insertions(+), 44 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/419045cb/pluto-portal/src/main/webapp/portletHubImpl.js
----------------------------------------------------------------------
diff --git a/pluto-portal/src/main/webapp/portletHubImpl.js b/pluto-portal/src/main/webapp/portletHubImpl.js
index ff27149..60eb8bf 100644
--- a/pluto-portal/src/main/webapp/portletHubImpl.js
+++ b/pluto-portal/src/main/webapp/portletHubImpl.js
@@ -525,28 +525,14 @@ var portlet = portlet || {};
if (pageState.prpMap[group].hasOwnProperty(tpid)) {
name = pageState.prpMap[group][tpid];
// only need to add parameter once, since it is shared
- if (!prpstrings.hasOwnProperty(name)) {
- prpstrings[name] = genParmString(tpid, name, PUBLIC_RENDER_PARAM, group);
- str += prpstrings[name];
+ if (!prpstrings.hasOwnProperty(group)) {
+ prpstrings[group] = genParmString(tpid, name, PUBLIC_RENDER_PARAM, group);
+ str += prpstrings[group];
}
}
}
}
}
-
-// for (tpid in pageState.portlets) {
-// if (pageState.portlets.hasOwnProperty(tpid)) {
-// names = pageState.portlets[tpid].pubParms;
-// for (ii=0; ii < names.length; ii++) {
-// name = names[ii];
-// // only need to add parameter once, since it is shared
-// if (!prpstrings.hasOwnProperty(name)) {
-// prpstrings[name] = genParmString(tpid, name, PUBLIC_RENDER_PARAM);
-// str += prpstrings[name];
-// }
-// }
-// }
-// }
url += str;
}
@@ -580,7 +566,7 @@ var portlet = portlet || {};
updateHistory = function (replace) {
if (doHistory) {
getUrl('RENDER', null, {}).then(function (url) {
- var token = JSON.stringify(pageState.portlets);
+ var token = JSON.stringify(pageState);
console.log("Updating history. URL =" + url + ", token length =" + token.length
+ ", token 30 chars =" + token.substring(0,30));
if (replace) {
@@ -622,32 +608,6 @@ var portlet = portlet || {};
}
}
-
- // process each portlet ID
-// pids = getIds();
-// for (ii = 0; ii < pids.length; ii++) {
-// tpid = pids[ii];
-//
-// // don't update for initiating portlet. that's done after the loop
-// if (tpid !== pid) {
-//
-// oldVal = getParmVal(tpid, prp);
-// prpNames = getPRPNames(tpid);
-//
-// // check for public parameter and if the value has changed
-// if ((prpNames.indexOf(prp) >= 0) &&
-// (_isParmEqual(oldVal, newVal) === false)) {
-//
-// if (newVal === undefined) {
-// delete pageState.portlets[tpid].state.parameters[prp];
-// } else {
-// pageState.portlets[tpid].state.parameters[prp] = newVal.slice(0);
-// }
-// upids.push(tpid);
-//
-// }
-// }
-// }
}
}
[06/14] portals-pluto git commit: Fixed bug in Portlet Hub public
render parameter handling; cleaned up portlet hub impl
Posted by ms...@apache.org.
Fixed bug in Portlet Hub public render parameter handling; cleaned up portlet hub impl
Project: http://git-wip-us.apache.org/repos/asf/portals-pluto/repo
Commit: http://git-wip-us.apache.org/repos/asf/portals-pluto/commit/65df9c67
Tree: http://git-wip-us.apache.org/repos/asf/portals-pluto/tree/65df9c67
Diff: http://git-wip-us.apache.org/repos/asf/portals-pluto/diff/65df9c67
Branch: refs/heads/V3Prototype
Commit: 65df9c6703e4bfe79800f2f0d5748bd0cd81a40b
Parents: a8bed7f
Author: Scott Nicklous <ms...@apache.org>
Authored: Wed Jan 28 10:04:48 2015 +0100
Committer: Scott Nicklous <ms...@apache.org>
Committed: Wed Jan 28 10:04:48 2015 +0100
----------------------------------------------------------------------
pluto-portal/src/main/webapp/portletHubImpl.js | 46 ++-------------------
1 file changed, 3 insertions(+), 43 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/65df9c67/pluto-portal/src/main/webapp/portletHubImpl.js
----------------------------------------------------------------------
diff --git a/pluto-portal/src/main/webapp/portletHubImpl.js b/pluto-portal/src/main/webapp/portletHubImpl.js
index ff27149..8269455 100644
--- a/pluto-portal/src/main/webapp/portletHubImpl.js
+++ b/pluto-portal/src/main/webapp/portletHubImpl.js
@@ -525,28 +525,14 @@ var portlet = portlet || {};
if (pageState.prpMap[group].hasOwnProperty(tpid)) {
name = pageState.prpMap[group][tpid];
// only need to add parameter once, since it is shared
- if (!prpstrings.hasOwnProperty(name)) {
- prpstrings[name] = genParmString(tpid, name, PUBLIC_RENDER_PARAM, group);
- str += prpstrings[name];
+ if (!prpstrings.hasOwnProperty(group)) {
+ prpstrings[group] = genParmString(tpid, name, PUBLIC_RENDER_PARAM, group);
+ str += prpstrings[group];
}
}
}
}
}
-
-// for (tpid in pageState.portlets) {
-// if (pageState.portlets.hasOwnProperty(tpid)) {
-// names = pageState.portlets[tpid].pubParms;
-// for (ii=0; ii < names.length; ii++) {
-// name = names[ii];
-// // only need to add parameter once, since it is shared
-// if (!prpstrings.hasOwnProperty(name)) {
-// prpstrings[name] = genParmString(tpid, name, PUBLIC_RENDER_PARAM);
-// str += prpstrings[name];
-// }
-// }
-// }
-// }
url += str;
}
@@ -622,32 +608,6 @@ var portlet = portlet || {};
}
}
-
- // process each portlet ID
-// pids = getIds();
-// for (ii = 0; ii < pids.length; ii++) {
-// tpid = pids[ii];
-//
-// // don't update for initiating portlet. that's done after the loop
-// if (tpid !== pid) {
-//
-// oldVal = getParmVal(tpid, prp);
-// prpNames = getPRPNames(tpid);
-//
-// // check for public parameter and if the value has changed
-// if ((prpNames.indexOf(prp) >= 0) &&
-// (_isParmEqual(oldVal, newVal) === false)) {
-//
-// if (newVal === undefined) {
-// delete pageState.portlets[tpid].state.parameters[prp];
-// } else {
-// pageState.portlets[tpid].state.parameters[prp] = newVal.slice(0);
-// }
-// upids.push(tpid);
-//
-// }
-// }
-// }
}
}
[07/14] portals-pluto git commit: Added version 3 demo portlet
Posted by ms...@apache.org.
Added version 3 demo portlet
Project: http://git-wip-us.apache.org/repos/asf/portals-pluto/repo
Commit: http://git-wip-us.apache.org/repos/asf/portals-pluto/commit/cea47a7c
Tree: http://git-wip-us.apache.org/repos/asf/portals-pluto/tree/cea47a7c
Diff: http://git-wip-us.apache.org/repos/asf/portals-pluto/diff/cea47a7c
Branch: refs/heads/V3Prototype
Commit: cea47a7c6b1744ec877be7ba0b8b09d2fcbcbe3d
Parents: 65df9c6
Author: Scott Nicklous <ms...@apache.org>
Authored: Wed Jan 28 10:21:41 2015 +0100
Committer: Scott Nicklous <ms...@apache.org>
Committed: Wed Jan 28 10:21:41 2015 +0100
----------------------------------------------------------------------
PortletV3Demo/pom.xml | 154 ++++++++++++++
.../java/basic/portlet/ColorSelPortlet.java | 106 ++++++++++
.../src/main/java/basic/portlet/Constants.java | 53 +++++
.../java/basic/portlet/ImageSelPortlet.java | 105 ++++++++++
.../java/basic/portlet/MessageBoxPortlet.java | 168 ++++++++++++++++
.../basic/portlet/PartialActionPortlet.java | 114 +++++++++++
.../java/basic/portlet/ResourcePortlet.java | 130 ++++++++++++
.../src/main/resources/logging.properties | 37 ++++
.../src/main/webapp/WEB-INF/jsp/view-csp.jsp | 201 +++++++++++++++++++
.../src/main/webapp/WEB-INF/jsp/view-isp.jsp | 178 ++++++++++++++++
.../src/main/webapp/WEB-INF/jsp/view-ivp.jsp | 161 +++++++++++++++
.../src/main/webapp/WEB-INF/jsp/view-mbp.jsp | 89 ++++++++
.../src/main/webapp/WEB-INF/jsp/view-pap.jsp | 108 ++++++++++
.../src/main/webapp/WEB-INF/portlet.xml | 129 ++++++++++++
PortletV3Demo/src/main/webapp/WEB-INF/web.xml | 4 +
.../src/main/webapp/resources/css/styles.css | 16 ++
.../main/webapp/resources/images/FullMoon.gif | Bin 0 -> 38190 bytes
.../webapp/resources/images/baseball-trans.gif | Bin 0 -> 8307 bytes
.../webapp/resources/images/fussball-trans.gif | Bin 0 -> 8733 bytes
.../webapp/resources/images/golfball-trans.gif | Bin 0 -> 9359 bytes
pom.xml | 1 +
21 files changed, 1754 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/cea47a7c/PortletV3Demo/pom.xml
----------------------------------------------------------------------
diff --git a/PortletV3Demo/pom.xml b/PortletV3Demo/pom.xml
new file mode 100644
index 0000000..3ff5884
--- /dev/null
+++ b/PortletV3Demo/pom.xml
@@ -0,0 +1,154 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.portals.pluto</groupId>
+ <artifactId>pluto</artifactId>
+ <version>3.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>PortletV3Demo</artifactId>
+ <packaging>war</packaging>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.portals.pluto</groupId>
+ <artifactId>portlet-api</artifactId>
+ <version>${project.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tomcat</groupId>
+ <artifactId>tomcat-servlet-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- for eclipse JSP tooling purposes -->
+ <dependency>
+ <groupId>javax.servlet.jsp</groupId>
+ <artifactId>jsp-api</artifactId>
+ <version>2.1</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.taglibs</groupId>
+ <artifactId>taglibs-standard-spec</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.taglibs</groupId>
+ <artifactId>taglibs-standard-impl</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.taglibs</groupId>
+ <artifactId>taglibs-standard-jstlel</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.portals.pluto</groupId>
+ <artifactId>pluto-taglib</artifactId>
+ <version>2.1.0-M3</version>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>PortletV3Demo</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.6</source>
+ <target>1.6</target>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-war-plugin</artifactId>
+ <configuration>
+ <archiveClasses>false</archiveClasses>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <profiles>
+ <profile>
+ <id>pluto</id>
+ <activation>
+ <property>
+ <name>!alwaysActivate</name>
+ </property>
+ </activation>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.taglibs</groupId>
+ <artifactId>taglibs-standard-spec</artifactId>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.taglibs</groupId>
+ <artifactId>taglibs-standard-impl</artifactId>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.taglibs</groupId>
+ <artifactId>taglibs-standard-jstlel</artifactId>
+ <scope>compile</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-war-plugin</artifactId>
+ <configuration>
+ <archiveClasses>false</archiveClasses>
+ <webXml>${project.build.directory}/pluto-resources/web.xml</webXml>
+ </configuration>
+ </plugin>
+ <!-- bind 'pluto:assemble' goal to 'generate-resources' lifecycle -->
+ <plugin>
+ <groupId>org.apache.portals.pluto</groupId>
+ <artifactId>maven-pluto-plugin</artifactId>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.portals.pluto</groupId>
+ <artifactId>pluto-util</artifactId>
+ <version>${project.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+ <executions>
+ <execution>
+ <phase>generate-resources</phase>
+ <goals>
+ <goal>assemble</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <!-- workaround for war processing of m-r-r-plugin causing the generated NOTICE and LICENSE file to be put under WEB-INF/classes/META-INF -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-remote-resources-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>process</goal>
+ </goals>
+ <configuration>
+ <outputDirectory>${project.build.directory}/${project.build.finalName}</outputDirectory>
+ <attached>false</attached>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
+</project>
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/cea47a7c/PortletV3Demo/src/main/java/basic/portlet/ColorSelPortlet.java
----------------------------------------------------------------------
diff --git a/PortletV3Demo/src/main/java/basic/portlet/ColorSelPortlet.java b/PortletV3Demo/src/main/java/basic/portlet/ColorSelPortlet.java
new file mode 100644
index 0000000..326191c
--- /dev/null
+++ b/PortletV3Demo/src/main/java/basic/portlet/ColorSelPortlet.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 basic.portlet;
+
+import static basic.portlet.Constants.*;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.GenericPortlet;
+import javax.portlet.PortletException;
+import javax.portlet.PortletRequestDispatcher;
+import javax.portlet.PortletURL;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.ResourceRequest;
+import javax.portlet.ResourceResponse;
+import javax.xml.namespace.QName;
+
+
+/**
+ * A management portlet that displays the current deep link configuration
+ */
+public class ColorSelPortlet extends GenericPortlet {
+
+ // Set up logging
+ // private static final String LOG_CLASS = ColorSelPortlet.class.getName();
+ // private final Logger logger = Logger.getLogger(LOG_CLASS);
+
+ protected void doView(RenderRequest req, RenderResponse resp)
+ throws PortletException, IOException {
+
+
+ resp.setContentType("text/html");
+
+ PortletRequestDispatcher rd = getPortletContext().getRequestDispatcher(
+ "/WEB-INF/jsp/view-csp.jsp");
+ rd.include(req, resp);
+
+}
+
+ /* (non-Javadoc)
+ * @see javax.portlet.GenericPortlet#serveResource(javax.portlet.ResourceRequest, javax.portlet.ResourceResponse)
+ */
+ @Override
+ public void serveResource(ResourceRequest req, ResourceResponse resp)
+ throws PortletException, IOException {
+ }
+
+ public void processAction(ActionRequest req, ActionResponse resp)
+ throws PortletException, IOException {
+
+ String[] vals = req.getParameterValues(PARAM_FG_COLOR);
+ String r = "0";
+ String g = "0";
+ String b = "0";
+ if (vals != null) {
+ for (String v : vals) {
+ if (v.equals(PARAM_FG_RED)) r = "F";
+ if (v.equals(PARAM_FG_GREEN)) g = "F";
+ if (v.equals(PARAM_FG_BLUE)) b = "F";
+ }
+ }
+ String clr = "#" + r + g + b;
+
+ // make sure the private parameter are all on the URL for
+ // potential back button support
+ if (vals != null) {
+ resp.setRenderParameter(PARAM_FG_COLOR, vals);
+ }
+
+ String val = req.getParameter(PARAM_SUBTYPE);
+ if (val != null) {
+ resp.setRenderParameter(PARAM_SUBTYPE, val);
+ }
+
+ val = req.getParameter(PARAM_MSG_INPUT);
+ if (val != null) {
+ resp.setRenderParameter(PARAM_MSG_INPUT, val);
+ }
+
+ String msg = val + DELIM + clr;
+ QName qn = new QName(EVENT_NAMESPACE, EVENT_NAME);
+ resp.setEvent(qn, msg);
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/cea47a7c/PortletV3Demo/src/main/java/basic/portlet/Constants.java
----------------------------------------------------------------------
diff --git a/PortletV3Demo/src/main/java/basic/portlet/Constants.java b/PortletV3Demo/src/main/java/basic/portlet/Constants.java
new file mode 100644
index 0000000..faf5092
--- /dev/null
+++ b/PortletV3Demo/src/main/java/basic/portlet/Constants.java
@@ -0,0 +1,53 @@
+package basic.portlet;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class Constants {
+
+ // maps the names of the images to the paths to the images -
+ public final static Map<String, String> imgMap = new HashMap<String, String>() {
+ private static final long serialVersionUID = 1L;
+ {
+ put("baseball", "/resources/images/baseball-trans.gif");
+ put("golfball", "/resources/images/golfball-trans.gif");
+ put("fussball", "/resources/images/fussball-trans.gif");
+ }};
+
+ public final static String DEFAULT_IMAGE = "/resources/images/FullMoon.gif";
+
+ public final static String PARAM_SELTYPE = "selType";
+ public final static String PARAM_SELTYPE_RADIO = "radio";
+ public final static String PARAM_SELTYPE_DROPDOWN = "dropdown";
+
+ // privae parameter for color selection portlet
+ public final static String PARAM_SUBTYPE = "subType";
+ public final static String PARAM_SUBTYPE_URL = "URL";
+ public final static String PARAM_SUBTYPE_FORM = "form";
+
+ public final static String PARAM_IMGNAME = "photo";
+ public final static String PARAM_COLOR = "color";
+ public final static String PARAM_ERRMSG = "errmsg";
+ public final static String PARAM_BORDER = "bo";
+ public final static String PARAM_BORDER_COLOR = "border";
+ public final static String PARAM_CACHE = "ca";
+ public final static String PARAM_CACHE_PAGE = "pa";
+ public final static String PARAM_CACHE_PORTLET = "po";
+ public final static String PARAM_CACHE_FULL = "fu";
+
+ public final static String PARAM_FG_COLOR = "fgcolor";
+ public final static String PARAM_FG_RED = "red";
+ public final static String PARAM_FG_GREEN = "green";
+ public final static String PARAM_FG_BLUE = "blue";
+ public final static String PARAM_MSG_INPUT = "imsg";
+
+ public final static String PARAM_NUM_ACTIONS = "numActions";
+
+ public final static String PARAM_NUM_MSGS = "numMsgs";
+ public final static String ATTRIB_MSGS = "msgs";
+
+ public final static String EVENT_NAMESPACE = "http://www.apache.org/portals/pluto/pub-render-params/ResourcePortlet";
+ public final static String EVENT_NAME = "Message";
+
+ public final static String DELIM = ";%;";
+}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/cea47a7c/PortletV3Demo/src/main/java/basic/portlet/ImageSelPortlet.java
----------------------------------------------------------------------
diff --git a/PortletV3Demo/src/main/java/basic/portlet/ImageSelPortlet.java b/PortletV3Demo/src/main/java/basic/portlet/ImageSelPortlet.java
new file mode 100644
index 0000000..4475ebb
--- /dev/null
+++ b/PortletV3Demo/src/main/java/basic/portlet/ImageSelPortlet.java
@@ -0,0 +1,105 @@
+/* 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 basic.portlet;
+
+import static basic.portlet.Constants.PARAM_IMGNAME;
+import static basic.portlet.Constants.PARAM_SELTYPE;
+import static basic.portlet.Constants.PARAM_SELTYPE_RADIO;
+import static basic.portlet.Constants.imgMap;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.Set;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.GenericPortlet;
+import javax.portlet.PortletException;
+import javax.portlet.PortletRequestDispatcher;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.ResourceRequest;
+import javax.portlet.ResourceResponse;
+
+
+/**
+ * A management portlet that displays the current deep link configuraion
+ */
+public class ImageSelPortlet extends GenericPortlet {
+
+ // Set up logging
+ private static final String LOG_CLASS = ImageSelPortlet.class.getName();
+ private final Logger logger = Logger.getLogger(LOG_CLASS);
+
+ protected void doView(RenderRequest req, RenderResponse resp)
+ throws PortletException, IOException {
+
+ if (logger.isLoggable(Level.FINE)) {
+ logger.logp(Level.FINE, this.getClass().getName(), "doView", "Entry");
+ }
+
+ resp.setContentType("text/html");
+
+ PortletRequestDispatcher rd = getPortletContext().getRequestDispatcher(
+ "/WEB-INF/jsp/view-isp.jsp");
+ rd.include(req, resp);
+
+ }
+
+ /* (non-Javadoc)
+ * @see javax.portlet.GenericPortlet#serveResource(javax.portlet.ResourceRequest, javax.portlet.ResourceResponse)
+ */
+ @Override
+ public void serveResource(ResourceRequest req, ResourceResponse resp)
+ throws PortletException, IOException {
+
+ resp.setContentType("text/html");
+ PrintWriter writer = resp.getWriter();
+
+ String pid = resp.getNamespace();
+ Set<String> names = imgMap.keySet();
+ String selType = req.getParameter(PARAM_SELTYPE);
+ selType = (selType == null) ? PARAM_SELTYPE_RADIO : selType;
+ String imgName = req.getParameter(PARAM_IMGNAME);
+ imgName = (imgName == null) ? "default" : imgName;
+
+ if (selType.equals(PARAM_SELTYPE_RADIO)) {
+ for (String name : names) {
+ writer.write(" <input type='radio' name='" + PARAM_IMGNAME + "' value='" +
+ name + "'" + (name.equals(imgName) ? "checked" : "") + ">" + name);
+ }
+ } else {
+ writer.write("<select id='" + pid + "-selBox' name='" + PARAM_IMGNAME + "' size='1'>");
+ writer.write(" <option value='default' " +
+ ("default".equals(imgName) ? "selected" : "") + ">-</option>");
+ for (String name : names) {
+ writer.write(" <option value='" + name + "'" +
+ (name.equals(imgName) ? "selected" : "") + ">" + name + "</option>");
+ }
+ writer.write("</select>");
+ }
+ }
+
+ public void processAction(ActionRequest req, ActionResponse resp)
+ throws PortletException, IOException {
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/cea47a7c/PortletV3Demo/src/main/java/basic/portlet/MessageBoxPortlet.java
----------------------------------------------------------------------
diff --git a/PortletV3Demo/src/main/java/basic/portlet/MessageBoxPortlet.java b/PortletV3Demo/src/main/java/basic/portlet/MessageBoxPortlet.java
new file mode 100644
index 0000000..232b696
--- /dev/null
+++ b/PortletV3Demo/src/main/java/basic/portlet/MessageBoxPortlet.java
@@ -0,0 +1,168 @@
+/* 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 basic.portlet;
+
+import static basic.portlet.Constants.*;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.ArrayList;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.EventRequest;
+import javax.portlet.EventResponse;
+import javax.portlet.GenericPortlet;
+import javax.portlet.PortletContext;
+import javax.portlet.PortletException;
+import javax.portlet.PortletRequestDispatcher;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.ResourceRequest;
+import javax.portlet.ResourceResponse;
+import javax.portlet.ResourceURL;
+
+/**
+ * A management portlet that displays the current deep link configuraion
+ */
+public class MessageBoxPortlet extends GenericPortlet {
+
+ // Set up logging
+ private static final String LOG_CLASS = MessageBoxPortlet.class.getName();
+ private final Logger logger = Logger.getLogger(LOG_CLASS);
+
+ protected void doView(RenderRequest req, RenderResponse resp)
+ throws PortletException, IOException {
+
+ if (logger.isLoggable(Level.FINE)) {
+ logger.logp(Level.FINE, this.getClass().getName(), "doView", "Entry");
+ }
+
+ resp.setContentType("text/html");
+
+ PortletRequestDispatcher rd = getPortletContext().getRequestDispatcher(
+ "/WEB-INF/jsp/view-mbp.jsp");
+ rd.include(req, resp);
+
+ }
+
+ @Override
+ public void processAction(ActionRequest req, ActionResponse resp)
+ throws PortletException, IOException {
+
+ // the only action for this portlet is to reset the stored messages
+
+ String actionName = req.getParameter("action");
+ logger.fine("MBP: Resetting messages. numMsgs = 0, actionName = " + actionName);
+
+ ArrayList<String> msgs = new ArrayList<String>();
+ StringBuffer sb = new StringBuffer();
+ sb.append("<p style='margin:2px 5px 2px 5px; color:#00D;"
+ + " background-color:#AAF;'>");
+ sb.append("Reset - No messages.");
+ sb.append("</p>");
+ msgs.add(sb.toString());
+
+ resp.setRenderParameter(PARAM_NUM_MSGS, "0");
+ req.getPortletSession().setAttribute(ATTRIB_MSGS, msgs);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public void processEvent(EventRequest req, EventResponse resp)
+ throws PortletException ,IOException {
+
+ ArrayList<String> msgs = (ArrayList<String>) req.getPortletSession().getAttribute(ATTRIB_MSGS);
+ if (msgs == null) {
+ msgs = new ArrayList<String>();
+ }
+
+ String[] msg;
+ int numMsgs = 0;
+ try {
+ numMsgs = Integer.parseInt(req.getParameter(PARAM_NUM_MSGS));
+ } catch (Exception e) {}
+
+ if (numMsgs == 0) {
+ msgs.clear();
+ }
+
+ logger.fine("MBP: Processing message event. Current # messages = " + msgs.size());
+
+ try {
+ // Both pieces of info are transported in a delimted string rather than
+ // an array since the Pluto impl doesn't seem to get along with array types as
+ // event payload types.
+ String val = (String) req.getEvent().getValue();
+ msg = val.split(DELIM);
+ } catch (Exception e) {
+ msg = new String[2];
+ msg[0] = "error getting message from event.";
+ msg[1] = "#D00";
+ }
+
+ String clr = req.getParameter(PARAM_COLOR);
+ clr = (clr == null) ? "#FFFFFF" : clr;
+
+ StringBuffer sb = new StringBuffer();
+ sb.append("<p style='margin:2px 5px 2px 5px; color:" + msg[1]
+ + "; background-color:" + clr + ";'>");
+ sb.append("" + (msgs.size() + 1) + ": " + msg[0]);
+ sb.append("</p>");
+
+ msgs.add(sb.toString());
+
+ logger.fine("Adding message: " + sb.toString());
+
+ resp.setRenderParameter(PARAM_NUM_MSGS, Integer.toString(msgs.size()));
+ req.getPortletSession().setAttribute(ATTRIB_MSGS, msgs);
+ };
+
+ /* (non-Javadoc)
+ * @see javax.portlet.GenericPortlet#serveResource(javax.portlet.ResourceRequest, javax.portlet.ResourceResponse)
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public void serveResource(ResourceRequest req, ResourceResponse resp)
+ throws PortletException, IOException {
+
+ resp.setContentType("text/html");
+ PrintWriter writer = resp.getWriter();
+
+ ArrayList<String> msgs = (ArrayList<String>) req.getPortletSession().getAttribute(ATTRIB_MSGS);
+ if (msgs == null) {
+ msgs = new ArrayList<String>();
+
+ StringBuffer sb = new StringBuffer();
+ sb.append("<p style='margin:0px 5px 0px 5px; color:#00D;"
+ + " background-color:#FFA;'>");
+ sb.append("No messages.");
+ sb.append("</p>");
+ msgs.add(sb.toString());
+ }
+
+ for (String msg : msgs) {
+ writer.write(msg);
+ }
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/cea47a7c/PortletV3Demo/src/main/java/basic/portlet/PartialActionPortlet.java
----------------------------------------------------------------------
diff --git a/PortletV3Demo/src/main/java/basic/portlet/PartialActionPortlet.java b/PortletV3Demo/src/main/java/basic/portlet/PartialActionPortlet.java
new file mode 100644
index 0000000..eb5b6cb
--- /dev/null
+++ b/PortletV3Demo/src/main/java/basic/portlet/PartialActionPortlet.java
@@ -0,0 +1,114 @@
+/* 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 basic.portlet;
+
+import static basic.portlet.Constants.*;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.ArrayList;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.EventRequest;
+import javax.portlet.EventResponse;
+import javax.portlet.GenericPortlet;
+import javax.portlet.PortletContext;
+import javax.portlet.PortletException;
+import javax.portlet.PortletRequestDispatcher;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.ResourceRequest;
+import javax.portlet.ResourceResponse;
+import javax.portlet.ResourceURL;
+
+/**
+ * A management portlet that displays the current deep link configuraion
+ */
+public class PartialActionPortlet extends GenericPortlet {
+
+ // Set up logging
+ private static final String LOG_CLASS = PartialActionPortlet.class.getName();
+ private final Logger logger = Logger.getLogger(LOG_CLASS);
+
+ protected void doView(RenderRequest req, RenderResponse resp)
+ throws PortletException, IOException {
+
+ if (logger.isLoggable(Level.FINE)) {
+ logger.logp(Level.FINE, this.getClass().getName(), "doView", "Entry");
+ }
+
+ resp.setContentType("text/html");
+
+ PortletRequestDispatcher rd = getPortletContext().getRequestDispatcher(
+ "/WEB-INF/jsp/view-pap.jsp");
+ rd.include(req, resp);
+
+ }
+
+ @Override
+ public void processAction(ActionRequest req, ActionResponse resp)
+ throws PortletException, IOException {
+
+ // the only action for this portlet is to increment the execition counter
+
+ String val = req.getParameter(PARAM_NUM_ACTIONS);
+ int na = 1;
+ if (val != null) {
+ try {
+ na = Integer.parseInt(val) + 1;
+ } catch (Exception e) {}
+ }
+
+ String actionName = req.getParameter("action");
+ logger.fine("PAP: executing partial action. action number = " + na + ", name = " + actionName);
+
+ resp.setRenderParameter(PARAM_NUM_ACTIONS, Integer.toString(na));
+ }
+
+ @Override
+ public void processEvent(EventRequest req, EventResponse resp)
+ throws PortletException ,IOException {
+ };
+
+ /* (non-Javadoc)
+ * @see javax.portlet.GenericPortlet#serveResource(javax.portlet.ResourceRequest, javax.portlet.ResourceResponse)
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public void serveResource(ResourceRequest req, ResourceResponse resp)
+ throws PortletException, IOException {
+
+ resp.setContentType("text/html");
+ PrintWriter writer = resp.getWriter();
+
+ String num = req.getParameter(PARAM_NUM_ACTIONS);
+ num = (num == null) ? "error" : num;
+
+ String pageState = req.getPageState();
+
+ writer.write("<p>Partial Action has been executed " + num + " times.</p>\n");
+ writer.write(";#delimiter#;");
+ writer.write(pageState);
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/cea47a7c/PortletV3Demo/src/main/java/basic/portlet/ResourcePortlet.java
----------------------------------------------------------------------
diff --git a/PortletV3Demo/src/main/java/basic/portlet/ResourcePortlet.java b/PortletV3Demo/src/main/java/basic/portlet/ResourcePortlet.java
new file mode 100644
index 0000000..f8bbbdd
--- /dev/null
+++ b/PortletV3Demo/src/main/java/basic/portlet/ResourcePortlet.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 basic.portlet;
+
+import static basic.portlet.Constants.PARAM_BORDER_COLOR;
+import static basic.portlet.Constants.PARAM_COLOR;
+import static basic.portlet.Constants.PARAM_IMGNAME;
+import static basic.portlet.Constants.imgMap;
+import static basic.portlet.Constants.DEFAULT_IMAGE;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.GenericPortlet;
+import javax.portlet.PortletException;
+import javax.portlet.PortletRequestDispatcher;
+import javax.portlet.PortletURL;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.ResourceRequest;
+import javax.portlet.ResourceResponse;
+
+
+/**
+ * A management portlet that displays the current deep link configuraion
+ */
+public class ResourcePortlet extends GenericPortlet {
+
+ // Set up logging
+ private static final String LOG_CLASS = ResourcePortlet.class.getName();
+ private final Logger logger = Logger.getLogger(LOG_CLASS);
+
+
+ protected void doView(RenderRequest req, RenderResponse resp)
+ throws PortletException, IOException {
+
+ if (logger.isLoggable(Level.FINE)) {
+ logger.logp(Level.FINE, this.getClass().getName(), "doView", "Entry");
+ }
+
+ resp.setContentType("text/html");
+
+ PortletRequestDispatcher rd = getPortletContext().getRequestDispatcher(
+ "/WEB-INF/jsp/view-ivp.jsp");
+ rd.include(req, resp);
+
+
+ }
+
+ /* (non-Javadoc)
+ * @see javax.portlet.GenericPortlet#serveResource(javax.portlet.ResourceRequest, javax.portlet.ResourceResponse)
+ */
+ @Override
+ public void serveResource(ResourceRequest req, ResourceResponse resp)
+ throws PortletException, IOException {
+
+ String key = req.getParameter(PARAM_IMGNAME);
+ String imgDir = DEFAULT_IMAGE;
+ if ((key != null) && imgMap.containsKey(key)) {
+ imgDir = imgMap.get(key);
+ }
+
+ String bc = req.getParameter(PARAM_BORDER_COLOR);
+ String imgStyle = "";
+ if (bc != null) {
+ imgStyle = " style='border:1px solid " + bc + ";' ";
+ }
+
+ String ctx = req.getContextPath();
+ String ca = req.getCacheability();
+
+ resp.setContentType("text/html");
+ PrintWriter writer = resp.getWriter();
+
+ String clr = req.getParameter(PARAM_COLOR);
+ clr = (clr == null) ? "#FFFFFF" : clr;
+
+ if (logger.isLoggable(Level.FINE)) {
+ logger.logp(Level.FINE, this.getClass().getName(), "serveResource", "photo=" + key + ", bgcolor=" + clr + ", border=" + bc);
+ }
+
+ // add action button if cacheability allows -
+ PortletURL aurl = null;
+ String bmu = "<p>Action URL could not be created.</p>";
+ try {
+ aurl = resp.createActionURL();
+ } catch (Exception e) {}
+ if (aurl != null) {
+ bmu = "<form METHOD='POST' ACTION='" + aurl + "'><input id='<portlet:namespace/>-clear' type='submit' name='action' value='Action' /></form>";
+ }
+
+ writer.write("<div style='background-color:" + clr + ";'>\n");
+ writer.write(" <table style='background-color:" + clr + ";'>");
+ writer.write(" <tr><td align='center' style='background-color:" + clr + ";'>");
+ writer.write(" <img src='" + ctx + imgDir + "'" + imgStyle + ">\n");
+ writer.write(" </td><td style='background-color:" + clr + ";'>");
+ writer.write(" <p>" + bmu + "</p>");
+ writer.write(" <p>Cacheability: " + ca + "</p>");
+ writer.write(" </td></tr>");
+ writer.write(" </table>");
+ writer.write("</div>\n");
+
+
+ }
+
+ public void processAction(ActionRequest req, ActionResponse resp)
+ throws PortletException, IOException {
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/cea47a7c/PortletV3Demo/src/main/resources/logging.properties
----------------------------------------------------------------------
diff --git a/PortletV3Demo/src/main/resources/logging.properties b/PortletV3Demo/src/main/resources/logging.properties
new file mode 100644
index 0000000..42a1f93
--- /dev/null
+++ b/PortletV3Demo/src/main/resources/logging.properties
@@ -0,0 +1,37 @@
+#
+# 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.
+
+handlers = org.apache.juli.FileHandler
+
+############################################################
+#
+# JDK 1.4+ logging handler specific properties for Pluto portal
+# using Tomcat's custom implementation of LogManager.
+# Logging level can be set to any one of:
+# SEVERE, WARN, INFO, CONFIG, FINE, FINEST or ALL.
+# See the Tomcat documentation for more details.
+#
+############################################################
+
+org.apache.juli.FileHandler.level = FINE
+org.apache.juli.FileHandler.directory = ${catalina.base}/logs
+#Log file will be named pluto.<yyyy-mm-dd>.log
+org.apache.juli.FileHandler.prefix = PortletV3Demo.
+
+org.apache.pluto.level=FINEST
+basic.portlet.level=FINEST
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/cea47a7c/PortletV3Demo/src/main/webapp/WEB-INF/jsp/view-csp.jsp
----------------------------------------------------------------------
diff --git a/PortletV3Demo/src/main/webapp/WEB-INF/jsp/view-csp.jsp b/PortletV3Demo/src/main/webapp/WEB-INF/jsp/view-csp.jsp
new file mode 100644
index 0000000..11c0475
--- /dev/null
+++ b/PortletV3Demo/src/main/webapp/WEB-INF/jsp/view-csp.jsp
@@ -0,0 +1,201 @@
+<%--
+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.
+--%>
+<%@ page session="false" %>
+<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %>
+<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
+<%@ page import="static basic.portlet.Constants.*" %>
+
+<portlet:defineObjects />
+
+<h3>Color Selector & Message Sender</h3><hr/>
+
+<%
+ String clr = renderRequest.getParameter(PARAM_COLOR);
+ clr = (clr == null) ? "#FFFFFF" : clr;
+
+ String[] vals = renderRequest.getParameterValues(PARAM_FG_COLOR);
+ String r = "";
+ String g = "";
+ String b = "";
+ if (vals != null) {
+ for (String v : vals) {
+ if (v.equals(PARAM_FG_RED)) r = "checked";
+ if (v.equals(PARAM_FG_GREEN)) g = "checked";
+ if (v.equals(PARAM_FG_BLUE)) b = "checked";
+ }
+ }
+%>
+
+<form onsubmit='return false;' enctype='multipart/form-data'>
+ <table><tr>
+ <td align='left'>Enter background color (public param):</td>
+ <td>
+ <input id='<portlet:namespace/>-color' name='<%=PARAM_COLOR%>' type='text' value='<%=clr%>' size='10' maxlength='10'>
+ </td>
+ <td><div id='<portlet:namespace/>-putMsgHere'></div></td>
+ </tr></table>
+</form>
+<hr/>
+<FORM id='<portlet:namespace/>-setParams' method='POST' enctype='application/x-www-form-urlencoded'>
+ <table><tr><td align='left'>
+ Select active foreground colors:
+ </td><td>
+ <input id='<portlet:namespace/>-red' name='<%=PARAM_FG_COLOR%>' value='<%=PARAM_FG_RED%>' type='checkbox' <%=r%>>
+ Red
+ </td><td>
+ <input id='<portlet:namespace/>-green' name='<%=PARAM_FG_COLOR%>' value='<%=PARAM_FG_GREEN%>' type='checkbox' <%=g%>>
+ Green
+ </td><td>
+ <input id='<portlet:namespace/>-blue' name='<%=PARAM_FG_COLOR%>' value='<%=PARAM_FG_BLUE%>' type='checkbox' <%=b%>>
+ Blue
+
+ </td></tr><tr><td>
+ Enter message:
+ </td><td colspan=3>
+ <input id='<portlet:namespace/>-msg' name='<%=PARAM_MSG_INPUT%>' type='text' value='' size='50' maxlength='50'>
+ </td><td>
+
+ </td></tr><tr><td>
+ Form submission:
+ </td><td>
+ <input id='<portlet:namespace/>sType-url' type='radio' name='<%=PARAM_SUBTYPE%>' value='<%=PARAM_SUBTYPE_URL%>' checked>URL
+ </td><td>
+ <input id='<portlet:namespace/>sType-form' type='radio' name='<%=PARAM_SUBTYPE%>' value='<%=PARAM_SUBTYPE_FORM%>'>Form
+ </td><td>
+ <INPUT id ='<portlet:namespace/>-send' VALUE='send' TYPE='submit'>
+ </td></tr></table>
+</FORM>
+<p><hr/></p>
+
+<script>
+(function () {
+ 'use strict';
+
+ var pid = '<portlet:namespace/>',
+ colorEntry = '<portlet:namespace/>-color',
+ msgdiv = '<portlet:namespace/>-putMsgHere',
+ rid = '<portlet:namespace/>-red',
+ gid = '<portlet:namespace/>-green',
+ bid = '<portlet:namespace/>-blue',
+ mid = '<portlet:namespace/>-msg',
+ formid = '<portlet:namespace/>-setParams',
+ sidurl = '<portlet:namespace/>sType-url',
+ sidform = '<portlet:namespace/>sType-form',
+ currState,
+ hub,
+
+
+ // Handler for onStateChange event
+ update = function (type, state) {
+ var oldColor = currState.p.getValue('<%=PARAM_COLOR%>'),
+
+ // use getValue with default value that is used if the parameter is not set
+ newColor = state.p.getValue('<%=PARAM_COLOR%>', '#FFFFFF'),
+ subtype = state.p.getValue('<%=PARAM_SUBTYPE%>', '<%=PARAM_SUBTYPE_URL%>'),
+ msg = state.p.getValue('<%=PARAM_MSG_INPUT%>', ''),
+
+ fgcolor = state.p.getValues('<%=PARAM_FG_COLOR%>'),
+ clr = {red: false, green: false, blue: false}, ii;
+
+ console.log("CSP: state updated. Type=" + type + ", color=" + newColor);
+
+ if (newColor !== oldColor) {
+ document.getElementById(msgdiv).innerHTML = '';
+ document.getElementById(colorEntry).value = newColor;
+ }
+
+ // make sure controls are set according to parameters
+
+ if (subtype === '<%=PARAM_SUBTYPE_URL%>') {
+ document.getElementById(sidurl).checked = true;
+ } else {
+ document.getElementById(sidform).checked = true;
+ }
+
+ if (fgcolor) {
+ for (ii = 0; ii < fgcolor.length; ii++) {
+ clr[fgcolor[ii]] = true;
+ }
+ }
+ document.getElementById(rid).checked = clr.red;
+ document.getElementById(gid).checked = clr.green;
+ document.getElementById(bid).checked = clr.blue;
+
+ document.getElementById(mid).value = msg;
+
+ currState = state;
+ };
+
+
+ // Register portlet with Portlet Hub. Add listener for onStateChange event.
+ portlet.register(pid).then(function (pi) {
+ console.log("CSP Color Selection Portlet: registered: " + pid);
+ hub = pi;
+ currState = hub.newState();
+ hub.addEventListener("portlet.onStateChange", update);
+ });
+
+
+ // Handle change in background color entry field
+ document.getElementById(colorEntry).onchange = function () {
+ var newColor = this.value, newState;
+ console.log("CSP: entry field updated. color=" + newColor);
+ if ((newColor === undefined) || (newColor === null) || !newColor.match(/^#(?:[A-Fa-f0-9]{3}){1,2}$/)) {
+ document.getElementById(msgdiv).innerHTML = 'Bad color. Enter #xxxxxx or #xxx.';
+ } else {
+ newState = currState.clone();
+ newState.p.setValue('color', newColor);
+ hub.setPortletState(newState);
+ }
+ };
+
+
+ // Handler for 'send' button click. Perform Ajax action.
+ document.getElementById(formid).addEventListener('submit', function (event) {
+ var parms, clrs = [], fel, submitForm = document.getElementById(sidform).checked;
+
+ console.log("CSP: sending message. submitForm=" + submitForm);
+
+ // decide how form is to be sent -
+ if (submitForm) {
+ fel = this;
+ hub.action(fel);
+ } else {
+ parms = hub.newParameters();
+ parms.setValue('action', 'send');
+ if (document.getElementById(rid).checked) {
+ clrs.push("<%=PARAM_FG_RED%>");
+ }
+ if (document.getElementById(gid).checked) {
+ clrs.push("<%=PARAM_FG_GREEN%>");
+ }
+ if (document.getElementById(bid).checked) {
+ clrs.push("<%=PARAM_FG_BLUE%>");
+ }
+ if (clrs.length > 0) {
+ parms.setValue('<%=PARAM_FG_COLOR%>', clrs);
+ }
+ parms.setValue('<%=PARAM_MSG_INPUT%>', document.getElementById(mid).value);
+ hub.action(parms);
+ }
+ event.preventDefault();
+ });
+
+}());
+</script>
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/cea47a7c/PortletV3Demo/src/main/webapp/WEB-INF/jsp/view-isp.jsp
----------------------------------------------------------------------
diff --git a/PortletV3Demo/src/main/webapp/WEB-INF/jsp/view-isp.jsp b/PortletV3Demo/src/main/webapp/WEB-INF/jsp/view-isp.jsp
new file mode 100644
index 0000000..675fe32
--- /dev/null
+++ b/PortletV3Demo/src/main/webapp/WEB-INF/jsp/view-isp.jsp
@@ -0,0 +1,178 @@
+<%--
+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.
+--%>
+<%@ page session="false" %>
+<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %>
+<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
+
+<portlet:defineObjects />
+
+
+<h3>Image Selector</h3><hr/>
+<FORM id='<portlet:namespace/>-setParams' onsubmit='return false;' enctype='multipart/form-data'>
+ <table><tr><td align='left'>
+ Selection type (private param):
+ </td><td>
+ <input id='<portlet:namespace/>-radio' type='radio' name='selType' value='radio'>Radio Button
+ <input id='<portlet:namespace/>-dropdown' type='radio' name='selType' value='dropdown'>Drop Down
+ </td></tr><tr><td>
+ Select Image (public param):
+ </td><td>
+
+ <div id='<portlet:namespace/>-putResourceHere'></div>
+
+ </td></tr></table>
+</FORM>
+<p><hr/></p>
+
+<script>
+(function () {
+ 'use strict';
+
+ var pid = '<portlet:namespace/>',
+ fid = '<portlet:namespace/>-setParams',
+ resdiv = '<portlet:namespace/>-putResourceHere',
+ st_radio = '<portlet:namespace/>-radio',
+ st_dropdown = '<portlet:namespace/>-dropdown',
+ selBox = '<portlet:namespace/>-selBox',
+
+ currState = {},
+ hub,
+
+ // Set image name PRP if radio button clicked -
+ handleImgRadio = function () {
+ console.log("ISP: image selected (radio): " + this.value);
+
+ if (currState.parameters.photo !== this.value) {
+ var newState = currState.clone();
+ newState.p.setValue('photo', this.value);
+ hub.setPortletState(newState);
+ }
+ },
+
+ // Set image name PRP if image selected in selection box -
+ handleImgDropdown = function () {
+ console.log("ISP: image selected (dropdown): " + this.value);
+
+ if (currState.parameters.photo !== this.value) {
+ var newState = currState.clone();
+ newState.p.setValue('photo', this.value);
+ hub.setPortletState(newState);
+ }
+ },
+
+ // function to select the proper image depending on radio button or dropdown display
+ selectImage = function (seltype, imgName) {
+ var ii, f = document.getElementById(fid);
+
+ if (!imgName) {
+ imgName = 'default';
+ }
+
+ if (seltype === 'radio') {
+ for (ii=0; ii < f.imgName.length; ii++) {
+ if (f.imgName[ii].value === imgName) {
+ console.log("ISP: image clicked: " + imgName);
+ f.imgName[ii].checked = true;
+ } else {
+ f.imgName[ii].checked = false;
+ }
+ }
+ } else {
+ for (ii=0; ii < f.imgName.length; ii++) {
+ if (f.imgName[ii].value === imgName) {
+ console.log("ISP: image selected: " + imgName);
+ f.imgName[ii].selected = true;
+ }
+ }
+ }
+ },
+
+ // Handler for onStateChange event
+ update = function (type, state) {
+ var oldST = currState.p.getValue('selType'),
+ newST = state.p.getValue('selType', 'radio'),
+ oldImg = currState.p.getValue('photo'),
+ newImg = state.p.getValue('photo');
+
+ console.log("ISP: state updated. type=" + type + ", selType=" + newST + ", photo=" + newImg);
+
+ if (oldST !== newST) {
+ hub.createResourceUrl({}).then(function (url) {
+ console.log("ISP: got url: " + url);
+ var xhr = new XMLHttpRequest();
+ xhr.onreadystatechange=function() {
+ if (xhr.readyState === 4 && xhr.status === 200) {
+ document.getElementById(resdiv).innerHTML = xhr.responseText;
+
+ // default is radio buttons
+ var ii, f = document.getElementById(fid);
+ if (newST === 'radio') {
+ for (ii=0; ii < f.imgName.length; ii++) {
+ console.log("ISP: adding selection handler for: " + f.imgName[ii].value);
+ f.imgName[ii].onclick = handleImgRadio;
+ }
+ } else if (newST === 'dropdown') {
+ console.log("ISP: adding selection handler to dropdown list element: " + selBox);
+ document.getElementById(selBox).onchange = handleImgDropdown;
+ }
+ selectImage(newST, newImg);
+ }
+ };
+ xhr.open("GET",url,true);
+ xhr.send();
+ });
+ } else {
+ // make sure image is selected according to parameter setting.
+ selectImage(newST, newImg);
+ }
+
+ if (newST === 'dropdown') {
+ document.getElementById(st_dropdown).checked = true;
+ } else {
+ document.getElementById(st_radio).checked = true;
+ }
+
+ currState=state;
+ },
+
+ // set private parameter selType to store the selection display type
+ handleST = function () {
+ console.log("ISP: select display type clicked: " + this.value);
+ if (currState.parameters.selType !== this.value) {
+ var newState = currState.clone();
+ newState.p.setValue('selType', this.value);
+ hub.setPortletState(newState);
+ }
+ };
+
+ document.getElementById(st_radio).onclick = handleST;
+ document.getElementById(st_dropdown).onclick = handleST;
+
+
+ // Register with Portlet Hub, add listener for onStateChange event
+ portlet.register(pid).then(function (pi) {
+ console.log("ISP Image Selection Portlet: registered: " + pid);
+ hub = pi;
+ currState = hub.newState();
+ hub.addEventListener("portlet.onStateChange", update);
+ });
+
+
+}());
+</script>
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/cea47a7c/PortletV3Demo/src/main/webapp/WEB-INF/jsp/view-ivp.jsp
----------------------------------------------------------------------
diff --git a/PortletV3Demo/src/main/webapp/WEB-INF/jsp/view-ivp.jsp b/PortletV3Demo/src/main/webapp/WEB-INF/jsp/view-ivp.jsp
new file mode 100644
index 0000000..68aa575
--- /dev/null
+++ b/PortletV3Demo/src/main/webapp/WEB-INF/jsp/view-ivp.jsp
@@ -0,0 +1,161 @@
+<%--
+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.
+--%>
+<%@ page session="false" %>
+<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %>
+<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
+
+<portlet:defineObjects />
+
+<div style='clear:both;'>
+<div style='float:left;'><h3>Image Viewer</h3></div>
+<div id=<portlet:namespace/>-counter style='float:right; font-size:250%; color:#0B0;'>1</div>
+</div><div style='clear:both;'><hr/>
+
+<FORM id='<portlet:namespace/>-setParams' onsubmit='return false;' enctype='multipart/form-data'>
+ <table><tr><td align='left'>
+ Cacheability setting:
+ </td><td>
+ <input id='<portlet:namespace/>-page' type='radio' name='cacheability' value='PAGE'>Page
+ <input id='<portlet:namespace/>-portlet' type='radio' name='cacheability' value='PORTLET'>Portlet
+ <input id='<portlet:namespace/>-full' type='radio' name='cacheability' value='FULL'>Full
+ </td></tr><tr><td>
+ Set border (resource parameter)
+ </td><td>
+ <input id='<portlet:namespace/>-border' type='checkbox' name='border' value='border'>
+ </td></tr></table>
+</FORM><hr/>
+
+<div id='<portlet:namespace/>-putResourceHere'></div>
+
+<script>
+(function () {
+ 'use strict';
+
+ var pid = '<portlet:namespace/>',
+ resdiv = '<portlet:namespace/>-putResourceHere',
+ border = '<portlet:namespace/>-border',
+ ca_page = '<portlet:namespace/>-page',
+ ca_portlet = '<portlet:namespace/>-portlet',
+ ca_full = '<portlet:namespace/>-full',
+
+ cntrId = '<portlet:namespace/>-counter',
+ cntr = 1,
+
+ resparms = {},
+ cacheability,
+ currState,
+ hub,
+
+ // Update function called by the Portlet Hub when an onStatechange event occurs.
+ update = function (type, state) {
+ var bo = state.p.getValue('bo'),
+ ca = state.p.getValue('ca', hub.constants.PAGE);
+
+ currState = state;
+
+ console.log("IVP: state updated. event type=" + type);
+
+ // set cacheability & border color according to parameters. Set controls
+ // according to parameers to enable back button support.
+
+ resparms = hub.newParameters();
+ if (bo) {
+ resparms.setValue('border', bo);
+ document.getElementById(border).checked = true;
+ } else {
+ document.getElementById(border).checked = false;
+ }
+
+ cacheability = ca;
+ switch (ca) {
+ case hub.constants.PAGE:
+ document.getElementById(ca_page).checked = true;
+ break;
+ case hub.constants.PORTLET:
+ document.getElementById(ca_portlet).checked = true;
+ break;
+ case hub.constants.FULL:
+ document.getElementById(ca_full).checked = true;
+ break;
+ }
+
+
+ hub.createResourceUrl(resparms, cacheability).then(function (url) {
+ var brdr = (resparms.border === undefined) ? undefined : resparms.border[0],
+ xhr = new XMLHttpRequest();
+ console.log("IVP: got url: " + url + ", res parm border=" + brdr);
+ xhr.onreadystatechange = function () {
+ if (xhr.readyState === 4 && xhr.status === 200) {
+ document.getElementById(resdiv).innerHTML=xhr.responseText;
+ }
+ };
+ xhr.open("GET",url,true);
+ xhr.send();
+ });
+ },
+
+ // Handler for cacheability radio buttons
+ handleCA = function () {
+ var c = hub.constants[this.value], nstate;
+ console.log("IVP: cacheability button clicked: " + this.value + ", corresponding to constant value " + c);
+ if (cacheability !== c) {
+ cacheability = c;
+ nstate = currState.clone();
+ nstate.p.setValue('ca', c);
+ hub.setPortletState(nstate);
+ }
+ };
+
+ document.getElementById(ca_page).checked = true;
+ document.getElementById(ca_page).onclick = handleCA;
+ document.getElementById(ca_portlet).onclick = handleCA;
+ document.getElementById(ca_full).onclick = handleCA;
+
+ // Handler for 'border' checkbox
+ document.getElementById(border).checked = false;
+ document.getElementById(border).onclick = function () {
+ var nstate = currState.clone();
+ console.log("IVP: border checked: " + this.checked);
+ if (this.checked) {
+ nstate.p.setValue('bo', '#00F');;
+ } else {
+ nstate.p.remove('bo');
+ }
+ hub.setPortletState(nstate);
+ };
+
+ // Register this portlet with the Portlet Hub and add event listener for
+ // the onStateChange event
+ portlet.register(pid).then(function (pi) {
+ console.log("IVP: registered: " + pid);
+ hub = pi;
+ cacheability = hub.constants.PAGE;
+ hub.addEventListener("portlet.onStateChange", update);
+ });
+
+ // Simple counter for demonstrating that page hasn't been refreshed.
+ window.setInterval(function () {
+ document.getElementById(cntrId).innerHTML = ++cntr;
+ }, 1000);
+
+}());
+</script>
+
+<p><hr/></p></div>
+
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/cea47a7c/PortletV3Demo/src/main/webapp/WEB-INF/jsp/view-mbp.jsp
----------------------------------------------------------------------
diff --git a/PortletV3Demo/src/main/webapp/WEB-INF/jsp/view-mbp.jsp b/PortletV3Demo/src/main/webapp/WEB-INF/jsp/view-mbp.jsp
new file mode 100644
index 0000000..5e85af0
--- /dev/null
+++ b/PortletV3Demo/src/main/webapp/WEB-INF/jsp/view-mbp.jsp
@@ -0,0 +1,89 @@
+<%--
+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.
+--%>
+<%@ page session="false" %>
+<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %>
+<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
+
+<portlet:defineObjects />
+
+<%
+ StringBuffer style = new StringBuffer(256);
+ style.append("border-style:solid; border-width:3px;");
+ style.append(" padding:4px; overflow:auto;");
+ style.append(" border-color:#000088; min-height:70px;");
+ style.append(" background:#E0E0E0;");
+%>
+
+<div style='clear:both;'>
+<div style='float:left;'><h3>Message Box Portlet</h3></div>
+<div style='float:right;'>
+<form onsubmit='return false;'><input id='<portlet:namespace/>-clear' type='submit' name='action' value='clear' /></form>
+</div>
+</div><div style='clear:both;'><hr/>
+<p>Messages that arrive via events from other portlets are displayed in this box.</p>
+<div id='<portlet:namespace/>-responseDiv' style="<%=style.toString()%>"></div>
+</div>
+
+<script>
+(function () {
+ 'use strict';
+ var pid = '<portlet:namespace/>',
+ resdiv = '<portlet:namespace/>-responseDiv',
+ clrButton = '<portlet:namespace/>-clear',
+
+ state,
+ resparms,
+ cacheability,
+ hub,
+
+ // Handler for onStateChange event
+ update = function (type, s) {
+ console.log("MBP: state updated. Event type = " + type);
+ state = s;
+
+ hub.createResourceUrl(resparms, cacheability).then(function (url) {
+ var xhr = new XMLHttpRequest();
+ console.log("MBP: got url: " + url);
+ xhr.onreadystatechange = function () {
+ if (xhr.readyState === 4 && xhr.status === 200) {
+ document.getElementById(resdiv).innerHTML=xhr.responseText;
+ }
+ };
+ xhr.open("GET",url,true);
+ xhr.send();
+ });
+ };
+
+ // Handler for "clear" button. execute an action which clears the stored messages
+ document.getElementById(clrButton).onclick = function () {
+ console.log("MBP: clear button clicked. ");
+ hub.action();
+ };
+
+ // Register portlet with Portlet Hub; add onStateChange listener
+ portlet.register(pid).then(function (pi) {
+ console.log("MBP: Message Box portlet registered: " + pid);
+ hub = pi;
+ resparms = hub.newParameters();
+ cacheability = hub.constants.PAGE;
+ hub.addEventListener("portlet.onStateChange", update);
+ });
+
+}());
+</script>
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/cea47a7c/PortletV3Demo/src/main/webapp/WEB-INF/jsp/view-pap.jsp
----------------------------------------------------------------------
diff --git a/PortletV3Demo/src/main/webapp/WEB-INF/jsp/view-pap.jsp b/PortletV3Demo/src/main/webapp/WEB-INF/jsp/view-pap.jsp
new file mode 100644
index 0000000..c9ccb8b
--- /dev/null
+++ b/PortletV3Demo/src/main/webapp/WEB-INF/jsp/view-pap.jsp
@@ -0,0 +1,108 @@
+<%--
+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.
+--%>
+<%@ page session="false" %>
+<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %>
+<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
+
+<portlet:defineObjects />
+
+<%
+ StringBuffer style = new StringBuffer(256);
+ style.append("border-style:solid; border-width:3px;");
+ style.append(" padding:4px; overflow:auto;");
+ style.append(" border-color:#008800; min-height:30px;");
+ style.append(" background:#E0E0E0;");
+%>
+
+<h3>Partial Action Portlet</h3>
+<hr/>
+<p>This portlet exercises the Partial Action execution path.</p>
+<form onsubmit='return false;' enctype='multipart/form-data'><input id='<portlet:namespace/>-doPA' type='submit' name='action' value='Do Partial Action' /></form>
+<div id='<portlet:namespace/>-responseDiv' style="<%=style.toString()%>"></div>
+
+<script>
+(function () {
+ 'use strict';
+ var pid = '<portlet:namespace/>',
+ resdiv = '<portlet:namespace/>-responseDiv',
+ paButton = '<portlet:namespace/>-doPA',
+
+ state,
+ actparms,
+ hub,
+
+ // Handler for onStateChange event
+ update = function (type, s) {
+ var nc = s.p.getValue('color', '#E0E0E0');
+ console.log("PAP: state updated. Event type = " + type);
+
+ // change background color for message box
+ if (state.p.getValue('color') !== nc) {
+ document.getElementById(resdiv).style.background = nc;
+ }
+ state = s;
+ };
+
+ // Handler for "partial action" button. Perform partial action sequence.
+ document.getElementById(paButton).onclick = function () {
+ var xhr = new XMLHttpRequest(), vals, pagestate = null, markup;
+ console.log("PAP: Partial action button clicked.");
+
+ // Add the render parameter counter as action parameter
+ actparms.setValue('numActions', state.p.getValue('numActions'));
+
+ hub.startPartialAction(actparms).then(function (pai) {
+
+ console.log("PAP: got partial action init object. URL: " + pai.url);
+
+ xhr.onreadystatechange = function () {
+ if (xhr.readyState === 4) {
+ if (xhr.status === 200) {
+ vals = xhr.responseText.split(";#delimiter#;");
+ if (vals.length !== 2) {
+ markup = "<p>Error parsing return data. # fields = " + vals.length + ".</p>";
+ } else {
+ markup = vals[0];
+ pagestate = vals[1];
+ }
+ } else {
+ markup = "<p>Communication error. XHR status=" + xhr.statusText + "</p>";
+ }
+ // Make sure setPageState is called even in error case in order to unblock the P.H.
+ pai.setPageState(pagestate);
+ document.getElementById(resdiv).innerHTML = markup;
+ }
+ };
+ xhr.open("POST",pai.url,true);
+ xhr.send();
+
+ });
+ };
+
+ // Register portlet with Portlet Hub; add onStateChange listener
+ portlet.register(pid).then(function (pi) {
+ console.log("PAP: registered: " + pid);
+ hub = pi;
+ state = hub.newState();
+ actparms = hub.newParameters();
+ hub.addEventListener("portlet.onStateChange", update);
+ });
+
+}());
+</script>
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/cea47a7c/PortletV3Demo/src/main/webapp/WEB-INF/portlet.xml
----------------------------------------------------------------------
diff --git a/PortletV3Demo/src/main/webapp/WEB-INF/portlet.xml b/PortletV3Demo/src/main/webapp/WEB-INF/portlet.xml
new file mode 100644
index 0000000..62ef563
--- /dev/null
+++ b/PortletV3Demo/src/main/webapp/WEB-INF/portlet.xml
@@ -0,0 +1,129 @@
+<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:rp="http://www.apache.org/portals/pluto/pub-render-params/ResourcePortlet"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
+ version="2.0"
+ id="v3.demo.portlet">
+ <portlet>
+ <portlet-name>V3ImageViewer</portlet-name>
+ <display-name>V3 Image Viewer Portlet</display-name>
+
+ <portlet-class>basic.portlet.ResourcePortlet</portlet-class>
+
+ <supports>
+ <mime-type>text/html</mime-type>
+ <portlet-mode>VIEW</portlet-mode>
+ </supports>
+
+ <supported-locale>en</supported-locale>
+
+ <portlet-info>
+ <title>V3 Image Viewer Portlet</title>
+ </portlet-info>
+
+ <supported-public-render-parameter>photo</supported-public-render-parameter>
+ <supported-public-render-parameter>color</supported-public-render-parameter>
+ </portlet>
+
+ <portlet>
+ <portlet-name>MessageBoxPortlet</portlet-name>
+ <display-name>Message Box Portlet</display-name>
+
+ <portlet-class>basic.portlet.MessageBoxPortlet</portlet-class>
+
+ <supports>
+ <mime-type>text/html</mime-type>
+ <portlet-mode>VIEW</portlet-mode>
+ </supports>
+
+ <supported-locale>en</supported-locale>
+
+ <portlet-info>
+ <title>PH Message Box Portlet</title>
+ </portlet-info>
+
+ <supported-processing-event>
+ <qname>rp:Message</qname>
+ </supported-processing-event>
+
+ <supported-public-render-parameter>color</supported-public-render-parameter>
+ </portlet>
+
+ <portlet>
+ <portlet-name>V3ImageSelector</portlet-name>
+ <display-name>Image Selection Portlet - alt PRP name</display-name>
+
+ <portlet-class>basic.portlet.ImageSelPortlet</portlet-class>
+
+ <supports>
+ <mime-type>text/html</mime-type>
+ <portlet-mode>VIEW</portlet-mode>
+ </supports>
+
+ <supported-locale>en</supported-locale>
+
+ <portlet-info>
+ <title>Image Selection Portlet - alt PRP name</title>
+ </portlet-info>
+
+ <supported-public-render-parameter>photo</supported-public-render-parameter>
+ </portlet>
+
+ <portlet>
+ <portlet-name>V3ColorSelector</portlet-name>
+ <display-name>Color Selection Portlet - alt QName</display-name>
+
+ <portlet-class>basic.portlet.ColorSelPortlet</portlet-class>
+
+ <supports>
+ <mime-type>text/html</mime-type>
+ <portlet-mode>VIEW</portlet-mode>
+ <portlet-mode>HELP</portlet-mode>
+ </supports>
+
+ <supported-locale>en</supported-locale>
+
+ <portlet-info>
+ <title>Color Selection Portlet - alt QName</title>
+ </portlet-info>
+
+ <supported-publishing-event>
+ <qname>rp:Message</qname>
+ </supported-publishing-event>
+ <supported-public-render-parameter>color</supported-public-render-parameter>
+ </portlet>
+
+ <portlet>
+ <portlet-name>PartialActionPortlet</portlet-name>
+ <display-name>Partial Action Portlet</display-name>
+
+ <portlet-class>basic.portlet.PartialActionPortlet</portlet-class>
+
+ <supports>
+ <mime-type>text/html</mime-type>
+ <portlet-mode>VIEW</portlet-mode>
+ </supports>
+
+ <supported-locale>en</supported-locale>
+
+ <portlet-info>
+ <title>PH Partial Action Portlet</title>
+ </portlet-info>
+
+ <supported-public-render-parameter>color</supported-public-render-parameter>
+ </portlet>
+
+ <event-definition>
+ <qname>rp:Message</qname>
+ <value-type>java.lang.String</value-type>
+ </event-definition>
+
+ <public-render-parameter>
+ <identifier>photo</identifier>
+ <qname>rp:ph-imgName</qname>
+ </public-render-parameter>
+ <public-render-parameter>
+ <identifier>color</identifier>
+ <qname>rp:alt-color</qname>
+ </public-render-parameter>
+ </portlet-app>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/cea47a7c/PortletV3Demo/src/main/webapp/WEB-INF/web.xml
----------------------------------------------------------------------
diff --git a/PortletV3Demo/src/main/webapp/WEB-INF/web.xml b/PortletV3Demo/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000..10055f0
--- /dev/null
+++ b/PortletV3Demo/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
+ <display-name>Portlet Version 3.0 Demo</display-name>
+</web-app>
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/cea47a7c/PortletV3Demo/src/main/webapp/resources/css/styles.css
----------------------------------------------------------------------
diff --git a/PortletV3Demo/src/main/webapp/resources/css/styles.css b/PortletV3Demo/src/main/webapp/resources/css/styles.css
new file mode 100644
index 0000000..9029874
--- /dev/null
+++ b/PortletV3Demo/src/main/webapp/resources/css/styles.css
@@ -0,0 +1,16 @@
+.emphasis {
+ font-style: italic;
+ font-size: 1.3em;
+}
+
+.basicJSFApp {
+ padding: 5px;
+ background-color: #DDFFDD;
+ border: thin solid #66DD66;
+}
+
+.infoBox {
+ padding: 5px;
+ background-color: #DDDDFF;
+ border: thin solid #6666DD;
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/cea47a7c/PortletV3Demo/src/main/webapp/resources/images/FullMoon.gif
----------------------------------------------------------------------
diff --git a/PortletV3Demo/src/main/webapp/resources/images/FullMoon.gif b/PortletV3Demo/src/main/webapp/resources/images/FullMoon.gif
new file mode 100644
index 0000000..a85ee1a
Binary files /dev/null and b/PortletV3Demo/src/main/webapp/resources/images/FullMoon.gif differ
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/cea47a7c/PortletV3Demo/src/main/webapp/resources/images/baseball-trans.gif
----------------------------------------------------------------------
diff --git a/PortletV3Demo/src/main/webapp/resources/images/baseball-trans.gif b/PortletV3Demo/src/main/webapp/resources/images/baseball-trans.gif
new file mode 100644
index 0000000..31c2100
Binary files /dev/null and b/PortletV3Demo/src/main/webapp/resources/images/baseball-trans.gif differ
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/cea47a7c/PortletV3Demo/src/main/webapp/resources/images/fussball-trans.gif
----------------------------------------------------------------------
diff --git a/PortletV3Demo/src/main/webapp/resources/images/fussball-trans.gif b/PortletV3Demo/src/main/webapp/resources/images/fussball-trans.gif
new file mode 100644
index 0000000..97bde92
Binary files /dev/null and b/PortletV3Demo/src/main/webapp/resources/images/fussball-trans.gif differ
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/cea47a7c/PortletV3Demo/src/main/webapp/resources/images/golfball-trans.gif
----------------------------------------------------------------------
diff --git a/PortletV3Demo/src/main/webapp/resources/images/golfball-trans.gif b/PortletV3Demo/src/main/webapp/resources/images/golfball-trans.gif
new file mode 100644
index 0000000..4ec86ce
Binary files /dev/null and b/PortletV3Demo/src/main/webapp/resources/images/golfball-trans.gif differ
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/cea47a7c/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index e355fad..e90209f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -628,6 +628,7 @@ TODO: Check if we need all of them. -->
<!-- PortletHub demo portlets -->
<module>PortletHubDemo</module>
+ <module>PortletV3Demo</module>
<!-- Pluto Utilities, Maven Plugins and Ant Tasks -->
<module>pluto-util</module>
[02/14] portals-pluto git commit: work towards enabling v3 deployment
descriptor
Posted by ms...@apache.org.
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/a8bed7fb/pluto-container/src/main/java/org/apache/pluto/container/om/portlet20/impl/FilterType.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet20/impl/FilterType.java b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet20/impl/FilterType.java
new file mode 100644
index 0000000..9d26b93
--- /dev/null
+++ b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet20/impl/FilterType.java
@@ -0,0 +1,214 @@
+/*
+ * 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.portlet20.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Locale;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+import org.apache.pluto.container.om.portlet.Description;
+import org.apache.pluto.container.om.portlet.DisplayName;
+import org.apache.pluto.container.om.portlet.Filter;
+import org.apache.pluto.container.om.portlet.InitParam;
+
+/**
+ * The filter element specifies a filter that can transform the content of portlet requests and portlet responses.
+ * Filters can access the initialization parameters declared in the deployment descriptor at runtime via the
+ * FilterConfig interface. A filter can be restricted to one or more lifecycle phases of the portlet. Valid entries for
+ * lifecycle are: ACTION_PHASE, EVENT_PHASE, RENDER_PHASE, RESOURCE_PHASE Used in: portlet-app <p>Java class for
+ * filterType complex type. <p>The following schema fragment specifies the expected content contained within this
+ * class.
+ *
+ * <pre>
+ * <complexType name="filterType">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="description" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}descriptionType" maxOccurs="unbounded" minOccurs="0"/>
+ * <element name="display-name" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}display-nameType" maxOccurs="unbounded" minOccurs="0"/>
+ * <element name="filter-name" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}filter-nameType"/>
+ * <element name="filter-class" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}fully-qualified-classType"/>
+ * <element name="lifecycle" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}string" maxOccurs="unbounded"/>
+ * <element name="init-param" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}init-paramType" maxOccurs="unbounded" minOccurs="0"/>
+ * </sequence>
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ * @version $Id$
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "filterType", propOrder = { "description", "displayName", "filterName", "filterClass", "lifecycle",
+ "initParam" })
+public class FilterType implements Filter
+{
+ @XmlElement(name = "description")
+ protected List<DescriptionType> description;
+ @XmlElement(name = "display-name")
+ protected List<DisplayNameType> displayName;
+ @XmlElement(name = "filter-name", required = true)
+ protected String filterName;
+ @XmlElement(name = "filter-class", required = true)
+ protected String filterClass;
+ @XmlElement(required = true)
+ protected List<String> lifecycle;
+ @XmlElement(name = "init-param")
+ protected List<InitParamType> initParam;
+
+ public Description getDescription(Locale locale)
+ {
+ for (Description d : getDescriptions())
+ {
+ if (d.getLocale().equals(locale))
+ {
+ return d;
+ }
+ }
+ return null;
+ }
+
+ public List<? extends Description> getDescriptions()
+ {
+ if (description == null)
+ {
+ description = new ArrayList<DescriptionType>();
+ }
+ return description;
+ }
+
+ public Description addDescription(String lang)
+ {
+ DescriptionType d = new DescriptionType();
+ d.setLang(lang);
+ if (getDescription(d.getLocale()) != null)
+ {
+ throw new IllegalArgumentException("Description for language: "+d.getLocale()+" already defined");
+ }
+ getDescriptions();
+ description.add(d);
+ return d;
+ }
+
+ public DisplayName getDisplayName(Locale locale)
+ {
+ for (DisplayName d : getDisplayNames())
+ {
+ if (d.getLocale().equals(locale))
+ {
+ return d;
+ }
+ }
+ return null;
+ }
+
+ public List<? extends DisplayName> getDisplayNames()
+ {
+ if (displayName == null)
+ {
+ displayName = new ArrayList<DisplayNameType>();
+ }
+ return displayName;
+ }
+
+ public DisplayName addDisplayName(String lang)
+ {
+ DisplayNameType d = new DisplayNameType();
+ d.setLang(lang);
+ if (getDisplayName(d.getLocale()) != null)
+ {
+ throw new IllegalArgumentException("DisplayName for language: "+d.getLocale()+" already defined");
+ }
+ getDisplayNames();
+ displayName.add(d);
+ return d;
+ }
+
+ public String getFilterName()
+ {
+ return filterName;
+ }
+
+ public void setFilterName(String value)
+ {
+ filterName = value;
+ }
+
+ public String getFilterClass()
+ {
+ return filterClass;
+ }
+
+ public void setFilterClass(String value)
+ {
+ filterClass = value;
+ }
+
+ public List<String> getLifecycles()
+ {
+ 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;
+ }
+
+ public List<? extends InitParam> getInitParams()
+ {
+ if (initParam == null)
+ {
+ initParam = new ArrayList<InitParamType>();
+ }
+ return initParam;
+ }
+
+ public InitParam addInitParam(String paramName)
+ {
+ if (getInitParam(paramName) != null)
+ {
+ throw new IllegalArgumentException("Init parameter: "+paramName+" already defined");
+ }
+ InitParamType param = new InitParamType();
+ param.setParamName(paramName);
+ getInitParams();
+ initParam.add(param);
+ return param;
+ }
+}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/a8bed7fb/pluto-container/src/main/java/org/apache/pluto/container/om/portlet20/impl/InitParamType.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet20/impl/InitParamType.java b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet20/impl/InitParamType.java
new file mode 100644
index 0000000..b62732f
--- /dev/null
+++ b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet20/impl/InitParamType.java
@@ -0,0 +1,121 @@
+/*
+ * 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.portlet20.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Locale;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+
+import org.apache.pluto.container.om.portlet.Description;
+import org.apache.pluto.container.om.portlet.InitParam;
+
+/**
+ * The init-param element contains a name/value pair as an initialization param of the portlet Used in:portlet <p>Java
+ * class for init-paramType complex type. <p>The following schema fragment specifies the expected content contained
+ * within this class.
+ *
+ * <pre>
+ * <complexType name="init-paramType">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="description" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}descriptionType" maxOccurs="unbounded" minOccurs="0"/>
+ * <element name="name" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}nameType"/>
+ * <element name="value" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}valueType"/>
+ * </sequence>
+ * <attribute name="id" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}string" />
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ * @version $Id$
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "init-paramType", propOrder = { "description", "name", "value" })
+public class InitParamType implements InitParam
+{
+ @XmlElement(name = "description")
+ protected List<DescriptionType> description;
+ @XmlElement(required = true)
+ @XmlJavaTypeAdapter(value=CollapsedStringAdapter.class)
+ protected String name;
+ @XmlElement(required = true)
+ @XmlJavaTypeAdapter(value=CollapsedStringAdapter.class)
+ protected String value;
+
+ public Description getDescription(Locale locale)
+ {
+ for (Description d : getDescriptions())
+ {
+ if (d.getLocale().equals(locale))
+ {
+ return d;
+ }
+ }
+ return null;
+ }
+
+ public List<? extends Description> getDescriptions()
+ {
+ if (description == null)
+ {
+ description = new ArrayList<DescriptionType>();
+ }
+ return description;
+ }
+
+ public Description addDescription(String lang)
+ {
+ DescriptionType d = new DescriptionType();
+ d.setLang(lang);
+ if (getDescription(d.getLocale()) != null)
+ {
+ throw new IllegalArgumentException("Description for language: "+d.getLocale()+" already defined");
+ }
+ getDescriptions();
+ description.add(d);
+ return d;
+ }
+
+ public String getParamName()
+ {
+ return name;
+ }
+
+ public void setParamName(String value)
+ {
+ name = value;
+ }
+
+ public String getParamValue()
+ {
+ return value;
+ }
+
+ public void setParamValue(String value)
+ {
+ this.value = value;
+ }
+}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/a8bed7fb/pluto-container/src/main/java/org/apache/pluto/container/om/portlet20/impl/ListenerType.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet20/impl/ListenerType.java b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet20/impl/ListenerType.java
new file mode 100644
index 0000000..ddab472
--- /dev/null
+++ b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet20/impl/ListenerType.java
@@ -0,0 +1,142 @@
+/*
+ * 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.portlet20.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Locale;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+import org.apache.pluto.container.om.portlet.Description;
+import org.apache.pluto.container.om.portlet.DisplayName;
+import org.apache.pluto.container.om.portlet.Listener;
+
+/**
+ * The listenerType is used to declare listeners for this portlet application. Used in: portlet-app <p>Java class for
+ * listenerType complex type. <p>The following schema fragment specifies the expected content contained within this
+ * class.
+ *
+ * <pre>
+ * <complexType name="listenerType">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="description" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}descriptionType" maxOccurs="unbounded" minOccurs="0"/>
+ * <element name="display-name" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}display-nameType" maxOccurs="unbounded" minOccurs="0"/>
+ * <element name="listener-class" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}fully-qualified-classType"/>
+ * </sequence>
+ * <attribute name="id" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}string" />
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ * @version $Id$
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "listenerType", propOrder = { "description", "displayName", "listenerClass" })
+public class ListenerType implements Listener
+{
+ @XmlElement(name = "description")
+ protected List<DescriptionType> description;
+ @XmlElement(name = "display-name")
+ protected List<DisplayNameType> displayName;
+ @XmlElement(name = "listener-class", required = true)
+ protected String listenerClass;
+
+ public Description getDescription(Locale locale)
+ {
+ for (Description d : getDescriptions())
+ {
+ if (d.getLocale().equals(locale))
+ {
+ return d;
+ }
+ }
+ return null;
+ }
+
+ public List<? extends Description> getDescriptions()
+ {
+ if (description == null)
+ {
+ description = new ArrayList<DescriptionType>();
+ }
+ return description;
+ }
+
+ public Description addDescription(String lang)
+ {
+ DescriptionType d = new DescriptionType();
+ d.setLang(lang);
+ if (getDescription(d.getLocale()) != null)
+ {
+ throw new IllegalArgumentException("Description for language: "+d.getLocale()+" already defined");
+ }
+ getDescriptions();
+ description.add(d);
+ return d;
+ }
+
+ public DisplayName getDisplayName(Locale locale)
+ {
+ for (DisplayName d : getDisplayNames())
+ {
+ if (d.getLocale().equals(locale))
+ {
+ return d;
+ }
+ }
+ return null;
+ }
+
+ public List<? extends DisplayName> getDisplayNames()
+ {
+ if (displayName == null)
+ {
+ displayName = new ArrayList<DisplayNameType>();
+ }
+ return displayName;
+ }
+
+ public DisplayName addDisplayName(String lang)
+ {
+ DisplayNameType d = new DisplayNameType();
+ d.setLang(lang);
+ if (getDisplayName(d.getLocale()) != null)
+ {
+ throw new IllegalArgumentException("DisplayName for language: "+d.getLocale()+" already defined");
+ }
+ getDisplayNames();
+ displayName.add(d);
+ return d;
+ }
+
+ public String getListenerClass()
+ {
+ return listenerClass;
+ }
+
+ public void setListenerClass(String value)
+ {
+ listenerClass = value;
+ }
+}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/a8bed7fb/pluto-container/src/main/java/org/apache/pluto/container/om/portlet20/impl/ObjectFactory.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet20/impl/ObjectFactory.java b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet20/impl/ObjectFactory.java
new file mode 100644
index 0000000..6fc2283
--- /dev/null
+++ b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet20/impl/ObjectFactory.java
@@ -0,0 +1,53 @@
+/*
+ * 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.portlet20.impl;
+
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.annotation.XmlElementDecl;
+import javax.xml.bind.annotation.XmlRegistry;
+import javax.xml.namespace.QName;
+
+/**
+ * This object contains factory methods for each Java content interface and Java element interface generated in the
+ * org.apache.pluto.descriptors.portlet20 package. <p>An ObjectFactory allows you to programatically construct new
+ * instances of the Java representation for XML content. The Java representation of XML content can consist of schema
+ * derived interfaces and classes representing the binding of schema type definitions, element declarations and model
+ * groups. Factory methods for each of these are provided in this class.
+ *
+ * @version $Id$
+ */
+@XmlRegistry
+public class ObjectFactory
+{
+ private final static QName _PortletApp_QNAME = new QName("http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd",
+ "portlet-app");
+
+ public ObjectFactory()
+ {
+ }
+
+ public PortletAppType createPortletApp()
+ {
+ return new PortletAppType();
+ }
+
+ @XmlElementDecl(namespace = "http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd", name = "portlet-app")
+ public JAXBElement<PortletAppType> createPortletApp(PortletAppType value)
+ {
+ return new JAXBElement<PortletAppType>(_PortletApp_QNAME, PortletAppType.class, null, value);
+ }
+}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/a8bed7fb/pluto-container/src/main/java/org/apache/pluto/container/om/portlet20/impl/PortletAppType.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet20/impl/PortletAppType.java b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet20/impl/PortletAppType.java
new file mode 100644
index 0000000..b3b473a
--- /dev/null
+++ b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet20/impl/PortletAppType.java
@@ -0,0 +1,549 @@
+/*
+ * 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.portlet20.impl;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+
+import javax.xml.XMLConstants;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlSchemaType;
+import javax.xml.bind.annotation.XmlTransient;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+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;
+
+/**
+ * <p>Java class for portlet-appType complex type. <p>The following schema fragment specifies the expected content
+ * contained within this class.
+ *
+ * <pre>
+ * <complexType name="portlet-appType">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="portlet" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}portletType" maxOccurs="unbounded" minOccurs="0"/>
+ * <element name="custom-portlet-mode" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}custom-portlet-modeType" maxOccurs="unbounded" minOccurs="0"/>
+ * <element name="custom-window-state" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}custom-window-stateType" maxOccurs="unbounded" minOccurs="0"/>
+ * <element name="user-attribute" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}user-attributeType" maxOccurs="unbounded" minOccurs="0"/>
+ * <element name="security-constraint" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}security-constraintType" maxOccurs="unbounded" minOccurs="0"/>
+ * <element name="resource-bundle" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}resource-bundleType" minOccurs="0"/>
+ * <element name="filter" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}filterType" maxOccurs="unbounded" minOccurs="0"/>
+ * <element name="filter-mapping" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}filter-mappingType" maxOccurs="unbounded" minOccurs="0"/>
+ * <element name="default-namespace" type="{http://www.w3.org/2001/XMLSchema}anyURI" minOccurs="0"/>
+ * <element name="event-definition" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}event-definitionType" maxOccurs="unbounded" minOccurs="0"/>
+ * <element name="public-render-parameter" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}public-render-parameterType" maxOccurs="unbounded" minOccurs="0"/>
+ * <element name="listener" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}listenerType" maxOccurs="unbounded" minOccurs="0"/>
+ * <element name="container-runtime-option" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}container-runtime-optionType" maxOccurs="unbounded" minOccurs="0"/>
+ * </sequence>
+ * <attribute name="version" use="required" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}string" />
+ * <attribute name="id" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}string" />
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ * @version $Id$
+ */
+@XmlRootElement(name = "portlet-app")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "portlet-appType", propOrder = { "portlet", "customPortletMode", "customWindowState", "userAttribute",
+ "securityConstraint", "resourceBundle", "filter", "filterMapping",
+ "defaultNamespace", "eventDefinition", "publicRenderParameter",
+ "listener", "containerRuntimeOption" })
+public class PortletAppType implements PortletApplicationDefinition
+{
+ @XmlElement(name = "portlet")
+ protected List<PortletType> portlet;
+ @XmlElement(name = "custom-portlet-mode")
+ protected List<CustomPortletModeType> customPortletMode;
+ @XmlElement(name = "custom-window-state")
+ protected List<CustomWindowStateType> customWindowState;
+ @XmlElement(name = "user-attribute")
+ protected List<UserAttributeType> userAttribute;
+ @XmlElement(name = "security-constraint")
+ protected List<SecurityConstraintType> securityConstraint;
+ @XmlElement(name = "resource-bundle")
+ @XmlJavaTypeAdapter(value=CollapsedStringAdapter.class)
+ protected String resourceBundle;
+ @XmlElement(name = "filter")
+ protected List<FilterType> filter;
+ @XmlElement(name = "filter-mapping")
+ protected List<FilterMappingType> filterMapping;
+ @XmlElement(name = "default-namespace")
+ @XmlSchemaType(name = "anyURI")
+ protected String defaultNamespace;
+ @XmlElement(name = "event-definition")
+ protected List<EventDefinitionType> eventDefinition;
+ @XmlElement(name = "public-render-parameter")
+ protected List<PublicRenderParameterType> publicRenderParameter;
+ @XmlElement(name = "listener")
+ protected List<ListenerType> listener;
+ @XmlElement(name = "container-runtime-option")
+ protected List<ContainerRuntimeOptionType> containerRuntimeOption;
+ @XmlAttribute(required = true)
+ protected String version = JSR_286_VERSION;
+
+ @XmlTransient
+ protected String name;
+ @XmlTransient
+ protected String contextPath;
+ @XmlTransient
+ protected Map<Locale, String> localeEncodingMappings;
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ public String getContextPath()
+ {
+ return contextPath;
+ }
+
+ public void setContextPath(String contextPath)
+ {
+ this.contextPath = contextPath;
+ }
+
+ public PortletDefinition getPortlet(String portletName)
+ {
+ for (PortletDefinition pd : getPortlets())
+ {
+ if (pd.getPortletName().equals(portletName))
+ {
+ return pd;
+ }
+ }
+ return null;
+ }
+
+ public List<? extends PortletDefinition> getPortlets()
+ {
+ if (portlet == null)
+ {
+ portlet = new ArrayList<PortletType>();
+ }
+ return portlet;
+ }
+
+ public PortletDefinition addPortlet(String portletName)
+ {
+ if (getPortlet(portletName) != null)
+ {
+ throw new IllegalArgumentException("Portlet with name: "+portletName+" already defined");
+ }
+ PortletType p = new PortletType();
+ p.setPortletName(portletName);
+ p.setApplication(this);
+ portlet.add(p);
+ return p;
+ }
+
+ public CustomPortletMode getCustomPortletMode(String name)
+ {
+ for (CustomPortletMode cpm : getCustomPortletModes())
+ {
+ if (cpm.getPortletMode().equalsIgnoreCase(name))
+ {
+ return cpm;
+ }
+ }
+ return null;
+ }
+
+ public List<? extends CustomPortletMode> getCustomPortletModes()
+ {
+ if (customPortletMode == null)
+ {
+ customPortletMode = new ArrayList<CustomPortletModeType>();
+ }
+ return customPortletMode;
+ }
+
+ public CustomPortletMode addCustomPortletMode(String name)
+ {
+ if (getCustomPortletMode(name) != null)
+ {
+ throw new IllegalArgumentException("Custom PortletMode with mode name: "+name+" already defined");
+ }
+ CustomPortletModeType cpm = new CustomPortletModeType();
+ cpm.setPortletMode(name);
+ customPortletMode.add(cpm);
+ return cpm;
+ }
+
+ public CustomWindowState getCustomWindowState(String name)
+ {
+ for (CustomWindowState cws : getCustomWindowStates())
+ {
+ if (cws.getWindowState().equalsIgnoreCase(name))
+ {
+ return cws;
+ }
+ }
+ return null;
+ }
+
+ public List<? extends CustomWindowState> getCustomWindowStates()
+ {
+ if (customWindowState == null)
+ {
+ customWindowState = new ArrayList<CustomWindowStateType>();
+ }
+ return customWindowState;
+ }
+
+ public CustomWindowState addCustomWindowState(String name)
+ {
+ if (getCustomWindowState(name) != null)
+ {
+ throw new IllegalArgumentException("Custom WindowState with state name: "+name+" already defined");
+ }
+ CustomWindowStateType cws = new CustomWindowStateType();
+ cws.setWindowState(name);
+ customWindowState.add(cws);
+ return cws;
+ }
+
+ public UserAttribute getUserAttribute(String name)
+ {
+ for (UserAttribute ua : getUserAttributes())
+ {
+ if (ua.getName().equals(name))
+ {
+ return ua;
+ }
+ }
+ return null;
+ }
+
+ public List<? extends UserAttribute> getUserAttributes()
+ {
+ if (userAttribute == null)
+ {
+ userAttribute = new ArrayList<UserAttributeType>();
+ }
+ return userAttribute;
+ }
+
+ public UserAttribute addUserAttribute(String name)
+ {
+ if (getUserAttribute(name) != null)
+ {
+ throw new IllegalArgumentException("User attribute with name: "+name+" already defined");
+ }
+ UserAttributeType ua = new UserAttributeType();
+ ua.setName(name);
+ userAttribute.add(ua);
+ return ua;
+ }
+
+ public List<? extends SecurityConstraint> getSecurityConstraints()
+ {
+ if (securityConstraint == null)
+ {
+ securityConstraint = new ArrayList<SecurityConstraintType>();
+ }
+ return securityConstraint;
+ }
+
+ public SecurityConstraint addSecurityConstraint(String transportGuarantee)
+ {
+ SecurityConstraintType sc = new SecurityConstraintType();
+ ((UserDataConstraintType)sc.getUserDataConstraint()).setTransportGuarantee(transportGuarantee);
+ getSecurityConstraints();
+ securityConstraint.add(sc);
+ return sc;
+ }
+
+ public String getResourceBundle()
+ {
+ return resourceBundle;
+ }
+
+ public void setResourceBundle(String value)
+ {
+ resourceBundle = value;
+ }
+
+ public Filter getFilter(String name)
+ {
+ for (Filter f : getFilters())
+ {
+ if (f.getFilterName().equals(name))
+ {
+ return f;
+ }
+ }
+ return null;
+ }
+
+ public List<? extends Filter> getFilters()
+ {
+ if (filter == null)
+ {
+ filter = new ArrayList<FilterType>();
+ }
+ return filter;
+ }
+
+ public Filter addFilter(String name)
+ {
+ if (getFilter(name) != null)
+ {
+ throw new IllegalArgumentException("Filter with name: "+name+" already defined");
+ }
+ FilterType f = new FilterType();
+ f.setFilterName(name);
+ filter.add(f);
+ return f;
+ }
+
+ public FilterMapping getFilterMapping(String name)
+ {
+ for (FilterMapping f : getFilterMappings())
+ {
+ if (f.getFilterName().equals(name))
+ {
+ return f;
+ }
+ }
+ return null;
+ }
+
+ public List<? extends FilterMapping> getFilterMappings()
+ {
+ if (filterMapping == null)
+ {
+ filterMapping = new ArrayList<FilterMappingType>();
+ }
+ return filterMapping;
+ }
+
+ public FilterMapping addFilterMapping(String name)
+ {
+ if (getFilterMapping(name) != null)
+ {
+ throw new IllegalArgumentException("Filtermapping for filter: "+name+" already defined");
+ }
+ FilterMappingType fm = new FilterMappingType();
+ fm.setFilterName(name);
+ filterMapping.add(fm);
+ return fm;
+ }
+
+ public String getDefaultNamespace()
+ {
+ return defaultNamespace != null ? defaultNamespace : XMLConstants.NULL_NS_URI;
+ }
+
+ public void setDefaultNamespace(String value)
+ {
+ defaultNamespace = value;
+ }
+
+ public List<? extends EventDefinition> getEventDefinitions()
+ {
+ if (eventDefinition == null)
+ {
+ eventDefinition = new ArrayList<EventDefinitionType>();
+ }
+ return eventDefinition;
+ }
+
+ public EventDefinition addEventDefinition(String name)
+ {
+ // TODO: check duplicates (complication: set of qname and name)
+ EventDefinitionType ed = new EventDefinitionType();
+ ed.setName(name);
+ eventDefinition.add(ed);
+ return ed;
+ }
+
+ public EventDefinition addEventDefinition(QName qname)
+ {
+ // TODO: check duplicates (complication: set of qname and name)
+ EventDefinitionType ed = new EventDefinitionType();
+ ed.setQName(qname);
+ eventDefinition.add(ed);
+ return ed;
+ }
+
+ public PublicRenderParameter getPublicRenderParameter(String identifier)
+ {
+ for (PublicRenderParameter prp : getPublicRenderParameters())
+ {
+ if (prp.getIdentifier().equals(identifier))
+ {
+ return prp;
+ }
+ }
+ return null;
+ }
+
+ public List<? extends PublicRenderParameter> getPublicRenderParameters()
+ {
+ if (publicRenderParameter == null)
+ {
+ publicRenderParameter = new ArrayList<PublicRenderParameterType>();
+ }
+ return publicRenderParameter;
+ }
+
+ public PublicRenderParameter addPublicRenderParameter(String name, String identifier)
+ {
+ if (getPublicRenderParameter(identifier) != null)
+ {
+ throw new IllegalArgumentException("PublicRenderParameter with identifier: "+identifier+" already defined");
+ }
+ // TODO: check duplicates on name|qname?
+ PublicRenderParameterType p = new PublicRenderParameterType();
+ p.setName(name);
+ p.setIdentifier(identifier);
+ publicRenderParameter.add(p);
+ return p;
+ }
+
+ public PublicRenderParameter addPublicRenderParameter(QName qname, String identifier)
+ {
+ if (getPublicRenderParameter(identifier) != null)
+ {
+ throw new IllegalArgumentException("PublicRenderParameter with identifier: "+identifier+" already defined");
+ }
+ // TODO: check duplicates on name|qname?
+ PublicRenderParameterType p = new PublicRenderParameterType();
+ p.setQName(qname);
+ p.setIdentifier(identifier);
+ publicRenderParameter.add(p);
+ return p;
+ }
+
+ public List<? extends Listener> getListeners()
+ {
+ if (listener == null)
+ {
+ listener = new ArrayList<ListenerType>();
+ }
+ return listener;
+ }
+
+ public Listener addListener(String listenerClass)
+ {
+ for (Listener l : getListeners())
+ {
+ if (l.getListenerClass().equals(listenerClass))
+ {
+ throw new IllegalArgumentException("Listener of class: "+listenerClass+" already defined");
+ }
+ }
+ ListenerType l = new ListenerType();
+ l.setListenerClass(listenerClass);
+ listener.add(l);
+ return l;
+ }
+
+ public ContainerRuntimeOption getContainerRuntimeOption(String name)
+ {
+ for (ContainerRuntimeOption cro : getContainerRuntimeOptions())
+ {
+ if (cro.getName().equals(name))
+ {
+ return cro;
+ }
+ }
+ return null;
+ }
+
+ public List<? extends ContainerRuntimeOption> getContainerRuntimeOptions()
+ {
+ if (containerRuntimeOption == null)
+ {
+ containerRuntimeOption = new ArrayList<ContainerRuntimeOptionType>();
+ }
+ return containerRuntimeOption;
+ }
+
+ public ContainerRuntimeOption addContainerRuntimeOption(String name)
+ {
+ if (getContainerRuntimeOption(name) != null)
+ {
+ throw new IllegalArgumentException("Container runtime option with name: "+name+" already defined");
+ }
+ ContainerRuntimeOptionType cro = new ContainerRuntimeOptionType();
+ cro.setName(name);
+ containerRuntimeOption.add(cro);
+ return cro;
+ }
+
+ public String getVersion()
+ {
+ return version;
+ }
+
+ public void setVersion(String value)
+ {
+ if (JSR_168_VERSION.equals(value) || JSR_286_VERSION.equals(value))
+ {
+ version = value;
+ }
+ else
+ {
+ throw new IllegalArgumentException("Application descriptor version: "+value+" unsupported.");
+ }
+ }
+
+ public Map<Locale, String> getLocaleEncodingMappings()
+ {
+ if (localeEncodingMappings == null)
+ {
+ localeEncodingMappings = new HashMap<Locale,String>();
+ }
+ return localeEncodingMappings;
+ }
+
+ public void addLocaleEncodingMapping(Locale locale, String encoding)
+ {
+ getLocaleEncodingMappings().put(locale, encoding);
+ }
+}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/a8bed7fb/pluto-container/src/main/java/org/apache/pluto/container/om/portlet20/impl/PortletCollectionType.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet20/impl/PortletCollectionType.java b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet20/impl/PortletCollectionType.java
new file mode 100644
index 0000000..3cfd5e8
--- /dev/null
+++ b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet20/impl/PortletCollectionType.java
@@ -0,0 +1,64 @@
+/*
+ * 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.portlet20.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+
+/**
+ * The portlet-collectionType is used to identify a subset of portlets within a portlet application to which a security
+ * constraint applies. Used in: security-constraint <p>Java class for portlet-collectionType complex type. <p>The
+ * following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * <complexType name="portlet-collectionType">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="portlet-name" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}portlet-nameType" maxOccurs="unbounded"/>
+ * </sequence>
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ * @version $Id$
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "portlet-collectionType", propOrder = { "portletName" })
+public class PortletCollectionType
+{
+ @XmlElement(name = "portlet-name", required = true)
+ @XmlJavaTypeAdapter(value=CollapsedStringAdapter.class)
+ protected List<String> portletName;
+
+ public List<String> getPortletNames()
+ {
+ if (portletName == null)
+ {
+ portletName = new ArrayList<String>();
+ }
+ return portletName;
+ }
+}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/a8bed7fb/pluto-container/src/main/java/org/apache/pluto/container/om/portlet20/impl/PortletInfoType.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet20/impl/PortletInfoType.java b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet20/impl/PortletInfoType.java
new file mode 100644
index 0000000..01f42a2
--- /dev/null
+++ b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet20/impl/PortletInfoType.java
@@ -0,0 +1,92 @@
+/*
+ * 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.portlet20.impl;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+
+import org.apache.pluto.container.om.portlet.PortletInfo;
+
+/**
+ * <p>Java class for portlet-infoType complex type. <p>The following schema fragment specifies the expected content
+ * contained within this class.
+ *
+ * <pre>
+ * <complexType name="portlet-infoType">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="title" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}titleType" minOccurs="0"/>
+ * <element name="short-title" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}short-titleType" minOccurs="0"/>
+ * <element name="keywords" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}keywordsType" minOccurs="0"/>
+ * </sequence>
+ * <attribute name="id" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}string" />
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ * @version $Id$
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "portlet-infoType", propOrder = { "title", "shortTitle", "keywords" })
+public class PortletInfoType implements PortletInfo
+{
+ @XmlElement (name = "title")
+ @XmlJavaTypeAdapter(value=CollapsedStringAdapter.class)
+ protected String title;
+ @XmlElement(name = "short-title")
+ @XmlJavaTypeAdapter(value=CollapsedStringAdapter.class)
+ protected String shortTitle;
+ @XmlElement(name = "keywords")
+ @XmlJavaTypeAdapter(value=CollapsedStringAdapter.class)
+ protected String keywords;
+
+ public String getTitle()
+ {
+ return title;
+ }
+
+ public void setTitle(String value)
+ {
+ title = value;
+ }
+
+ public String getShortTitle()
+ {
+ return shortTitle;
+ }
+
+ public void setShortTitle(String value)
+ {
+ shortTitle = value;
+ }
+
+ public String getKeywords()
+ {
+ return keywords;
+ }
+
+ public void setKeywords(String value)
+ {
+ keywords = value;
+ }
+}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/a8bed7fb/pluto-container/src/main/java/org/apache/pluto/container/om/portlet20/impl/PortletPreferencesType.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet20/impl/PortletPreferencesType.java b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet20/impl/PortletPreferencesType.java
new file mode 100644
index 0000000..ee1d092
--- /dev/null
+++ b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet20/impl/PortletPreferencesType.java
@@ -0,0 +1,101 @@
+/*
+ * 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.portlet20.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+import org.apache.pluto.container.om.portlet.Preference;
+import org.apache.pluto.container.om.portlet.Preferences;
+
+/**
+ * Portlet persistent preference store. Used in: portlet <p>Java class for portlet-preferencesType complex type. <p>The
+ * following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * <complexType name="portlet-preferencesType">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="preference" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}preferenceType" maxOccurs="unbounded" minOccurs="0"/>
+ * <element name="preferences-validator" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}preferences-validatorType" minOccurs="0"/>
+ * </sequence>
+ * <attribute name="id" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}string" />
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ * @version $Id$
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "portlet-preferencesType", propOrder = { "preference", "preferencesValidator" })
+public class PortletPreferencesType implements Preferences
+{
+ @XmlElement(name = "preference")
+ protected List<PreferenceType> preference;
+ @XmlElement(name = "preferences-validator")
+ protected String preferencesValidator;
+
+ public Preference getPortletPreference(String name)
+ {
+ for (Preference p : getPortletPreferences())
+ {
+ if (p.getName().equals(name))
+ {
+ return p;
+ }
+ }
+ return null;
+ }
+
+ public List<? extends Preference> getPortletPreferences()
+ {
+ if (preference == null)
+ {
+ preference = new ArrayList<PreferenceType>();
+ }
+ return preference;
+ }
+
+ public Preference addPreference(String name)
+ {
+ if (getPortletPreference(name) != null)
+ {
+ throw new IllegalArgumentException("Portlet preference with name: "+name+" already defined");
+ }
+ PreferenceType pref = new PreferenceType();
+ pref.setName(name);
+ preference.add(pref);
+ return pref;
+ }
+
+ public String getPreferencesValidator()
+ {
+ return preferencesValidator;
+ }
+
+ public void setPreferencesValidator(String value)
+ {
+ preferencesValidator = value;
+ }
+}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/a8bed7fb/pluto-container/src/main/java/org/apache/pluto/container/om/portlet20/impl/PortletType.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet20/impl/PortletType.java b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet20/impl/PortletType.java
new file mode 100644
index 0000000..6bb2207
--- /dev/null
+++ b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet20/impl/PortletType.java
@@ -0,0 +1,521 @@
+/*
+ * 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.portlet20.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Locale;
+
+import javax.xml.bind.Unmarshaller;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlTransient;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+import javax.xml.namespace.QName;
+
+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;
+
+/**
+ * The portlet element contains the declarative data of a portlet. Used in: portlet-app <p>Java class for portletType
+ * complex type. <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * <complexType name="portletType">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="description" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}descriptionType" maxOccurs="unbounded" minOccurs="0"/>
+ * <element name="portlet-name" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}portlet-nameType"/>
+ * <element name="display-name" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}display-nameType" maxOccurs="unbounded" minOccurs="0"/>
+ * <element name="portlet-class" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}portlet-classType"/>
+ * <element name="init-param" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}init-paramType" maxOccurs="unbounded" minOccurs="0"/>
+ * <element name="expiration-cache" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}expiration-cacheType" minOccurs="0"/>
+ * <element name="cache-scope" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}cache-scopeType" minOccurs="0"/>
+ * <element name="supports" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}supportsType" maxOccurs="unbounded"/>
+ * <element name="supported-locale" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}supported-localeType" maxOccurs="unbounded" minOccurs="0"/>
+ * <element name="resource-bundle" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}resource-bundleType" minOccurs="0"/>
+ * <element name="portlet-info" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}portlet-infoType" minOccurs="0"/>
+ * <element name="portlet-preferences" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}portlet-preferencesType" minOccurs="0"/>
+ * <element name="security-role-ref" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}security-role-refType" maxOccurs="unbounded" minOccurs="0"/>
+ * <element name="supported-processing-event" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}event-definition-referenceType" maxOccurs="unbounded" minOccurs="0"/>
+ * <element name="supported-publishing-event" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}event-definition-referenceType" maxOccurs="unbounded" minOccurs="0"/>
+ * <element name="supported-public-render-parameter" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}string" maxOccurs="unbounded" minOccurs="0"/>
+ * <element name="container-runtime-option" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}container-runtime-optionType" maxOccurs="unbounded" minOccurs="0"/>
+ * </sequence>
+ * <attribute name="id" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}string" />
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ * @version $Id$
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "portletType", propOrder = { "description", "portletName", "displayName", "portletClass", "initParam",
+ "expirationCache", "cacheScope", "supports", "supportedLocale",
+ "resourceBundle", "portletInfo", "portletPreferences", "securityRoleRef",
+ "supportedProcessingEvent", "supportedPublishingEvent",
+ "supportedPublicRenderParameter", "containerRuntimeOption" })
+public class PortletType implements PortletDefinition
+{
+ @XmlElement(name = "description")
+ protected List<DescriptionType> description;
+ @XmlElement(name = "portlet-name", required = true)
+ @XmlJavaTypeAdapter(value=CollapsedStringAdapter.class)
+ protected String portletName;
+ @XmlElement(name = "display-name")
+ protected List<DisplayNameType> displayName;
+ @XmlElement(name = "portlet-class", required = true)
+ @XmlJavaTypeAdapter(value=CollapsedStringAdapter.class)
+ protected String portletClass;
+ @XmlElement(name = "init-param")
+ protected List<InitParamType> initParam;
+ @XmlElement(name = "expiration-cache")
+ protected Integer expirationCache;
+ @XmlElement(name = "cache-scope")
+ @XmlJavaTypeAdapter(value=CollapsedStringAdapter.class)
+ protected String cacheScope;
+ @XmlElement(required = true)
+ protected List<SupportsType> supports;
+ @XmlElement(name = "supported-locale")
+ @XmlJavaTypeAdapter(value=CollapsedStringAdapter.class)
+ protected List<String> supportedLocale;
+ @XmlElement(name = "resource-bundle")
+ @XmlJavaTypeAdapter(value=CollapsedStringAdapter.class)
+ protected String resourceBundle;
+ @XmlElement(name = "portlet-info")
+ protected PortletInfoType portletInfo;
+ @XmlElement(name = "portlet-preferences")
+ protected PortletPreferencesType portletPreferences;
+ @XmlElement(name = "security-role-ref")
+ protected List<SecurityRoleRefType> securityRoleRef;
+ @XmlElement(name = "supported-processing-event")
+ protected List<EventDefinitionReferenceType> supportedProcessingEvent;
+ @XmlElement(name = "supported-publishing-event")
+ protected List<EventDefinitionReferenceType> supportedPublishingEvent;
+ @XmlElement(name = "supported-public-render-parameter")
+ protected List<String> supportedPublicRenderParameter;
+ @XmlElement(name = "container-runtime-option")
+ protected List<ContainerRuntimeOptionType> containerRuntimeOption;
+
+ @XmlTransient
+ private PortletApplicationDefinition application;
+
+ public PortletType()
+ {
+ }
+
+ public PortletApplicationDefinition getApplication()
+ {
+ return application;
+ }
+
+ public void setApplication(PortletApplicationDefinition app)
+ {
+ this.application = app;
+ }
+
+ public Description getDescription(Locale locale)
+ {
+ for (Description d : getDescriptions())
+ {
+ if (d.getLocale().equals(locale))
+ {
+ return d;
+ }
+ }
+ return null;
+ }
+
+ public List<? extends Description> getDescriptions()
+ {
+ if (description == null)
+ {
+ description = new ArrayList<DescriptionType>();
+ }
+ return description;
+ }
+
+ public Description addDescription(String lang)
+ {
+ DescriptionType d = new DescriptionType();
+ d.setLang(lang);
+ if (getDescription(d.getLocale()) != null)
+ {
+ throw new IllegalArgumentException("Description for language: "+d.getLocale()+" already defined");
+ }
+ getDescriptions();
+ description.add(d);
+ return d;
+ }
+
+ public DisplayName getDisplayName(Locale locale)
+ {
+ for (DisplayName d : getDisplayNames())
+ {
+ if (d.getLocale().equals(locale))
+ {
+ return d;
+ }
+ }
+ return null;
+ }
+
+ public List<? extends DisplayName> getDisplayNames()
+ {
+ if (displayName == null)
+ {
+ displayName = new ArrayList<DisplayNameType>();
+ }
+ return displayName;
+ }
+
+ public DisplayName addDisplayName(String lang)
+ {
+ DisplayNameType d = new DisplayNameType();
+ d.setLang(lang);
+ if (getDisplayName(d.getLocale()) != null)
+ {
+ throw new IllegalArgumentException("DisplayName for language: "+d.getLocale()+" already defined");
+ }
+ getDisplayNames();
+ displayName.add(d);
+ return d;
+ }
+
+ public String getPortletName()
+ {
+ return portletName;
+ }
+
+ public void setPortletName(String value)
+ {
+ portletName = value;
+ }
+
+ public String getPortletClass()
+ {
+ return portletClass;
+ }
+
+ public void setPortletClass(String value)
+ {
+ portletClass = value;
+ }
+
+ public InitParam getInitParam(String name)
+ {
+ for (InitParam param : getInitParams())
+ {
+ if (param.getParamName().equals(name))
+ {
+ return param;
+ }
+ }
+ return null;
+ }
+
+ public List<? extends InitParam> getInitParams()
+ {
+ if (initParam == null)
+ {
+ initParam = new ArrayList<InitParamType>();
+ }
+ return initParam;
+ }
+
+ public InitParam addInitParam(String paramName)
+ {
+ if (getInitParam(paramName) != null)
+ {
+ throw new IllegalArgumentException("Init parameter: "+paramName+" already defined");
+ }
+ InitParamType param = new InitParamType();
+ param.setParamName(paramName);
+ getInitParams();
+ initParam.add(param);
+ return param;
+ }
+
+ public int getExpirationCache()
+ {
+ return expirationCache != null ? expirationCache.intValue() : 0;
+ }
+
+ public void setExpirationCache(int value)
+ {
+ expirationCache = new Integer(value);
+ }
+
+ /**
+ * Caching scope, allowed values are "private" indicating that the content should not be shared across users and
+ * "public" indicating that the content may be shared across users. The default value if not present is "private".
+ */
+ public String getCacheScope()
+ {
+ return cacheScope != null ? cacheScope : "private";
+ }
+
+ public void setCacheScope(String cacheScope)
+ {
+ this.cacheScope = cacheScope;
+ }
+
+ public Supports getSupports(String mimeType)
+ {
+ for (Supports s : getSupports())
+ {
+ if (s.getMimeType().equals(mimeType))
+ {
+ return s;
+ }
+ }
+ return null;
+ }
+
+ public List<? extends Supports> getSupports()
+ {
+ if (supports == null)
+ {
+ supports = new ArrayList<SupportsType>();
+ }
+ return supports;
+ }
+
+ public Supports addSupports(String mimeType)
+ {
+ if (getSupports(mimeType) != null)
+ {
+ throw new IllegalArgumentException("Supports for mime type: "+mimeType+" already defined");
+ }
+ SupportsType s = new SupportsType();
+ s.setMimeType(mimeType);
+ supports.add(s);
+ return s;
+ }
+
+ public List<String> getSupportedLocales()
+ {
+ if (supportedLocale == null)
+ {
+ supportedLocale = new ArrayList<String>();
+ }
+ return supportedLocale;
+ }
+
+ public void addSupportedLocale(String lang)
+ {
+ for (String l : getSupportedLocales())
+ {
+ if (l.equals(lang))
+ {
+ throw new IllegalArgumentException("Supported locale: "+lang+" already defined");
+ }
+ }
+ supportedLocale.add(lang);
+ }
+
+ public String getResourceBundle()
+ {
+ return resourceBundle;
+ }
+
+ public void setResourceBundle(String value)
+ {
+ resourceBundle = value;
+ }
+
+ public PortletInfo getPortletInfo()
+ {
+ if (portletInfo == null)
+ {
+ portletInfo = new PortletInfoType();
+ }
+ return portletInfo;
+ }
+
+ public Preferences getPortletPreferences()
+ {
+ if (portletPreferences == null)
+ {
+ portletPreferences = new PortletPreferencesType();
+ }
+ return portletPreferences;
+ }
+
+ public SecurityRoleRef getSecurityRoleRef(String roleName)
+ {
+ for (SecurityRoleRef ref : getSecurityRoleRefs())
+ {
+ if (ref.getRoleName().equals(roleName))
+ {
+ return ref;
+ }
+ }
+ return null;
+ }
+
+ public List<? extends SecurityRoleRef> getSecurityRoleRefs()
+ {
+ if (securityRoleRef == null)
+ {
+ securityRoleRef = new ArrayList<SecurityRoleRefType>();
+ }
+ return securityRoleRef;
+ }
+
+ public SecurityRoleRef addSecurityRoleRef(String roleName)
+ {
+ if (getSecurityRoleRef(roleName) != null)
+ {
+ throw new IllegalArgumentException("Security role reference for role: "+roleName+" already defined");
+ }
+ SecurityRoleRefType srr = new SecurityRoleRefType();
+ srr.setRoleName(roleName);
+ securityRoleRef.add(srr);
+ return srr;
+ }
+
+ public List<? extends EventDefinitionReference> getSupportedProcessingEvents()
+ {
+ if (supportedProcessingEvent == null)
+ {
+ supportedProcessingEvent = new ArrayList<EventDefinitionReferenceType>();
+ }
+ return supportedProcessingEvent;
+ }
+
+ public EventDefinitionReference addSupportedProcessingEvent(QName qname)
+ {
+ // TODO: check duplicates
+ getSupportedProcessingEvents();
+ EventDefinitionReferenceType edr = new EventDefinitionReferenceType();
+ edr.setQName(qname);
+ supportedProcessingEvent.add(edr);
+ return edr;
+ }
+
+ public EventDefinitionReference addSupportedProcessingEvent(String name)
+ {
+ // TODO check duplicates
+ getSupportedProcessingEvents();
+ EventDefinitionReferenceType edr = new EventDefinitionReferenceType();
+ edr.setName(name);
+ supportedProcessingEvent.add(edr);
+ return edr;
+ }
+
+ public List<? extends EventDefinitionReference> getSupportedPublishingEvents()
+ {
+ if (supportedPublishingEvent == null)
+ {
+ supportedPublishingEvent = new ArrayList<EventDefinitionReferenceType>();
+ }
+ return supportedPublishingEvent;
+ }
+
+ public EventDefinitionReference addSupportedPublishingEvent(QName qname)
+ {
+ // TODO: check duplicates
+ getSupportedPublishingEvents();
+ EventDefinitionReferenceType edr = new EventDefinitionReferenceType();
+ edr.setQName(qname);
+ supportedPublishingEvent.add(edr);
+ return edr;
+ }
+
+ public EventDefinitionReference addSupportedPublishingEvent(String name)
+ {
+ // TODO check duplicates
+ getSupportedPublishingEvents();
+ EventDefinitionReferenceType edr = new EventDefinitionReferenceType();
+ edr.setName(name);
+ supportedPublishingEvent.add(edr);
+ return edr;
+ }
+
+ public List<String> getSupportedPublicRenderParameters()
+ {
+ if (supportedPublicRenderParameter == null)
+ {
+ supportedPublicRenderParameter = new ArrayList<String>();
+ }
+ return supportedPublicRenderParameter;
+ }
+
+ public void addSupportedPublicRenderParameter(String identifier)
+ {
+ for (String ident : getSupportedPublicRenderParameters())
+ {
+ if (ident.equals(identifier))
+ {
+ throw new IllegalArgumentException("Support for public render parameter with identifier: "+identifier+" already defined");
+ }
+ }
+ supportedPublicRenderParameter.add(identifier);
+ }
+
+ public ContainerRuntimeOption getContainerRuntimeOption(String name)
+ {
+ for (ContainerRuntimeOption cro : getContainerRuntimeOptions())
+ {
+ if (cro.getName().equals(name))
+ {
+ return cro;
+ }
+ }
+ return null;
+ }
+
+ public List<? extends ContainerRuntimeOption> getContainerRuntimeOptions()
+ {
+ if (containerRuntimeOption == null)
+ {
+ containerRuntimeOption = new ArrayList<ContainerRuntimeOptionType>();
+ }
+ return containerRuntimeOption;
+ }
+
+ public ContainerRuntimeOption addContainerRuntimeOption(String name)
+ {
+ if (getContainerRuntimeOption(name) != null)
+ {
+ throw new IllegalArgumentException("Container runtime option with name: "+name+" already defined");
+ }
+ ContainerRuntimeOptionType cro = new ContainerRuntimeOptionType();
+ cro.setName(name);
+ containerRuntimeOption.add(cro);
+ return cro;
+ }
+
+ public void afterUnmarshal(Unmarshaller u, Object parent) {
+ application = (PortletApplicationDefinition)parent;
+ }
+}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/a8bed7fb/pluto-container/src/main/java/org/apache/pluto/container/om/portlet20/impl/PreferenceType.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet20/impl/PreferenceType.java b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet20/impl/PreferenceType.java
new file mode 100644
index 0000000..3a147c1
--- /dev/null
+++ b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet20/impl/PreferenceType.java
@@ -0,0 +1,98 @@
+/*
+ * 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.portlet20.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+
+import org.apache.pluto.container.om.portlet.Preference;
+
+/**
+ * Persistent preference values that may be used for customization and personalization by the portlet. Used in:
+ * portlet-preferences <p>Java class for preferenceType complex type. <p>The following schema fragment specifies the
+ * expected content contained within this class.
+ *
+ * <pre>
+ * <complexType name="preferenceType">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="name" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}nameType"/>
+ * <element name="value" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}valueType" maxOccurs="unbounded" minOccurs="0"/>
+ * <element name="read-only" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}read-onlyType" minOccurs="0"/>
+ * </sequence>
+ * <attribute name="id" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}string" />
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ * @version $Id$
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "preferenceType", propOrder = { "name", "value", "readOnly" })
+public class PreferenceType implements Preference
+{
+ @XmlElement(required = true)
+ @XmlJavaTypeAdapter(value=CollapsedStringAdapter.class)
+ protected String name;
+ @XmlJavaTypeAdapter(value=CollapsedStringAdapter.class)
+ protected List<String> value;
+ @XmlElement(name = "read-only")
+ protected Boolean readOnly;
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String value)
+ {
+ name = value;
+ }
+
+ public List<String> getValues()
+ {
+ if (value == null)
+ {
+ value = new ArrayList<String>();
+ }
+ return value;
+ }
+
+ public void addValue(String value)
+ {
+ getValues().add(value);
+ }
+
+ public boolean isReadOnly()
+ {
+ return readOnly != null ? readOnly.booleanValue() : false;
+ }
+
+ public void setReadOnly(boolean value)
+ {
+ readOnly = value ? Boolean.TRUE : Boolean.FALSE;
+ }
+}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/a8bed7fb/pluto-container/src/main/java/org/apache/pluto/container/om/portlet20/impl/PublicRenderParameterType.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet20/impl/PublicRenderParameterType.java b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet20/impl/PublicRenderParameterType.java
new file mode 100644
index 0000000..f9d7e02
--- /dev/null
+++ b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet20/impl/PublicRenderParameterType.java
@@ -0,0 +1,156 @@
+/*
+ * 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.portlet20.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Locale;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlSchemaType;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+import javax.xml.namespace.QName;
+
+import org.apache.pluto.container.om.portlet.Description;
+import org.apache.pluto.container.om.portlet.PublicRenderParameter;
+
+/**
+ * The public-render-parameters defines a render parameter that is allowed to be public and thus be shared with other
+ * portlets. The identifier must be used for referencing this public render parameter in the portlet code. Used in:
+ * portlet-app <p>Java class for public-render-parameterType complex type. <p>The following schema fragment specifies
+ * the expected content contained within this class.
+ *
+ * <pre>
+ * <complexType name="public-render-parameterType">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="description" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}descriptionType" maxOccurs="unbounded" minOccurs="0"/>
+ * <element name="identifier" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}string"/>
+ * <choice>
+ * <element name="qname" type="{http://www.w3.org/2001/XMLSchema}QName"/>
+ * <element name="name" type="{http://www.w3.org/2001/XMLSchema}NCName"/>
+ * </choice>
+ * <element name="alias" type="{http://www.w3.org/2001/XMLSchema}QName" maxOccurs="unbounded" minOccurs="0"/>
+ * </sequence>
+ * <attribute name="id" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}string" />
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ * @version $Id$
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "public-render-parameterType", propOrder = { "description", "identifier", "qname", "name", "alias" })
+public class PublicRenderParameterType implements PublicRenderParameter
+{
+ @XmlElement(name = "description")
+ protected List<DescriptionType> description;
+ @XmlElement(required = true)
+ protected String identifier;
+ protected QName qname;
+ @XmlJavaTypeAdapter(CollapsedStringAdapter.class)
+ @XmlSchemaType(name = "NCName")
+ protected String name;
+ protected List<QName> alias;
+
+ public Description getDescription(Locale locale)
+ {
+ for (Description d : getDescriptions())
+ {
+ if (d.getLocale().equals(locale))
+ {
+ return d;
+ }
+ }
+ return null;
+ }
+
+ public List<? extends Description> getDescriptions()
+ {
+ if (description == null)
+ {
+ description = new ArrayList<DescriptionType>();
+ }
+ return description;
+ }
+
+ public Description addDescription(String lang)
+ {
+ DescriptionType d = new DescriptionType();
+ d.setLang(lang);
+ if (getDescription(d.getLocale()) != null)
+ {
+ throw new IllegalArgumentException("Description for language: "+d.getLocale()+" already defined");
+ }
+ getDescriptions();
+ description.add(d);
+ return d;
+ }
+
+ public String getIdentifier()
+ {
+ return identifier;
+ }
+
+ public void setIdentifier(String value)
+ {
+ identifier = value;
+ }
+
+ public QName getQName()
+ {
+ return qname;
+ }
+
+ public void setQName(QName value)
+ {
+ qname = value;
+ name = null;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String value)
+ {
+ name = value;
+ qname = null;
+ }
+
+ public List<QName> getAliases()
+ {
+ if (alias == null)
+ {
+ alias = new ArrayList<QName>();
+ }
+ return alias;
+ }
+
+ public void addAlias(QName alias)
+ {
+ // TODO: check duplicates
+ getAliases().add(alias);
+ }
+}
[12/14] portals-pluto git commit: Merge branch 'PortletHub' into
V3Prototype
Posted by ms...@apache.org.
Merge branch 'PortletHub' into V3Prototype
Project: http://git-wip-us.apache.org/repos/asf/portals-pluto/repo
Commit: http://git-wip-us.apache.org/repos/asf/portals-pluto/commit/e92c13cd
Tree: http://git-wip-us.apache.org/repos/asf/portals-pluto/tree/e92c13cd
Diff: http://git-wip-us.apache.org/repos/asf/portals-pluto/diff/e92c13cd
Branch: refs/heads/V3Prototype
Commit: e92c13cd095ccb3984f41dd1a0391052eb88dd67
Parents: d257452 419045c
Author: Scott Nicklous <ms...@apache.org>
Authored: Wed Jan 28 12:57:23 2015 +0100
Committer: Scott Nicklous <ms...@apache.org>
Committed: Wed Jan 28 12:57:23 2015 +0100
----------------------------------------------------------------------
pluto-portal/src/main/webapp/portletHubImpl.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
[14/14] portals-pluto git commit: 1) When creating the URL,
the versions for all portlets on the page are retrieved and stored
for later use. Verified that v3 portlets really show up with version = "3.0".
2) In the public render parameter QName mapper, r
Posted by ms...@apache.org.
1) When creating the URL, the versions for all portlets on the page are
retrieved and stored for later use. Verified that v3 portlets really show up
with version = "3.0".
2) In the public render parameter QName mapper, reduced the log level to
"Trace" from "Debug" in order to reduce the amount of log information being
stored.
Project: http://git-wip-us.apache.org/repos/asf/portals-pluto/repo
Commit: http://git-wip-us.apache.org/repos/asf/portals-pluto/commit/acb93c67
Tree: http://git-wip-us.apache.org/repos/asf/portals-pluto/tree/acb93c67
Diff: http://git-wip-us.apache.org/repos/asf/portals-pluto/diff/acb93c67
Branch: refs/heads/V3Prototype
Commit: acb93c6769da845fbec3b32a9ff4d742dee72a4d
Parents: 676a5ec
Author: Scott Nicklous <ms...@apache.org>
Authored: Wed Jan 28 15:35:52 2015 +0100
Committer: Scott Nicklous <ms...@apache.org>
Committed: Wed Jan 28 15:35:52 2015 +0100
----------------------------------------------------------------------
.../config/impl/DriverConfigurationImpl.java | 10 ++++++-
.../driver/url/impl/PortalURLParserImpl.java | 30 ++++++++++++++++++--
.../driver/url/impl/RelativePortalURLImpl.java | 17 +++++++++++
.../driver/config/DriverConfiguration.java | 3 ++
.../PublicRenderParameterQNameMapper.java | 24 ++++++++--------
.../org/apache/pluto/driver/url/PortalURL.java | 21 ++++++++++++++
.../pluto-portal-driver-services-config.xml | 3 ++
7 files changed, 93 insertions(+), 15 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/acb93c67/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/config/impl/DriverConfigurationImpl.java
----------------------------------------------------------------------
diff --git a/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/config/impl/DriverConfigurationImpl.java b/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/config/impl/DriverConfigurationImpl.java
index f29c2fb..26a63c1 100644
--- a/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/config/impl/DriverConfigurationImpl.java
+++ b/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/config/impl/DriverConfigurationImpl.java
@@ -25,6 +25,7 @@ import javax.portlet.WindowState;
import org.apache.pluto.container.PortletContainerException;
import org.apache.pluto.container.PortletPreferencesService;
+import org.apache.pluto.container.driver.PortletRegistryService;
import org.apache.pluto.driver.config.DriverConfiguration;
import org.apache.pluto.driver.services.portal.PageConfig;
import org.apache.pluto.driver.services.portal.PropertyConfigService;
@@ -49,6 +50,7 @@ public class DriverConfigurationImpl
private final SupportedModesService supportedModesService;
private final SupportedWindowStateService supportedWindowStateService;
private final PublicRenderParameterService publicRenderParameterService;
+ private final PortletRegistryService portletRegistryService;
// Container Services
private PortletPreferencesService portletPreferencesService;
@@ -58,7 +60,8 @@ public class DriverConfigurationImpl
RenderConfigService renderService,
SupportedModesService supportedModesService,
SupportedWindowStateService supportedWindowStateService,
- PublicRenderParameterService publicRenderParameterService) {
+ PublicRenderParameterService publicRenderParameterService,
+ PortletRegistryService portletRegistryService) {
this.portalUrlParser = portalUrlParser;
this.propertyService = propertyService;
@@ -66,6 +69,7 @@ public class DriverConfigurationImpl
this.supportedModesService = supportedModesService;
this.supportedWindowStateService = supportedWindowStateService;
this.publicRenderParameterService = publicRenderParameterService;
+ this.portletRegistryService = portletRegistryService;
}
/**
@@ -177,6 +181,10 @@ public class DriverConfigurationImpl
public PublicRenderParameterService getPublicRenderParameterService() {
return publicRenderParameterService;
}
+
+ public PortletRegistryService getPortletRegistryService() {
+ return portletRegistryService;
+ }
public Set<PortletMode> getSupportedPortletModes(String portletId) throws PortletContainerException {
return supportedModesService.getSupportedPortletModes(portletId);
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/acb93c67/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/url/impl/PortalURLParserImpl.java
----------------------------------------------------------------------
diff --git a/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/url/impl/PortalURLParserImpl.java b/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/url/impl/PortalURLParserImpl.java
index 4de11e9..d42828e 100644
--- a/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/url/impl/PortalURLParserImpl.java
+++ b/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/url/impl/PortalURLParserImpl.java
@@ -21,6 +21,7 @@ import java.net.URLDecoder;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -34,6 +35,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.pluto.driver.AttributeKeys;
import org.apache.pluto.driver.config.DriverConfiguration;
+import org.apache.pluto.driver.services.portal.PortletWindowConfig;
import org.apache.pluto.driver.services.portal.PublicRenderParameterMapper;
import org.apache.pluto.driver.url.PortalURL;
import org.apache.pluto.driver.url.PortalURLParameter;
@@ -167,16 +169,40 @@ public class PortalURLParserImpl implements PortalURLParser {
LOG.debug("Parse: renderPath: " + renderPath.toString() + ", pathInfo: " + pathInfo);
}
+ // Set up public render parameter mapper & portlet ID list
+
ServletContext sc = request.getServletContext();
DriverConfiguration dc = (DriverConfiguration) sc.getAttribute(AttributeKeys.DRIVER_CONFIG);
PublicRenderParameterMapper prpm = dc.getPublicRenderParameterService()
.getPRPMapper(renderPath.toString());
portalURL.setPublicRenderParameterMapper(prpm);
- portalURL.setPortletIds(dc.getPageConfig(renderPath.toString()).getPortletIds());
+ Collection<String> pids = dc.getPageConfig(renderPath.toString()).getPortletIds();
+ portalURL.setPortletIds(pids);
- ArrayList<String> portletIds = new ArrayList<String>();
+ // Extract the version info for the portlets on the page and store in URL
+
+ StringBuilder vstr = new StringBuilder();
+ if (LOG.isDebugEnabled()) {
+ vstr.append("Portlet Versions: ");
+ }
+ for (String pid : pids) {
+ String appName = PortletWindowConfig.fromId(pid).getContextPath();
+ try {
+ String pv = dc.getPortletRegistryService().getPortletApplication(appName).getVersion();
+ portalURL.setVersion(pid, pv);
+ if (LOG.isDebugEnabled()) {
+ vstr.append(pid).append(" = ").append(pv).append(", ");
+ }
+ } catch (Exception e) {
+ LOG.error("Portlet application definition could not be retrieved for " + appName);
+ }
+ }
+ if (LOG.isDebugEnabled()) {
+ LOG.debug(vstr.toString());
+ }
// Tokenize the rest and process the tokens
+ ArrayList<String> portletIds = new ArrayList<String>();
if (pathInfo.length() > 2) {
String[] tokens = pathInfo.split("/" + PREFIX);
for (String t : tokens) {
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/acb93c67/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/url/impl/RelativePortalURLImpl.java
----------------------------------------------------------------------
diff --git a/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/url/impl/RelativePortalURLImpl.java b/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/url/impl/RelativePortalURLImpl.java
index 723f1e0..172f924 100644
--- a/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/url/impl/RelativePortalURLImpl.java
+++ b/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/url/impl/RelativePortalURLImpl.java
@@ -64,6 +64,8 @@ public class RelativePortalURLImpl implements PortalURL {
private PublicRenderParameterMapper prpMapper = null;
private HashSet<String> portletIds = new HashSet<String>();
+ private HashMap<String, String> versionMap = new HashMap<String, String>();
+ private HashMap<String, Boolean> v3Map = new HashMap<String, Boolean>();
/**
* PortalURLParser used to construct the string
@@ -285,6 +287,8 @@ public class RelativePortalURLImpl implements PortalURL {
portalURL.resourceWindow = resourceWindow;
portalURL.prpMapper = (prpMapper == null) ? null : prpMapper.clone();
portalURL.portletIds = new HashSet<String>(portletIds);
+ portalURL.versionMap = new HashMap<String, String>(versionMap);
+ portalURL.v3Map = new HashMap<String, Boolean>(v3Map);
return portalURL;
}
//JSR-286 methods
@@ -402,4 +406,17 @@ public class RelativePortalURLImpl implements PortalURL {
public Collection<String> getPortletIds() {
return this.portletIds;
}
+
+ public void setVersion(String portletId, String version) {
+ versionMap.put(portletId, version);
+ v3Map.put(portletId, (version.equals("3.0")));
+ }
+
+ public String getVersion(String portletId) {
+ return versionMap.get(portletId);
+ }
+
+ public boolean isVersion3(String portletId) {
+ return v3Map.get(portletId);
+ }
}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/acb93c67/pluto-portal-driver/src/main/java/org/apache/pluto/driver/config/DriverConfiguration.java
----------------------------------------------------------------------
diff --git a/pluto-portal-driver/src/main/java/org/apache/pluto/driver/config/DriverConfiguration.java b/pluto-portal-driver/src/main/java/org/apache/pluto/driver/config/DriverConfiguration.java
index 8ef2fbe..bddfe7e 100644
--- a/pluto-portal-driver/src/main/java/org/apache/pluto/driver/config/DriverConfiguration.java
+++ b/pluto-portal-driver/src/main/java/org/apache/pluto/driver/config/DriverConfiguration.java
@@ -25,6 +25,7 @@ import javax.portlet.WindowState;
import org.apache.pluto.container.PortletContainerException;
import org.apache.pluto.container.PortletPreferencesService;
+import org.apache.pluto.container.driver.PortletRegistryService;
import org.apache.pluto.driver.services.portal.PageConfig;
import org.apache.pluto.driver.services.portal.PublicRenderParameterService;
import org.apache.pluto.driver.services.portal.RenderConfigService;
@@ -95,6 +96,8 @@ public interface DriverConfiguration {
public Set<WindowState> getSupportedWindowStates(String portletId, String contentType) throws PortletContainerException;
public PublicRenderParameterService getPublicRenderParameterService();
+
+ public PortletRegistryService getPortletRegistryService();
//
// Utility methods for the container
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/acb93c67/pluto-portal-driver/src/main/java/org/apache/pluto/driver/services/portal/PublicRenderParameterQNameMapper.java
----------------------------------------------------------------------
diff --git a/pluto-portal-driver/src/main/java/org/apache/pluto/driver/services/portal/PublicRenderParameterQNameMapper.java b/pluto-portal-driver/src/main/java/org/apache/pluto/driver/services/portal/PublicRenderParameterQNameMapper.java
index 414998f..41c5030 100644
--- a/pluto-portal-driver/src/main/java/org/apache/pluto/driver/services/portal/PublicRenderParameterQNameMapper.java
+++ b/pluto-portal-driver/src/main/java/org/apache/pluto/driver/services/portal/PublicRenderParameterQNameMapper.java
@@ -64,9 +64,9 @@ public class PublicRenderParameterQNameMapper implements PublicRenderParameterMa
LOGGER.debug("Setting up the PRP mapper. There are " + pids.size() + " portlets to process.");
StringBuilder dbgstr = new StringBuilder(1024);
- boolean isDebug = LOGGER.isDebugEnabled();
+ boolean isTrace = LOGGER.isTraceEnabled();
for (String pid : pids) {
- if (isDebug) {
+ if (isTrace) {
dbgstr.append("\n Processing portlet id = " + pid);
}
@@ -82,7 +82,7 @@ public class PublicRenderParameterQNameMapper implements PublicRenderParameterMa
pad = pore.getPortletApplication(cxtpa);
pd = pore.getPortlet(cxtpa, portletName);
- if (isDebug) {
+ if (isTrace) {
dbgstr.append("\n For context: " + cxtpa + ", App name is "
+ pad.getName() + ", portlet name is " + pd.getPortletName());
}
@@ -127,7 +127,7 @@ public class PublicRenderParameterQNameMapper implements PublicRenderParameterMa
qnList.add(qn);
}
- if (isDebug) {
+ if (isTrace) {
dbgstr.append("\n Added PRP for window = " + pid + " QName = " + qn.toString()
+ ", ID = " + prpId);
}
@@ -143,7 +143,7 @@ public class PublicRenderParameterQNameMapper implements PublicRenderParameterMa
}
}
}
- if (isDebug) {
+ if (isTrace) {
dbgstr.append("\nOn page " + paco.getName() + " there are " + prpList.size()
+ " PRPs divided into " + qnList.size() + " groups with sizes: ");
String prefix = "";
@@ -151,7 +151,7 @@ public class PublicRenderParameterQNameMapper implements PublicRenderParameterMa
dbgstr.append(prefix + lp.size());
prefix = ", ";
}
- LOGGER.debug(dbgstr.toString());
+ LOGGER.trace(dbgstr.toString());
}
}
@@ -171,8 +171,8 @@ public class PublicRenderParameterQNameMapper implements PublicRenderParameterMa
p.setValues(vals);
oprps.add(p);
}
- if (LOGGER.isDebugEnabled()) {
- LOGGER.debug("For index: " + index + ", QName = " + qn + ", group size = "
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("For index: " + index + ", QName = " + qn + ", group size = "
+ oprps.size());
}
return oprps;
@@ -260,8 +260,8 @@ public class PublicRenderParameterQNameMapper implements PublicRenderParameterMa
dbgstr.append(prefix + prp.getWindowId());
prefix = ", ";
}
- if (LOGGER.isDebugEnabled()) {
-// LOGGER.debug(dbgstr.toString()); // fills log with entries.
+ if (LOGGER.isTraceEnabled()) {
+// LOGGER.trace(dbgstr.toString()); // fills log with entries.
}
return prpm;
}
@@ -282,8 +282,8 @@ public class PublicRenderParameterQNameMapper implements PublicRenderParameterMa
}
}
}
- if (LOGGER.isDebugEnabled()) {
- LOGGER.debug("For window " + wid + " there are " + prps.size() + " parameters. " + dbgstr.toString());
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("For window " + wid + " there are " + prps.size() + " parameters. " + dbgstr.toString());
}
return prps;
}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/acb93c67/pluto-portal-driver/src/main/java/org/apache/pluto/driver/url/PortalURL.java
----------------------------------------------------------------------
diff --git a/pluto-portal-driver/src/main/java/org/apache/pluto/driver/url/PortalURL.java b/pluto-portal-driver/src/main/java/org/apache/pluto/driver/url/PortalURL.java
index 3c98c04..3463cc1 100644
--- a/pluto-portal-driver/src/main/java/org/apache/pluto/driver/url/PortalURL.java
+++ b/pluto-portal-driver/src/main/java/org/apache/pluto/driver/url/PortalURL.java
@@ -72,6 +72,27 @@ public interface PortalURL extends Cloneable {
* @return
*/
public Collection<String> getPortletIds();
+
+ /**
+ * Sets the version for the given portlet ID
+ * @param portletId
+ * @param version
+ */
+ public void setVersion(String portletId, String version);
+
+ /**
+ * gets the version for the given portlet ID
+ * @param portletId
+ * @return
+ */
+ public String getVersion(String portletId);
+
+ /**
+ * Returns <code>true</code> if the given portlet ID refers to a version 3 portlet
+ * @param portletId
+ * @return
+ */
+ public boolean isVersion3(String portletId);
Collection<PortalURLParameter> getParameters();
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/acb93c67/pluto-portal/src/main/webapp/WEB-INF/pluto-portal-driver-services-config.xml
----------------------------------------------------------------------
diff --git a/pluto-portal/src/main/webapp/WEB-INF/pluto-portal-driver-services-config.xml b/pluto-portal/src/main/webapp/WEB-INF/pluto-portal-driver-services-config.xml
index f83a548..2405153 100644
--- a/pluto-portal/src/main/webapp/WEB-INF/pluto-portal-driver-services-config.xml
+++ b/pluto-portal/src/main/webapp/WEB-INF/pluto-portal-driver-services-config.xml
@@ -130,6 +130,9 @@ limitations under the License.
<constructor-arg>
<ref bean="PublicRenderParameterService"/>
</constructor-arg>
+ <constructor-arg>
+ <ref bean="PortletContextService"/>
+ </constructor-arg>
<!--
<property name="portletPreferencesService"><ref bean="PortletPreferencesService"/></property>
[03/14] portals-pluto git commit: work towards enabling v3 deployment
descriptor
Posted by ms...@apache.org.
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/a8bed7fb/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/UserAttributeType.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/UserAttributeType.java b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/UserAttributeType.java
deleted file mode 100644
index 53f4d8b..0000000
--- a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/UserAttributeType.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * 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.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlType;
-import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
-import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
-
-import org.apache.pluto.container.om.portlet.Description;
-import org.apache.pluto.container.om.portlet.UserAttribute;
-
-/**
- * User attribute defines a user specific attribute that the portlet application needs. The portlet within this
- * application can access this attribute via the request parameter USER_INFO map. Used in: portlet-app <p>Java class
- * for user-attributeType complex type. <p>The following schema fragment specifies the expected content contained
- * within this class.
- *
- * <pre>
- * <complexType name="user-attributeType">
- * <complexContent>
- * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * <sequence>
- * <element name="description" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}descriptionType" maxOccurs="unbounded" minOccurs="0"/>
- * <element name="name" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}nameType"/>
- * </sequence>
- * <attribute name="id" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}string" />
- * </restriction>
- * </complexContent>
- * </complexType>
- * </pre>
- *
- * @version $Id$
- */
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "user-attributeType", propOrder = { "description", "name" })
-public class UserAttributeType implements UserAttribute
-{
- @XmlElement(name = "description")
- protected List<DescriptionType> description;
- @XmlElement(required = true)
- @XmlJavaTypeAdapter(value=CollapsedStringAdapter.class)
- protected String name;
-
- public Description getDescription(Locale locale)
- {
- for (Description d : getDescriptions())
- {
- if (d.getLocale().equals(locale))
- {
- return d;
- }
- }
- return null;
- }
-
- public List<? extends Description> getDescriptions()
- {
- if (description == null)
- {
- description = new ArrayList<DescriptionType>();
- }
- return description;
- }
-
- public Description addDescription(String lang)
- {
- DescriptionType d = new DescriptionType();
- d.setLang(lang);
- if (getDescription(d.getLocale()) != null)
- {
- throw new IllegalArgumentException("Description for language: "+d.getLocale()+" already defined");
- }
- getDescriptions();
- description.add(d);
- return d;
- }
-
- public String getName()
- {
- return name;
- }
-
- public void setName(String value)
- {
- name = value;
- }
-}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/a8bed7fb/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/UserDataConstraintType.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/UserDataConstraintType.java b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/UserDataConstraintType.java
deleted file mode 100644
index 4e436f6..0000000
--- a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/UserDataConstraintType.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * 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.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlType;
-import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
-import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
-
-import org.apache.pluto.container.om.portlet.Description;
-import org.apache.pluto.container.om.portlet.UserDataConstraint;
-
-/**
- * The user-data-constraintType is used to indicate how data communicated between the client and portlet should be
- * protected. Used in: security-constraint <p>Java class for user-data-constraintType complex type. <p>The following
- * schema fragment specifies the expected content contained within this class.
- *
- * <pre>
- * <complexType name="user-data-constraintType">
- * <complexContent>
- * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * <sequence>
- * <element name="description" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}descriptionType" maxOccurs="unbounded" minOccurs="0"/>
- * <element name="transport-guarantee" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}transport-guaranteeType"/>
- * </sequence>
- * <attribute name="id" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}string" />
- * </restriction>
- * </complexContent>
- * </complexType>
- * </pre>
- *
- * @version $Id$
- */
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "user-data-constraintType", propOrder = { "description", "transportGuarantee" })
-public class UserDataConstraintType implements UserDataConstraint
-{
- @XmlElement(name = "description")
- protected List<DescriptionType> description;
- @XmlElement(name = "transport-guarantee", required = true)
- @XmlJavaTypeAdapter(value=CollapsedStringAdapter.class)
- protected String transportGuarantee;
-
- public Description getDescription(Locale locale)
- {
- for (Description d : getDescriptions())
- {
- if (d.getLocale().equals(locale))
- {
- return d;
- }
- }
- return null;
- }
-
- public List<? extends Description> getDescriptions()
- {
- if (description == null)
- {
- description = new ArrayList<DescriptionType>();
- }
- return description;
- }
-
- public Description addDescription(String lang)
- {
- DescriptionType d = new DescriptionType();
- d.setLang(lang);
- if (getDescription(d.getLocale()) != null)
- {
- throw new IllegalArgumentException("Description for language: "+d.getLocale()+" already defined");
- }
- getDescriptions();
- description.add(d);
- return d;
- }
-
- public String getTransportGuarantee()
- {
- return transportGuarantee;
- }
-
- public void setTransportGuarantee(String value)
- {
- transportGuarantee = value;
- }
-}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/a8bed7fb/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/package-info.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/package-info.java b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/package-info.java
deleted file mode 100644
index f8d494b..0000000
--- a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/package-info.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * 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.
- *
- * @version $Id$
- */
-@javax.xml.bind.annotation.XmlSchema(namespace = "http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
-package org.apache.pluto.container.om.portlet.impl;
-
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/a8bed7fb/pluto-container/src/main/java/org/apache/pluto/container/om/portlet10/impl/PortletAppType.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet10/impl/PortletAppType.java b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet10/impl/PortletAppType.java
index c11baae..2723517 100644
--- a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet10/impl/PortletAppType.java
+++ b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet10/impl/PortletAppType.java
@@ -1,471 +1,471 @@
-/*
- * 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.portlet10.impl;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlAttribute;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlType;
-
-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.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.Preference;
-import org.apache.pluto.container.om.portlet.Preferences;
-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.UserAttribute;
-
-/**
- * <p>Java class for portlet-appType complex type.</p> <p>The following schema fragment specifies the expected
- * content contained within this class.</p>
- *
- * <pre>
- * <complexType name="portlet-appType">
- * <complexContent>
- * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * <sequence>
- * <element name="portlet" type="{http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd}portletType" maxOccurs="unbounded" minOccurs="0"/>
- * <element name="custom-portlet-mode" type="{http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd}custom-portlet-modeType" maxOccurs="unbounded" minOccurs="0"/>
- * <element name="custom-window-state" type="{http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd}custom-window-stateType" maxOccurs="unbounded" minOccurs="0"/>
- * <element name="user-attribute" type="{http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd}user-attributeType" maxOccurs="unbounded" minOccurs="0"/>
- * <element name="security-constraint" type="{http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd}security-constraintType" maxOccurs="unbounded" minOccurs="0"/>
- * </sequence>
- * <attribute name="version" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- * <attribute name="id" type="{http://www.w3.org/2001/XMLSchema}string" />
- * </restriction>
- * </complexContent>
- * </complexType>
- * </pre>
- *
- * @version $Id$
- */
-@XmlRootElement(name = "portlet-app")
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "portlet-appType", propOrder = { "portlet", "customPortletMode", "customWindowState", "userAttribute",
- "securityConstraint" })
-public class PortletAppType
-{
- @XmlElement(name = "portlet")
- List<PortletType> portlet;
- @XmlElement(name = "custom-portlet-mode")
- List<CustomPortletModeType> customPortletMode;
- @XmlElement(name = "custom-window-state")
- List<CustomWindowStateType> customWindowState;
- @XmlElement(name = "user-attribute")
- List<UserAttributeType> userAttribute;
- @XmlElement(name = "security-constraint")
- List<SecurityConstraintType> securityConstraint;
- @XmlAttribute(required = true)
- String version = PortletApplicationDefinition.JSR_168_VERSION;
-
- public PortletAppType()
- {
- }
-
- public PortletAppType(PortletApplicationDefinition app)
- {
- // downgrade
- for (PortletDefinition pd : app.getPortlets())
- {
- if (portlet == null)
- {
- portlet = new ArrayList<PortletType>();
- }
- PortletType pt = new PortletType();
- downgradePortlet(pd, pt);
- portlet.add(pt);
- }
- for (CustomPortletMode cpm : app.getCustomPortletModes())
- {
- if (customPortletMode == null)
- {
- customPortletMode = new ArrayList<CustomPortletModeType>();
- }
- CustomPortletModeType cpmt = new CustomPortletModeType();
- cpmt.portletMode = cpm.getPortletMode();
- for (Description d : cpm.getDescriptions())
- {
- if (cpmt.description == null)
- {
- cpmt.description = new ArrayList<DescriptionType>();
- }
- DescriptionType dt = new DescriptionType();
- dt.lang = d.getLang();
- dt.value = d.getDescription();
- cpmt.description.add(dt);
- }
- }
- for (CustomWindowState cws : app.getCustomWindowStates())
- {
- if (customWindowState == null)
- {
- customWindowState = new ArrayList<CustomWindowStateType>();
- }
- CustomWindowStateType cwst = new CustomWindowStateType();
- cwst.windowState = cws.getWindowState();
- for (Description d : cws.getDescriptions())
- {
- if (cwst.description == null)
- {
- cwst.description = new ArrayList<DescriptionType>();
- }
- DescriptionType dt = new DescriptionType();
- dt.lang = d.getLang();
- dt.value = d.getDescription();
- cwst.description.add(dt);
- }
- }
- }
-
- public PortletApplicationDefinition upgrade()
- {
- PortletApplicationDefinition app = new org.apache.pluto.container.om.portlet.impl.PortletAppType();
- app.setVersion(version);
- if (portlet != null)
- {
- for (PortletType src : portlet)
- {
- PortletDefinition target = app.addPortlet(src.portletName);
- upgradePortlet(src, target);
- }
- }
- if (customPortletMode != null)
- {
- for (CustomPortletModeType src : customPortletMode)
- {
- CustomPortletMode target = app.addCustomPortletMode(src.portletMode);
- if (src.description != null)
- {
- for (DescriptionType d : src.description)
- {
- Description desc = target.addDescription(d.lang);
- desc.setDescription(d.value);
- }
- }
- }
- }
- if (customWindowState != null)
- {
- for (CustomWindowStateType src : customWindowState)
- {
- CustomWindowState target = app.addCustomWindowState(src.windowState);
- if (src.description != null)
- {
- for (DescriptionType d : src.description)
- {
- Description desc = target.addDescription(d.lang);
- desc.setDescription(d.value);
- }
- }
- }
- }
- if (userAttribute != null)
- {
- for (UserAttributeType src : userAttribute)
- {
- UserAttribute target = app.addUserAttribute(src.name);
- if (src.description != null)
- {
- for (DescriptionType d : src.description)
- {
- Description desc = target.addDescription(d.lang);
- desc.setDescription(d.value);
- }
- }
- }
- }
- if (securityConstraint != null)
- {
- for (SecurityConstraintType src : securityConstraint)
- {
- SecurityConstraint target = app.addSecurityConstraint(src.userDataConstraint.transportGuarantee);
- if (src.displayName != null)
- {
- for (DisplayNameType d : src.displayName)
- {
- DisplayName dname = target.addDisplayName(d.lang);
- dname.setDisplayName(d.value);
- }
- }
- if (src.portletCollection != null && src.portletCollection.portletName != null)
- {
- for (String pname : src.portletCollection.portletName)
- {
- target.addPortletName(pname);
- }
- }
- }
- }
- return app;
- }
-
- private void downgradePortlet(PortletDefinition src, PortletType target)
- {
- for (Description d : src.getDescriptions())
- {
- if (target.description == null)
- {
- target.description = new ArrayList<DescriptionType>();
- }
- DescriptionType dt = new DescriptionType();
- dt.lang = d.getLang();
- dt.value = d.getDescription();
- target.description.add(dt);
- }
- for (DisplayName d : src.getDisplayNames())
- {
- if (target.displayName == null)
- {
- target.displayName = new ArrayList<DisplayNameType>();
- }
- DisplayNameType dnt = new DisplayNameType();
- dnt.lang = d.getLang();
- dnt.value = d.getDisplayName();
- target.displayName.add(dnt);
- }
- target.portletClass = src.getPortletClass();
- if (src.getExpirationCache() != 0)
- {
- target.expirationCache = new Integer(src.getExpirationCache());
- }
- for (InitParam p : src.getInitParams())
- {
- if (target.initParam == null)
- {
- target.initParam = new ArrayList<InitParamType>();
- }
- InitParamType pt = new InitParamType();
- pt.name = p.getParamName();
- pt.value = p.getParamValue();
- for (Description d : p.getDescriptions())
- {
- if (pt.description == null)
- {
- pt.description = new ArrayList<DescriptionType>();
- }
- DescriptionType dt = new DescriptionType();
- dt.lang = d.getLang();
- dt.value = d.getDescription();
- pt.description.add(dt);
- }
- target.initParam.add(pt);
- }
- for (Supports s : src.getSupports())
- {
- if (target.supports == null)
- {
- target.supports = new ArrayList<SupportsType>();
- }
- SupportsType st = new SupportsType();
- st.mimeType = s.getMimeType();
- for (String name : s.getPortletModes())
- {
- if (st.portletMode == null)
- {
- st.portletMode = new ArrayList<String>();
- }
- st.portletMode.add(name);
- }
- target.supports.add(st);
- }
- for (String lang : src.getSupportedLocales())
- {
- if (target.supportedLocale == null)
- {
- target.supportedLocale = new ArrayList<String>();
- }
- target.supportedLocale.add(lang);
- }
- target.resourceBundle = src.getResourceBundle();
- PortletInfoType pit = new PortletInfoType();
- pit.title = src.getPortletInfo().getTitle();
- pit.shortTitle = src.getPortletInfo().getShortTitle();
- pit.keywords = src.getPortletInfo().getKeywords();
- if (pit.title != null || pit.shortTitle != null || pit.keywords != null)
- {
- target.portletInfo = pit;
- }
- PortletPreferencesType ppt = new PortletPreferencesType();
- ppt.preferencesValidator = src.getPortletPreferences().getPreferencesValidator();
- for (Preference p : src.getPortletPreferences().getPortletPreferences())
- {
- if (ppt.preference == null)
- {
- ppt.preference = new ArrayList<PreferenceType>();
- }
- PreferenceType pt = new PreferenceType();
- pt.name = p.getName();
- pt.readOnly = p.isReadOnly() ? Boolean.TRUE : null;
- for (String value : p.getValues())
- {
- if (pt.value == null)
- {
- pt.value = new ArrayList<String>();
- }
- pt.value.add(value);
- }
- ppt.preference.add(pt);
- }
- if (ppt.preferencesValidator != null || ppt.preference != null)
- {
- target.portletPreferences = ppt;
- }
- for (SecurityRoleRef srr : src.getSecurityRoleRefs())
- {
- if (target.securityRoleRef == null)
- {
- target.securityRoleRef = new ArrayList<SecurityRoleRefType>();
- }
- SecurityRoleRefType srrt = new SecurityRoleRefType();
- srrt.roleName = srr.getRoleName();
- srrt.roleLink = srr.getRoleLink();
- for (Description d : srr.getDescriptions())
- {
- if (srrt.description == null)
- {
- srrt.description = new ArrayList<DescriptionType>();
- }
- DescriptionType dt = new DescriptionType();
- dt.lang = d.getLang();
- dt.value = d.getDescription();
- srrt.description.add(dt);
- }
- target.securityRoleRef.add(srrt);
- }
- }
-
- private void upgradePortlet(PortletType src, PortletDefinition target)
- {
- if (src.description != null)
- {
- for (DescriptionType d : src.description)
- {
- Description desc = target.addDescription(d.lang);
- desc.setDescription(d.value);
- }
- }
- if (src.displayName != null)
- {
- for (DisplayNameType d : src.displayName)
- {
- DisplayName dname = target.addDisplayName(d.lang);
- dname.setDisplayName(d.value);
- }
- }
- target.setPortletClass(src.portletClass);
- if (src.expirationCache != null)
- {
- target.setExpirationCache(src.expirationCache.intValue());
- }
- if (src.initParam != null)
- {
- for (InitParamType p : src.initParam)
- {
- InitParam param = target.addInitParam(p.name);
- param.setParamValue(p.value);
- if (p.description != null)
- {
- for (DescriptionType d : p.description)
- {
- Description desc = param.addDescription(d.lang);
- desc.setDescription(d.value);
- }
- }
- }
- }
- if (src.supports != null)
- {
- for (SupportsType st : src.supports)
- {
- Supports s = target.addSupports(st.mimeType);
- if (st.portletMode != null)
- {
- for (String mode : st.portletMode)
- {
- s.addPortletMode(mode);
- }
- }
- }
- }
- if (src.supportedLocale != null)
- {
- for (String lang : src.supportedLocale)
- {
- target.addSupportedLocale(lang);
- }
- }
- target.setResourceBundle(src.resourceBundle);
- if (src.portletInfo != null)
- {
- PortletInfo pi = target.getPortletInfo();
- pi.setTitle(src.portletInfo.title);
- pi.setShortTitle(src.portletInfo.shortTitle);
- pi.setKeywords(src.portletInfo.keywords);
- }
- if (src.portletPreferences != null)
- {
- Preferences prefs = target.getPortletPreferences();
- prefs.setPreferencesValidator(src.portletPreferences.preferencesValidator);
- if (src.portletPreferences.preference != null)
- {
- for (PreferenceType p : src.portletPreferences.preference)
- {
- Preference pref = prefs.addPreference(p.name);
- if (p.value != null)
- {
- for (String value : p.value)
- {
- pref.addValue(value);
- }
- }
- if (p.readOnly != null)
- {
- pref.setReadOnly(p.readOnly.booleanValue());
- }
- }
- }
- }
- if (src.securityRoleRef != null)
- {
- for (SecurityRoleRefType rrt : src.securityRoleRef)
- {
- SecurityRoleRef srr = target.addSecurityRoleRef(rrt.roleName);
- srr.setRoleLink(rrt.roleLink);
- if (rrt.description != null)
- {
- for (DescriptionType d : rrt.description)
- {
- Description desc = srr.addDescription(d.lang);
- desc.setDescription(d.value);
- }
- }
- }
- }
- }
-}
+/*
+ * 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.portlet10.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+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.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.Preference;
+import org.apache.pluto.container.om.portlet.Preferences;
+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.UserAttribute;
+
+/**
+ * <p>Java class for portlet-appType complex type.</p> <p>The following schema fragment specifies the expected
+ * content contained within this class.</p>
+ *
+ * <pre>
+ * <complexType name="portlet-appType">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="portlet" type="{http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd}portletType" maxOccurs="unbounded" minOccurs="0"/>
+ * <element name="custom-portlet-mode" type="{http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd}custom-portlet-modeType" maxOccurs="unbounded" minOccurs="0"/>
+ * <element name="custom-window-state" type="{http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd}custom-window-stateType" maxOccurs="unbounded" minOccurs="0"/>
+ * <element name="user-attribute" type="{http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd}user-attributeType" maxOccurs="unbounded" minOccurs="0"/>
+ * <element name="security-constraint" type="{http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd}security-constraintType" maxOccurs="unbounded" minOccurs="0"/>
+ * </sequence>
+ * <attribute name="version" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
+ * <attribute name="id" type="{http://www.w3.org/2001/XMLSchema}string" />
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ * @version $Id$
+ */
+@XmlRootElement(name = "portlet-app")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "portlet-appType", propOrder = { "portlet", "customPortletMode", "customWindowState", "userAttribute",
+ "securityConstraint" })
+public class PortletAppType
+{
+ @XmlElement(name = "portlet")
+ List<PortletType> portlet;
+ @XmlElement(name = "custom-portlet-mode")
+ List<CustomPortletModeType> customPortletMode;
+ @XmlElement(name = "custom-window-state")
+ List<CustomWindowStateType> customWindowState;
+ @XmlElement(name = "user-attribute")
+ List<UserAttributeType> userAttribute;
+ @XmlElement(name = "security-constraint")
+ List<SecurityConstraintType> securityConstraint;
+ @XmlAttribute(required = true)
+ String version = PortletApplicationDefinition.JSR_168_VERSION;
+
+ public PortletAppType()
+ {
+ }
+
+ public PortletAppType(PortletApplicationDefinition app)
+ {
+ // downgrade
+ for (PortletDefinition pd : app.getPortlets())
+ {
+ if (portlet == null)
+ {
+ portlet = new ArrayList<PortletType>();
+ }
+ PortletType pt = new PortletType();
+ downgradePortlet(pd, pt);
+ portlet.add(pt);
+ }
+ for (CustomPortletMode cpm : app.getCustomPortletModes())
+ {
+ if (customPortletMode == null)
+ {
+ customPortletMode = new ArrayList<CustomPortletModeType>();
+ }
+ CustomPortletModeType cpmt = new CustomPortletModeType();
+ cpmt.portletMode = cpm.getPortletMode();
+ for (Description d : cpm.getDescriptions())
+ {
+ if (cpmt.description == null)
+ {
+ cpmt.description = new ArrayList<DescriptionType>();
+ }
+ DescriptionType dt = new DescriptionType();
+ dt.lang = d.getLang();
+ dt.value = d.getDescription();
+ cpmt.description.add(dt);
+ }
+ }
+ for (CustomWindowState cws : app.getCustomWindowStates())
+ {
+ if (customWindowState == null)
+ {
+ customWindowState = new ArrayList<CustomWindowStateType>();
+ }
+ CustomWindowStateType cwst = new CustomWindowStateType();
+ cwst.windowState = cws.getWindowState();
+ for (Description d : cws.getDescriptions())
+ {
+ if (cwst.description == null)
+ {
+ cwst.description = new ArrayList<DescriptionType>();
+ }
+ DescriptionType dt = new DescriptionType();
+ dt.lang = d.getLang();
+ dt.value = d.getDescription();
+ cwst.description.add(dt);
+ }
+ }
+ }
+
+ public PortletApplicationDefinition upgrade()
+ {
+ PortletApplicationDefinition app = new org.apache.pluto.container.om.portlet20.impl.PortletAppType();
+ app.setVersion(version);
+ if (portlet != null)
+ {
+ for (PortletType src : portlet)
+ {
+ PortletDefinition target = app.addPortlet(src.portletName);
+ upgradePortlet(src, target);
+ }
+ }
+ if (customPortletMode != null)
+ {
+ for (CustomPortletModeType src : customPortletMode)
+ {
+ CustomPortletMode target = app.addCustomPortletMode(src.portletMode);
+ if (src.description != null)
+ {
+ for (DescriptionType d : src.description)
+ {
+ Description desc = target.addDescription(d.lang);
+ desc.setDescription(d.value);
+ }
+ }
+ }
+ }
+ if (customWindowState != null)
+ {
+ for (CustomWindowStateType src : customWindowState)
+ {
+ CustomWindowState target = app.addCustomWindowState(src.windowState);
+ if (src.description != null)
+ {
+ for (DescriptionType d : src.description)
+ {
+ Description desc = target.addDescription(d.lang);
+ desc.setDescription(d.value);
+ }
+ }
+ }
+ }
+ if (userAttribute != null)
+ {
+ for (UserAttributeType src : userAttribute)
+ {
+ UserAttribute target = app.addUserAttribute(src.name);
+ if (src.description != null)
+ {
+ for (DescriptionType d : src.description)
+ {
+ Description desc = target.addDescription(d.lang);
+ desc.setDescription(d.value);
+ }
+ }
+ }
+ }
+ if (securityConstraint != null)
+ {
+ for (SecurityConstraintType src : securityConstraint)
+ {
+ SecurityConstraint target = app.addSecurityConstraint(src.userDataConstraint.transportGuarantee);
+ if (src.displayName != null)
+ {
+ for (DisplayNameType d : src.displayName)
+ {
+ DisplayName dname = target.addDisplayName(d.lang);
+ dname.setDisplayName(d.value);
+ }
+ }
+ if (src.portletCollection != null && src.portletCollection.portletName != null)
+ {
+ for (String pname : src.portletCollection.portletName)
+ {
+ target.addPortletName(pname);
+ }
+ }
+ }
+ }
+ return app;
+ }
+
+ private void downgradePortlet(PortletDefinition src, PortletType target)
+ {
+ for (Description d : src.getDescriptions())
+ {
+ if (target.description == null)
+ {
+ target.description = new ArrayList<DescriptionType>();
+ }
+ DescriptionType dt = new DescriptionType();
+ dt.lang = d.getLang();
+ dt.value = d.getDescription();
+ target.description.add(dt);
+ }
+ for (DisplayName d : src.getDisplayNames())
+ {
+ if (target.displayName == null)
+ {
+ target.displayName = new ArrayList<DisplayNameType>();
+ }
+ DisplayNameType dnt = new DisplayNameType();
+ dnt.lang = d.getLang();
+ dnt.value = d.getDisplayName();
+ target.displayName.add(dnt);
+ }
+ target.portletClass = src.getPortletClass();
+ if (src.getExpirationCache() != 0)
+ {
+ target.expirationCache = new Integer(src.getExpirationCache());
+ }
+ for (InitParam p : src.getInitParams())
+ {
+ if (target.initParam == null)
+ {
+ target.initParam = new ArrayList<InitParamType>();
+ }
+ InitParamType pt = new InitParamType();
+ pt.name = p.getParamName();
+ pt.value = p.getParamValue();
+ for (Description d : p.getDescriptions())
+ {
+ if (pt.description == null)
+ {
+ pt.description = new ArrayList<DescriptionType>();
+ }
+ DescriptionType dt = new DescriptionType();
+ dt.lang = d.getLang();
+ dt.value = d.getDescription();
+ pt.description.add(dt);
+ }
+ target.initParam.add(pt);
+ }
+ for (Supports s : src.getSupports())
+ {
+ if (target.supports == null)
+ {
+ target.supports = new ArrayList<SupportsType>();
+ }
+ SupportsType st = new SupportsType();
+ st.mimeType = s.getMimeType();
+ for (String name : s.getPortletModes())
+ {
+ if (st.portletMode == null)
+ {
+ st.portletMode = new ArrayList<String>();
+ }
+ st.portletMode.add(name);
+ }
+ target.supports.add(st);
+ }
+ for (String lang : src.getSupportedLocales())
+ {
+ if (target.supportedLocale == null)
+ {
+ target.supportedLocale = new ArrayList<String>();
+ }
+ target.supportedLocale.add(lang);
+ }
+ target.resourceBundle = src.getResourceBundle();
+ PortletInfoType pit = new PortletInfoType();
+ pit.title = src.getPortletInfo().getTitle();
+ pit.shortTitle = src.getPortletInfo().getShortTitle();
+ pit.keywords = src.getPortletInfo().getKeywords();
+ if (pit.title != null || pit.shortTitle != null || pit.keywords != null)
+ {
+ target.portletInfo = pit;
+ }
+ PortletPreferencesType ppt = new PortletPreferencesType();
+ ppt.preferencesValidator = src.getPortletPreferences().getPreferencesValidator();
+ for (Preference p : src.getPortletPreferences().getPortletPreferences())
+ {
+ if (ppt.preference == null)
+ {
+ ppt.preference = new ArrayList<PreferenceType>();
+ }
+ PreferenceType pt = new PreferenceType();
+ pt.name = p.getName();
+ pt.readOnly = p.isReadOnly() ? Boolean.TRUE : null;
+ for (String value : p.getValues())
+ {
+ if (pt.value == null)
+ {
+ pt.value = new ArrayList<String>();
+ }
+ pt.value.add(value);
+ }
+ ppt.preference.add(pt);
+ }
+ if (ppt.preferencesValidator != null || ppt.preference != null)
+ {
+ target.portletPreferences = ppt;
+ }
+ for (SecurityRoleRef srr : src.getSecurityRoleRefs())
+ {
+ if (target.securityRoleRef == null)
+ {
+ target.securityRoleRef = new ArrayList<SecurityRoleRefType>();
+ }
+ SecurityRoleRefType srrt = new SecurityRoleRefType();
+ srrt.roleName = srr.getRoleName();
+ srrt.roleLink = srr.getRoleLink();
+ for (Description d : srr.getDescriptions())
+ {
+ if (srrt.description == null)
+ {
+ srrt.description = new ArrayList<DescriptionType>();
+ }
+ DescriptionType dt = new DescriptionType();
+ dt.lang = d.getLang();
+ dt.value = d.getDescription();
+ srrt.description.add(dt);
+ }
+ target.securityRoleRef.add(srrt);
+ }
+ }
+
+ private void upgradePortlet(PortletType src, PortletDefinition target)
+ {
+ if (src.description != null)
+ {
+ for (DescriptionType d : src.description)
+ {
+ Description desc = target.addDescription(d.lang);
+ desc.setDescription(d.value);
+ }
+ }
+ if (src.displayName != null)
+ {
+ for (DisplayNameType d : src.displayName)
+ {
+ DisplayName dname = target.addDisplayName(d.lang);
+ dname.setDisplayName(d.value);
+ }
+ }
+ target.setPortletClass(src.portletClass);
+ if (src.expirationCache != null)
+ {
+ target.setExpirationCache(src.expirationCache.intValue());
+ }
+ if (src.initParam != null)
+ {
+ for (InitParamType p : src.initParam)
+ {
+ InitParam param = target.addInitParam(p.name);
+ param.setParamValue(p.value);
+ if (p.description != null)
+ {
+ for (DescriptionType d : p.description)
+ {
+ Description desc = param.addDescription(d.lang);
+ desc.setDescription(d.value);
+ }
+ }
+ }
+ }
+ if (src.supports != null)
+ {
+ for (SupportsType st : src.supports)
+ {
+ Supports s = target.addSupports(st.mimeType);
+ if (st.portletMode != null)
+ {
+ for (String mode : st.portletMode)
+ {
+ s.addPortletMode(mode);
+ }
+ }
+ }
+ }
+ if (src.supportedLocale != null)
+ {
+ for (String lang : src.supportedLocale)
+ {
+ target.addSupportedLocale(lang);
+ }
+ }
+ target.setResourceBundle(src.resourceBundle);
+ if (src.portletInfo != null)
+ {
+ PortletInfo pi = target.getPortletInfo();
+ pi.setTitle(src.portletInfo.title);
+ pi.setShortTitle(src.portletInfo.shortTitle);
+ pi.setKeywords(src.portletInfo.keywords);
+ }
+ if (src.portletPreferences != null)
+ {
+ Preferences prefs = target.getPortletPreferences();
+ prefs.setPreferencesValidator(src.portletPreferences.preferencesValidator);
+ if (src.portletPreferences.preference != null)
+ {
+ for (PreferenceType p : src.portletPreferences.preference)
+ {
+ Preference pref = prefs.addPreference(p.name);
+ if (p.value != null)
+ {
+ for (String value : p.value)
+ {
+ pref.addValue(value);
+ }
+ }
+ if (p.readOnly != null)
+ {
+ pref.setReadOnly(p.readOnly.booleanValue());
+ }
+ }
+ }
+ }
+ if (src.securityRoleRef != null)
+ {
+ for (SecurityRoleRefType rrt : src.securityRoleRef)
+ {
+ SecurityRoleRef srr = target.addSecurityRoleRef(rrt.roleName);
+ srr.setRoleLink(rrt.roleLink);
+ if (rrt.description != null)
+ {
+ for (DescriptionType d : rrt.description)
+ {
+ Description desc = srr.addDescription(d.lang);
+ desc.setDescription(d.value);
+ }
+ }
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/a8bed7fb/pluto-container/src/main/java/org/apache/pluto/container/om/portlet20/impl/ContainerRuntimeOptionType.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet20/impl/ContainerRuntimeOptionType.java b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet20/impl/ContainerRuntimeOptionType.java
new file mode 100644
index 0000000..a199c26
--- /dev/null
+++ b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet20/impl/ContainerRuntimeOptionType.java
@@ -0,0 +1,87 @@
+/*
+ * 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.portlet20.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+
+import org.apache.pluto.container.om.portlet.ContainerRuntimeOption;
+
+/**
+ * The container-runtime-option element contains settings for the portlet container that the portlet expects to be
+ * honored at runtime. These settings may re-define default portlet container behavior, like the javax.portlet.escapeXml
+ * setting that disables XML encoding of URLs produced by the portlet tag library as default. Names with the
+ * javax.portlet prefix are reserved for the Java Portlet Specification. Used in: portlet-app, portlet <p>Java class
+ * for container-runtime-optionType complex type. <p>The following schema fragment specifies the expected content
+ * contained within this class.
+ *
+ * <pre>
+ * <complexType name="container-runtime-optionType">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="name" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}nameType"/>
+ * <element name="value" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}valueType" maxOccurs="unbounded" minOccurs="0"/>
+ * </sequence>
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ * @version $Id$
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "container-runtime-optionType", propOrder = { "name", "value" })
+public class ContainerRuntimeOptionType implements ContainerRuntimeOption
+{
+ @XmlElement(required = true)
+ @XmlJavaTypeAdapter(value=CollapsedStringAdapter.class)
+ protected String name;
+ @XmlJavaTypeAdapter(value=CollapsedStringAdapter.class)
+ protected List<String> value;
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String value)
+ {
+ name = value;
+ }
+
+ public List<String> getValues()
+ {
+ if (value == null)
+ {
+ value = new ArrayList<String>();
+ }
+ return value;
+ }
+
+ public void addValue(String value)
+ {
+ getValues().add(value);
+ }
+}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/a8bed7fb/pluto-container/src/main/java/org/apache/pluto/container/om/portlet20/impl/CustomPortletModeType.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet20/impl/CustomPortletModeType.java b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet20/impl/CustomPortletModeType.java
new file mode 100644
index 0000000..d6102ca
--- /dev/null
+++ b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet20/impl/CustomPortletModeType.java
@@ -0,0 +1,121 @@
+/*
+ * 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.portlet20.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Locale;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+
+import org.apache.pluto.container.om.portlet.CustomPortletMode;
+import org.apache.pluto.container.om.portlet.Description;
+
+/**
+ * A custom portlet mode that one or more portlets in this portlet application supports. If the portal does not need to
+ * provide some management functionality for this portlet mode, the portal-managed element needs to be set to "false",
+ * otherwise to "true". Default is "true". Used in: portlet-app <p>Java class for custom-portlet-modeType complex type.
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * <complexType name="custom-portlet-modeType">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="description" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}descriptionType" maxOccurs="unbounded" minOccurs="0"/>
+ * <element name="portlet-mode" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}portlet-modeType"/>
+ * <element name="portal-managed" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}portal-managedType" minOccurs="0"/>
+ * </sequence>
+ * <attribute name="id" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}string" />
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ * @version $Id$
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "custom-portlet-modeType", propOrder = { "description", "portletMode", "portalManaged" })
+public class CustomPortletModeType implements CustomPortletMode
+{
+ @XmlElement(name = "description")
+ protected List<DescriptionType> description;
+ @XmlElement(name = "portlet-mode", required = true)
+ @XmlJavaTypeAdapter(value=CollapsedStringAdapter.class)
+ protected String portletMode;
+ @XmlElement(name = "portal-managed")
+ protected Boolean portalManaged;
+
+ public Description getDescription(Locale locale)
+ {
+ for (Description d : getDescriptions())
+ {
+ if (d.getLocale().equals(locale))
+ {
+ return d;
+ }
+ }
+ return null;
+ }
+
+ public List<? extends Description> getDescriptions()
+ {
+ if (description == null)
+ {
+ description = new ArrayList<DescriptionType>();
+ }
+ return description;
+ }
+
+ public Description addDescription(String lang)
+ {
+ DescriptionType d = new DescriptionType();
+ d.setLang(lang);
+ if (getDescription(d.getLocale()) != null)
+ {
+ throw new IllegalArgumentException("Description for language: "+d.getLocale()+" already defined");
+ }
+ getDescriptions();
+ description.add(d);
+ return d;
+ }
+
+ public String getPortletMode()
+ {
+ return portletMode != null ? portletMode.toLowerCase() : null;
+ }
+
+ public void setPortletMode(String value)
+ {
+ portletMode = value.toLowerCase();
+ }
+
+ public boolean isPortalManaged()
+ {
+ return portalManaged != null ? portalManaged.booleanValue() : true;
+ }
+
+ public void setPortalManaged(boolean value)
+ {
+ portalManaged = value ? Boolean.TRUE : Boolean.FALSE;
+ }
+}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/a8bed7fb/pluto-container/src/main/java/org/apache/pluto/container/om/portlet20/impl/CustomWindowStateType.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet20/impl/CustomWindowStateType.java b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet20/impl/CustomWindowStateType.java
new file mode 100644
index 0000000..2cf0cab
--- /dev/null
+++ b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet20/impl/CustomWindowStateType.java
@@ -0,0 +1,107 @@
+/*
+ * 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.portlet20.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Locale;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+
+import org.apache.pluto.container.om.portlet.CustomWindowState;
+import org.apache.pluto.container.om.portlet.Description;
+
+/**
+ * A custom window state that one or more portlets in this portlet application supports. Used in: portlet-app <p>Java
+ * class for custom-window-stateType complex type. <p>The following schema fragment specifies the expected content
+ * contained within this class.
+ *
+ * <pre>
+ * <complexType name="custom-window-stateType">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="description" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}descriptionType" maxOccurs="unbounded" minOccurs="0"/>
+ * <element name="window-state" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}window-stateType"/>
+ * </sequence>
+ * <attribute name="id" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}string" />
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ * @version $Id$
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "custom-window-stateType", propOrder = { "description", "windowState" })
+public class CustomWindowStateType implements CustomWindowState
+{
+ @XmlElement(name = "description")
+ protected List<DescriptionType> description;
+ @XmlElement(name = "window-state", required = true)
+ @XmlJavaTypeAdapter(value=CollapsedStringAdapter.class)
+ protected String windowState;
+
+ public Description getDescription(Locale locale)
+ {
+ for (Description d : getDescriptions())
+ {
+ if (d.getLocale().equals(locale))
+ {
+ return d;
+ }
+ }
+ return null;
+ }
+
+ public List<? extends Description> getDescriptions()
+ {
+ if (description == null)
+ {
+ description = new ArrayList<DescriptionType>();
+ }
+ return description;
+ }
+
+ public Description addDescription(String lang)
+ {
+ DescriptionType d = new DescriptionType();
+ d.setLang(lang);
+ if (getDescription(d.getLocale()) != null)
+ {
+ throw new IllegalArgumentException("Description for language: "+d.getLocale()+" already defined");
+ }
+ getDescriptions();
+ description.add(d);
+ return d;
+ }
+
+ public String getWindowState()
+ {
+ return windowState != null ? windowState.toLowerCase() : null;
+ }
+
+ public void setWindowState(String value)
+ {
+ windowState = value.toLowerCase();
+ }
+}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/a8bed7fb/pluto-container/src/main/java/org/apache/pluto/container/om/portlet20/impl/DescriptionType.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet20/impl/DescriptionType.java b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet20/impl/DescriptionType.java
new file mode 100644
index 0000000..95e7c93
--- /dev/null
+++ b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet20/impl/DescriptionType.java
@@ -0,0 +1,120 @@
+/*
+ * 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.portlet20.impl;
+
+import java.util.Locale;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlTransient;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.XmlValue;
+import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+
+import org.apache.pluto.container.om.portlet.Description;
+
+/**
+ * The description element is used to provide text describing the parent element. The description element should include
+ * any information that the portlet application war file producer wants to provide to the consumer of the portlet
+ * application war file (i.e., to the Deployer). Typically, the tools used by the portlet application war file consumer
+ * will display the description when processing the parent element that contains the description. It has an optional
+ * attribute xml:lang to indicate which language is used in the description according to RFC 1766
+ * (http://www.ietf.org/rfc/rfc1766.txt). The default value of this attribute is English(“en�?). Used in: init-param,
+ * portlet, portlet-app, security-role <p>Java class for descriptionType complex type. <p>The following schema
+ * fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * <complexType name="descriptionType">
+ * <simpleContent>
+ * <extension base="<http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd>string">
+ * <attribute ref="{http://www.w3.org/XML/1998/namespace}lang"/>
+ * </extension>
+ * </simpleContent>
+ * </complexType>
+ * </pre>
+ *
+ * @version $Id$
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "descriptionType", propOrder = { "value" })
+public class DescriptionType implements Description
+{
+ @XmlValue
+ @XmlJavaTypeAdapter(value=CollapsedStringAdapter.class)
+ protected String value;
+ @XmlAttribute(namespace = "http://www.w3.org/XML/1998/namespace")
+ protected String lang = null;
+ @XmlTransient
+ protected Locale locale;
+
+ public String getDescription()
+ {
+ return value;
+ }
+
+ public void setDescription(String value)
+ {
+ this.value = value;
+ }
+
+ public String getLang()
+ {
+ return lang == null ? Locale.ENGLISH.toString() : lang;
+ }
+
+ public void setLang(String value)
+ {
+ lang = value;
+ deriveLocale();
+ }
+
+ public Locale getLocale()
+ {
+ return locale == null ? deriveLocale() : locale;
+ }
+
+ protected Locale deriveLocale()
+ {
+ Locale locale = null;
+ String lang = this.getLang();
+ if (lang != null)
+ {
+ String country = "";
+ String variant = "";
+ String[] localeArray = lang.split("[-|_]");
+ for (int i = 0; i < localeArray.length; i++)
+ {
+ if (i == 0)
+ {
+ lang = localeArray[i];
+ }
+ else if (i == 1)
+ {
+ country = localeArray[i];
+ }
+ else if (i == 2)
+ {
+ variant = localeArray[i];
+ }
+ }
+ locale = new Locale(lang, country, variant);
+ }
+ return this.locale = locale;
+ }
+}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/a8bed7fb/pluto-container/src/main/java/org/apache/pluto/container/om/portlet20/impl/DisplayNameType.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet20/impl/DisplayNameType.java b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet20/impl/DisplayNameType.java
new file mode 100644
index 0000000..5ec2507
--- /dev/null
+++ b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet20/impl/DisplayNameType.java
@@ -0,0 +1,122 @@
+/*
+ * 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.portlet20.impl;
+
+import java.util.Locale;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlTransient;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.XmlValue;
+import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+
+import org.apache.pluto.container.om.portlet.DisplayName;
+
+/**
+ * The display-name type contains a short name that is intended to be displayed by tools. It is used by display-name
+ * elements. The display name need not be unique. Example: ...
+ *
+ * <pre>
+ * <?xml version="1.0" encoding="UTF-8"?><display-name xmlns="http://www.w3.org/2001/XMLSchema" xmlns:portlet="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" xml:lang="en">Employee Self Service</display-name>
+ * </pre>
+ *
+ * It has an optional attribute xml:lang to indicate which language is used in the description according to RFC 1766
+ * (http://www.ietf.org/rfc/rfc1766.txt). The default value of this attribute is English(“en�?). <p>Java class for
+ * display-nameType complex type. <p>The following schema fragment specifies the expected content contained within this
+ * class.
+ *
+ * <pre>
+ * <complexType name="display-nameType">
+ * <simpleContent>
+ * <extension base="<http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd>string">
+ * <attribute ref="{http://www.w3.org/XML/1998/namespace}lang"/>
+ * </extension>
+ * </simpleContent>
+ * </complexType>
+ * </pre>
+ *
+ * @version $Id$
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "display-nameType", propOrder = { "value" })
+public class DisplayNameType implements DisplayName
+{
+ @XmlValue
+ @XmlJavaTypeAdapter(value=CollapsedStringAdapter.class)
+ protected String value;
+ @XmlAttribute(namespace = "http://www.w3.org/XML/1998/namespace")
+ protected String lang = null;
+ @XmlTransient
+ protected Locale locale;
+
+ public String getDisplayName()
+ {
+ return value;
+ }
+
+ public void setDisplayName(String value)
+ {
+ this.value = value;
+ }
+
+ public String getLang()
+ {
+ return lang == null ? Locale.ENGLISH.toString() : lang;
+ }
+
+ public void setLang(String value)
+ {
+ lang = value;
+ }
+
+ public Locale getLocale()
+ {
+ return locale == null ? deriveLocale() : locale;
+ }
+
+ protected Locale deriveLocale()
+ {
+ Locale locale = null;
+ String lang = this.getLang();
+ if (lang != null)
+ {
+ String country = "";
+ String variant = "";
+ String[] localeArray = lang.split("[-|_]");
+ for (int i = 0; i < localeArray.length; i++)
+ {
+ if (i == 0)
+ {
+ lang = localeArray[i];
+ }
+ else if (i == 1)
+ {
+ country = localeArray[i];
+ }
+ else if (i == 2)
+ {
+ variant = localeArray[i];
+ }
+ }
+ locale = new Locale(lang, country, variant);
+ }
+ return this.locale = locale;
+ }
+}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/a8bed7fb/pluto-container/src/main/java/org/apache/pluto/container/om/portlet20/impl/EventDefinitionReferenceType.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet20/impl/EventDefinitionReferenceType.java b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet20/impl/EventDefinitionReferenceType.java
new file mode 100644
index 0000000..e6d83a7
--- /dev/null
+++ b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet20/impl/EventDefinitionReferenceType.java
@@ -0,0 +1,85 @@
+/*
+ * 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.portlet20.impl;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlSchemaType;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+import javax.xml.namespace.QName;
+
+import org.apache.pluto.container.om.portlet.EventDefinitionReference;
+
+/**
+ * The event-definition-referenceType is used to reference events declared with the event-definition element at
+ * application level. Used in: portlet <p>Java class for event-definition-referenceType complex type. <p>The following
+ * schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * <complexType name="event-definition-referenceType">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <choice>
+ * <element name="qname" type="{http://www.w3.org/2001/XMLSchema}QName"/>
+ * <element name="name" type="{http://www.w3.org/2001/XMLSchema}NCName"/>
+ * </choice>
+ * <attribute name="id" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}string" />
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ * @version $Id$
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "event-definition-referenceType", propOrder = { "qname", "name" })
+public class EventDefinitionReferenceType implements EventDefinitionReference
+{
+ protected QName qname;
+ @XmlJavaTypeAdapter(CollapsedStringAdapter.class)
+ @XmlSchemaType(name = "NCName")
+ protected String name;
+
+ public QName getQName()
+ {
+ return qname;
+ }
+
+ public void setQName(QName value)
+ {
+ qname = value;
+ name = null;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String value)
+ {
+ name = value;
+ qname = null;
+ }
+
+ public QName getQualifiedName(String defaultNamespace)
+ {
+ return qname != null ? qname : name != null ? new QName(defaultNamespace, name) : null;
+ }
+}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/a8bed7fb/pluto-container/src/main/java/org/apache/pluto/container/om/portlet20/impl/EventDefinitionType.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet20/impl/EventDefinitionType.java b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet20/impl/EventDefinitionType.java
new file mode 100644
index 0000000..eaaeeac
--- /dev/null
+++ b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet20/impl/EventDefinitionType.java
@@ -0,0 +1,161 @@
+/*
+ * 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.portlet20.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Locale;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlSchemaType;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+import javax.xml.namespace.QName;
+
+import org.apache.pluto.container.om.portlet.Description;
+import org.apache.pluto.container.om.portlet.EventDefinition;
+
+/**
+ * The event-definitionType is used to declare events the portlet can either receive or emit. The name must be unique
+ * and must be the one the portlet is using in its code for referencing this event. Used in: portlet-app <p>Java class
+ * for event-definitionType complex type. <p>The following schema fragment specifies the expected content contained
+ * within this class.
+ *
+ * <pre>
+ * <complexType name="event-definitionType">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="description" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}descriptionType" maxOccurs="unbounded" minOccurs="0"/>
+ * <choice>
+ * <element name="qname" type="{http://www.w3.org/2001/XMLSchema}QName"/>
+ * <element name="name" type="{http://www.w3.org/2001/XMLSchema}NCName"/>
+ * </choice>
+ * <element name="alias" type="{http://www.w3.org/2001/XMLSchema}QName" maxOccurs="unbounded" minOccurs="0"/>
+ * <element name="value-type" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}fully-qualified-classType" minOccurs="0"/>
+ * </sequence>
+ * <attribute name="id" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}string" />
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ * @version $Id$
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "event-definitionType", propOrder = { "description", "qname", "name", "alias", "valueType" })
+public class EventDefinitionType implements EventDefinition
+{
+ @XmlElement(name = "description")
+ protected List<DescriptionType> description;
+ protected QName qname;
+ @XmlJavaTypeAdapter(CollapsedStringAdapter.class)
+ @XmlSchemaType(name = "NCName")
+ protected String name;
+ protected List<QName> alias;
+ @XmlElement(name = "value-type")
+ protected String valueType;
+
+ public Description getDescription(Locale locale)
+ {
+ for (Description d : getDescriptions())
+ {
+ if (d.getLocale().equals(locale))
+ {
+ return d;
+ }
+ }
+ return null;
+ }
+
+ public List<? extends Description> getDescriptions()
+ {
+ if (description == null)
+ {
+ description = new ArrayList<DescriptionType>();
+ }
+ return description;
+ }
+
+ public Description addDescription(String lang)
+ {
+ DescriptionType d = new DescriptionType();
+ d.setLang(lang);
+ if (getDescription(d.getLocale()) != null)
+ {
+ throw new IllegalArgumentException("Description for language: "+d.getLocale()+" already defined");
+ }
+ getDescriptions();
+ description.add(d);
+ return d;
+ }
+
+ public QName getQName()
+ {
+ return qname;
+ }
+
+ public void setQName(QName value)
+ {
+ qname = value;
+ name = null;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String value)
+ {
+ name = value;
+ qname = null;
+ }
+
+ public List<QName> getAliases()
+ {
+ if (alias == null)
+ {
+ alias = new ArrayList<QName>();
+ }
+ return alias;
+ }
+
+ public void addAlias(QName alias)
+ {
+ // TODO: check for duplicates
+ getAliases().add(alias);
+ }
+
+ public String getValueType()
+ {
+ return valueType;
+ }
+
+ public void setValueType(String value)
+ {
+ valueType = value;
+ }
+
+ public QName getQualifiedName(String defaultNamespace)
+ {
+ return qname != null ? qname : name != null ? new QName(defaultNamespace, name) : null;
+ }
+}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/a8bed7fb/pluto-container/src/main/java/org/apache/pluto/container/om/portlet20/impl/FilterMappingType.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet20/impl/FilterMappingType.java b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet20/impl/FilterMappingType.java
new file mode 100644
index 0000000..948bcbd
--- /dev/null
+++ b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet20/impl/FilterMappingType.java
@@ -0,0 +1,88 @@
+/*
+ * 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.portlet20.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+
+import org.apache.pluto.container.om.portlet.FilterMapping;
+
+/**
+ * Declaration of the filter mappings in this portlet application is done by using filter-mappingType. The container
+ * uses the filter-mapping declarations to decide which filters to apply to a request, and in what order. To determine
+ * which filters to apply it matches filter-mapping declarations on the portlet-name and the lifecyle phase defined in
+ * the filter element. The order in which filters are invoked is the order in which filter-mapping declarations that
+ * match appear in the list of filter-mapping elements. Used in: portlet-app <p>Java class for filter-mappingType
+ * complex type. <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * <complexType name="filter-mappingType">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="filter-name" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}filter-nameType"/>
+ * <element name="portlet-name" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}portlet-nameType" maxOccurs="unbounded"/>
+ * </sequence>
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ * @version $Id$
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "filter-mappingType", propOrder = { "filterName", "portletName" })
+public class FilterMappingType implements FilterMapping
+{
+ @XmlElement(name = "filter-name", required = true)
+ protected String filterName;
+ @XmlElement(name = "portlet-name", required = true)
+ @XmlJavaTypeAdapter(value=CollapsedStringAdapter.class)
+ protected List<String> portletName;
+
+ public String getFilterName()
+ {
+ return filterName;
+ }
+
+ public void setFilterName(String value)
+ {
+ filterName = value;
+ }
+
+ public List<String> getPortletNames()
+ {
+ if (portletName == null)
+ {
+ portletName = new ArrayList<String>();
+ }
+ return portletName;
+ }
+
+ public void addPortletName(String name)
+ {
+ // TODO: check for duplicates
+ getPortletNames().add(name);
+ }
+}