View Javadoc

1   /*
2    * Copyright 2003,2004 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  /* 
17  
18   */
19  
20  package org.apache.pluto.core.impl;
21  
22  import javax.portlet.PortalContext;
23  
24  import org.apache.pluto.services.information.InformationProviderAccess;
25  import org.apache.pluto.services.information.PortalContextProvider;
26  import org.apache.pluto.util.Enumerator;
27  /***
28   * The <CODE>PortalContext</CODE> interface gives the portlet
29   * the ability to retrieve information about the portal calling this portlet.
30   * <p>
31   * The portlet can only read the <CODE>PortalContext</CODE> data.
32   */
33  public class PortalContextImpl implements PortalContext
34  {
35  
36      private PortalContextProvider provider = null;
37  
38      public PortalContextImpl() 
39      {
40          provider = InformationProviderAccess.getStaticProvider().getPortalContextProvider();
41      }
42  
43      // javax.portlet.PortalContext implementation -------------------------------------------------
44      public java.lang.String getProperty(java.lang.String name)
45      {
46          if (name == null)
47          {
48              throw new IllegalArgumentException("Property name == null");
49          }
50  
51          return provider.getProperty(name);
52      }
53  
54  
55      public java.util.Enumeration getPropertyNames()
56      {
57          return(new Enumerator(provider.getPropertyNames()));
58      }
59  
60      public java.util.Enumeration getSupportedPortletModes()
61      {
62          return new Enumerator(provider.getSupportedPortletModes());
63      }
64  
65      public java.util.Enumeration getSupportedWindowStates()
66      {
67          return new Enumerator(provider.getSupportedWindowStates());
68      }
69  
70      public String getPortalInfo()
71      {
72          return provider.getPortalInfo();
73      }
74      // --------------------------------------------------------------------------------------------
75  }