Source Code Cross Referenced for PortletConfigImpl.java in  » Portal » Open-Portal » com » sun » portal » portlet » impl » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Portal » Open Portal » com.sun.portal.portlet.impl 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2002 Sun Microsystems, Inc. All 
003:         * rights reserved. Use of this product is subject 
004:         * to license terms. Federal Acquisitions: 
005:         * Commercial Software -- Government Users 
006:         * Subject to Standard License Terms and 
007:         * Conditions. 
008:         * 
009:         * Sun, Sun Microsystems, the Sun logo, and Sun ONE 
010:         * are trademarks or registered trademarks of Sun Microsystems, 
011:         * Inc. in the United States and other countries. 
012:         */
013:        package com.sun.portal.portlet.impl;
014:
015:        import java.util.Collections;
016:        import java.util.Enumeration;
017:        import java.util.HashMap;
018:        import java.util.Iterator;
019:        import java.util.List;
020:        import java.util.Locale;
021:        import java.util.Map;
022:        import java.util.MissingResourceException;
023:        import java.util.ResourceBundle;
024:
025:        import javax.portlet.PortletConfig;
026:        import javax.portlet.PortletContext;
027:
028:        import com.sun.portal.portletcontainercommon.descriptor.InitParamDescriptor;
029:        import com.sun.portal.portletcontainercommon.descriptor.PortletDescriptor;
030:        import com.sun.portal.portletcontainercommon.descriptor.PortletInfoDescriptor;
031:
032:        /**
033:         * The <code>PortletConfigImpl</code> class provides a default
034:         * implementation for the <code>PortletConfig</code> interface.
035:         *
036:         */
037:
038:        public class PortletConfigImpl implements  PortletConfig {
039:
040:            // private data members
041:            private String _portletName;
042:            private PortletContext _portletContext;
043:            private PortletDescriptor _pd;
044:            private Map _paramsMap = new HashMap();
045:
046:            // constructor
047:            public PortletConfigImpl(PortletDescriptor portletDescriptor,
048:                    String portletName, PortletContext portletContext) {
049:
050:                _portletName = portletName;
051:                _portletContext = portletContext;
052:                _pd = portletDescriptor;
053:                initParamsMap();
054:            }
055:
056:            /**
057:             * construct an internal map to store the init parameters
058:             */
059:            private void initParamsMap() {
060:
061:                if (_pd != null) {
062:                    for (Iterator i = _pd.getInitParamDescriptors().iterator(); i
063:                            .hasNext();) {
064:                        InitParamDescriptor ipd = (InitParamDescriptor) i
065:                                .next();
066:                        _paramsMap.put(ipd.getParamName(), ipd.getParamValue());
067:                    }
068:                }
069:            }
070:
071:            /**
072:             * Returns a String containing the value of the named initialization parameter, 
073:             * or null if the parameter does not exist.
074:             *
075:             * @param name	a <code>String</code> specifying the name
076:             *			of the initialization parameter
077:             *
078:             * @return		a <code>String</code> containing the value 
079:             *			of the initialization parameter
080:             *
081:             * @exception	java.lang.IllegalArgumentException	
082:             *                      if name is <code>null</code>.
083:             */
084:            public String getInitParameter(java.lang.String name)
085:                    throws IllegalArgumentException {
086:
087:                if (name == null) {
088:                    throw new IllegalArgumentException();
089:                }
090:                return (String) _paramsMap.get(name);
091:            }
092:
093:            /**
094:             * Returns the names of the portlet initialization parameters as an 
095:             * <code>Enumeration</code> of String objects, or an empty <code>Enumeration</code> if the 
096:             * portlet has no initialization parameters.    
097:             *
098:             * @return		an <code>Enumeration</code> of <code>String</code> 
099:             *			objects containing the names of the portlet 
100:             *			initialization parameters, or an empty <code>Enumeration</code> if the 
101:             *                    portlet has no initialization parameters. 
102:             */
103:            public Enumeration getInitParameterNames() {
104:
105:                return Collections.enumeration(_paramsMap.keySet());
106:            }
107:
108:            /**
109:             * Returns the <code>PortletContext</code> of the portlet application 
110:             * the portlet is in.
111:             *
112:             * @return   a <code>PortletContext</code> object, used by the 
113:             *           caller to interact with its portlet container
114:             *
115:             * @see PortletContext
116:             */
117:            public PortletContext getPortletContext() {
118:                return _portletContext;
119:            }
120:
121:            /**
122:             * Returns the name of the portlet.
123:             * <P>
124:             * The name may be provided via server administration, assigned in the
125:             * portlet application deployment descriptor with the <code>portlet-name</code>
126:             * tag.
127:             *
128:             * @return   the portlet name
129:             */
130:            public String getPortletName() {
131:
132:                return _portletName;
133:            }
134:
135:            /**
136:             * Gets the resource bundle for the given locale based on the
137:             * resource bundle defined in the deployment descriptor
138:             * with <code>resource-bundle</code> tag or the inlined resources
139:             * defined in the deployment descriptor.
140:             *
141:             * @param    locale    the locale for which to retrieve the resource bundle
142:             * 
143:             * @return   the resource bundle for the given locale
144:             *
145:             */
146:            public ResourceBundle getResourceBundle(Locale locale)
147:                    throws MissingResourceException {
148:
149:                String rbName;
150:                ResourceBundle rb = null;
151:
152:                // check if the portlet descriptor is null
153:                if (_pd == null) {
154:                    // cannot obtain name of the resource class and the 
155:                    // name of the key for the resource
156:                    throw new MissingResourceException(
157:                            "PortletConfigImpl.getResourceBundle: missing portlet descriptor",
158:                            null, null);
159:                } else {
160:                    rbName = _pd.getResourceBundle();
161:                }
162:
163:                PortletInfoDescriptor pid = _pd.getPortletInfoDescriptor();
164:                Object values[] = new Object[] { "", "", "" };
165:                boolean valuesDefinedInline[] = new boolean[] { false, false,
166:                        false };
167:
168:                if (pid != null) {
169:                    if (pid.getTitle() != null) {
170:                        values[0] = pid.getTitle();
171:                        valuesDefinedInline[0] = true;
172:                    }
173:                    if (pid.getShortTitle() != null) {
174:                        values[1] = pid.getShortTitle();
175:                        valuesDefinedInline[1] = true;
176:                    }
177:                    if (pid.getKeywords() != null) {
178:                        List keywords = pid.getKeywords();
179:
180:                        String[] strArray = new String[keywords.size()];
181:                        values[2] = (String[]) keywords.toArray(strArray);
182:                        valuesDefinedInline[2] = true;
183:                    }
184:                }
185:
186:                try {
187:                    if (rbName != null) {
188:                        rb = ResourceBundle.getBundle(rbName, locale, Thread
189:                                .currentThread().getContextClassLoader());
190:                    }
191:                } catch (MissingResourceException me) {
192:                    //falls through
193:                }
194:                rb = (ResourceBundle) new PortletResourceBundle(rb, rbName,
195:                        values, valuesDefinedInline);
196:
197:                return rb;
198:            }
199:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.