KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > portal > portlet > impl > PortletConfigImpl


1 /*****************************************
2  * *
3  * JBoss Portal: The OpenSource Portal *
4  * *
5  * Distributable under LGPL license. *
6  * See terms of license at gnu.org. *
7  * *
8  *****************************************/

9 package org.jboss.portal.portlet.impl;
10
11 import java.util.Collections JavaDoc;
12 import java.util.Enumeration JavaDoc;
13 import java.util.Locale JavaDoc;
14 import java.util.Map JavaDoc;
15 import java.util.ResourceBundle JavaDoc;
16
17 import javax.portlet.PortletConfig;
18 import javax.portlet.PortletContext;
19
20 import org.jboss.portal.portlet.plugins.language.ResourceBundles;
21
22 /**
23  * @author <a HREF="mailto:julien@jboss.org">Julien Viet</a>
24  * @version $Revision: 1.2 $
25  */

26 public class PortletConfigImpl implements PortletConfig
27 {
28
29    private String JavaDoc portletName;
30    private PortletContext portletContext;
31    private Map JavaDoc initParameters;
32    private ResourceBundles resourceBundles;
33
34    public PortletConfigImpl(String JavaDoc portletName,
35                             PortletContext portletContext,
36                             Map JavaDoc initParameters,
37                             ResourceBundles resourceBundles)
38    {
39       this.portletName = portletName;
40       this.portletContext = portletContext;
41       this.initParameters = initParameters;
42       this.resourceBundles = resourceBundles;
43    }
44
45    public String JavaDoc getPortletName()
46    {
47       return portletName;
48    }
49
50    public PortletContext getPortletContext()
51    {
52       return portletContext;
53    }
54
55    /**
56     * May return null ? the spec does not specify what happens
57     * when the bundle is not found for the locale.
58     */

59    public ResourceBundle JavaDoc getResourceBundle(Locale JavaDoc locale)
60    {
61       return resourceBundles.get(locale);
62    }
63
64    public String JavaDoc getInitParameter(String JavaDoc s)
65    {
66       if (s == null)
67       {
68          throw new IllegalArgumentException JavaDoc("name must not be null");
69       }
70       return (String JavaDoc)initParameters.get(s);
71    }
72
73    public Enumeration JavaDoc getInitParameterNames()
74    {
75       return Collections.enumeration(initParameters.keySet());
76    }
77 }
78
Popular Tags