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:14 UTC

[12/35] portals-pluto git commit: Preliminary updates to make the portlet url generation listener and preferences validator annotations type annotations rather than method annotations.

Preliminary updates to make the portlet url generation listener and preferences validator annotations type annotations rather than method annotations.


Project: http://git-wip-us.apache.org/repos/asf/portals-pluto/repo
Commit: http://git-wip-us.apache.org/repos/asf/portals-pluto/commit/58a39c39
Tree: http://git-wip-us.apache.org/repos/asf/portals-pluto/tree/58a39c39
Diff: http://git-wip-us.apache.org/repos/asf/portals-pluto/diff/58a39c39

Branch: refs/heads/V3Prototype
Commit: 58a39c39190555d1c75fef6e639693655aac8f65
Parents: 0ceee24
Author: Scott Nicklous <ms...@apache.org>
Authored: Wed Dec 9 19:01:08 2015 +0100
Committer: Scott Nicklous <ms...@apache.org>
Committed: Wed Dec 9 19:01:08 2015 +0100

----------------------------------------------------------------------
 .../driver/PortletContainerInitializer.java     |   1 -
 .../pluto/container/impl/portlet-app_3_0.xsd    |  19 ++-
 .../portlet/annotations/InitParameter.java      |   2 +-
 .../portlet/annotations/PortletListener.java    |  93 +++++++++++++
 .../annotations/PortletRequestFilter.java       |   2 +-
 .../PortletURLGenerationListener.java           | 129 -------------------
 .../annotations/PreferencesValidator.java       |  27 +---
 .../portlet/annotations/SecurityRoleRef.java    |   2 +-
 .../javax/portlet/annotations/package-info.java |   2 +-
 9 files changed, 118 insertions(+), 159 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/58a39c39/pluto-container-driver-api/src/main/java/org/apache/pluto/container/driver/PortletContainerInitializer.java
----------------------------------------------------------------------
diff --git a/pluto-container-driver-api/src/main/java/org/apache/pluto/container/driver/PortletContainerInitializer.java b/pluto-container-driver-api/src/main/java/org/apache/pluto/container/driver/PortletContainerInitializer.java
index 9fb036b..f53c045 100644
--- a/pluto-container-driver-api/src/main/java/org/apache/pluto/container/driver/PortletContainerInitializer.java
+++ b/pluto-container-driver-api/src/main/java/org/apache/pluto/container/driver/PortletContainerInitializer.java
@@ -25,7 +25,6 @@ import javax.portlet.annotations.PortletApplication;
 import javax.portlet.annotations.PortletConfiguration;
 import javax.portlet.annotations.PortletConfigurations;
 import javax.portlet.annotations.PortletRequestFilter;
-import javax.portlet.filter.PortletFilter;
 import javax.servlet.ServletContainerInitializer;
 import javax.servlet.ServletContext;
 import javax.servlet.ServletException;

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/58a39c39/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
index 9aebdea..4cd1a8a 100644
--- 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
@@ -372,15 +372,22 @@
 				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
+				RESOURCE_PHASE.
+            The filter-name element allows an annotated filter to be addressed
+            and replaced through a corresponding portlet deployment descriptor 
+            filter and / or filter mapping configuration.
+            If the filter class is null, the annotated filter with matching filter name will
+            be removed from the configuration. The ordinal element determines the order of execution
+            should there be multiple filters configured. The default ordinal number is 0.
 				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-name" type="portlet:filter-nameType" minOccurs="0" maxOccurs="1"/>
 			<element name="filter-class" type="portlet:fully-qualified-classType"/>
+         <element name="ordinal" type="xs:int" minOccurs="0" maxOccurs="1"/>
 			<element name="lifecycle" type="portlet:string" maxOccurs="unbounded"/>
 			<element name="init-param" type="portlet:init-paramType" minOccurs="0" maxOccurs="unbounded"/>
 		</sequence>
@@ -439,14 +446,20 @@
 		<annotation>
 			<documentation>
 			The listenerType is used to declare listeners for this portlet application.
