Return-Path: X-Original-To: apmail-portals-pluto-scm-archive@www.apache.org Delivered-To: apmail-portals-pluto-scm-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C148C1872D for ; Fri, 27 Nov 2015 12:37:44 +0000 (UTC) Received: (qmail 99091 invoked by uid 500); 27 Nov 2015 12:37:44 -0000 Delivered-To: apmail-portals-pluto-scm-archive@portals.apache.org Received: (qmail 99012 invoked by uid 500); 27 Nov 2015 12:37:44 -0000 Mailing-List: contact pluto-scm-help@portals.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list pluto-scm@portals.apache.org Received: (qmail 97719 invoked by uid 99); 27 Nov 2015 12:37:43 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 27 Nov 2015 12:37:43 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 02CF0E00DE; Fri, 27 Nov 2015 12:37:43 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: msnicklous@apache.org To: pluto-scm@portals.apache.org Date: Fri, 27 Nov 2015 12:38:08 -0000 Message-Id: <6aaa10ee443b4304abe3a13c6a57b0f4@git.apache.org> In-Reply-To: <60e5badbb6394086b5395d70f027bc71@git.apache.org> References: <60e5badbb6394086b5395d70f027bc71@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [27/38] portals-pluto git commit: Integrated latest version of the portlet API 3.0. Made necessary minor adaptations the Pluto code and demo portlets to make the previously available funtionality work. For the partial action request, changed implementati http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/7fb0624d/portlet-api/src/main/java/javax/portlet/annotations/PortletConfiguration.java ---------------------------------------------------------------------- diff --git a/portlet-api/src/main/java/javax/portlet/annotations/PortletConfiguration.java b/portlet-api/src/main/java/javax/portlet/annotations/PortletConfiguration.java new file mode 100644 index 0000000..58bc397 --- /dev/null +++ b/portlet-api/src/main/java/javax/portlet/annotations/PortletConfiguration.java @@ -0,0 +1,236 @@ +/* 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.*; + + +/** + *
+ * Annotation for the portlet configuration. + * Many of these configuration parameters also appear in + * the portlet deployment descriptor. + *

+ * The portlet deployment descriptor can continue to be used. + * Values of configuration parameters appearing in the deployment descriptor have + * precedence over the corresponding values defined in the annotation. + *

+ */ +@Retention(RUNTIME) @Target({TYPE}) +public @interface PortletConfiguration { + + /** + * The portlet name for the annotated type. + * + * @return The portlet name + */ + String portletName(); + + /** + * The portlet initialization parameters. + * + * @return An array of initialization parameters + */ + InitParameter[] initParams() default {}; + + /** + * The portlet container runtime options. + * + * @return An array of portlet runtime options + */ + RuntimeOption[] runtimeOptions() default {}; + + /** + *
+ * The locales supported by the portlet. + * An array of String values, each of which represents a single locale. + *

+ * The locale is specified as a language tag as defined in + * IETF BCP 47, "Tags for Identifying Languages". + *

+ * + * @see java.util.Locale + * @see java.util.Locale#forLanguageTag forLanguageTag + * @see IETF BCP 47 + * + * @return An array of language tag strings + */ + String[] supportedLocales() default {"en"}; + + /** + *
+ * Locale specific static title for this portlet. + *
+ * + * @return The portlet title + */ + LocaleString[] title() default {}; + + /** + *
+ * Locale specific short version of the static title. + *
+ * + * @return The short title + */ + LocaleString[] shortTitle() default {}; + + /** + *
+ * The display-name type contains a locale-specific short name that is intended to be displayed by tools. + * It is used by display-name elements. + * The display name need not be unique. + *
+ * + * @return The display name + */ + LocaleString[] displayName() default {}; + + /** + *
+ * The portlet description. + * It provides locale-specific text describing the portlet for use by the portal application or by tools. + *
+ * + * @return The portlet description + */ + LocaleString[] description() default {}; + + /** + *
+ * Locale specific keywords associated with this portlet. + * The keywords are separated by commas within the value of the + * LocaleString array element. + *
+ * + * @return The keywords + */ + LocaleString[] keywords() default {}; + + /** + *
+ * The portlet preferences. + *
+ * + * @return The portlet preferences + */ + Preference[] prefs() default {}; + + /** + *
+ * The public render parameter identifiers used by the portlet. + *
+ * + * @return The array of public render parameters. + */ + String[] publicParams() default {}; + + /** + *
+ * Defines the content types supported by the portlet along with + * the associated portlet modes and window states. + *
+ * + * @return An array of content type support items + */ + ContentTypeSupport[] contentTypes() default {@ContentTypeSupport}; + + /** + *
+ * The resource bundle name for this portlet. + * Name of the resource bundle containing the language specific + * portlet information in different languages. + *

+ * the file name is specified without + * the language specific part (e.g. _en) or the file extension. + *

+ * + * @return The resource bundle name + */ + String resourceBundle() default ""; + + /** + *
+ * The supported portlet modes and window states. + *
+ * + * @return The supported portlet modes and window states + */ + Supports[] supports() default {}; + + /** + *
+ * The cache scope, which defines whether generated portlet content is private + * for the user or can be shared across different users. + *

+ * If this field is set to TRUE, cached information can be shared + * between users. + * Otherwise cached information will be considered private + * to the user. + *

+ * This value is set before the annotated method is called. + *

+ * + * @return The cache scope + */ + boolean cacheScopePublic() default false; + + /** + *
+ * Expiration-time defines the time in seconds after which the portlet output expires. + * A value of -1 indicates that the output never expires. + *

+ * This value is set before the annotated method is called. + *

+ * + * @return The expiration time + */ + int cacheExpirationTime() default 0; + + /** + *
+ * The dependencies the portlet may have on external resources. + * The resources can represent client-side prerequisites such as JavaScript libraries + * or stylesheet resources that are shared among portlets. + *
+ * + * @return The dependencies + */ + Dependency[] dependencies() default {}; + + /** + *
+ * The security role references. + *
+ * + * @return The security role references + */ + SecurityRoleRef[] roleRefs() default {}; +} http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/7fb0624d/portlet-api/src/main/java/javax/portlet/annotations/PortletConfigurations.java ---------------------------------------------------------------------- diff --git a/portlet-api/src/main/java/javax/portlet/annotations/PortletConfigurations.java b/portlet-api/src/main/java/javax/portlet/annotations/PortletConfigurations.java new file mode 100644 index 0000000..cf05926 --- /dev/null +++ b/portlet-api/src/main/java/javax/portlet/annotations/PortletConfigurations.java @@ -0,0 +1,51 @@ +/* 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.*; + + +/** + *
+ * Annotation for configuration of multiple portlets. + * @see PortletConfiguration + *
+ */ +@Retention(RUNTIME) @Target({TYPE}) +public @interface PortletConfigurations { + + /** + * The portlet configurations. Each array entry contains the configuration + * for a single portlet. + * + * @return An array of portlet configurations + */ + PortletConfiguration[] configurations(); +} http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/7fb0624d/portlet-api/src/main/java/javax/portlet/annotations/PortletQName.java ---------------------------------------------------------------------- diff --git a/portlet-api/src/main/java/javax/portlet/annotations/PortletQName.java b/portlet-api/src/main/java/javax/portlet/annotations/PortletQName.java new file mode 100644 index 0000000..3c5fccd --- /dev/null +++ b/portlet-api/src/main/java/javax/portlet/annotations/PortletQName.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. + */ + +/* + * 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.*; + + +/** + *
+ * This annotation is used within composite portlet configuration annotations to + * represent a QName for use in portlet event and public render parameter definitions. + * It cannot be used as a stand-alone portlet annotation. + *

+ * The qname is specified as a string of the form + * namespace-name:local-part, where + *

    + *
  • + * namespace-name is a URI specifying the namespace. + *
  • + *
  • + * local-part is a non-empty String. + *
  • + *
+ *
+ * + * @see javax.xml.namespace.QName javax.xml.namespace.QName + * @see W3C Qname definition + */ +@Retention(RUNTIME) @Target({ANNOTATION_TYPE}) +public @interface PortletQName { + + /** + * The QName namespace URI. + *

+ * If the QName namespace URI is empty, the default value is used. + * The default value is taken from the following locations, specified in order of precedence: + *

    + *
  • + * The value defined in the {@literal <}default-namespace{@literal >} element in the portlet + * deployment descriptor. + *
  • + *
  • + * The value defined in the {@literal <}defaultNamespace{@literal >} element in the + * {@literal @}PortletApplication annotation. + *
  • + *
  • + * The value javax.xml.XMLConstants.NULL_NS_URI + *
  • + *
+ * + * @return The QName namespace URI. + * + * @see PortletApplication#defaultNamespaceURI() + */ + String namespaceURI(); + + /** + * The local part. + *

+ * local-part should be a non-empty String. + * + * @return The qname local part. + */ + String localPart(); +} http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/7fb0624d/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 new file mode 100644 index 0000000..258aaed --- /dev/null +++ b/portlet-api/src/main/java/javax/portlet/annotations/PortletRequestFilter.java @@ -0,0 +1,129 @@ +/* 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.*; + + +/** + *

+ * Designates a portlet request filter class. + * The request filter performs filtering tasks on either the request to a portlet, + * on the response from a portlet, or on both. + *

+ * Request filters perform filtering in the doFilter method. + * Every Filter has access to a FilterConfig object from which it can obtain its + * initialization parameters and a reference to the PortletContext object. + * It can to load resources needed for filtering tasks through the PortletContext object. + *

+ * Request filters can be applied to the Action phase, the Event phase, the Render phase + * or the Resource phase depending on which of the filter interfaces the request filter class + * implements. + *

+ * The annotated type must implement one or more of the following interfaces: + *

    + *
  • javax.portlet.filter.PortletFilter
  • + *
  • javax.portlet.filter.ActionFilter
  • + *
  • javax.portlet.filter.EventFilter
  • + *
  • javax.portlet.filter.RenderFilter
  • + *
  • javax.portlet.filter.ResourceFilter
  • + *
+ *
+ * + * @see javax.portlet.filter.PortletFilter + * @see javax.portlet.filter.ActionFilter + * @see javax.portlet.filter.EventFilter + * @see javax.portlet.filter.RenderFilter + * @see javax.portlet.filter.ResourceFilter + * + */ + +@Retention(RUNTIME) @Target({TYPE}) +public @interface PortletRequestFilter { + + /** + *
+ * The portlet names for which the request filter applies. + *

+ * The annotated request filter can apply to multiple portlets within the portlet + * application. The names of the portlets to which the request filter applies must be + * specified in this field. + *

+ * A wildcard character '*' can be specified in the first portletName array element + * to indicate that the request filter 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 filter initialization parameters. + *
+ * + * @return An array of initialization parameters + */ + InitParameter[] initParams() default {}; + + /** + *
+ * The display-name type contains a language-specific short name that is intended to be displayed by tools. + *
+ * + * @return The display name + */ + LocaleString[] displayName() default {}; + + /** + *
+ * The portlet filter description + * providing locale-specific text describing the portlet filter for use by the portal application or by tools. + *
+ * + * @return The portlet description + */ + LocaleString[] description() default {}; + + /** + *
+ * The ordinal number for this annotated method. + *

+ * The ordinal number determines the order of execution if multiple methods + * are annotated for a given request 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; +} http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/7fb0624d/portlet-api/src/main/java/javax/portlet/annotations/PortletResources.java ---------------------------------------------------------------------- diff --git a/portlet-api/src/main/java/javax/portlet/annotations/PortletResources.java b/portlet-api/src/main/java/javax/portlet/annotations/PortletResources.java new file mode 100644 index 0000000..232e000 --- /dev/null +++ b/portlet-api/src/main/java/javax/portlet/annotations/PortletResources.java @@ -0,0 +1,153 @@ +/* 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.*; + + +/** + *
+ * Declares resources needed by one or more portlets in a portlet application. + * The resources may be provided by the portlet for inclusion into the header section + * through the GenericPortlet#doHeaders method + * or may represent dependencies on external resources. + *

+ * The annotated method must have one of the following signatures: + *

    + *
  • + * public void <methodName>(RenderRequest, RenderResponse) + *

    + * This corresponds to the doHeaders method. Output written through the + * render response object will be placed in the document <head> section. + *

  • + *
  • + * String <methodName>() + *

    + * The String returned by the method will be placed + * in the document <head> section. + *

  • + *
+ *

+ * The method name can be freely selected. + *

+ * The method declaration may contain a throws clause. Exceptions declared in the + * throws clause should be of type {@link javax.portlet.PortletException} or + * {@link java.io.IOException}. + * Checked exceptions of any other type will be caught, wrapped with a PortletException, + * and rethrown. + *

+ * This annotation may be applied to a type or to a method. + * If applied to a type, it behaves as though it were applied to an empty + * doHeaders method. + *

+ * + * @see javax.portlet.GenericPortlet#doHeaders(javax.portlet.RenderRequest, javax.portlet.RenderResponse) doHeaders + */ + +@Retention(RUNTIME) @Target({METHOD}) +public @interface PortletResources { + + /** + *
+ * The portlet names for which the resources apply. + *

+ * The annotated method can apply to multiple portlets within the portlet + * application. The names of the portlets to which the resources apply must be + * specified in this field. + *

+ * A wildcard character '*' can be specified in the first portletName array element + * to indicate that the resource declarations are 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(); + + /** + *
+ * Sets the content type, or the MIME type, of content generated by the method. + * The content type will be set before the annotated method body is executed. + *

+ * If this field is empty, no content type will be set. + * The portlet can then set the content type using the portlet API + * RenderResponse#setContentType method. + *

+ * + * @see javax.portlet.RenderResponse#setContentType(String) RenderResponse#setContentType + * + * @return The content type + */ + String contentType() default "text/html"; + + /** + *
+ * Specifies a resource, such as a JSP, an HTML file, or a servlet, to be included. + *

+ * The resource will be included using the + * PortletRequestDispatcher#include method after the method body + * has been executed. + *

+ * If this field is empty, no resource will be included. + *

+ * + * @see javax.portlet.PortletRequestDispatcher + * @see javax.portlet.PortletRequestDispatcher#include(javax.portlet.PortletRequest, javax.portlet.PortletResponse) PortletRequestDispatcher#include + * + * @return The resource to be included + */ + String include() default ""; + + /** + *
+ * The dependencies the portlet may have on external resources. + * The resources can represent client-side prerequisites such as JavaScript libraries + * or stylesheet resources that are shared among portlets. + *
+ * + * @return The dependencies + */ + Dependency[] dependencies() default {}; + + /** + *
+ * The ordinal number for this annotated method. + *

+ * 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; +} http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/7fb0624d/portlet-api/src/main/java/javax/portlet/annotations/PortletSerializable.java ---------------------------------------------------------------------- diff --git a/portlet-api/src/main/java/javax/portlet/annotations/PortletSerializable.java b/portlet-api/src/main/java/javax/portlet/annotations/PortletSerializable.java new file mode 100644 index 0000000..0e1e20a --- /dev/null +++ b/portlet-api/src/main/java/javax/portlet/annotations/PortletSerializable.java @@ -0,0 +1,84 @@ +/* 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; + +/** + *
+ * This interface must be implemented by {@link PortletStateScoped} beans + * in order to allow the bean portlet container to intialize the bean at the + * beginning of a request and passivate the bean at the end of the request. + *

+ * These methods are not intended to be called by application code. + *

+ * A {@literal @}PortletStateScoped bean must be a valid bean; in particular, + * it must provide a default constructor or be constructable through an + * {@literal @}Produces method or field. + *

+ * Note that only changes made to the bean state during ActionMethod + * or EventMethod execution are stored in the portlet state. + * Changes made during RenderMethod, ServeResourceMethod, + * or HeaderMethod execution will not be available during subsequent requests. + *

+ * + * @see PortletStateScoped + */ +public interface PortletSerializable { + + /** + * The portlet bean container calls this method after {@link ActionMethod} + * or {@link EventMethod} execution to obtain the bean state. + *

+ * The bean developer should take care to include all internal bean data in the + * returned state that is necessary for properly initializing the bean when the + * portlet bean container calls the + * {@link PortletSerializable#deserialize(String[]) deserialize} method. + *

+ * If no bean data has been set, this method should return an empty array or + * null in order to avoid setting extraneous parameters. + * + * @return The bean state as a string array. + */ + public String[] serialize(); + + /** + * The bean portlet container calls this method at the beginning of every portlet + * request method that uses the bean. + *

+ * The string array portlet state data is the same array provided to the container + * by the {@link PortletSerializable#serialize() serialize} method. + * The bean should reconstruct its internal state during execution of this method. + *

+ * If no data is available for the portlet, for example because because no + * {@link ActionMethod} or {@link EventMethod} has been executed for the portlet, + * the state parameter will be an empty array. + *

+ * If the state array is empty, the bean implementation should provide approriate + * default values for its internal variables. + * + * @param state The bean state as string array. + * The array will be empty if bean data has not yet been set. + */ + public void deserialize(String[] state); +} http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/7fb0624d/portlet-api/src/main/java/javax/portlet/annotations/PortletSessionScoped.java ---------------------------------------------------------------------- diff --git a/portlet-api/src/main/java/javax/portlet/annotations/PortletSessionScoped.java b/portlet-api/src/main/java/javax/portlet/annotations/PortletSessionScoped.java new file mode 100644 index 0000000..f10d83a --- /dev/null +++ b/portlet-api/src/main/java/javax/portlet/annotations/PortletSessionScoped.java @@ -0,0 +1,76 @@ +/* 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.Documented; +import java.lang.annotation.Inherited; +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import javax.enterprise.context.NormalScope; +import javax.portlet.PortletSession; + +import static java.lang.annotation.ElementType.*; +import static java.lang.annotation.RetentionPolicy.*; + + +/** + *

+ * Provides a CDI custom scope that is scoped to the portlet session rather than to the + * servlet session. + *

+ * Note that a portlet session scoped bean must implement + * java.io.Serializable, since it will be stored in the portlet session. + *

+ * + */ + +@Retention(RUNTIME) +@Target({TYPE}) +@NormalScope(passivating=true) +@Inherited +@Documented +public @interface PortletSessionScoped { + + /** + * The portlet scope into which the annotated bean is to be placed. Can be set to + * the following values: + *
    + *
  • + * PortletSession.PORTLET_SCOPE - scopes the bean to the portlet session + *
  • + *
  • + * PortletSession.APPLICATION_SCOPED - Scopes the bean to the portlet application session. + * The effect of this scope is the same as using the CDI @SessionScoped annotation. + *
  • + *
+ * + * @return The portlet scope + * + * @see PortletSession#PORTLET_SCOPE + * @see PortletSession#APPLICATION_SCOPE + */ + int value() default PortletSession.PORTLET_SCOPE; +} http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/7fb0624d/portlet-api/src/main/java/javax/portlet/annotations/PortletStateScoped.java ---------------------------------------------------------------------- diff --git a/portlet-api/src/main/java/javax/portlet/annotations/PortletStateScoped.java b/portlet-api/src/main/java/javax/portlet/annotations/PortletStateScoped.java new file mode 100644 index 0000000..3c7d4a1 --- /dev/null +++ b/portlet-api/src/main/java/javax/portlet/annotations/PortletStateScoped.java @@ -0,0 +1,96 @@ +/* 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.Inherited; +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import javax.enterprise.context.NormalScope; + +import static java.lang.annotation.ElementType.*; +import static java.lang.annotation.RetentionPolicy.*; + + +/** + *
+ * Provides a CDI custom scope that is scoped to the portlet state. + * The purpose of this scope is to allow portlet render parameters to be handled like + * beans. + *

+ * If an {@literal @}PortletStateScoped bean is injected into a class containing + * an {@literal @}EventMethod or an {@literal @}ActionMethod, + * the bean is associated with the corresponding portlet. + * The bean state is stored as a render parameter of the that portlet. + *

+ * A bean annotated with this scope must implement the {@link PortletSerializable} + * interface, + * which provides methods used by the portlet bean container to synchronize the bean + * according to the portlet state. + *

+ * An {@literal @}PortletStateScoped bean is similar to an + * {@literal @}RequestScoped bean in that a new instance is created at the + * beginning of each request. + * However, for {@literal @}PortletStateScopedScoped beans, the portlet bean + * container calls the + * {@link PortletSerializable#deserialize(String[]) PortletSerializable#deserialize} + * method at the beginning of each request to initialize the bean and the + * {@link PortletSerializable#serialize() PortletSerializable#serialize} method + * at the end of an action request or event request to obtain the serialized bean data. + *

+ * A {@literal @}PortletStateScoped bean must be a valid bean and + * must provide a default constructor. + *

+ * Note that only changes made to the bean state during ActionMethod + * or EventMethod execution are stored in the portlet state. + * Changes made during RenderMethod, ServeResourceMethod, + * or HeaderMethod execution will not be available during subsequent requests. + *

+ * + * @see PortletSerializable + */ + +@Retention(RUNTIME) +@Target({TYPE}) +@NormalScope() +@Inherited +public @interface PortletStateScoped { + + /** + * The name of the render parameter under which the bean state is to be stored. + *

+ * If the name is not specified through the annotation, the portlet container + * will assign a render parameter name. + *

+ * If this element is a public render parameter identifier as declared in the + * portlet application configuration, + * the render parameter represented by the annotated class will be treated as + * a public render parameter. + * + * @return The parameter name + */ + String paramName() default ""; +} http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/7fb0624d/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 new file mode 100644 index 0000000..1ad3af0 --- /dev/null +++ b/portlet-api/src/main/java/javax/portlet/annotations/PortletURLGenerationListener.java @@ -0,0 +1,129 @@ +/* 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.*; + + +/** + *

+ * Designates a portlet URL generation listener method. + * The listener method will be invoked before a URL of the corresponding type is + * generated. + *

+ * The annotated method must have one of the following signatures: + *

+ * public void <methodName>(ActionURL actionURL) + *

+ *

+ * public void <methodName>(RenderURL renderURL) + *

+ *

+ * public void <methodName>(ResourceURL resourceURL) + *

+ * where the method name can be freely selected. + *

+ * + * @see javax.portlet.PortletURLGenerationListener + * + */ + +@Retention(RUNTIME) @Target({METHOD}) +public @interface PortletURLGenerationListener { + + /** + *
+ * 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. + *
+ */ + public enum URLType {RENDER, ACTION, RESOURCE} + + /** + * The portlet names for which the listener applies. + *

+ * 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. + *

+ * 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. + *

+ * 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; + + /** + *

+ * The display-name type contains a language-specific short name that is intended to be displayed by tools. + *
+ * + * @return The display name + */ + LocaleString[] displayName() default {}; + + /** + *
+ * The portlet filter description + * providing locale-specific text describing the portlet filter for use by the portal application or by tools. + *
+ * + * @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/7fb0624d/portlet-api/src/main/java/javax/portlet/annotations/Preference.java ---------------------------------------------------------------------- diff --git a/portlet-api/src/main/java/javax/portlet/annotations/Preference.java b/portlet-api/src/main/java/javax/portlet/annotations/Preference.java new file mode 100644 index 0000000..1bfa5ca --- /dev/null +++ b/portlet-api/src/main/java/javax/portlet/annotations/Preference.java @@ -0,0 +1,73 @@ +/* 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.*; + + +/** + *
+ * This annotation is used within composite portlet configuration annotations to + * represent a single portlet preference. + * It cannot be used as a stand-alone portlet annotation. + *
+ */ +@Retention(RUNTIME) @Target({ANNOTATION_TYPE}) +public @interface Preference { + + /** + * The preference name. + * + * @return The preference name + */ + String name(); + + /** + * The preference values array. + * + * @return The preference values. + */ + String[] values(); + + /** + * Marks the preference as being read-only. + * + * @return The read-only flag + */ + boolean isReadOnly() default false; + + /** + *
+ * Provides locale-specific text describing the portlet preference for use by the portal application or by tools. + *
+ * + * @return The portlet preference description + */ + LocaleString[] description() default {}; +} http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/7fb0624d/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 new file mode 100644 index 0000000..2fe4751 --- /dev/null +++ b/portlet-api/src/main/java/javax/portlet/annotations/PreferencesValidator.java @@ -0,0 +1,83 @@ +/* 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.*; + + +/** + *
+ * Designates a preferences validator method. + * 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. + *

+ * The annotated method must have the following signature: + *

+ * public void <methodName>(PortletPreferences preferences) throws ValidatorException + *

+ * where the method name can be freely selected. + *

+ *

+ * + * @see javax.portlet.PreferencesValidator#validate(javax.portlet.PortletPreferences) PreferencesValidator#validate + * + */ + +@Retention(RUNTIME) @Target({METHOD}) +public @interface PreferencesValidator { + + /** + * The portlet names for which the validator applies. + *

+ * The annotated validator method can apply to multiple portlets within the portlet + * application. The names of the portlets to which the validator applies must be + * specified in this field. + *

+ * A wildcard character '*' can be specified in the first portletName array element + * to indicate that the validator 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. + *

+ * 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; +} http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/7fb0624d/portlet-api/src/main/java/javax/portlet/annotations/PublicRenderParameterDefinition.java ---------------------------------------------------------------------- diff --git a/portlet-api/src/main/java/javax/portlet/annotations/PublicRenderParameterDefinition.java b/portlet-api/src/main/java/javax/portlet/annotations/PublicRenderParameterDefinition.java new file mode 100644 index 0000000..fed9df8 --- /dev/null +++ b/portlet-api/src/main/java/javax/portlet/annotations/PublicRenderParameterDefinition.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.*; + + +/** + *

+ * This annotation is used within composite portlet configuration annotations to + * represent a single public render parameter. + * It cannot be used as a stand-alone portlet annotation. + *
+ */ +@Retention(RUNTIME) @Target({ANNOTATION_TYPE}) +public @interface PublicRenderParameterDefinition { + + /** + *
+ * The public render parameter identifier. + *

+ * This identifier is used as the public render parameter name in the + * portlet parameter handling interfaces. + *

+ * The public render parameter identifier must be unique within the portlet application. + *

+ * + * @see javax.portlet.PortletConfig#getPublicRenderParameterNames() PortletConfig#getPublicRenderParameterNames + * + * @return The public render parameter identifier + */ + String identifier(); + + /** + *
+ * The public render parameter Qname. + *

+ * The public render parameter qname must be unique within the portlet application. + *

+ * + * @see javax.xml.namespace.QName + * @see Qname definition + * + * @return The qname + */ + PortletQName qname(); + + /** + *
+ * Provides locale-specific text describing the public render parameter for use by the portal application or by tools. + *
+ * + * @return The public render parameter description + */ + LocaleString[] description() default {}; + + /** + *
+ * The display-name type contains a locale-specific short name that is intended to be displayed by tools. + * It is used by display-name elements. + * The display name need not be unique. + *
+ * + * @return The display name + */ + LocaleString[] displayName() default {}; +} http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/7fb0624d/portlet-api/src/main/java/javax/portlet/annotations/RenderMethod.java ---------------------------------------------------------------------- diff --git a/portlet-api/src/main/java/javax/portlet/annotations/RenderMethod.java b/portlet-api/src/main/java/javax/portlet/annotations/RenderMethod.java new file mode 100644 index 0000000..7ccc463 --- /dev/null +++ b/portlet-api/src/main/java/javax/portlet/annotations/RenderMethod.java @@ -0,0 +1,143 @@ +/* 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 static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + + +/** + *
+ * Designates a method corresponding to the portlet API render method. + * The annotated method must have one of the following signatures: + *

+ * The annotated method must have one of the following signatures: + *

    + *
  • + * public void <methodName>(RenderRequest, RenderResponse) + *

    + * This corresponds to the render method. + *

  • + *
  • + * public String <methodName>() + *

    + * The String returned by the method will be written to the response unchanged. + *

  • + *
  • + * public void <methodName>() + *

    + * Intended for use when only a resource include is needed. + *

  • + *
+ * where the method name can be freely selected. + *

+ * The method declaration may contain a throws clause. Exceptions declared in the + * throws clause should be of type {@link javax.portlet.PortletException} or + * {@link java.io.IOException}. + * Checked exceptions of any other type will be caught, wrapped with a PortletException, + * and rethrown. + *

+ * + * @see javax.portlet.Portlet#render(javax.portlet.RenderRequest, javax.portlet.RenderResponse) Portlet#render + * + */ + +@Retention(RUNTIME) @Target({METHOD}) +public @interface RenderMethod { + + /** + * The portlet names for which the render method applies. + *

+ * The annotated method can apply to multiple portlets within the portlet + * application. The names of the portlets to which the resources apply must be + * specified in this field. + *

+ * A wildcard character '*' can be specified in the first portletName array element + * to indicate that the resource declarations are 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 portlet mode rendered by the annotated method. + *

+ * If an portlet mode is specified, the bean enabler will dispatch Render requests with + * matching portlet mode values to this method. + *

+ * If this field is empty, the method will be executed for all + * Render requests not dispatched by portlet mode to other RenderMethods. + * + * @return The portlet mode + */ + String portletMode() default "view"; + + /** + * Sets the content type, or the MIME type, of content generated by the method. + * The content type will be set before the annotated method body is executed. + *

+ * If this field is empty, no content type will be set. + * The portlet can then set the content type using the portlet API + * RenderResponse#setContentType method. + * + * @see javax.portlet.RenderResponse#setContentType(String) RenderResponse#setContentType + * + * @return The content type + */ + String contentType() default "text/html"; + + /** + * Specifies a resource, such as a JSP, an HTML file, or a servlet to be included. + *

+ * The resource will be included using the + * PortletRequestDispatcher#include method after the method body + * has been executed. + *

+ * If this field is empty, no resource will be included. + * + * @see javax.portlet.PortletRequestDispatcher + * @see javax.portlet.PortletRequestDispatcher#include(javax.portlet.PortletRequest, javax.portlet.PortletResponse) PortletRequestDispatcher#include + * + * @return The resource to be included + */ + String include() default ""; + + /** + * The ordinal number for this annotated method. + *

+ * 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; +} http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/7fb0624d/portlet-api/src/main/java/javax/portlet/annotations/RenderParam.java ---------------------------------------------------------------------- diff --git a/portlet-api/src/main/java/javax/portlet/annotations/RenderParam.java b/portlet-api/src/main/java/javax/portlet/annotations/RenderParam.java new file mode 100644 index 0000000..3246fd3 --- /dev/null +++ b/portlet-api/src/main/java/javax/portlet/annotations/RenderParam.java @@ -0,0 +1,68 @@ +/* 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 javax.enterprise.util.Nonbinding; +import javax.inject.Qualifier; + +import static java.lang.annotation.ElementType.*; +import static java.lang.annotation.RetentionPolicy.*; + + +/** + *

+ * Qualifier that specifies an action parameter for injection. + * The parameter will be null if accessed during action + * request execution. + *

+ * The type of the injection target must be String or String[]. + *

+ * This annotation may only be used in an {@literal @}RequestScoped or + * {@literal @}PortletStateScoped bean. + *

+ * Example: + *

+ * {@literal @}Inject {@literal @}RenderParam("paramName")
+ * private String param; + *
+ *
+ * + * @see javax.portlet.PortletRequest#getParameter(String) getParameter + * @see javax.portlet.PortletRequest#getParameterValues(String) getParameterValues + */ + +@Qualifier @Retention(RUNTIME) @Target({METHOD, FIELD, PARAMETER}) +public @interface RenderParam { + + /** + * The parameter name. + * + * @return The parameter name. + */ + @Nonbinding String value(); +} http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/7fb0624d/portlet-api/src/main/java/javax/portlet/annotations/ResourceParam.java ---------------------------------------------------------------------- diff --git a/portlet-api/src/main/java/javax/portlet/annotations/ResourceParam.java b/portlet-api/src/main/java/javax/portlet/annotations/ResourceParam.java new file mode 100644 index 0000000..5956c8a --- /dev/null +++ b/portlet-api/src/main/java/javax/portlet/annotations/ResourceParam.java @@ -0,0 +1,77 @@ +/* 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 javax.enterprise.util.Nonbinding; +import javax.inject.Qualifier; + +import static java.lang.annotation.ElementType.*; +import static java.lang.annotation.RetentionPolicy.*; + + +/** + *
+ * Qualifier that specifies an resource parameter for injection. + * The parameter will be null if accessed outside of a serve resource method. + *

+ * Note that this method will only return resource parameters, not render parameters. + * To access render parameters within a serve resource method, use the + * {@link RenderParam} annotation. + * However, if the specified name addresses both a resource parameter and a private render + * parameter, the injected bean will contain both sets of values, with the + * render parameter entries following the resource parameter entries in the values array. + *

+ * The type of the injection target must be String or String[]. + *

+ * This annotation may only be used in {@literal @}RequestScoped or + * {@literal @}PortletStateScoped beans. + *

+ * Example: + *

+ * {@literal @}Inject {@literal @}ResourceParam("paramName")
+ * private String[] paramValues; + *
+ *
+ * + * @see javax.portlet.PortletRequest#getParameter(String) getParameter + * @see javax.portlet.PortletRequest#getParameterValues(String) getParameterValues + * @see javax.portlet.ResourceRequest#getPrivateRenderParameterMap() getPrivateRenderParameterMap + * + * @see RenderParam + */ + +@Qualifier @Retention(RUNTIME) @Target({METHOD, FIELD, PARAMETER}) +public @interface ResourceParam { + + /** + * The parameter name. + * + * @return The parameter name. + */ + @Nonbinding String value(); +} http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/7fb0624d/portlet-api/src/main/java/javax/portlet/annotations/RuntimeOption.java ---------------------------------------------------------------------- diff --git a/portlet-api/src/main/java/javax/portlet/annotations/RuntimeOption.java b/portlet-api/src/main/java/javax/portlet/annotations/RuntimeOption.java new file mode 100644 index 0000000..98a8da0 --- /dev/null +++ b/portlet-api/src/main/java/javax/portlet/annotations/RuntimeOption.java @@ -0,0 +1,58 @@ +/* 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.*; + + +/** + *
+ * This annotation is used within composite portlet configuration annotations to + * represent portlet container runtime option name-value pairs. + * It cannot be used as a stand-alone portlet annotation. + *
+ */ +@Retention(RUNTIME) @Target({ANNOTATION_TYPE}) +public @interface RuntimeOption { + + /** + * The container runtime option name. + * + * @return The parameter name + */ + String name(); + + /** + * The container runtime options value + * + * @return The parameter value + */ + String value(); +} http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/7fb0624d/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 new file mode 100644 index 0000000..a371110 --- /dev/null +++ b/portlet-api/src/main/java/javax/portlet/annotations/SecurityRoleRef.java @@ -0,0 +1,61 @@ +/* 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.*; + + +/** + *
+ * This annotation is used within composite portlet configuration annotations to + * represent a single security role reference. + * It cannot be used as a stand-alone portlet annotation. + *
+ */ +@Retention(RUNTIME) @Target({ANNOTATION_TYPE}) +public @interface SecurityRoleRef { + + /** + *
+ * The role name. + *
+ * + * @return The role name + */ + String roleName(); + + /** + *
+ * The application role that the role name is mapped to. + *
+ * + * @return The role link + */ + String roleLink() default ""; +} http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/7fb0624d/portlet-api/src/main/java/javax/portlet/annotations/ServeResourceMethod.java ---------------------------------------------------------------------- diff --git a/portlet-api/src/main/java/javax/portlet/annotations/ServeResourceMethod.java b/portlet-api/src/main/java/javax/portlet/annotations/ServeResourceMethod.java new file mode 100644 index 0000000..af64501 --- /dev/null +++ b/portlet-api/src/main/java/javax/portlet/annotations/ServeResourceMethod.java @@ -0,0 +1,157 @@ +/* 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 static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + + +/** + *
+ * Designates a method corresponding to the portlet API serveResource method. + *

+ * The annotated method must have one of the following signatures: + *

    + *
  • + * public void <methodName>(ResourceRequest, ResourceResponse) + *

    + * This corresponds to the serveResource method. + *

  • + *
  • + * public String <methodName>() + *

    + * The String returned by the method will be written to the response unchanged. + *

  • + *
  • + * public void <methodName>() + *

    + * Intended for use when only a resource include is needed. + *

  • + *
+ * where the method name can be freely selected. + *

+ * The method declaration may contain a throws clause. Exceptions declared in the + * throws clause should be of type {@link javax.portlet.PortletException} or + * {@link java.io.IOException}. + * Checked exceptions of any other type will be caught, wrapped with a PortletException, + * and rethrown. + *

+ * + * @see javax.portlet.ResourceServingPortlet#serveResource(javax.portlet.ResourceRequest, javax.portlet.ResourceResponse) ResourceServingPortlet#serveResource + * + */ + +@Retention(RUNTIME) @Target({METHOD}) +public @interface ServeResourceMethod { + + /** + * The portlet names for which the serve resource method applies. + *

+ * The annotated method can apply to multiple portlets within the portlet + * application. The names of the portlets to which the resources apply must be + * specified in this field. + *

+ * A wildcard character '*' can be specified in the first portletName array element + * to indicate that the resource declarations are 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 resource ID. + *

+ * If a resource ID is specified, the bean enabler will dispatch Resource requests with + * matching values of the resource ID to this method. + *

+ * If this field is empty, + * the method will be executed for all Resource requests not dispatched + * to other named ResourceMethods. + * + * @return The resource ID + */ + String resourceID() default ""; + + /** + * Sets the character encoding for content generated by the annotated method. + * The character encoding will be set before the annotated method body is executed. + *

+ * If this field is empty, the character encoding will not be set. + * The portlet can then set the character encoding using the portlet API + * ResourceResponse#setCharacterEncoding method. + * + * @see javax.portlet.ResourceResponse#setCharacterEncoding(String) ResourceResponse#setCharacterEncoding + * + * @return The character encoding + */ + String characterEncoding() default "UTF-8"; + + /** + * Sets the content type, or the MIME type, of content generated by the method. + * The content type will be set before the annotated method body is executed. + *

+ * If this field is empty, no content type will be set. + * The portlet can then set the content type using the portlet API + * ResourceResponse#setContentType method. + * + * @see javax.portlet.ResourceResponse#setContentType(String) ResourceResponse#setContentType + * + * @return The content type + */ + String contentType() default "text/html"; + + /** + * Specifies a resource, such as a JSP, an HTML file, or a servlet, to be included. + *

+ * The resource will be included using the + * PortletRequestDispatcher#include method after the method body + * has been executed. + *

+ * If this field is empty, no resource will be included. + * + * @see javax.portlet.PortletRequestDispatcher + * @see javax.portlet.PortletRequestDispatcher#include(javax.portlet.PortletRequest, javax.portlet.PortletResponse) PortletRequestDispatcher#include + * + * @return The resource to be included + */ + String include() default ""; + + /** + * The ordinal number for this annotated method. + *

+ * 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; +} http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/7fb0624d/portlet-api/src/main/java/javax/portlet/annotations/Supports.java ---------------------------------------------------------------------- diff --git a/portlet-api/src/main/java/javax/portlet/annotations/Supports.java b/portlet-api/src/main/java/javax/portlet/annotations/Supports.java new file mode 100644 index 0000000..c9c0e37 --- /dev/null +++ b/portlet-api/src/main/java/javax/portlet/annotations/Supports.java @@ -0,0 +1,74 @@ +/* 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.*; + + +/** + *

+ * This annotation is used within composite portlet configuration annotations to + * specify the supported portlet modes and window states for a given locale. + * It cannot be used as a stand-alone portlet annotation. + *
+ */ +@Retention(RUNTIME) @Target({ANNOTATION_TYPE}) +public @interface Supports { + + /** + *
+ * The MIME type for the supported portlet modes and window + * states listed in this annotation, for example "text{@literal /}html". + *

+ * The MIME type may also contain the wildcard character '*', + * for example "text{@literal /}*" or "*{@literal /}*". + *

+ * + * @return The mime type + */ + String mimeType() default "text/html"; + + /** + *
+ * The names of the supported portlet modes. + *
+ * + * @return The supported portlet modes + */ + String[] portletModes() default ""; + + /** + *
+ * The names of the supported window states. + *
+ * + * @return The supported window states + */ + String[] windowStates() default ""; +}