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  package org.apache.wsrp4j.consumer;
18  
19  import oasis.names.tc.wsrp.v1.types.BlockingInteractionResponse;
20  import oasis.names.tc.wsrp.v1.types.DestroyPortletsResponse;
21  import oasis.names.tc.wsrp.v1.types.MarkupResponse;
22  import oasis.names.tc.wsrp.v1.types.PortletContext;
23  import oasis.names.tc.wsrp.v1.types.PortletDescriptionResponse;
24  import oasis.names.tc.wsrp.v1.types.PortletPropertyDescriptionResponse;
25  import oasis.names.tc.wsrp.v1.types.PropertyList;
26  import oasis.names.tc.wsrp.v1.types.ReturnAny;
27  
28  import org.apache.wsrp4j.exception.WSRPException;
29  
30  /**
31   * The portlet driver is a wrapper for all action which can be performed on an
32   * portlet. There is one portlet driver for all instances of an portlet.
33   */
34  public interface PortletDriver {
35  
36      /**
37       * Get the portlet this driver is bound to.
38       * 
39       * @return The enity
40       **/
41      public WSRPPortlet getPortlet();
42  
43      /**
44       * This method is used to retrieve the markup generated by the portlet instance.
45       * 
46       * @param markupRequest The markup request 
47       * @return The markup response generated by portlet
48       **/
49      public MarkupResponse getMarkup(MarkupRequest markupRequest, String userID)
50              throws WSRPException;
51  
52      /**
53       * This method is used to perform a blocking interaction on the portlet instance.
54       * 
55       * @param actionRequest The interaction request 
56       **/
57      public BlockingInteractionResponse performBlockingInteraction(
58              InteractionRequest actionRequest, String userID)
59              throws WSRPException;
60  
61      /**
62       * Clone the portlet
63       * 
64       * @return The new portlet context
65       **/
66      public PortletContext clonePortlet(String userID) throws WSRPException;
67  
68      /**
69       * 
70       **/
71      public void initCookie() throws WSRPException;
72  
73      /**
74       * Destroy the producer portlets specified in the entiyHandles array.    
75       **/
76      public DestroyPortletsResponse destroyPortlets(String[] portletHandles,
77              String userID) throws WSRPException;
78  
79      /**
80       * Inform the producer that the sessions specified in the sessionIDs array
81       * will no longer be used by the consumer and can therefor be released.     
82       **/
83      public ReturnAny releaseSessions(String[] sessionIDs, String userID)
84              throws WSRPException;
85  
86      /**
87       * Fetches information about the portlet from the producer. 
88       * 
89       * @param userID is used to get the user context of the user from the user registry
90       * @param desiredLocales Array of locales the description should be provided
91       * @return The response to the getPortletDescription call.
92       **/
93      public PortletDescriptionResponse getPortletDescription(String userID,
94              String[] desiredLocales) throws WSRPException;
95  
96      /**
97       * Fetches all published properties of an remote portlet.
98       * 
99       * @param userID The ID of the user this request is done for
100      * 
101      * @return The portlet property description response from the producer
102      **/
103     public PortletPropertyDescriptionResponse getPortletPropertyDescription(
104             String userID) throws WSRPException;
105 
106     /**
107      * Get the current values of the properties with the given names.
108      * 
109      * @param names The names of the properties
110      * @param userID The ID of the user is used to get the user context
111      * 
112      * @return A list of properties containing the values and names of the properties.
113      **/
114     public PropertyList getPortletProperties(String[] names, String userID)
115             throws WSRPException;
116 
117     /**
118      * Set the portlet properties specified in the property list
119      * 
120      * @param properties List of properties to be set.
121      * @param userID The ID of the user is used to get the user context
122      **/
123     public PortletContext setPortletProperties(PropertyList properties,
124             String userID) throws WSRPException;
125 }