Source Code Cross Referenced for PortletConfigInfo.java in  » Portal » stringbeans-3.5 » com » nabhinc » portal » core » 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 » stringbeans 3.5 » com.nabhinc.portal.core 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /* 
002:         * (C) Copyright 2006 Nabh Information Systems, Inc. 
003:         * 
004:         * This program is free software; you can redistribute it and/or
005:         * modify it under the terms of the GNU General Public License 
006:         * as published by the Free Software Foundation; either version 2
007:         * of the License, or (at your option) any later version.
008:         * 
009:         * This program is distributed in the hope that it will be useful,
010:         * but WITHOUT ANY WARRANTY; without even the implied warranty of 
011:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
012:         * GNU General Public License for more details.
013:         * 
014:         * You should have received a copy of the GNU General Public License
015:         * along with this program; if not, write to the Free Software 
016:         * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
017:         * 
018:         */
019:        package com.nabhinc.portal.core;
020:
021:        import java.util.HashMap;
022:        import java.util.Hashtable;
023:        import java.util.Locale;
024:        import java.util.Map;
025:
026:        import javax.portlet.Portlet;
027:        import javax.portlet.PortletMode;
028:        import javax.portlet.PortletModeException;
029:        import javax.portlet.PortletSecurityException;
030:        import javax.portlet.PreferencesValidator;
031:        import javax.portlet.RenderRequest;
032:        import javax.portlet.WindowState;
033:        import javax.portlet.WindowStateException;
034:        import javax.servlet.ServletException;
035:        import javax.servlet.http.HttpServletRequest;
036:
037:        import org.apache.commons.logging.Log;
038:        import org.apache.commons.logging.LogFactory;
039:
040:        import com.nabhinc.portal.config.PortletType;
041:        import com.nabhinc.portal.container.PortletConfigImpl;
042:        import com.nabhinc.portal.container.PortletPreferencesImpl;
043:        import com.nabhinc.portal.model.PortletAccessController;
044:
045:        /**
046:         * Maintains information related to a portlet including configuration as
047:         * well as cache.
048:         *
049:         * @author Padmanabh Dabke
050:         * (c) 2006 Nabh Information Systems, Inc. All Rights Reserved.
051:         */
052:        public class PortletConfigInfo {
053:
054:            public static final int PORTLET_STATUS_LOADED = 0;
055:            public static final int PORTLET_STATUS_PREF_VALIDATOR_ERROR = 1;
056:            public static final int PORTLET_STATUS_INSTANTIATION_ERROR = 2;
057:            public static final int PORTLET_STATUS_INIT_ERROR = 3;
058:            public static final int PORTLET_STATUS_UNLOADED = 4;
059:            public static final int PORTLET_STATUS_UNAVAILABLE = 5;
060:            public static final int PORTLET_STATUS_INTERNAL_ERROR = 6;
061:
062:            private Log logger = LogFactory.getLog(this .getClass());
063:
064:            public boolean isWSRPPortlet = false;
065:
066:            /**
067:             * Context path of the PortletServlet that loaded this portlet config
068:             */
069:            public String contextPath = null;
070:
071:            /**
072:             * Servlet URI of the PortletServlet that loaded this portlet config
073:             */
074:            public String servletURI = null;
075:
076:            /**
077:             * Portlet name
078:             */
079:            public String name = null;
080:
081:            /**
082:             * Portlet instance
083:             */
084:            public Portlet portlet = null;
085:
086:            /**
087:             * Load status of the portlet
088:             */
089:            public int loadStatus = PORTLET_STATUS_UNLOADED;
090:
091:            /**
092:             * Exception encountered while creating the portlet.
093:             */
094:            public String loadError = null;
095:
096:            /**
097:             * Stack trace of exception encountered while creating the portlet.
098:             */
099:            public String loadErrorStackTrace = null;
100:
101:            /**
102:             * Portlet preferences as configured in portlet.xml file
103:             */
104:            public Hashtable<String, PortletPreferencesImpl.PrefInfo> configuredPrefs = null;
105:
106:            /**
107:             * Default display name for the portlet
108:             */
109:            public String displayName = null;
110:
111:            /**
112:             * Locale -> display name map
113:             */
114:
115:            public HashMap localizedDisplayNames = new HashMap();
116:
117:            /**
118:             * Portlet description
119:             */
120:            public String description = "";
121:
122:            /**
123:             * Map of locale -> portlet description
124:             */
125:            public HashMap localizedDescriptions = new HashMap();
126:
127:            public String title = null;
128:
129:            public String shortTitle = null;
130:
131:            public String keywords = null;
132:
133:            public String[] keywordArray = null;
134:
135:            /**
136:             * Mapping between portlet security roles and Webapp
137:             * security roles.
138:             */
139:            public HashMap securityRoleMapping = new HashMap();
140:
141:            /**
142:             * Locales supported
143:             */
144:            public String defaultLocale = null;
145:
146:            public HashMap localeSupport = new HashMap();
147:
148:            /**
149:             * Preferences validator
150:             */
151:            public PreferencesValidator prefValidator = null;
152:
153:            /**
154:             * Object representing portlet configuration in XML
155:             */
156:            public PortletType portletType = null;
157:
158:            /**
159:             * Is this portlet not suitable to be displayed in a narrow
160:             * column ?
161:             */
162:            // public boolean isWide = false;
163:            /**
164:             * PortletConfig object corresponding to the portlet
165:             */
166:            public PortletConfigImpl config = null;
167:
168:            /**
169:             * Number of seconds the content can be cached.
170:             * 0 => No caching
171:             * -1 => Cache never expires
172:             */
173:            public int expirationCache = 0;
174:
175:            /**
176:             * Cached portlet content
177:             */
178:            public String cachedContent = null;
179:
180:            /**
181:             * If content of this portlet is cacheable, the value
182:             * indicates UTC seconds after which the cache expires.
183:             */
184:            public long cacheExpirationTime = 0;
185:
186:            /**
187:             * Map of mime type -> Array of portlet modes
188:             */
189:            public HashMap mimeTypeSupport = new HashMap();
190:
191:            /**
192:             * Supported window states
193:             */
194:            public HashMap windowStateSupport = new HashMap();
195:
196:            public PortletConfigInfo(String pName, Hashtable pr,
197:                    PortletConfigImpl pc, PreferencesValidator pValidator,
198:                    PortletType pType, String cPath, String sURI) {
199:                name = pName;
200:                configuredPrefs = pr;
201:                config = pc;
202:                prefValidator = pValidator;
203:                portletType = pType;
204:                contextPath = cPath;
205:                servletURI = sURI;
206:            }
207:
208:            public String getPortletDisplayName(RenderRequest request) {
209:                return getPortletDisplayName(request.getLocale());
210:            }
211:
212:            public String getPortletDisplayName(Locale l) {
213:                String dName = (String) localizedDisplayNames.get(l);
214:                if (dName == null)
215:                    return displayName;
216:                else
217:                    return dName;
218:
219:            }
220:
221:            public String getPortletDescription(RenderRequest request) {
222:                return getPortletDescription(request.getLocale());
223:            }
224:
225:            public String getPortletDescription(Locale l) {
226:                String descr = (String) localizedDescriptions.get(l);
227:                if (descr == null)
228:                    return description;
229:                else
230:                    return descr;
231:            }
232:
233:            /**
234:             * Check if the current user can change to specified window state.
235:             * @param wState New window state
236:             * @param mimeType Mime type for the current request
237:             * @throws WindowStateException Thrown if the new window state is not allowed
238:             */
239:            public void checkWindowState(WindowState wState, String mimeType)
240:                    throws WindowStateException {
241:                String wStateStr = wState.toString().toLowerCase();
242:                // Hack for WSRP support
243:                if ("{wsrp-windowstate}".equals(wStateStr))
244:                    return;
245:
246:                if (!PortalServlet.getInstance().isWindowStateSupported(
247:                        wStateStr)) {
248:                    throw new WindowStateException("State not supported.",
249:                            wState);
250:                }
251:            }
252:
253:            /* (non-Javadoc)
254:             * @see com.nabhinc.portal.container.AccessChecker#isPortletModeAllowed(javax.portlet.PortletMode)
255:             */
256:            public void checkPortletMode(PortletMode pMode, String mimeType,
257:                    HttpServletRequest req) throws PortletModeException,
258:                    PortletSecurityException {
259:                String pModeStr = pMode.toString().toLowerCase();
260:                // Hack for WSRP support
261:                if ("{wsrp-mode}".equals(pModeStr))
262:                    return;
263:                Map supportedModes = (Map) this .mimeTypeSupport.get(mimeType);
264:                if (supportedModes == null) {
265:                    throw new PortletModeException("Mode not supported.", pMode);
266:                } else {
267:                    if (supportedModes.get(pModeStr) == null)
268:                        throw new PortletModeException("Mode not supported.",
269:                                pMode);
270:                }
271:
272:                try {
273:                    if (PortletAccessController.getInstance().isAccessible(req,
274:                            this , pModeStr)) {
275:                        return;
276:                    } else {
277:                        throw new PortletSecurityException("Permission denied.");
278:                    }
279:                } catch (ServletException e) {
280:                    this .logger.error(
281:                            "Failed to check portlet mode permissions.", e);
282:                }
283:            }
284:
285:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.