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 2016/01/18 13:41:11 UTC
[09/35] portals-pluto git commit: Added configuration by annotation
for V3 portlets. For v3 portlets,
neither the web application deployment descriptor nor the portlet deployment
descriptor are necessary. * Annotations provided for all portlet config
Added configuration by annotation for V3 portlets. For v3 portlets, neither
the web application deployment descriptor nor the portlet deployment
descriptor are necessary.
* Annotations provided for all portlet config items
* If portlet.xml supplied in addition, configuration is merged
* Values from the portlet.xml file take precedence over annotated values
* Added corresponding unit tests
Project: http://git-wip-us.apache.org/repos/asf/portals-pluto/repo
Commit: http://git-wip-us.apache.org/repos/asf/portals-pluto/commit/ab12285f
Tree: http://git-wip-us.apache.org/repos/asf/portals-pluto/tree/ab12285f
Diff: http://git-wip-us.apache.org/repos/asf/portals-pluto/diff/ab12285f
Branch: refs/heads/V3Prototype
Commit: ab12285fb4689f153e4652f370f0361422968f02
Parents: a283cd0
Author: Scott Nicklous <ms...@apache.org>
Authored: Mon Dec 7 07:58:42 2015 +0100
Committer: Scott Nicklous <ms...@apache.org>
Committed: Mon Dec 7 07:58:42 2015 +0100
----------------------------------------------------------------------
.../pluto/container/om/portlet/Dependency.java | 25 +
.../pluto/container/om/portlet/Description.java | 11 +-
.../pluto/container/om/portlet/DisplayName.java | 48 +-
.../pluto/container/om/portlet/Filter.java | 23 +-
.../pluto/container/om/portlet/Listener.java | 3 +
.../pluto/container/om/portlet/LocaleText.java | 30 +
.../container/om/portlet/PortletDefinition.java | 4 +
.../pluto/container/om/portlet/PortletInfo.java | 71 +-
.../om/portlet/PublicRenderParameter.java | 4 +
pluto-container/pom.xml | 2 +-
.../impl/PortletAppDescriptorServiceImpl.java | 32 +-
.../om/portlet/impl/ConfigurationHolder.java | 165 ++--
.../om/portlet/impl/ConfigurationProcessor.java | 70 +-
.../impl/ContainerRuntimeOptionImpl.java | 36 +
.../om/portlet/impl/CustomPortletModeImpl.java | 36 +
.../om/portlet/impl/CustomWindowStateImpl.java | 36 +
.../om/portlet/impl/DependencyImpl.java | 118 +++
.../om/portlet/impl/DescriptionImpl.java | 51 +-
.../om/portlet/impl/DisplayNameImpl.java | 46 +-
.../om/portlet/impl/EventDefinitionImpl.java | 36 +
.../impl/EventDefinitionReferenceImpl.java | 36 +
.../container/om/portlet/impl/FilterImpl.java | 65 ++
.../om/portlet/impl/FilterMappingImpl.java | 36 +
.../om/portlet/impl/InitParamImpl.java | 36 +
.../impl/JSR168ConfigurationProcessor.java | 10 +-
.../impl/JSR286ConfigurationProcessor.java | 26 +-
.../impl/JSR362ConfigurationProcessor.java | 637 +++++++++----
.../container/om/portlet/impl/ListenerImpl.java | 54 ++
.../om/portlet/impl/LocaleTextImpl.java | 136 +++
.../impl/PortletApplicationDefinitionImpl.java | 61 +-
.../om/portlet/impl/PortletDefinitionImpl.java | 140 ++-
.../om/portlet/impl/PortletInfoImpl.java | 195 +++-
.../portlet/impl/PublicRenderParameterImpl.java | 71 ++
.../om/portlet/impl/SecurityConstraintImpl.java | 36 +
.../om/portlet/impl/SecurityRoleRefImpl.java | 36 +
.../container/om/portlet/impl/SupportsImpl.java | 36 +
.../om/portlet/impl/UserAttributeImpl.java | 36 +
.../om/portlet/impl/UserDataConstraintImpl.java | 36 +
.../container/impl/JaxbReadTest168Gen.java | 1 -
.../container/impl/JaxbReadTest286Gen.java | 1 -
.../pluto/container/impl/JaxbReadTest286NC.java | 1 -
.../container/impl/JaxbReadTest362Gen.java | 5 +-
.../impl/fixtures/TestAnnotatedFilter.java | 88 ++
.../fixtures/TestAnnotatedGenericPortlet.java | 60 ++
.../impl/fixtures/TestAnnotatedPortlet.java | 82 ++
.../fixtures/TestMultiAnnotatedPortlet.java | 74 ++
.../fixtures/TestPortletAppAnnotatedClass.java | 118 +++
.../jsr168/CustomPortletMode168ImplTest.java | 8 +-
.../jsr168/CustomWindowState168ImplTest.java | 8 +-
...PortletApplicationDefinition168ImplTest.java | 2 +-
.../jsr168/PortletDefinition168ImplTest.java | 22 +-
.../jsr168/SecurityConstraint168ImplTest.java | 10 +-
.../impl/jsr168/UserAttribute168ImplTest.java | 10 +-
.../jsr168/UserDataConstraint168ImplTest.java | 10 +-
.../jsr286/CustomPortletMode286ImplTest.java | 8 +-
.../jsr286/CustomWindowState286ImplTest.java | 8 +-
...PortletApplicationDefinition286ImplTest.java | 17 +-
.../jsr286/PortletDefinition286ImplTest.java | 22 +-
.../jsr286/SecurityConstraint286ImplTest.java | 10 +-
.../impl/jsr286/UserAttribute286ImplTest.java | 10 +-
.../jsr286/UserDataConstraint286ImplTest.java | 10 +-
.../jsr362/CustomPortletMode362ImplTest.java | 9 +-
.../jsr362/CustomWindowState362ImplTest.java | 8 +-
...ExtendingPortletInterfaceAnnotationTest.java | 266 ++++++
.../jsr362/JSR362PortletAppAnnotationTest.java | 385 ++++++++
.../JSR362PortletFilterAnnotationTest.java | 230 +++++
.../impl/jsr362/MergePortletAppTest.java | 819 +++++++++++++++++
.../impl/jsr362/MergePortletDefinitionTest.java | 887 +++++++++++++++++++
.../impl/jsr362/MultiAnnotatedPortletTest.java | 346 ++++++++
...PortletApplicationDefinition362ImplTest.java | 249 +++++-
.../PortletDefinition362AnnotationTest.java | 815 +++++++++++++++++
.../jsr362/PortletDefinition362ImplTest.java | 364 +++++++-
.../jsr362/SecurityConstraint362ImplTest.java | 122 ---
.../impl/jsr362/UserAttribute362ImplTest.java | 10 +-
.../jsr362/UserDataConstraint362ImplTest.java | 105 ---
.../om/portlet/AnotherBundle.properties | 6 +
.../om/portlet/portlet362Generated.xml | 20 +-
.../container/om/portlet/portlet362Merge.xml | 185 ++++
78 files changed, 7125 insertions(+), 816 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/ab12285f/pluto-container-api/src/main/java/org/apache/pluto/container/om/portlet/Dependency.java
----------------------------------------------------------------------
diff --git a/pluto-container-api/src/main/java/org/apache/pluto/container/om/portlet/Dependency.java b/pluto-container-api/src/main/java/org/apache/pluto/container/om/portlet/Dependency.java
new file mode 100644
index 0000000..0beff9c
--- /dev/null
+++ b/pluto-container-api/src/main/java/org/apache/pluto/container/om/portlet/Dependency.java
@@ -0,0 +1,25 @@
+package org.apache.pluto.container.om.portlet;
+
+public interface Dependency {
+
+ /**
+ * @return the name
+ */
+ String getName();
+
+ /**
+ * @param name the name to set
+ */
+ void setName(String name);
+
+ /**
+ * @return the version
+ */
+ String getVersion();
+
+ /**
+ * @param version the version to set
+ */
+ void setVersion(String version);
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/ab12285f/pluto-container-api/src/main/java/org/apache/pluto/container/om/portlet/Description.java
----------------------------------------------------------------------
diff --git a/pluto-container-api/src/main/java/org/apache/pluto/container/om/portlet/Description.java b/pluto-container-api/src/main/java/org/apache/pluto/container/om/portlet/Description.java
index 9f3294c..f199bdd 100644
--- a/pluto-container-api/src/main/java/org/apache/pluto/container/om/portlet/Description.java
+++ b/pluto-container-api/src/main/java/org/apache/pluto/container/om/portlet/Description.java
@@ -16,15 +16,6 @@
*/
package org.apache.pluto.container.om.portlet;
-import java.util.Locale;
-public interface Description {
-
- String getLang();
- void setLang(String lang);
-
- String getDescription();
- void setDescription(String description);
-
- Locale getLocale();
+public interface Description extends LocaleText {
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/ab12285f/pluto-container-api/src/main/java/org/apache/pluto/container/om/portlet/DisplayName.java
----------------------------------------------------------------------
diff --git a/pluto-container-api/src/main/java/org/apache/pluto/container/om/portlet/DisplayName.java b/pluto-container-api/src/main/java/org/apache/pluto/container/om/portlet/DisplayName.java
index 52adaf6..55dee8d 100644
--- a/pluto-container-api/src/main/java/org/apache/pluto/container/om/portlet/DisplayName.java
+++ b/pluto-container-api/src/main/java/org/apache/pluto/container/om/portlet/DisplayName.java
@@ -1,29 +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.
- */
-package org.apache.pluto.container.om.portlet;
-
-import java.util.Locale;
-
-public interface DisplayName {
-
- String getLang();
-
- String getDisplayName();
- void setDisplayName(String displayName);
-
- Locale getLocale();
+/*
+ * 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;
+
+
+public interface DisplayName extends LocaleText {
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/ab12285f/pluto-container-api/src/main/java/org/apache/pluto/container/om/portlet/Filter.java
----------------------------------------------------------------------
diff --git a/pluto-container-api/src/main/java/org/apache/pluto/container/om/portlet/Filter.java b/pluto-container-api/src/main/java/org/apache/pluto/container/om/portlet/Filter.java
index d03f1be..346f091 100644
--- a/pluto-container-api/src/main/java/org/apache/pluto/container/om/portlet/Filter.java
+++ b/pluto-container-api/src/main/java/org/apache/pluto/container/om/portlet/Filter.java
@@ -21,23 +21,30 @@ import java.util.Locale;
public interface Filter {
- String getFilterName();
+ String getFilterName();
- Description getDescription(Locale locale);
+ Description getDescription(Locale locale);
List<Description> getDescriptions();
void addDescription(Description desc);
- DisplayName getDisplayName(Locale locale);
+ DisplayName getDisplayName(Locale locale);
List<DisplayName> getDisplayNames();
void addDisplayName(DisplayName dn);
- String getFilterClass();
- void setFilterClass(String filterClass);
+ String getFilterClass();
+ void setFilterClass(String filterClass);
- InitParam getInitParam(String paramName);
+ InitParam getInitParam(String paramName);
List<InitParam> getInitParams();
void addInitParam(InitParam ip);
- List<String> getLifecycles();
- void addLifecycle(String lifecycle);
+ List<String> getLifecycles();
+ void addLifecycle(String lifecycle);
+
+ // establishes ordering for annotated filters
+ int getOrdinal();
+ void setOrdinal(int ordinal);
+
+ // marks if the ordinal was set (annotated filter only)
+ boolean isOrdinalSet();
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/ab12285f/pluto-container-api/src/main/java/org/apache/pluto/container/om/portlet/Listener.java
----------------------------------------------------------------------
diff --git a/pluto-container-api/src/main/java/org/apache/pluto/container/om/portlet/Listener.java b/pluto-container-api/src/main/java/org/apache/pluto/container/om/portlet/Listener.java
index c1e7fdf..f507377 100644
--- a/pluto-container-api/src/main/java/org/apache/pluto/container/om/portlet/Listener.java
+++ b/pluto-container-api/src/main/java/org/apache/pluto/container/om/portlet/Listener.java
@@ -31,4 +31,7 @@ public interface Listener {
DisplayName getDisplayName(Locale locale);
List<DisplayName> getDisplayNames();
void addDisplayName(DisplayName dispName);
+
+ String getListenerName();
+ void setListenerName(String listenerName);
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/ab12285f/pluto-container-api/src/main/java/org/apache/pluto/container/om/portlet/LocaleText.java
----------------------------------------------------------------------
diff --git a/pluto-container-api/src/main/java/org/apache/pluto/container/om/portlet/LocaleText.java b/pluto-container-api/src/main/java/org/apache/pluto/container/om/portlet/LocaleText.java
new file mode 100644
index 0000000..9412905
--- /dev/null
+++ b/pluto-container-api/src/main/java/org/apache/pluto/container/om/portlet/LocaleText.java
@@ -0,0 +1,30 @@
+/*
+ * 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.Locale;
+
+public interface LocaleText {
+
+ String getLang();
+ void setLang(String lang);
+
+ String getText();
+ void setText(String text);
+
+ Locale getLocale();
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/ab12285f/pluto-container-api/src/main/java/org/apache/pluto/container/om/portlet/PortletDefinition.java
----------------------------------------------------------------------
diff --git a/pluto-container-api/src/main/java/org/apache/pluto/container/om/portlet/PortletDefinition.java b/pluto-container-api/src/main/java/org/apache/pluto/container/om/portlet/PortletDefinition.java
index 8d3250c..6de7da5 100644
--- a/pluto-container-api/src/main/java/org/apache/pluto/container/om/portlet/PortletDefinition.java
+++ b/pluto-container-api/src/main/java/org/apache/pluto/container/om/portlet/PortletDefinition.java
@@ -78,4 +78,8 @@ public interface PortletDefinition {
ContainerRuntimeOption getContainerRuntimeOption(String name);
List<ContainerRuntimeOption> getContainerRuntimeOptions();
void addContainerRuntimeOption(ContainerRuntimeOption cro);
+
+ void addDependency(Dependency dep);
+ List<Dependency> getDependencies();
+ Dependency getDependency(String name);
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/ab12285f/pluto-container-api/src/main/java/org/apache/pluto/container/om/portlet/PortletInfo.java
----------------------------------------------------------------------
diff --git a/pluto-container-api/src/main/java/org/apache/pluto/container/om/portlet/PortletInfo.java b/pluto-container-api/src/main/java/org/apache/pluto/container/om/portlet/PortletInfo.java
index 6c89bb8..131c92b 100644
--- a/pluto-container-api/src/main/java/org/apache/pluto/container/om/portlet/PortletInfo.java
+++ b/pluto-container-api/src/main/java/org/apache/pluto/container/om/portlet/PortletInfo.java
@@ -1,29 +1,44 @@
-/*
- * 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;
-
-public interface PortletInfo {
-
- String getTitle();
- void setTitle(String title);
-
- String getKeywords();
- void setKeywords(String keywords);
-
- String getShortTitle();
- void setShortTitle(String shortTitle);
+/*
+ * 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;
+
+public interface PortletInfo {
+
+ String getTitle();
+ void setTitle(String title);
+
+ LocaleText getTitle(Locale locale);
+ List<LocaleText> getTitles();
+ void addTitle(LocaleText title);
+
+ String getKeywords();
+ void setKeywords(String keywords);
+
+ LocaleText getKeywords(Locale locale);
+ List<LocaleText> getKeywordsList();
+ void addKeywords(LocaleText kw);
+
+ String getShortTitle();
+ void setShortTitle(String shortTitle);
+
+ LocaleText getShortTitle(Locale locale);
+ List<LocaleText> getShortTitles();
+ void addShortTitle(LocaleText st);
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/ab12285f/pluto-container-api/src/main/java/org/apache/pluto/container/om/portlet/PublicRenderParameter.java
----------------------------------------------------------------------
diff --git a/pluto-container-api/src/main/java/org/apache/pluto/container/om/portlet/PublicRenderParameter.java b/pluto-container-api/src/main/java/org/apache/pluto/container/om/portlet/PublicRenderParameter.java
index 7c0297e..3734e3c 100644
--- a/pluto-container-api/src/main/java/org/apache/pluto/container/om/portlet/PublicRenderParameter.java
+++ b/pluto-container-api/src/main/java/org/apache/pluto/container/om/portlet/PublicRenderParameter.java
@@ -30,6 +30,10 @@ public interface PublicRenderParameter {
List<Description> getDescriptions();
void addDescription(Description desc);
+ DisplayName getDisplayName(Locale locale);
+ List<DisplayName> getDisplayNames();
+ void addDisplayName(DisplayName desc);
+
List<QName> getAliases();
void addAlias(QName alias);
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/ab12285f/pluto-container/pom.xml
----------------------------------------------------------------------
diff --git a/pluto-container/pom.xml b/pluto-container/pom.xml
index 1108ace..d05a50b 100644
--- a/pluto-container/pom.xml
+++ b/pluto-container/pom.xml
@@ -102,7 +102,7 @@
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<includes>
- <include>**/*ImplTest.java</include>
+ <include>**/*Test.java</include>
<include>**/*TestSuite.java</include>
</includes>
<excludes>
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/ab12285f/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 48a9aab..c4e0354 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
@@ -103,22 +103,22 @@ public class PortletAppDescriptorServiceImpl implements PortletAppDescriptorServ
public void mergeWebDescriptor(PortletApplicationDefinition pad,
InputStream webDescriptor) throws Exception {
- ConfigurationHolder confHolder = new ConfigurationHolder(pad);
- confHolder.processWebDD(webDescriptor);
-
- if (isDebug) {
- StringBuilder txt = new StringBuilder(128);
- txt.append("Processed web DD for Portlet app: ").append(pad.getName());
- txt.append(", context path: ").append(pad.getContextPath());
- txt.append(", # portlets: ").append(pad.getPortlets().size());
- txt.append(", names: ");
- String sep = "";
- for (PortletDefinition pd : pad.getPortlets()) {
- txt.append(sep).append(pd.getPortletName());
- sep = ", ";
- }
- LOG.debug(txt.toString());
- }
+// ConfigurationHolder confHolder = new ConfigurationHolder(pad);
+// confHolder.processWebDD(webDescriptor);
+//
+// if (isDebug) {
+// StringBuilder txt = new StringBuilder(128);
+// txt.append("Processed web DD for Portlet app: ").append(pad.getName());
+// txt.append(", context path: ").append(pad.getContextPath());
+// txt.append(", # portlets: ").append(pad.getPortlets().size());
+// txt.append(", names: ");
+// String sep = "";
+// for (PortletDefinition pd : pad.getPortlets()) {
+// txt.append(sep).append(pd.getPortletName());
+// sep = ", ";
+// }
+// LOG.debug(txt.toString());
+// }
}
/**
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/ab12285f/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/ConfigurationHolder.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/ConfigurationHolder.java b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/ConfigurationHolder.java
index 8202fba..2595a95 100644
--- a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/ConfigurationHolder.java
+++ b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/ConfigurationHolder.java
@@ -20,7 +20,12 @@ package org.apache.pluto.container.om.portlet.impl;
import java.io.IOException;
import java.io.InputStream;
+import java.util.Set;
+import javax.portlet.annotations.PortletApplication;
+import javax.portlet.annotations.PortletConfiguration;
+import javax.portlet.annotations.PortletConfigurations;
+import javax.portlet.annotations.PortletRequestFilter;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.JAXBException;
@@ -35,80 +40,53 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
- * This class processes the web app deployment descriptor and the portlet
- * deployment descriptor files.
+ * This class processes the web app deployment descriptor and the portlet deployment descriptor files.
*
*
* @author Scott Nicklous
*
*/
public class ConfigurationHolder {
-
- public static final String ATTRIB_NAME = "PortletAppConfig";
-
- private PortletApplicationDefinition pad = null;
- private ConfigurationProcessor jcp = null;
+ public static final String ATTRIB_NAME = "PortletAppConfig";
+ private PortletApplicationDefinition pad = null;
+ private ConfigurationProcessor jcp = null;
/** Logger. */
- private static final Logger LOG = LoggerFactory
- .getLogger(ConfigurationHolder.class);
+ private static final Logger LOG = LoggerFactory.getLogger(ConfigurationHolder.class);
private static final boolean isDebug = LOG.isDebugEnabled();
private static final String JAXB_CONTEXT = "org.apache.pluto.container.om.portlet10.impl:"
+ "org.apache.pluto.container.om.portlet20.impl:"
+ "org.apache.pluto.container.om.portlet30.impl";
-
/**
* Default constructor
*/
public ConfigurationHolder() {
this.pad = new PortletApplicationDefinitionImpl();
}
- /**
- * Constructor
- *
- * @param pad
- */
- public ConfigurationHolder(PortletApplicationDefinition pad) {
- this.pad = pad;
- }
/**
* returns the finished portlet application definition
*
- * @return the portlet application definition
+ * @return the portlet application definition
*/
public PortletApplicationDefinition getPad() {
return pad;
}
/**
- * Sets the portlet application definition to be processed
- *
- * @param pad
- */
- public void setPad(PortletApplicationDefinition pad) {
- this.pad = pad;
- }
-
- /**
- * Processes the portlet deployment descriptor represented by the given input
- * stream.
+ * Processes the portlet deployment descriptor represented by the given input stream.
* <p>
- * The data is merged into an existing configuration data structure if one is
- * provided. This capability is used by version 3 portlets for merging config
- * data from the files into config data that has been read from annotations.
+ * The data is merged into an existing configuration data structure if one is provided. This capability is used by
+ * version 3 portlets for merging config data from the files into config data that has been read from annotations.
* <p>
- * If no existing configuration data is provides, or if a version 1.0 or
- * version 2.0 deployment descriptor is being processed, a new configuration
- * data structure is created.
+ * If no existing configuration data is provides, or if a version 1.0 or version 2.0 deployment descriptor is being
+ * processed, a new configuration data structure is created.
* <p>
- * The class also performs validity checking and throws exceptions for
- * invalid data. To maintain compatibility with the earlier Pluto
- * implementation, an <code>IllegalArgumentException</code> is thrown in such
- * cases.
+ * The class also performs validity checking and throws exceptions for invalid data. To maintain compatibility with
+ * the earlier Pluto implementation, an <code>IllegalArgumentException</code> is thrown in such cases.
*
*
* @param stream
@@ -118,11 +96,11 @@ public class ConfigurationHolder {
* If an I/O error occurs
* @throws IllegalArgumentException
* If data validation fails
- * @throws XMLStreamException
+ * @throws XMLStreamException
*/
- public void processPortletDD(InputStream stream)
- throws IOException, IllegalArgumentException, JAXBException, XMLStreamException {
-
+ public void processPortletDD(InputStream stream) throws IOException, IllegalArgumentException, JAXBException,
+ XMLStreamException {
+
ClassLoader mycl = this.getClass().getClassLoader();
JAXBContext cntxt = JAXBContext.newInstance(JAXB_CONTEXT, mycl);
@@ -143,39 +121,31 @@ public class ConfigurationHolder {
txt.append(jel.getValue().getClass().getCanonicalName());
LOG.debug(txt.toString());
}
-
- if (jel.getValue() instanceof
- org.apache.pluto.container.om.portlet10.impl.PortletAppType) {
- // Ignore existing config data for 1.0 portlets
+ if (jel.getValue() instanceof org.apache.pluto.container.om.portlet10.impl.PortletAppType) {
+
+ // Ignore existing config data for 1.0 portlets
pad = new PortletApplicationDefinitionImpl();
- jcp = new JSR168ConfigurationProcessor();
-
- } else if (jel.getValue() instanceof
- org.apache.pluto.container.om.portlet20.impl.PortletAppType) {
-
+ jcp = new JSR168ConfigurationProcessor(pad);
+
+ } else if (jel.getValue() instanceof org.apache.pluto.container.om.portlet20.impl.PortletAppType) {
+
// Ignore existing config data for 2.0 portlets
pad = new PortletApplicationDefinitionImpl();
- jcp = new JSR286ConfigurationProcessor();
-
- } else if (jel.getValue() instanceof
- org.apache.pluto.container.om.portlet30.impl.PortletAppType) {
-
- // for v3, let config data from DD overwrite existing data from annotations
- if (pad == null) {
- pad = new PortletApplicationDefinitionImpl();
- }
- jcp = new JSR362ConfigurationProcessor();
-
+ jcp = new JSR286ConfigurationProcessor(pad);
+
+ } else if (jel.getValue() instanceof org.apache.pluto.container.om.portlet30.impl.PortletAppType) {
+
+ jcp = new JSR362ConfigurationProcessor(pad);
+
} else {
- String warning = "Unknown application type: " +
- jel.getValue().getClass().getCanonicalName();
+ String warning = "Unknown application type: " + jel.getValue().getClass().getCanonicalName();
LOG.warn(warning);
throw new IOException(warning);
}
- pad = jcp.process(jel);
-
+ jcp.process(jel);
+
if (isDebug) {
StringBuilder txt = new StringBuilder(128);
txt.append("Parsed DD for Portlet app: ").append(pad.getName());
@@ -190,20 +160,67 @@ public class ConfigurationHolder {
}
}
-
+
/**
* extracts the locale-encoding mapping from the web deployment descriptor
*
- * @param in Input stream for the web DD
- * @throws Exception
+ * @param in
+ * Input stream for the web DD
+ * @throws Exception
*/
public void processWebDD(InputStream in) throws Exception {
if (jcp == null) {
- jcp = new JSR286ConfigurationProcessor();
+ jcp = new JSR286ConfigurationProcessor(pad);
}
- jcp.processWebDD(in, pad);
+ jcp.processWebDD(in);
}
-
+
+ /**
+ * Accepts a list of classes that are annotated with portlet configuration and portlet application configuration
+ * annotations. Extracts the config data from the annotations to create a corresponding portlet application
+ * definition structure.
+ * <p>
+ * This method must be called before processing the portlet xml so that the data from the portlet DD may properly
+ * override the annotation configuration data.
+ * <p>
+ * This method is designed to be used within a ServletContainerInitializer onStartup() method. The SCI should be
+ * annotated as follows: <code>@HandlesTypes({PortletApplication.class, PortletConfiguration.class, #
+ * PortletConfigurations.class, PortletRequestFilter.class})</code>
+ *
+ * @param classes
+ * List of classes annotated with portlet config annotations
+ */
+ public void processConfigAnnotations(Set<Class<?>> classes) {
+ if (classes != null) {
+ jcp = new JSR362ConfigurationProcessor(pad);
+ for (Class<?> cls : classes) {
+
+ PortletApplication pa = cls.getAnnotation(PortletApplication.class);
+ if (pa != null) {
+ jcp.processPortletAppAnnotation(pa);
+ }
+
+ PortletConfiguration pc = cls.getAnnotation(PortletConfiguration.class);
+ if (pc != null) {
+ jcp.processPortletConfigAnnotation(pc, cls);
+ }
+
+ PortletConfigurations pcs = cls.getAnnotation(PortletConfigurations.class);
+ if (pcs != null) {
+ for (PortletConfiguration config : pcs.value()) {
+ jcp.processPortletConfigAnnotation(config, cls);
+ }
+ }
+
+ PortletRequestFilter prf = cls.getAnnotation(PortletRequestFilter.class);
+ if (prf != null) {
+ jcp.processPortletFilterAnnotation(cls);
+ }
+
+ }
+ }
+ }
+
/**
* validates the configuration. To be called after the configuration has been completely read.
*/
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/ab12285f/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/ConfigurationProcessor.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/ConfigurationProcessor.java b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/ConfigurationProcessor.java
index 9ae6021..6ae4208 100644
--- a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/ConfigurationProcessor.java
+++ b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/ConfigurationProcessor.java
@@ -5,6 +5,8 @@ import java.util.Arrays;
import java.util.Locale;
import java.util.ResourceBundle;
+import javax.portlet.annotations.PortletApplication;
+import javax.portlet.annotations.PortletConfiguration;
import javax.xml.bind.JAXBElement;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
@@ -27,10 +29,13 @@ public abstract class ConfigurationProcessor {
/** Logger. */
private static final Logger LOG = LoggerFactory
.getLogger(ConfigurationProcessor.class);
-
+
protected PortletApplicationDefinition pad;
+ public ConfigurationProcessor(PortletApplicationDefinition pad) {
+ this.pad = pad;
+ }
public PortletApplicationDefinition getPad() {
return pad;
@@ -46,8 +51,7 @@ public abstract class ConfigurationProcessor {
* @throws IllegalArgumentException
* If there is a data validation error
*/
- public abstract PortletApplicationDefinition process(
- JAXBElement<?> rootElement) throws IllegalArgumentException;
+ public abstract void process(JAXBElement<?> rootElement) throws IllegalArgumentException;
/**
* Validates the given portlet application definition. This method should only be called after
@@ -144,11 +148,6 @@ public abstract class ConfigurationProcessor {
txt.append(assignable.getCanonicalName());
throw new Exception();
}
-// } catch (ClassNotFoundException e) {
-// txt.append(", Exception: ").append(e.toString());
-// LOG.warn(txt.toString());
-// // can't throw exception if class not found, since the portlet
-// // application definition is used by the assembly mojo
} catch (Exception e) {
LOG.warn(txt.toString());
throw new IllegalArgumentException(txt.toString(), e);
@@ -189,10 +188,9 @@ public abstract class ConfigurationProcessor {
* Reads web app deployment descriptor to extract the locale - encoding mappings
*
* @param in Input stream for DD
- * @param pad Portlet application definition to be updated
* @throws Exception If there is a parsing problem
*/
- public void processWebDD(InputStream in, PortletApplicationDefinition pad) throws Exception {
+ public void processWebDD(InputStream in) throws Exception {
// set up document
DocumentBuilderFactory fact = DocumentBuilderFactory.newInstance();
@@ -220,5 +218,57 @@ public abstract class ConfigurationProcessor {
pad.addLocaleEncodingMapping(locale, encstr);
}
}
+
+ /**
+ * Extracts the data from the portlet application annotation and adds it to the
+ * portlet application definition structure.
+ * <p>
+ * The default method implementation does nothing. The V3 implementation will
+ * override this method to provide function.
+ * <p>
+ * This method is designed to be called before the portlet deployment descriptor
+ * is read so that data from the portlet DD can override that provided through annotations.
+ *
+ * @param pa The portlet application annotation
+ */
+ public void processPortletAppAnnotation(PortletApplication pa) {
+ // default impl = do nothing
+ }
+
+ /**
+ * Extracts the data from the portlet annotation and adds it to a
+ * portlet definition structure. The portlet definition will be created if it does not
+ * already exist.
+ * <p>
+ * The default method implementation does nothing. The V3 implementation will
+ * override this method to provide function.
+ * <p>
+ * This method is designed to be called before the portlet deployment descriptor
+ * is read so that data from the portlet DD can override that provided through annotations.
+ *
+ * @param pc The portlet configuration annotation
+ * @param cls The annotated class
+ */
+ public void processPortletConfigAnnotation(PortletConfiguration pc, Class<?> cls) {
+ // default impl = do nothing
+ }
+
+
+ /**
+ * Extracts the data from the portlet annotation and adds it to a
+ * portlet filter definition structure. The portlet filter definition will be created if it does not
+ * already exist.
+ * <p>
+ * The default method implementation does nothing. The V3 implementation will
+ * override this method to provide function.
+ * <p>
+ * This method is designed to be called before the portlet deployment descriptor
+ * is read so that data from the portlet DD can override that provided through annotations.
+ *
+ * @param cls The annotated class.
+ */
+ public void processPortletFilterAnnotation(Class<?> cls) {
+ // default impl = do nothing
+ }
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/ab12285f/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/ContainerRuntimeOptionImpl.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/ContainerRuntimeOptionImpl.java b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/ContainerRuntimeOptionImpl.java
index a99616f..dc516bf 100644
--- a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/ContainerRuntimeOptionImpl.java
+++ b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/ContainerRuntimeOptionImpl.java
@@ -78,4 +78,40 @@ public class ContainerRuntimeOptionImpl implements ContainerRuntimeOption {
values.add(value);
}
+ /* (non-Javadoc)
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((name == null) ? 0 : name.hashCode());
+ return result;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ ContainerRuntimeOptionImpl other = (ContainerRuntimeOptionImpl) obj;
+ if (name == null) {
+ if (other.name != null) {
+ return false;
+ }
+ } else if (!name.equals(other.name)) {
+ return false;
+ }
+ return true;
+ }
+
}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/ab12285f/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/CustomPortletModeImpl.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/CustomPortletModeImpl.java b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/CustomPortletModeImpl.java
index ad3a3ad..e635b86 100644
--- a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/CustomPortletModeImpl.java
+++ b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/CustomPortletModeImpl.java
@@ -121,4 +121,40 @@ public class CustomPortletModeImpl implements CustomPortletMode {
descs.add(desc);
}
+ /* (non-Javadoc)
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((pm == null) ? 0 : pm.hashCode());
+ return result;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ CustomPortletModeImpl other = (CustomPortletModeImpl) obj;
+ if (pm == null) {
+ if (other.pm != null) {
+ return false;
+ }
+ } else if (!pm.equals(other.pm)) {
+ return false;
+ }
+ return true;
+ }
+
}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/ab12285f/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/CustomWindowStateImpl.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/CustomWindowStateImpl.java b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/CustomWindowStateImpl.java
index 0c6d311..26a783b 100644
--- a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/CustomWindowStateImpl.java
+++ b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/CustomWindowStateImpl.java
@@ -101,4 +101,40 @@ public class CustomWindowStateImpl implements CustomWindowState {
descs.add(desc);
}
+ /* (non-Javadoc)
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((ws == null) ? 0 : ws.hashCode());
+ return result;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ CustomWindowStateImpl other = (CustomWindowStateImpl) obj;
+ if (ws == null) {
+ if (other.ws != null) {
+ return false;
+ }
+ } else if (!ws.equals(other.ws)) {
+ return false;
+ }
+ return true;
+ }
+
}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/ab12285f/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/DependencyImpl.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/DependencyImpl.java b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/DependencyImpl.java
new file mode 100644
index 0000000..3a44d07
--- /dev/null
+++ b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/DependencyImpl.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.portlet.impl;
+
+import org.apache.pluto.container.om.portlet.Dependency;
+
+
+/**
+ * Encapsulates the dependency configuration data.
+ *
+ * @author Scott Nicklous
+ *
+ */
+public class DependencyImpl implements Dependency {
+
+ String name = null;
+ String version = null;
+
+ public DependencyImpl() {
+ }
+
+ public DependencyImpl(String name, String version) {
+ this.name = name;
+ this.version = version;
+ }
+
+ public DependencyImpl(Dependency di) {
+ this.name = di.getName();
+ this.version = di.getVersion();
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.pluto.container.om.portlet.impl.Dependency#getName()
+ */
+ @Override
+ public String getName() {
+ return name;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.pluto.container.om.portlet.impl.Dependency#setName(java.lang.String)
+ */
+ @Override
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.pluto.container.om.portlet.impl.Dependency#getVersion()
+ */
+ @Override
+ public String getVersion() {
+ return version;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.pluto.container.om.portlet.impl.Dependency#setVersion(java.lang.String)
+ */
+ @Override
+ public void setVersion(String version) {
+ this.version = version;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((name == null) ? 0 : name.hashCode());
+ return result;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ DependencyImpl other = (DependencyImpl) obj;
+ if (name == null) {
+ if (other.name != null) {
+ return false;
+ }
+ } else if (!name.equals(other.name)) {
+ return false;
+ }
+ return true;
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/ab12285f/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/DescriptionImpl.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/DescriptionImpl.java b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/DescriptionImpl.java
index dd7c258..63b87b3 100644
--- a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/DescriptionImpl.java
+++ b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/DescriptionImpl.java
@@ -29,17 +29,13 @@ import org.apache.pluto.container.om.portlet.Description;
* @author Scott Nicklous
*
*/
-public class DescriptionImpl implements Description {
-
- private Locale locale;
- private String desc;
+public class DescriptionImpl extends LocaleTextImpl implements Description {
/**
* default: lang = english
*/
public DescriptionImpl() {
- locale = Locale.ENGLISH;
- desc = "";
+ super();
}
/**
@@ -48,53 +44,14 @@ public class DescriptionImpl implements Description {
* @param disp description string
*/
public DescriptionImpl(Locale locale, String desc) {
- this.locale = locale;
- this.desc = desc;
+ super(locale, desc);
}
/**
* Copy constructor
*/
public DescriptionImpl(Description di) {
- this.locale = (Locale) di.getLocale().clone();
- this.desc = di.getDescription();
- }
-
- /* (non-Javadoc)
- * @see org.apache.pluto.container.om.portlet.Description#getLang()
- */
- @Override
- public String getLang() {
- return locale.toLanguageTag();
- }
-
- @Override
- public void setLang(String lang) {
- this.locale = Locale.forLanguageTag(lang);
- }
-
- /* (non-Javadoc)
- * @see org.apache.pluto.container.om.portlet.Description#getDescription()
- */
- @Override
- public String getDescription() {
- return desc;
- }
-
- /* (non-Javadoc)
- * @see org.apache.pluto.container.om.portlet.Description#setDescription(java.lang.String)
- */
- @Override
- public void setDescription(String description) {
- desc = description;
- }
-
- /* (non-Javadoc)
- * @see org.apache.pluto.container.om.portlet.Description#getLocale()
- */
- @Override
- public Locale getLocale() {
- return Locale.forLanguageTag(locale.toLanguageTag());
+ super(di);
}
}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/ab12285f/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/DisplayNameImpl.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/DisplayNameImpl.java b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/DisplayNameImpl.java
index 89171a2..cd20cb1 100644
--- a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/DisplayNameImpl.java
+++ b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/DisplayNameImpl.java
@@ -29,17 +29,13 @@ import org.apache.pluto.container.om.portlet.DisplayName;
* @author Scott Nicklous
*
*/
-public class DisplayNameImpl implements DisplayName {
-
- private Locale locale;
- private String disp;
+public class DisplayNameImpl extends LocaleTextImpl implements DisplayName {
/**
* default: lang = english
*/
public DisplayNameImpl() {
- locale = Locale.ENGLISH;
- disp = "";
+ super();
}
/**
@@ -48,48 +44,14 @@ public class DisplayNameImpl implements DisplayName {
* @param disp description string
*/
public DisplayNameImpl(Locale locale, String desc) {
- this.locale = locale;
- this.disp = desc;
+ super(locale, desc);
}
/**
* Copy constructor
*/
public DisplayNameImpl(DisplayName di) {
- this.locale = (Locale) di.getLocale().clone();
- this.disp = di.getDisplayName();
- }
-
- /* (non-Javadoc)
- * @see org.apache.pluto.container.om.portlet.DisplayName#getLang()
- */
- @Override
- public String getLang() {
- return locale.toLanguageTag();
- }
-
- /* (non-Javadoc)
- * @see org.apache.pluto.container.om.portlet.DisplayName#getDisplayName()
- */
- @Override
- public String getDisplayName() {
- return disp;
- }
-
- /* (non-Javadoc)
- * @see org.apache.pluto.container.om.portlet.DisplayName#setDisplayName(java.lang.String)
- */
- @Override
- public void setDisplayName(String description) {
- disp = description;
- }
-
- /* (non-Javadoc)
- * @see org.apache.pluto.container.om.portlet.DisplayName#getLocale()
- */
- @Override
- public Locale getLocale() {
- return (Locale) locale.clone();
+ super(di);
}
}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/ab12285f/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/EventDefinitionImpl.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/EventDefinitionImpl.java b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/EventDefinitionImpl.java
index d932fbf..a4a70bd 100644
--- a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/EventDefinitionImpl.java
+++ b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/EventDefinitionImpl.java
@@ -176,4 +176,40 @@ public class EventDefinitionImpl implements EventDefinition {
valType = valueType;
}
+ /* (non-Javadoc)
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((qn == null) ? 0 : qn.hashCode());
+ return result;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ EventDefinitionImpl other = (EventDefinitionImpl) obj;
+ if (qn == null) {
+ if (other.qn != null) {
+ return false;
+ }
+ } else if (!qn.equals(other.qn)) {
+ return false;
+ }
+ return true;
+ }
+
}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/ab12285f/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/EventDefinitionReferenceImpl.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/EventDefinitionReferenceImpl.java b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/EventDefinitionReferenceImpl.java
index bcdc4b3..9480c66 100644
--- a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/EventDefinitionReferenceImpl.java
+++ b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/EventDefinitionReferenceImpl.java
@@ -67,4 +67,40 @@ public class EventDefinitionReferenceImpl implements EventDefinitionReference {
this.qname = qn;
}
+ /* (non-Javadoc)
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((qname == null) ? 0 : qname.hashCode());
+ return result;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ EventDefinitionReferenceImpl other = (EventDefinitionReferenceImpl) obj;
+ if (qname == null) {
+ if (other.qname != null) {
+ return false;
+ }
+ } else if (!qname.equals(other.qname)) {
+ return false;
+ }
+ return true;
+ }
+
}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/ab12285f/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/FilterImpl.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/FilterImpl.java b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/FilterImpl.java
index 6f3d53d..6598e84 100644
--- a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/FilterImpl.java
+++ b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/FilterImpl.java
@@ -43,6 +43,8 @@ public class FilterImpl implements Filter {
private final List<DisplayName> dispNames = new ArrayList<DisplayName>();
private final Map<String, InitParam> initParams = new HashMap<String, InitParam>();
private String fclass = "";
+ private int ordinal;
+ private boolean ordinalSet = false;
/**
@@ -65,6 +67,8 @@ public class FilterImpl implements Filter {
for (InitParam ip : fi.getInitParams()) {
this.initParams.put(ip.getParamName(), new InitParamImpl(ip));
}
+ this.ordinal = fi.getOrdinal();
+ this.ordinalSet = fi.isOrdinalSet();
}
@@ -191,4 +195,65 @@ public class FilterImpl implements Filter {
initParams.put(ip.getParamName(), ip);
}
+ /**
+ * @return the ordinal
+ */
+ @Override
+ public int getOrdinal() {
+ return ordinal;
+ }
+
+ /**
+ * @param ordinal the ordinal to set
+ */
+ @Override
+ public void setOrdinal(int ordinal) {
+ this.ordinal = ordinal;
+ this.ordinalSet = true;
+ }
+
+ /**
+ * @return the ordinalSet
+ */
+ @Override
+ public boolean isOrdinalSet() {
+ return ordinalSet;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((filterName == null) ? 0 : filterName.hashCode());
+ return result;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ FilterImpl other = (FilterImpl) obj;
+ if (filterName == null) {
+ if (other.filterName != null) {
+ return false;
+ }
+ } else if (!filterName.equals(other.filterName)) {
+ return false;
+ }
+ return true;
+ }
+
}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/ab12285f/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/FilterMappingImpl.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/FilterMappingImpl.java b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/FilterMappingImpl.java
index 2b46787..c727ebc 100644
--- a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/FilterMappingImpl.java
+++ b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/FilterMappingImpl.java
@@ -75,4 +75,40 @@ public class FilterMappingImpl implements FilterMapping {
portletNames.add(portletName);
}
+ /* (non-Javadoc)
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((filterName == null) ? 0 : filterName.hashCode());
+ return result;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ FilterMappingImpl other = (FilterMappingImpl) obj;
+ if (filterName == null) {
+ if (other.filterName != null) {
+ return false;
+ }
+ } else if (!filterName.equals(other.filterName)) {
+ return false;
+ }
+ return true;
+ }
+
}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/ab12285f/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/InitParamImpl.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/InitParamImpl.java b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/InitParamImpl.java
index ab9b310..f7168b9 100644
--- a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/InitParamImpl.java
+++ b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/InitParamImpl.java
@@ -115,4 +115,40 @@ public class InitParamImpl implements InitParam {
descs.add(desc);
}
+ /* (non-Javadoc)
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((name == null) ? 0 : name.hashCode());
+ return result;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ InitParamImpl other = (InitParamImpl) obj;
+ if (name == null) {
+ if (other.name != null) {
+ return false;
+ }
+ } else if (!name.equals(other.name)) {
+ return false;
+ }
+ return true;
+ }
+
}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/ab12285f/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/JSR168ConfigurationProcessor.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/JSR168ConfigurationProcessor.java b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/JSR168ConfigurationProcessor.java
index cc69cd1..6278314 100644
--- a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/JSR168ConfigurationProcessor.java
+++ b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/JSR168ConfigurationProcessor.java
@@ -77,15 +77,17 @@ public class JSR168ConfigurationProcessor extends ConfigurationProcessor {
.getLogger(JSR168ConfigurationProcessor.class);
// private static final boolean isDebug = LOG.isDebugEnabled();
private static final boolean isTrace = LOG.isTraceEnabled();
-
+
+ public JSR168ConfigurationProcessor(PortletApplicationDefinition pad) {
+ super(pad);
+ }
/* (non-Javadoc)
* @see org.apache.pluto.container.om.portlet.impl.jsr168.ConfigurationProcessor#process(javax.xml.bind.JAXBElement)
*/
@Override
- public PortletApplicationDefinition process(JAXBElement<?> rootElement)
+ public void process(JAXBElement<?> rootElement)
throws IllegalArgumentException {
- pad = new PortletApplicationDefinitionImpl();
// make sure we were called properly
assert (rootElement != null);
@@ -120,7 +122,6 @@ public class JSR168ConfigurationProcessor extends ConfigurationProcessor {
handleUA(app.getUserAttribute());
handlePortlets(app.getPortlet());
- return pad;
}
/**
@@ -559,6 +560,7 @@ public class JSR168ConfigurationProcessor extends ConfigurationProcessor {
}
}
+
@Override
public void validate() throws IllegalArgumentException {
// For version 1.0, do nothing.
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/ab12285f/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/JSR286ConfigurationProcessor.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/JSR286ConfigurationProcessor.java b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/JSR286ConfigurationProcessor.java
index 248633e..28df6f8 100644
--- a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/JSR286ConfigurationProcessor.java
+++ b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/JSR286ConfigurationProcessor.java
@@ -23,7 +23,6 @@ import java.util.List;
import java.util.Locale;
import javax.portlet.Portlet;
-import javax.portlet.PortletPreferences;
import javax.portlet.PortletURLGenerationListener;
import javax.portlet.PreferencesValidator;
import javax.portlet.filter.PortletFilter;
@@ -98,6 +97,10 @@ public class JSR286ConfigurationProcessor extends JSR168ConfigurationProcessor {
// private static final boolean isDebug = LOG.isDebugEnabled();
private static final boolean isTrace = LOG.isTraceEnabled();
+ public JSR286ConfigurationProcessor(PortletApplicationDefinition pad) {
+ super(pad);
+ }
+
/*
* (non-Javadoc)
*
@@ -106,9 +109,7 @@ public class JSR286ConfigurationProcessor extends JSR168ConfigurationProcessor {
* #process(javax.xml.bind.JAXBElement)
*/
@Override
- public PortletApplicationDefinition process(JAXBElement<?> rootElement)
- throws IllegalArgumentException {
- pad = new PortletApplicationDefinitionImpl();
+ public void process(JAXBElement<?> rootElement) throws IllegalArgumentException {
// make sure we were called properly
assert (rootElement != null);
@@ -172,7 +173,6 @@ public class JSR286ConfigurationProcessor extends JSR168ConfigurationProcessor {
handlePortlets(app.getPortlet());
handleFilterMappings(app.getFilterMapping());
- return pad;
}
/**
@@ -792,15 +792,15 @@ public class JSR286ConfigurationProcessor extends JSR168ConfigurationProcessor {
if (pit.getTitle() != null) {
title = pit.getTitle().getValue();
}
- if (pit.getShortTitle() != null) {
- st = pit.getShortTitle().getValue();
- }
- if (pit.getKeywords() != null) {
- kw = pit.getKeywords().getValue();
- }
- PortletInfo info = new PortletInfoImpl(title, kw, st);
- pd.setPortletInfo(info);
+ if (pit.getShortTitle() != null) {
+ st = pit.getShortTitle().getValue();
+ }
+ if (pit.getKeywords() != null) {
+ kw = pit.getKeywords().getValue();
}
+ PortletInfo info = new PortletInfoImpl(title, kw, st);
+ pd.setPortletInfo(info);
+ }
for (SupportedLocaleType slt : portlet.getSupportedLocale()) {
pd.addSupportedLocale(slt.getValue());