1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
12   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
14   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
15   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
16   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
17   * SOFTWARE.
18   */
19  
20  package com.liferay.portlet.wsrp;
21  
22  import org.apache.wsrp4j.consumer.PortletWindowSession;
23  import org.apache.wsrp4j.consumer.driver.GenericPortletSessionImpl;
24  import org.apache.wsrp4j.consumer.driver.GenericPortletWindowSessionImpl;
25  import org.apache.wsrp4j.log.LogManager;
26  import org.apache.wsrp4j.log.Logger;
27  
28  /**
29   * <a href="PortletSessionImpl.java.html"><b><i>View Source</i></b></a>
30   *
31   * @author Michael Young
32   *
33   */
34  public class PortletSessionImpl extends GenericPortletSessionImpl {
35  
36      public PortletSessionImpl(String handle) {
37          super(handle);
38      }
39  
40      /**
41       * Get the <code>PortletWindowSession</code> of the portlet window with
42       * the given ID.
43       *
44       * @param windowID
45       *            The ID of the portlet window
46       * @return The <code>PorletWindowSession</code> with the given ID.
47       */
48      public PortletWindowSession getPortletWindowSession(String windowID) {
49          final String MN = "getPortletWindowSession";
50  
51          if (_logger.isLogging(Logger.TRACE_HIGH)) {
52              _logger.entry(Logger.TRACE_HIGH, MN);
53          }
54  
55          PortletWindowSession session = (PortletWindowSession) this.windowSessions
56                  .get(windowID);
57          if (session == null) {
58              session = new GenericPortletWindowSessionImpl(windowID, this);
59              this.windowSessions.put(windowID, session);
60  
61              if (_logger.isLogging(Logger.TRACE_HIGH)) {
62                  _logger.text(Logger.TRACE_HIGH, MN,
63                          "created windowSession with ID: " + windowID);
64              }
65          }
66  
67          if (_logger.isLogging(Logger.TRACE_HIGH)) {
68              _logger.exit(Logger.TRACE_HIGH, MN);
69          }
70  
71          return session;
72      }
73  
74      // logger
75      private static final Logger _logger = LogManager.getLogManager().getLogger(
76              PortletSessionImpl.class);
77  
78  }