Source Code Cross Referenced for PortalURLImpl.java in  » Portal » Pluto » org » apache » pluto » driver » url » 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 » Pluto » org.apache.pluto.driver.url.impl 
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.pluto.driver.url.impl;
018:
019:        import java.util.Collection;
020:        import java.util.Collections;
021:        import java.util.HashMap;
022:        import java.util.Iterator;
023:        import java.util.Map;
024:
025:        import javax.portlet.PortletMode;
026:        import javax.portlet.WindowState;
027:
028:        import org.apache.pluto.driver.url.PortalURL;
029:        import org.apache.pluto.driver.url.PortalURLParameter;
030:        import org.apache.pluto.driver.url.PortalURLParser;
031:
032:        /**
033:         * The portal URL.
034:         * @since 1.0
035:         * @deprecated replaced by {@link RelativePortalURLImpl}
036:         */
037:        public class PortalURLImpl implements  PortalURL {
038:
039:            /** Server URI contains protocol, host name, and (optional) port. */
040:            private String serverURI;
041:
042:            private String servletPath;
043:            private String renderPath;
044:            private String actionWindow;
045:
046:            /**
047:             * PortalURLParser used to construct the string
048:             * representation of this portal url.
049:             */
050:            private PortalURLParser urlParser;
051:
052:            /** The window states: key is the window ID, value is WindowState. */
053:            private Map windowStates = new HashMap();
054:
055:            private Map portletModes = new HashMap();
056:
057:            /** Parameters of the portlet windows. */
058:            private Map parameters = new HashMap();
059:
060:            // Constructors ------------------------------------------------------------
061:
062:            /**
063:             * Constructs a PortalURLImpl instance using default port.
064:             * @param protocol  the protocol.
065:             * @param hostName  the host name.
066:             * @param contextPath  the servlet context path.
067:             * @param servletName  the servlet name.
068:             */
069:            public PortalURLImpl(String protocol, String hostName,
070:                    String contextPath, String servletName,
071:                    PortalURLParser urlParser) {
072:                this (protocol, hostName, -1, contextPath, servletName,
073:                        urlParser);
074:            }
075:
076:            /**
077:             * Constructs a PortalURLImpl instance using customized port.
078:             * @param protocol  the protocol.
079:             * @param hostName  the host name.
080:             * @param port  the port number: 0 or negative means using default port.
081:             * @param contextPath  the servlet context path.
082:             * @param servletName  the servlet name.
083:             */
084:            public PortalURLImpl(String protocol, String hostName, int port,
085:                    String contextPath, String servletName,
086:                    PortalURLParser urlParser) {
087:                StringBuffer buffer = new StringBuffer();
088:                buffer.append(protocol);
089:                buffer.append(hostName);
090:                if (port > 0) {
091:                    buffer.append(":").append(port);
092:                }
093:                serverURI = buffer.toString();
094:
095:                buffer = new StringBuffer();
096:                buffer.append(contextPath);
097:                buffer.append(servletName);
098:                servletPath = buffer.toString();
099:                this .urlParser = urlParser;
100:            }
101:
102:            /**
103:             * Internal private constructor used by method <code>clone()</code>.
104:             * @see #clone()
105:             */
106:            private PortalURLImpl() {
107:                // Do nothing.
108:            }
109:
110:            // Public Methods ----------------------------------------------------------
111:
112:            public void setRenderPath(String renderPath) {
113:                this .renderPath = renderPath;
114:            }
115:
116:            public String getRenderPath() {
117:                return renderPath;
118:            }
119:
120:            public void addParameter(PortalURLParameter param) {
121:                parameters.put(param.getWindowId() + param.getName(), param);
122:            }
123:
124:            public Collection getParameters() {
125:                return parameters.values();
126:            }
127:
128:            public void setActionWindow(String actionWindow) {
129:                this .actionWindow = actionWindow;
130:            }
131:
132:            public String getActionWindow() {
133:                return actionWindow;
134:            }
135:
136:            public Map getPortletModes() {
137:                return Collections.unmodifiableMap(portletModes);
138:            }
139:
140:            public PortletMode getPortletMode(String windowId) {
141:                PortletMode mode = (PortletMode) portletModes.get(windowId);
142:                if (mode == null) {
143:                    mode = PortletMode.VIEW;
144:                }
145:                return mode;
146:            }
147:
148:            public void setPortletMode(String windowId, PortletMode portletMode) {
149:                portletModes.put(windowId, portletMode);
150:            }
151:
152:            public Map getWindowStates() {
153:                return Collections.unmodifiableMap(windowStates);
154:            }
155:
156:            /**
157:             * Returns the window state of the specified window.
158:             * @param windowId  the window ID.
159:             * @return the window state. Default to NORMAL.
160:             */
161:            public WindowState getWindowState(String windowId) {
162:                WindowState state = (WindowState) windowStates.get(windowId);
163:                if (state == null) {
164:                    state = WindowState.NORMAL;
165:                }
166:                return state;
167:            }
168:
169:            /**
170:             * Sets the window state of the specified window.
171:             * @param windowId  the window ID.
172:             * @param windowState  the window state.
173:             */
174:            public void setWindowState(String windowId, WindowState windowState) {
175:                this .windowStates.put(windowId, windowState);
176:            }
177:
178:            /**
179:             * Clear parameters of the specified window.
180:             * @param windowId  the window ID.
181:             */
182:            public void clearParameters(String windowId) {
183:                for (Iterator it = parameters.entrySet().iterator(); it
184:                        .hasNext();) {
185:                    Map.Entry entry = (Map.Entry) it.next();
186:                    PortalURLParameter param = (PortalURLParameter) entry
187:                            .getValue();
188:                    if (param.getWindowId().equals(windowId)) {
189:                        it.remove();
190:                    }
191:                }
192:            }
193:
194:            /**
195:             * Converts to a string representing the portal URL.
196:             * @return a string representing the portal URL.
197:             * @see org.apache.pluto.driver.url.impl.PortalURLParserImpl#toString(PortalURL)
198:             */
199:            public String toString() {
200:                return urlParser.toString(this );
201:            }
202:
203:            /**
204:             * Returns the server URI (protocol, name, port).
205:             * @return the server URI portion of the portal URL.
206:             */
207:            public String getServerURI() {
208:                return serverURI;
209:            }
210:
211:            /**
212:             * Returns the servlet path (context path + servlet name).
213:             * @return the servlet path.
214:             */
215:            public String getServletPath() {
216:                return servletPath;
217:            }
218:
219:            /**
220:             * Clone a copy of itself.
221:             * @return a copy of itself.
222:             */
223:            public Object clone() {
224:                PortalURLImpl portalURL = new PortalURLImpl();
225:                portalURL.serverURI = this .serverURI;
226:                portalURL.servletPath = this .servletPath;
227:                portalURL.parameters = new HashMap(parameters);
228:                portalURL.portletModes = new HashMap(portletModes);
229:                portalURL.windowStates = new HashMap(windowStates);
230:                portalURL.renderPath = renderPath;
231:                portalURL.actionWindow = actionWindow;
232:                return portalURL;
233:            }
234:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.