01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17: package org.apache.cocoon.portal.wsrp.consumer;
18:
19: import java.util.Hashtable;
20:
21: import org.apache.avalon.framework.logger.Logger;
22: import org.apache.wsrp4j.consumer.GroupSessionMgr;
23: import org.apache.wsrp4j.consumer.driver.GenericUserSessionImpl;
24: import org.apache.wsrp4j.exception.WSRPException;
25:
26: /**
27: * Implements a simple consumer-based user session<br/>
28: *
29: * Note: Since most of this methods all only for the session handler,
30: * consider to make most of the methods package scoped.<br/>
31: *
32: * @author <a href="mailto:cziegeler@s-und-n.de">Carsten Ziegeler</a>
33: * @author <a href="mailto:malessandrini@s-und-n.de">Michel Alessandrini</a>
34: *
35: * @version $Id: UserSessionImpl.java 433543 2006-08-22 06:22:54Z crossley $
36: **/
37: public class UserSessionImpl extends GenericUserSessionImpl {
38:
39: /** The logger */
40: protected final Logger logger;
41:
42: /**
43: * Constructor <br/
44: *
45: * @param producerID
46: * @param userID
47: * @param markupURL
48: * @param logger
49: * @throws WSRPException
50: */
51: public UserSessionImpl(String producerID, String userID,
52: String markupURL, Logger logger) throws WSRPException {
53: super (producerID, userID, markupURL);
54: this .logger = logger;
55: this .setGroupSessionTable(new Hashtable());
56: }
57:
58: /**
59: * Get the group session for this group ID<br/>
60: *
61: * @param groupID ID of the portlet application
62: * @return The a group session for the provided group ID or a new groupSession
63: **/
64: public GroupSessionMgr getGroupSession(String groupID)
65: throws WSRPException {
66: GroupSessionMgr groupSession = null;
67: if (groupID != null) {
68: groupSession = (GroupSessionMgr) this .groupSessions
69: .get(groupID);
70: if (groupSession == null) {
71: groupSession = new GroupSessionImpl(groupID, this
72: .getMarkupInterfaceURL(), this.logger);
73: addGroupSession(groupSession);
74: }
75: }
76: return groupSession;
77: }
78: }
|