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.consumer;
22  
23  import java.util.Iterator;
24  
25  /**
26   * Interface for a consumer based group session.A group session
27   * is used to hold portlet session objects of portlet instances 
28   * which belong to the same group of the same producer according to their 
29   * portlet description. 
30   * 
31   * @author Stephan Laertz
32   * @author <a href='mailto:peter.fischer@de.ibm.com'>Peter Fischer</a>
33   **/
34  public interface GroupSession {
35  
36      /**
37       * Get the ID of the group this group session belongs to.
38       * 
39       * @return The group ID
40       **/
41      public String getGroupID();
42  
43      /**
44       * Get the portlet session object which is identified with
45       * the givven instanceKey from the group session. If no portlet session
46       * with that instanceKey exists it depends of the implementation wether
47       * null or a newly created portlet session object is returned.
48       * 
49       * @param instanceKey The key which identifies the portlet session object
50       * 
51       * @return The portlet session with the given key
52       **/
53      public PortletSession getPortletSession(String instanceKey);
54  
55      /**
56       * Get all portlet session objects currently stored in the group session.
57       * 
58       * @return Iterator with all portlet session objects in the group session.
59       **/
60      public Iterator getAllPortletSessions();
61  
62      /**
63       * Check if the group session holds a portlet session with the given key.
64       * 
65       * @return True if the group session holds a protlet session with the given key;
66       *         false otherwise
67       **/
68      public boolean existsPortletSession(String instanceKey);
69  
70      /**
71       * Set the ID of the group this group session belongs to.
72       * 
73       * @param groupID ID of the group
74       **/
75      public void setGroupID(String groupID);
76  
77      /**
78       * Add a portlet session to this group session.
79       * 
80       * @param portletSession The portlet session which should be 
81       *                      added to this group session.
82       **/
83      public void addPortletSession(PortletSession portletSession);
84  
85      /**
86       * Remove the portlet session object with the given key from the 
87       * group session. Subsequent calls of getPortletSession with the same
88       * key should either return null or a newly created object.
89       * 
90       * @param instanceKey Key which identifies the portlet session object to be removed.
91       **/
92      public void removePortletSession(String instanceKey);
93  
94      /**
95       * Removes all portlet session objects from the group session. Consequently
96       * this methods can be used to clear the group session.     
97       **/
98      public void removeAllPortletSessions();
99  
100 }