Source Code Cross Referenced for PortletWindowConfig.java in  » Portal » Pluto » org » apache » pluto » driver » services » portal » 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.services.portal 
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.services.portal;
018:
019:        /**
020:         * Configuration of a portlet window on the portal page.
021:         */
022:        public class PortletWindowConfig {
023:
024:            // Private Member Variables ------------------------------------------------
025:
026:            /** The context path of the associated portlet. */
027:            private String contextPath;
028:
029:            /** The portlet name. */
030:            private String portletName;
031:
032:            /** The metaInfo that provides uniqueness across window ids. */
033:            private String metaInfo;
034:
035:            // Constructor -------------------------------------------------------------
036:
037:            /**
038:             * No-arg constructor.
039:             */
040:            public PortletWindowConfig() {
041:
042:            }
043:
044:            private PortletWindowConfig(String contextPath, String portletName,
045:                    String metaInfo) {
046:                this .contextPath = contextPath;
047:                this .portletName = portletName;
048:                this .metaInfo = metaInfo;
049:            }
050:
051:            // Public Methods ----------------------------------------------------------
052:
053:            public String getId() {
054:                return createPortletId(contextPath, portletName, metaInfo);
055:            }
056:
057:            public String getContextPath() {
058:                return contextPath;
059:            }
060:
061:            public void setContextPath(String contextPath) {
062:                this .contextPath = contextPath;
063:            }
064:
065:            public String getPortletName() {
066:                return portletName;
067:            }
068:
069:            public void setPortletName(String portletName) {
070:                this .portletName = portletName;
071:            }
072:
073:            public String getMetaInfo() {
074:                return metaInfo;
075:            }
076:
077:            public void setMetaInfo(String metaInfo) {
078:                this .metaInfo = metaInfo;
079:            }
080:
081:            // Public Static Methods ---------------------------------------------------
082:
083:            /**
084:             * Creates the portlet ID from context path and portlet name. The portlet ID
085:             * is constructed by concatinating the context path and the portlet name
086:             * using a dot ('.').
087:             *
088:             * The method checks that the portlet name parameter does not have a dot. This check
089:             * is not done for the portlet ID.
090:             *
091:             * @param contextPath  the portlet context path.
092:             * @param portletName  the portlet name.
093:             * @throws IllegalArgumentException if the portletName has a dot
094:             * @throws NullPointerException if the portlet Name or context path is null.
095:             */
096:            public static String createPortletId(String contextPath,
097:                    String portletName, String metaInfo)
098:                    throws NullPointerException, IllegalArgumentException {
099:
100:                if (contextPath == null) {
101:                    throw new NullPointerException(
102:                            "Context path must not be null.");
103:                }
104:                if (portletName == null) {
105:                    throw new NullPointerException(
106:                            "Portlet name must not be null.");
107:                }
108:                if (portletName.indexOf('.') != -1) {
109:                    throw new IllegalArgumentException(
110:                            "Portlet name must not have a dot(period). Please remove the dot from the value of the portlet-name element ("
111:                                    + portletName + ") in portlet.xml");
112:                }
113:
114:                if (metaInfo == null) {
115:                    metaInfo = "";
116:                }
117:                return contextPath + "." + portletName + "!" + metaInfo;
118:            }
119:
120:            /**
121:             * Parses out the portlet context path from the portlet ID.
122:             * @param portletId  the portlet ID to parse.
123:             * @return the portlet context path.
124:             */
125:            public static String parseContextPath(String portletId) {
126:                int index = getSeparatorIndex(portletId);
127:                return portletId.substring(0, index);
128:            }
129:
130:            /**
131:             * Parses out the portlet context path from the portlet ID.
132:             * @param portletId  the portlet ID to parse.
133:             * @return the portlet context path.
134:             */
135:            public static String parsePortletName(String portletId) {
136:                int index = getSeparatorIndex(portletId);
137:                String postfix = portletId.substring(index + 1);
138:                index = postfix.indexOf("!");
139:                if (index > -1) {
140:                    return postfix.substring(0, index);
141:                }
142:                return postfix;
143:            }
144:
145:            public static String parseMetaInfo(String portletId) {
146:                int index = portletId.indexOf("!");
147:                if (index > -1) {
148:                    return portletId.substring(index + 1);
149:                }
150:                return "";
151:            }
152:
153:            // Private Static Method ---------------------------------------------------
154:
155:            /**
156:             * Parses the portlet ID and returns the separator (".") index. The portlet
157:             * ID passed in should be a valid ID: not null, not starts with ".",
158:             * not ends with ".", and contains ".". The portlet ID can have more than
159:             * one dot, but the last one is taken to be the separator.
160:             *
161:             * @param portletId  the portlet ID to parse.
162:             * @return the separator index.
163:             * @throws IllegalArgumentException if portlet ID does not contain a dot or the dot is the first or last character.
164:             * @throws NullPointerException if the portlet ID is null
165:             */
166:            private static int getSeparatorIndex(String portletId)
167:                    throws NullPointerException, IllegalArgumentException {
168:                if (portletId == null) {
169:                    throw new NullPointerException("Portlet ID is null");
170:                }
171:
172:                int index = portletId.lastIndexOf(".");
173:                if (index <= 0 || index == portletId.length() - 1) {
174:                    throw new IllegalArgumentException(
175:                            "Portlet ID '"
176:                                    + portletId
177:                                    + "' does not contain a dot or the dot is the first or last character");
178:                }
179:                return index;
180:            }
181:
182:            public static PortletWindowConfig fromId(String portletWindowId) {
183:                String contextPath = parseContextPath(portletWindowId);
184:                String portletName = parsePortletName(portletWindowId);
185:                String metaInfo = parseMetaInfo(portletWindowId);
186:                return new PortletWindowConfig(contextPath, portletName,
187:                        metaInfo);
188:            }
189:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.