KickJava   Java API By Example, From Geeks To Geeks.

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


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.Map JavaDoc;
10 import java.util.HashMap JavaDoc;
11 import java.util.Iterator JavaDoc;
12 import org.exoplatform.services.wsrp.consumer.GroupSession;
13 import org.exoplatform.services.wsrp.consumer.GroupSessionMgr;
14 import org.exoplatform.services.wsrp.consumer.UserSessionMgr;
15 import org.exoplatform.services.wsrp.exceptions.WSRPException;
16
17 /*
18  * @author Mestrallet Benjamin
19  * benjmestrallet@users.sourceforge.net
20  * Date: 9 févr. 2004
21  * Time: 22:31:23
22  */

23
24 public class UserSessionImpl extends InitCookieImpl
25     implements UserSessionMgr {
26
27   protected Map JavaDoc groupSessions = new HashMap JavaDoc();
28   private String JavaDoc userID;
29
30   public UserSessionImpl(String JavaDoc markupInterfaceURL) {
31     super(markupInterfaceURL);
32   }
33
34   public GroupSessionMgr getGroupSession(String JavaDoc groupID) throws WSRPException {
35     if (groupID != null) {
36       GroupSessionMgr groupSession = (GroupSessionMgr) groupSessions.get(groupID);
37       if (groupSession == null) {
38         groupSession = new GroupSessionImpl(groupID, getMarkupInterfaceURL());
39         addGroupSession(groupSession);
40       }
41       return groupSession;
42     }
43     return null;
44   }
45
46   public String JavaDoc getUserID() {
47     return userID;
48   }
49
50   public void setUserID(String JavaDoc userID) {
51     this.userID = userID;
52   }
53
54   public Iterator JavaDoc getAllGroupSessions() {
55     return groupSessions.values().iterator();
56   }
57
58   public void addGroupSession(GroupSession groupSession) {
59     groupSessions.put(groupSession.getGroupID(), groupSession);
60   }
61
62   public void removeGroupSession(String JavaDoc groupID) {
63     groupSessions.remove(groupID);
64   }
65
66   public void removeAllGroupSessions() {
67     groupSessions.clear();
68   }
69
70 }
Popular Tags