View Javadoc

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  
20  
21  package org.apache.myfaces.context.portlet;
22  
23  import java.util.Enumeration;
24  import java.util.Map;
25  
26  import javax.portlet.PortletContext;
27  
28  import org.apache.myfaces.util.AbstractAttributeMap;
29  
30  
31  /**
32   * ServletContext init parameters as Map.
33   *
34   * @author  Stan Silvert (latest modification by $Author: lu4242 $)
35   * @version $Revision: 1000660 $ $Date: 2010-09-23 18:02:43 -0500 (Thu, 23 Sep 2010) $
36   */
37  public class InitParameterMap extends AbstractAttributeMap
38  {
39      final PortletContext _portletContext;
40  
41      InitParameterMap(PortletContext portletContext)
42      {
43          _portletContext = portletContext;
44      }
45  
46      protected Object getAttribute(String key)
47      {
48          return _portletContext.getInitParameter(key);
49      }
50  
51      protected void setAttribute(String key, Object value)
52      {
53          throw new UnsupportedOperationException(
54              "Cannot set PortletContext InitParameter");
55      }
56  
57      protected void removeAttribute(String key)
58      {
59          throw new UnsupportedOperationException(
60              "Cannot remove PortletContext InitParameter");
61      }
62  
63      protected Enumeration getAttributeNames()
64      {
65          return _portletContext.getInitParameterNames();
66      }
67  
68      public boolean equals(Object o) {
69          boolean retValue;
70  
71          retValue = super.equals(o);
72          return retValue;
73      }
74  
75      public int hashCode() {
76          int retValue;
77  
78          retValue = super.hashCode();
79          return retValue;
80      }
81      
82      public void putAll(Map t)
83      {
84          throw new UnsupportedOperationException();
85      }
86  
87  
88      public void clear()
89      {
90          throw new UnsupportedOperationException();
91      }
92  }