KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > cocoon > portal > wsrp > consumer > PortletSessionImpl


1 /*
2  * Copyright 2005 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 package org.apache.cocoon.portal.wsrp.consumer;
17
18 import org.apache.avalon.framework.logger.Logger;
19 import org.apache.wsrp4j.consumer.PortletWindowSession;
20 import org.apache.wsrp4j.consumer.driver.GenericPortletSessionImpl;
21 import org.apache.wsrp4j.util.Modes;
22 import org.apache.wsrp4j.util.WindowStates;
23
24 /**
25  * Defines a session object at the consumer-side
26  * to store remote portlet related information that
27  * are needed to interact with the portlet<br/>
28  *
29  * @author <a HREF="mailto:cziegeler@s-und-n.de">Carsten Ziegeler</a>
30  * @author <a HREF="mailto:malessandrini@s-und-n.de">Michel Alessandrini</a>
31  *
32  * @version $Id: PortletSessionImpl.java 264755 2005-08-30 10:29:21Z cziegeler $
33  */

34 public class PortletSessionImpl extends GenericPortletSessionImpl {
35
36     /** The logger. */
37     protected final Logger logger;
38
39     /**
40      * constructor
41      *
42      * @param handle
43      * @param logger
44      */

45     public PortletSessionImpl(String JavaDoc handle, Logger logger) {
46         super(handle);
47         this.logger = logger;
48     }
49
50     /**
51      * Get the <code>PortletWindowSession</code> of the portlet window with the given ID<br/>
52      *
53      * @param windowID The ID of the portlet window
54      * @return The <code>PorletWindowSession</code> with the given ID.
55      **/

56     public PortletWindowSession getPortletWindowSession(String JavaDoc windowID) {
57         SimplePortletWindowSession session = (SimplePortletWindowSession)this.windowSessions.get(windowID);
58         if (session == null) {
59             session = new SimplePortletWindowSessionImpl(windowID, this);
60             session.setMode(Modes._view);
61             session.setWindowState(WindowStates._normal);
62             this.windowSessions.put(windowID, session);
63
64             if ( this.logger.isDebugEnabled() ) {
65                 logger.debug("Created windowSession with ID: " + windowID);
66             }
67         }
68         return session;
69     }
70 }
71
Popular Tags