1 5 6 package org.exoplatform.portlets.wsrp; 7 8 9 import java.util.Map ; 10 import java.util.HashMap ; 11 import java.util.Iterator ; 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 23 24 public class UserSessionImpl extends InitCookieImpl 25 implements UserSessionMgr { 26 27 protected Map groupSessions = new HashMap (); 28 private String userID; 29 30 public UserSessionImpl(String markupInterfaceURL) { 31 super(markupInterfaceURL); 32 } 33 34 public GroupSessionMgr getGroupSession(String 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 getUserID() { 47 return userID; 48 } 49 50 public void setUserID(String userID) { 51 this.userID = userID; 52 } 53 54 public Iterator 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 groupID) { 63 groupSessions.remove(groupID); 64 } 65 66 public void removeAllGroupSessions() { 67 groupSessions.clear(); 68 } 69 70 } | Popular Tags |