Source Code Cross Referenced for JetspeedPortalContext.java in  » Portal » jetspeed-2.1.3 » org » apache » jetspeed » 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 » jetspeed 2.1.3 » org.apache.jetspeed 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Licensed to the Apache Software Foundation (ASF) under one or more
003:         * contributor license agreements.  See the NOTICE file distributed with
004:         * this work for additional information regarding copyright ownership.
005:         * The ASF licenses this file to You under the Apache License, Version 2.0
006:         * (the "License"); you may not use this file except in compliance with
007:         * the License.  You may obtain a copy of the License at
008:         * 
009:         *      http://www.apache.org/licenses/LICENSE-2.0
010:         * 
011:         * Unless required by applicable law or agreed to in writing, software
012:         * distributed under the License is distributed on an "AS IS" BASIS,
013:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014:         * See the License for the specific language governing permissions and
015:         * limitations under the License.
016:         */
017:        package org.apache.jetspeed;
018:
019:        import java.util.Collection;
020:        import java.util.Enumeration;
021:        import java.util.HashMap;
022:
023:        import javax.portlet.PortletMode;
024:        import javax.portlet.WindowState;
025:
026:        import org.apache.jetspeed.administration.PortalConfiguration;
027:        import org.apache.jetspeed.container.PortletRequestContext;
028:        import org.apache.jetspeed.engine.Engine;
029:        import org.apache.jetspeed.om.common.portlet.PortletApplication;
030:        import org.apache.pluto.util.Enumerator;
031:
032:        /**
033:         * Implementation of Portal Context associated with running thread of the engine
034:         *
035:         * @author <a href="mailto:david@bluesunrise.com">David Sean Taylor</a>
036:         * @version $Id: JetspeedPortalContext.java 553375 2007-07-05 05:37:00Z taylor $
037:         */
038:        public class JetspeedPortalContext implements  PortalContext {
039:            private static final String SUPPORTED_WINDOWSTATE_ATTR = "supported.windowstate";
040:            private static final String SUPPORTED_PORTLETMODE_ATTR = "supported.portletmode";
041:            private static final String PORTAL_VERSION_ATTR = "portal.version";
042:            private static final String PORTAL_NAME_ATTR = "portal.name";
043:
044:            /**
045:             * The engine associated with this context.
046:             */
047:            private Engine engine = null;
048:
049:            /**
050:             * Runtime attributes.
051:             */
052:            private HashMap attributes = new HashMap();
053:
054:            /**
055:             * Configuration state
056:             */
057:            private PortalConfiguration configuration = null;
058:
059:            /**
060:             * The base from which the Jetspped application will operate.
061:             */
062:            private String applicationRoot;
063:
064:            private final String portalInfo;
065:
066:            public JetspeedPortalContext(Engine engine,
067:                    PortalConfiguration configuration, String applicationRoot) {
068:                this .engine = engine;
069:                this .configuration = configuration;
070:                this .applicationRoot = applicationRoot;
071:
072:                portalInfo = configuration.getString(PORTAL_NAME_ATTR) + "/"
073:                        + configuration.getString(PORTAL_VERSION_ATTR);
074:
075:                // Inititalize supported portlet modes and window states
076:                String[] supportedModes = configuration
077:                        .getStringArray(SUPPORTED_PORTLETMODE_ATTR);
078:                String[] supportedStates = configuration
079:                        .getStringArray(SUPPORTED_WINDOWSTATE_ATTR);
080:                new JetspeedActions(supportedModes, supportedStates);
081:            }
082:
083:            // ------------------------------------------------------------------------
084:            //  A C C E S S O R S
085:            // ------------------------------------------------------------------------
086:
087:            /**
088:             * Returns the configuration properties for this Jetspeed engine context.
089:             *
090:             * @return a <code>Configuration</code> containing the configuration properties for this Jetspeed context.
091:             */
092:            public PortalConfiguration getConfiguration() {
093:                return configuration;
094:            }
095:
096:            public String getConfigurationProperty(String key) {
097:                return configuration.getString(key);
098:            }
099:
100:            public String getConfigurationProperty(String key,
101:                    String defaultValue) {
102:                return configuration.getString(key, defaultValue);
103:            }
104:
105:            /**
106:             * Set the configuration properties for this Jetspeed engine context.
107:             *
108:             * @param configuration - the configuration properties
109:             */
110:            public void setConfiguration(PortalConfiguration configuration) {
111:                this .configuration = configuration;
112:            }
113:
114:            /**
115:             * Returns the application root for this Jetspeed engine context.
116:             *
117:             * @return a <code>String</code> containing the application root path for this Jetspeed context.
118:             */
119:            public String getApplicationRoot() {
120:                return applicationRoot;
121:            }
122:
123:            /**
124:             * Sets the application root path for this Jetspeed engine context.
125:             *
126:             * @param applicationRoot - the applicationRoot path on the file system.
127:             */
128:            public void setApplicationRoot(String applicationRoot) {
129:                this .applicationRoot = applicationRoot;
130:            }
131:
132:            /**
133:             * Returns the engine associated with this context.
134:             *
135:             * @return an <code>Engine</code> associated with this context
136:             */
137:            public Engine getEngine() {
138:                return this .engine;
139:            }
140:
141:            /**
142:             * Returns the engine attribute with the given name, or null if there is no attribute by that name.
143:             *
144:             * @return an <code>Object</code> containing the value of the attribute, or null if no attribute exists matching the given name
145:             */
146:            public Object getAttribute(String name) {
147:                return attributes.get(name);
148:            }
149:
150:            /**
151:             * Binds an object to a given attribute name in this servlet context.
152:             *
153:             * @param  name - a <code>String</code> specifying the name of the attribute
154:             * @param value - an <code>Object</code> representing the attribute to be bound
155:             */
156:            public void setAttribute(String name, Object value) {
157:                attributes.put(name, value);
158:            }
159:
160:            /* (non-Javadoc)
161:             * @see javax.portlet.PortalContext#getProperty(java.lang.String)
162:             */
163:            public String getProperty(String name) {
164:                if (name == null) {
165:                    throw new IllegalArgumentException("Property name == null");
166:                }
167:                return (String) configuration.getString(name);
168:            }
169:
170:            /* (non-Javadoc)
171:             * @see javax.portlet.PortalContext#getPropertyNames()
172:             */
173:            public Enumeration getPropertyNames() {
174:                return new Enumerator(configuration.getKeys());
175:            }
176:
177:            private Collection getSupportedModes() {
178:                PortletRequestContext ctx = PortletRequestContext.getContext();
179:                if (ctx != null) {
180:                    PortletApplication pa = ((PortletApplication) ctx
181:                            .getPortletDefinition()
182:                            .getPortletApplicationDefinition());
183:                    return pa.getSupportedPortletModes();
184:                }
185:                return JetspeedActions.getStandardPortletModes();
186:            }
187:
188:            /* (non-Javadoc)
189:             * @see javax.portlet.PortalContext#getSupportedPortletModes()
190:             */
191:            public Enumeration getSupportedPortletModes() {
192:                return new Enumerator(getSupportedModes());
193:            }
194:
195:            public boolean isPortletModeAllowed(PortletMode mode) {
196:                return getSupportedModes().contains(mode);
197:            }
198:
199:            private Collection getSupportedStates() {
200:                PortletRequestContext ctx = PortletRequestContext.getContext();
201:                if (ctx != null) {
202:                    PortletApplication pa = ((PortletApplication) ctx
203:                            .getPortletDefinition()
204:                            .getPortletApplicationDefinition());
205:                    return pa.getSupportedWindowStates();
206:                }
207:                return JetspeedActions.getStandardWindowStates();
208:            }
209:
210:            /* (non-Javadoc)
211:             * @see javax.portlet.PortalContext#getSupportedWindowStates()
212:             */
213:            public Enumeration getSupportedWindowStates() {
214:                return new Enumerator(getSupportedStates());
215:            }
216:
217:            public boolean isWindowStateAllowed(WindowState state) {
218:                return getSupportedStates().contains(state);
219:            }
220:
221:            /* (non-Javadoc)
222:             * @see javax.portlet.PortalContext#getPortalInfo()
223:             */
224:            public String getPortalInfo() {
225:                return portalInfo;
226:            }
227:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.