1   /*
2    * Copyright 2000-2001,2004 The Apache Software Foundation.
3    * 
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    * 
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    * 
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  
17  /* 
18  
19   */
20  
21  package org.apache.wsrp4j.producer.provider;
22  
23  import oasis.names.tc.wsrp.v1.types.PortletDescription;
24  import oasis.names.tc.wsrp.v1.types.RegistrationContext;
25  import oasis.names.tc.wsrp.v1.types.ServiceDescription;
26  import oasis.names.tc.wsrp.v1.types.UserContext;
27  
28  import org.apache.wsrp4j.exception.WSRPException;
29  
30  /**
31   * This interface provides methods to access portlet descriptions as well as
32   * the service description.
33   *
34   * @author Stefan Behl
35   *
36   */
37  public interface DescriptionHandler {
38  
39      /**
40       * Returns a ServiceDescription, based on the input arguments.
41       * See the getProducerOfferedPortletDescriptions() method for more details.
42       * 
43       * @param regContext         contains data related to a particular registration
44       *                           (e.g. the registration handle and state)
45       * @param desiredLocales     array of requested locales, if null request all available locales
46       * 
47       */
48      public ServiceDescription getServiceDescription(
49              RegistrationContext regContext, String[] desiredLocales)
50              throws WSRPException;
51  
52      /**
53       * Indicates whether registration is required (for this Producer) or not.
54       * 
55       * @return Returns true if registration is required, otherwise false. 
56       */
57      public boolean isRegistrationRequired() throws WSRPException;
58  
59      /**
60       * Returns an array containing all portlet descriptions, i.e. one portlet
61       * description per producer offered portlet.
62       * 
63       * @param regContext         contains data related to a particular registration
64       *                           (e.g. the registration handle and state)
65       * @param desiredLocales     array of requested locales, if null request all available locales
66       * 
67       * @return    Array of PortletDescription-objects.
68       */
69      public PortletDescription[] getProducerOfferedPortletDescriptions(
70              RegistrationContext regContext, String[] desiredLocales)
71              throws WSRPException;
72  
73      /**
74       * Returns an PortletDescription for the given PortletHandle based on the input
75       * arguments. On how the desiredLocales and sendAllLocales parameter affects the
76       * returned PortletDescription, please see the method getProducerOfferedPortletDescriptions().
77       * 
78       * @param portletHandle      the handle of a particular portlet
79       * @param regContext         contains data related to a particular registration
80       *                           (e.g. the registration handle and state)
81       * @param userContext        contains the user context
82       * @param desiredLocales     array of requested locales, if null request all available locales
83       * 
84       * @return PortletDescription
85       */
86      public PortletDescription getPortletDescription(String portletHandle,
87              RegistrationContext regContext, UserContext userContext,
88              String[] desiredLocales) throws WSRPException;
89  
90      /**
91       * Returns a complete PortletDescription for the given PortletHandle.
92       * 
93       * @param portletHandle      the handle of a particular portlet
94       * 
95       * @return PortletDescription
96       */
97      public PortletDescription getPortletDescription(String portletHandle)
98              throws WSRPException;
99  
100 }