+         The optional listener-name element allows an annotated listener to be addressed
+         and replaced through a corresponding portlet deployment descriptor configuration.
+         If a listener name is provided and the listener class is null, the annotated listener will
+         be removed from the configuration. The ordinal element determines the order of execution
+         should there be multiple listeners configured. The default ordinal number is 0.
 			Used in: portlet-app
 			</documentation>
 		</annotation>
 		<sequence>
          <element name="listener-name" type="portlet:string" minOccurs="0" maxOccurs="1"/>
+         <element name="ordinal" type="xs:int" minOccurs="0" maxOccurs="1"/>
 			<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"/>
+			<element name="listener-class" type="portlet:fully-qualified-classType" minOccurs="0" maxOccurs="1"/>
 		</sequence>
 		<attribute name="id" type="portlet:string" use="optional"/>
 	</complexType>

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/58a39c39/portlet-api/src/main/java/javax/portlet/annotations/InitParameter.java
----------------------------------------------------------------------
diff --git a/portlet-api/src/main/java/javax/portlet/annotations/InitParameter.java b/portlet-api/src/main/java/javax/portlet/annotations/InitParameter.java
index 40880d4..721a91e 100644
--- a/portlet-api/src/main/java/javax/portlet/annotations/InitParameter.java
+++ b/portlet-api/src/main/java/javax/portlet/annotations/InitParameter.java
@@ -61,7 +61,7 @@ public @interface InitParameter {
     * Provides locale-specific text describing the initialization parameter for use by the portal application or by tools.
     * </div>
     * 
-    * @return  The event description
+    * @return  The parameter description
     */
    LocaleString[]      description() default {};
 }

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/58a39c39/portlet-api/src/main/java/javax/portlet/annotations/PortletListener.java
----------------------------------------------------------------------
diff --git a/portlet-api/src/main/java/javax/portlet/annotations/PortletListener.java b/portlet-api/src/main/java/javax/portlet/annotations/PortletListener.java
new file mode 100644
index 0000000..77ead30
--- /dev/null
+++ b/portlet-api/src/main/java/javax/portlet/annotations/PortletListener.java
@@ -0,0 +1,93 @@
+/*  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.
+ */
+
+/*
+ * This source code implements specifications defined by the Java
+ * Community Process. In order to remain compliant with the specification
+ * DO NOT add / change / or delete method signatures!
+ */
+package javax.portlet.annotations;
+
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import static java.lang.annotation.ElementType.*;
+import static java.lang.annotation.RetentionPolicy.*;
+
+
+/**
+ * <div class='changed_added_3_0'>
+ * Designates a portlet URL generation listener class.
+ * The listener method will be invoked before a URL of the corresponding type is
+ * generated.
+ * <p>
+ * The annotated method must implement the <code>PortletListener</code> interface.
+ * </div>
+ *    
+ * @see javax.portlet.PortletURLGenerationListener
+ *
+ */
+
+@Retention(RUNTIME) @Target({TYPE})
+public @interface PortletListener {
+   
+   /**
+    * The listener name. 
+    * <p>
+    * The listener name is not required. If a listener name is provided, the listener configuration
+    * may be addressed through the listener name in the portlet deployment descriptor to modify 
+    * or remove the listener.
+    * <p>
+    *  
+    * 
+    * @return  The listener name
+    */
+   String   listenerName() default "";
+   
+   /**
+    * The ordinal number for this annotated method.
+    * <p>
+    * The ordinal number determines the order of execution if multiple methods
+    * are annotated for a given URL type.
+    * Annotated methods with a lower ordinal number are executed before methods with
+    * a higher ordinal number.
+    * 
+    * @return     The ordinal number
+    */
+   int         ordinal() default 0;
+   
+   /**
+    * <div class='not-supported'>
+    * The display-name type contains a language-specific short name that is intended to be displayed by tools. 
+    * </div>
+    * 
+    * @return  The display name
+    */
+   LocaleString[]   displayName() default {};
+   
+   /**
+    * <div class='not-supported'>
+    * The portlet listener description
+    * providing locale-specific text describing the portlet listener for use by the portal application or by tools.
+    * </div>
+    * 
+    * @return  The portlet description
+    */
+   LocaleString[]   description() default {};
+}

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/58a39c39/portlet-api/src/main/java/javax/portlet/annotations/PortletRequestFilter.java
----------------------------------------------------------------------
diff --git a/portlet-api/src/main/java/javax/portlet/annotations/PortletRequestFilter.java b/portlet-api/src/main/java/javax/portlet/annotations/PortletRequestFilter.java
index 908d0de..d48127e 100644
--- a/portlet-api/src/main/java/javax/portlet/annotations/PortletRequestFilter.java
+++ b/portlet-api/src/main/java/javax/portlet/annotations/PortletRequestFilter.java
@@ -96,7 +96,7 @@ public @interface PortletRequestFilter {
     * 
     * @return     The portlet names
     */
-   String[]   portletNames();
+   String[]   portletNames() default "*";
    
    /**
     * <div class='not-supported'>

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/58a39c39/portlet-api/src/main/java/javax/portlet/annotations/PortletURLGenerationListener.java
----------------------------------------------------------------------
diff --git a/portlet-api/src/main/java/javax/portlet/annotations/PortletURLGenerationListener.java b/portlet-api/src/main/java/javax/portlet/annotations/PortletURLGenerationListener.java
deleted file mode 100644
index 1ad3af0..0000000
--- a/portlet-api/src/main/java/javax/portlet/annotations/PortletURLGenerationListener.java
+++ /dev/null
@@ -1,129 +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.
- */
-
-/*
- * This source code implements specifications defined by the Java
- * Community Process. In order to remain compliant with the specification
- * DO NOT add / change / or delete method signatures!
- */
-package javax.portlet.annotations;
-
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-import static java.lang.annotation.ElementType.*;
-import static java.lang.annotation.RetentionPolicy.*;
-
-
-/**
- * <div class='changed_added_3_0'>
- * Designates a portlet URL generation listener method.
- * The listener method will be invoked before a URL of the corresponding type is
- * generated.
- * <p>
- * The annotated method must have one of the following signatures:
- * <p>
- *    <code>public void &lt;methodName&gt;(ActionURL actionURL)</code>
- * <p>   
- * <p>
- *    <code>public void &lt;methodName&gt;(RenderURL renderURL)</code>
- * <p>   
- * <p>
- *    <code>public void &lt;methodName&gt;(ResourceURL resourceURL)</code>
- * <p>   
- * where the method name can be freely selected.
- * </div>
- *    
- * @see javax.portlet.PortletURLGenerationListener
- *
- */
-
-@Retention(RUNTIME) @Target({METHOD})
-public @interface PortletURLGenerationListener {
-   
-   /**
-    * <div class='changed_added_3_0'>
-    * Needed for V2.0 portlets to discern between a Render URL and an Action URL
-    * since both are represented by the interface PortletURL.
-    * 
-    * Not needed for v3.0 portlets.
-    * </div>
-    */
-   public enum URLType {RENDER, ACTION, RESOURCE}
-   
-   /**
-    * The portlet names for which the listener applies.
-    * <p>
-    * The annotated listener method can apply to multiple portlets within the portlet
-    * application. The names of the portlets to which the listener applies must be 
-    * specified in this field.
-    * <p>
-    * A wildcard character '*' can be specified in the first portletName array element 
-    * to indicate that the listener is to apply to all portlets in the portlet application.
-    * If specified, the wildcard character must appear alone in the first array element.
-    * 
-    * @return     The portlet names
-    */
-   String[]    portletNames();
-   
-   /**
-    * The ordinal number for this annotated method.
-    * <p>
-    * The ordinal number determines the order of execution if multiple methods
-    * are annotated for a given URL type.
-    * Annotated methods with a lower ordinal number are executed before methods with
-    * a higher ordinal number.
-    * 
-    * @return     The ordinal number
-    */
-   int         ordinal() default 0;
-   
-   /**
-    * <div class='not-supported'>
-    * The display-name type contains a language-specific short name that is intended to be displayed by tools. 
-    * </div>
-    * 
-    * @return  The display name
-    */
-   LocaleString[]   displayName() default {};
-   
-   /**
-    * <div class='not-supported'>
-    * The portlet filter description
-    * providing locale-specific text describing the portlet filter for use by the portal application or by tools.
-    * </div>
-    * 
-    * @return  The portlet description
-    */
-   LocaleString[]   description() default {};
-   
-   /**
-    * The URL Type. 
-    * This field is needed for v2.0 portlets to discern between render URLs and 
-    * action URLs, since both are represented by the interface PortletURL.
-    * 
-    * Needs not be specified for ResourceURLs, as they are identified by the
-    * ResourceURL interface.
-    * 
-    * Not needed for v3.0 portlets
-    * 
-    * @return  The URL type
-    */
-   URLType     type() default URLType.RENDER;
-}

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/58a39c39/portlet-api/src/main/java/javax/portlet/annotations/PreferencesValidator.java
----------------------------------------------------------------------
diff --git a/portlet-api/src/main/java/javax/portlet/annotations/PreferencesValidator.java b/portlet-api/src/main/java/javax/portlet/annotations/PreferencesValidator.java
index 2fe4751..fafc46e 100644
--- a/portlet-api/src/main/java/javax/portlet/annotations/PreferencesValidator.java
+++ b/portlet-api/src/main/java/javax/portlet/annotations/PreferencesValidator.java
@@ -33,25 +33,20 @@ import static java.lang.annotation.RetentionPolicy.*;
 
 /**
  * <div class='changed_added_3_0'>
- * Designates a preferences validator method.
+ * Designates a preferences validator class.
  * The PreferencesValidator allows validation of the set of portlet preferences 
  * before they are stored in the persistent store.
  * The validator method is invoked during execution of the 
  * store method of the PortletPreferences. 
  * <p>
- * The annotated method must have the following signature:
- * <p>
- *    <code>public void &lt;methodName&gt;(PortletPreferences preferences) throws ValidatorException</code>
- * <p>   
- * where the method name can be freely selected.
- * <p>
+ * The annotated class must implement the <code>PreferencesValidator</code> interface.
  * </div>
  *    
- * @see javax.portlet.PreferencesValidator#validate(javax.portlet.PortletPreferences) PreferencesValidator#validate
+ * @see javax.portlet.PreferencesValidator
  *
  */
 
-@Retention(RUNTIME) @Target({METHOD})
+@Retention(RUNTIME) @Target({TYPE})
 public @interface PreferencesValidator {
    
    /**
@@ -67,17 +62,5 @@ public @interface PreferencesValidator {
     * 
     * @return     The portlet names
     */
-   String[]   portletNames();
-   
-   /**
-    * The ordinal number for this annotated method.
-    * <p>
-    * The ordinal number determines the order of execution if multiple methods
-    * are annotated.
-    * Annotated methods with a lower ordinal number are executed before methods with
-    * a higher ordinal number.
-    * 
-    * @return     The ordinal number
-    */
-   int        ordinal() default 0;
+   String[]   portletNames() default "*";
 }

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/58a39c39/portlet-api/src/main/java/javax/portlet/annotations/SecurityRoleRef.java
----------------------------------------------------------------------
diff --git a/portlet-api/src/main/java/javax/portlet/annotations/SecurityRoleRef.java b/portlet-api/src/main/java/javax/portlet/annotations/SecurityRoleRef.java
index 30e6833..e143057 100644
--- a/portlet-api/src/main/java/javax/portlet/annotations/SecurityRoleRef.java
+++ b/portlet-api/src/main/java/javax/portlet/annotations/SecurityRoleRef.java
@@ -65,7 +65,7 @@ public @interface SecurityRoleRef {
     * It provides locale-specific text describing the security role ref for use by the portal application or by tools.
     * </div>
     * 
-    * @return  The portlet description
+    * @return  The security role reference description
     */
    LocaleString[]   description() default {};
 }

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/58a39c39/portlet-api/src/main/java/javax/portlet/annotations/package-info.java
----------------------------------------------------------------------
diff --git a/portlet-api/src/main/java/javax/portlet/annotations/package-info.java b/portlet-api/src/main/java/javax/portlet/annotations/package-info.java
index aa7cb4c..9e17489 100644
--- a/portlet-api/src/main/java/javax/portlet/annotations/package-info.java
+++ b/portlet-api/src/main/java/javax/portlet/annotations/package-info.java
@@ -80,7 +80,7 @@
  * <p>
  * Please see the following annotation descriptions:
  * {@link javax.portlet.annotations.PortletRequestFilter},
- * {@link javax.portlet.annotations.PortletURLGenerationListener}, and
+ * {@link javax.portlet.annotations.PortletListener}, and
  * {@link javax.portlet.annotations.PreferencesValidator}.
  * </ul>
  * <h4>Injectable Portlet Artifacts</h4>