KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > exoplatform > portlets > wsrp > GroupSessionImpl


1 /*
2 * Copyright 2001-2004 The eXo platform SARL All rights reserved.
3 * Please look at license.txt in info directory for more license detail.
4 */

5
6 package org.exoplatform.portlets.wsrp;
7
8
9 import java.util.HashMap JavaDoc;
10 import java.util.Iterator JavaDoc;
11 import java.util.Map JavaDoc;
12 import org.exoplatform.services.wsrp.consumer.GroupSessionMgr;
13 import org.exoplatform.services.wsrp.consumer.PortletSession;
14
15 /*
16  * @author Mestrallet Benjamin
17  * benjmestrallet@users.sourceforge.net
18  * Date: 9 févr. 2004
19  * Time: 22:34:33
20  */

21
22 public class GroupSessionImpl extends InitCookieImpl
23     implements GroupSessionMgr {
24
25   protected String JavaDoc groupID;
26   protected Map JavaDoc portletSessions = new HashMap JavaDoc();
27
28   public GroupSessionImpl(String JavaDoc groupID, String JavaDoc markupURL) {
29     super(markupURL);
30     this.groupID = groupID;
31   }
32
33   public PortletSession getPortletSession(String JavaDoc portletHandle) {
34     if (portletHandle == null) {
35       return null;
36     }
37     PortletSession portletSession = (PortletSession) this.portletSessions.get(portletHandle);
38     if (portletSession == null) {
39       portletSession = new PortletSessionImpl(portletHandle);
40       addPortletSession(portletSession);
41     }
42     return portletSession;
43   }
44
45   public String JavaDoc getGroupID() {
46     return groupID;
47   }
48
49   public void setGroupID(String JavaDoc groupID) {
50     this.groupID = groupID;
51   }
52
53   public Iterator JavaDoc getAllPortletSessions() {
54     return portletSessions.values().iterator();
55   }
56
57   public boolean existsPortletSession(String JavaDoc instanceKey) {
58     return portletSessions.containsKey(instanceKey);
59   }
60
61   public void addPortletSession(PortletSession portletSession) {
62     portletSessions.put(portletSession.getPortletHandle(), portletSession);
63   }
64
65   public void removePortletSession(String JavaDoc instanceKey) {
66     portletSessions.remove(instanceKey);
67   }
68
69   public void removeAllPortletSessions() {
70     portletSessions.clear();
71   }
72
73
74
75 }
Popular Tags