Source Code Cross Referenced for WSRPToContainerMap.java in  » Portal » Open-Portal » com » sun » portal » wsrp » common » 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.wsrp.common 
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.wsrp.common;
014:
015:        import java.util.List;
016:        import java.util.ArrayList;
017:        import java.util.Map;
018:        import java.util.HashMap;
019:        import java.util.Hashtable;
020:        import java.util.Iterator;
021:        import java.util.Collections;
022:        import java.util.StringTokenizer;
023:
024:        import com.sun.portal.container.*;
025:
026:        public class WSRPToContainerMap {
027:
028:            //*****************************************************************
029:            //
030:            // Channel Mode conversion
031:            //
032:            //***************************************************************
033:
034:            private static final Map _windowStateMap = getWindowStateMap();
035:            private static final Map _windowStateReverseMap = getWindowStateReverseMap();
036:
037:            private static Map getWindowStateMap() {
038:                Map windowStateMap = new HashMap();
039:
040:                windowStateMap.put(WSRPSpecKeys.WINDOW_STATE_MINIMIZED,
041:                        WindowState.MINIMIZED);
042:                windowStateMap.put(WSRPSpecKeys.WINDOW_STATE_MAXIMIZED,
043:                        WindowState.MAXIMIZED);
044:                windowStateMap.put(WSRPSpecKeys.WINDOW_STATE_NORMAL,
045:                        WindowState.NORMAL);
046:                return windowStateMap;
047:
048:            }
049:
050:            private static Map getWindowStateReverseMap() {
051:
052:                Map windowStateReverseMap = new HashMap();
053:                windowStateReverseMap.put(WindowState.MINIMIZED,
054:                        WSRPSpecKeys.WINDOW_STATE_MINIMIZED);
055:                windowStateReverseMap.put(WindowState.MAXIMIZED,
056:                        WSRPSpecKeys.WINDOW_STATE_MAXIMIZED);
057:                windowStateReverseMap.put(WindowState.NORMAL,
058:                        WSRPSpecKeys.WINDOW_STATE_NORMAL);
059:
060:                return windowStateReverseMap;
061:            }
062:
063:            /**
064:             * Convert the window state representation used by the WSRP to
065:             * the representation understood by the container layer
066:             */
067:            public static List mapWindowStateToContainer(
068:                    String[] wsrpWindowStates) {
069:                List newList = new ArrayList();
070:                for (int i = 0; wsrpWindowStates != null
071:                        && i < wsrpWindowStates.length; i++) {
072:                    WindowState winState = (WindowState) _windowStateMap
073:                            .get(wsrpWindowStates[i]);
074:                    if (winState != null) {
075:                        newList.add(winState);
076:                    }
077:                }
078:                return newList;
079:
080:            }
081:
082:            /**
083:             * Convert the WindowState representation 
084:             * underderstood by the container layer to WSRP
085:             * Check for null
086:             */
087:            public static String[] mapWindowStateToWSRP(
088:                    List containerWindowStates) {
089:                String[] wsrpWindowStates = new String[containerWindowStates
090:                        .size()];
091:
092:                Iterator iter = containerWindowStates.iterator();
093:                int i = 0;
094:                while (iter.hasNext()) {
095:                    wsrpWindowStates[i] = (String) _windowStateReverseMap
096:                            .get(iter.next());
097:                    i++;
098:                }
099:                return wsrpWindowStates;
100:
101:            }
102:
103:            /**
104:            /**
105:             * Convert the window state representation used by the WSRP to
106:             * the representation understood by the container layer
107:             */
108:            public static WindowState mapWindowStateToContainer(
109:                    String wsrpWindowState) {
110:                WindowState winState = (WindowState) _windowStateMap
111:                        .get(wsrpWindowState);
112:                return winState;
113:            }
114:
115:            /**
116:             * Convert the window state representation used by the container layer to
117:             * the representation understood by the WSRP 
118:             */
119:            public static String mapWindowStateToWSRP(WindowState windowState) {
120:                String winState = (String) _windowStateReverseMap
121:                        .get(windowState);
122:                return winState;
123:            }
124:
125:            //*****************************************************************
126:            //
127:            // Channel Mode conversion
128:            //
129:            //***************************************************************
130:
131:            private static final Map _channelModeMap = getChannelModeMap();
132:            private static final Map _channelModeReverseMap = getChannelModeReverseMap();
133:
134:            private static Map getChannelModeMap() {
135:                Map channelModeMap = new HashMap();
136:
137:                channelModeMap.put(WSRPSpecKeys.MODE_VIEW, ChannelMode.VIEW);
138:                channelModeMap.put(WSRPSpecKeys.MODE_EDIT, ChannelMode.EDIT);
139:                channelModeMap.put(WSRPSpecKeys.MODE_HELP, ChannelMode.HELP);
140:                return channelModeMap;
141:
142:            }
143:
144:            private static Map getChannelModeReverseMap() {
145:
146:                Map channelModeReverseMap = new HashMap();
147:                channelModeReverseMap.put(ChannelMode.VIEW,
148:                        WSRPSpecKeys.MODE_VIEW);
149:                channelModeReverseMap.put(ChannelMode.EDIT,
150:                        WSRPSpecKeys.MODE_EDIT);
151:                channelModeReverseMap.put(ChannelMode.HELP,
152:                        WSRPSpecKeys.MODE_HELP);
153:
154:                return channelModeReverseMap;
155:            }
156:
157:            /**
158:             * Convert the channelMode representation 
159:             * underderstood by the container layer to WSRP
160:             * Check for null
161:             */
162:            public static String[] mapChannelModeToWSRP(
163:                    List containerChannelModes) {
164:                String[] wsrpChannelModes = new String[containerChannelModes
165:                        .size()];
166:
167:                Iterator iter = containerChannelModes.iterator();
168:                int i = 0;
169:                while (iter.hasNext()) {
170:                    wsrpChannelModes[i] = (String) _channelModeReverseMap
171:                            .get(iter.next());
172:                    i++;
173:                }
174:                return wsrpChannelModes;
175:
176:            }
177:
178:            /**
179:             * Convert the channelMode representation used by the WSRP to
180:             * the representation understood by the container layer
181:             */
182:            public static List mapChannelModeToContainer(
183:                    String[] wsrpChannelModes) {
184:                List newList = new ArrayList();
185:                for (int i = 0; wsrpChannelModes != null
186:                        && i < wsrpChannelModes.length; i++) {
187:                    ChannelMode mode = (ChannelMode) _channelModeMap
188:                            .get(wsrpChannelModes[i]);
189:                    if (mode != null) {
190:                        newList.add(mode);
191:                    }
192:                }
193:                return newList;
194:
195:            }
196:
197:            /**
198:             * Convert the window state representation used by the WSRP to
199:             * the representation understood by the container layer
200:             */
201:            public static ChannelMode mapChannelModeToContainer(
202:                    String wsrpChannelMode) {
203:                ChannelMode mode = (ChannelMode) _channelModeMap
204:                        .get(wsrpChannelMode);
205:                return mode;
206:            }
207:
208:            /**
209:             * Convert the window state representation used by the container layer to
210:             * the representation understood by the WSRP 
211:             */
212:            public static String mapChannelModeToWSRP(ChannelMode channelMode) {
213:                String mode = (String) _channelModeReverseMap.get(channelMode);
214:                return mode;
215:            }
216:
217:            //***************************************************************
218:            // URL Type
219:            //
220:            //************************************************************
221:
222:            private static final Map _urlTypeMap = getURLTypeMap();
223:            private static final Map _urlTypeReverseMap = getURLTypeReverseMap();
224:
225:            private static Map getURLTypeMap() {
226:                Map urlTypeMap = new HashMap();
227:
228:                urlTypeMap.put("blockingAction", ChannelURL.ACTION_URL_TYPE);
229:                urlTypeMap.put("render", ChannelURL.RENDER_URL_TYPE);
230:                return urlTypeMap;
231:
232:            }
233:
234:            private static Map getURLTypeReverseMap() {
235:                Map urlTypeReverseMap = new HashMap();
236:
237:                urlTypeReverseMap.put(ChannelURL.ACTION_URL_TYPE,
238:                        "blockingAction");
239:                urlTypeReverseMap.put(ChannelURL.RENDER_URL_TYPE, "render");
240:                return urlTypeReverseMap;
241:
242:            }
243:
244:            /**
245:             * Convert the URLType representation used by the Portlet to
246:             * the representation understood by the container layer
247:             */
248:            public static String mapURLTypeToContainer(String urlType) {
249:                String channelURLType = (String) _urlTypeMap.get(urlType);
250:                return channelURLType;
251:            }
252:
253:            /**
254:             * Convert the URLType representation used by the container layer to
255:             * the representation understood by the WSRP 
256:             */
257:            public static String mapURLTypeToWSRP(String urlType) {
258:                String wsrpUrlType = (String) _urlTypeReverseMap.get(urlType);
259:                return wsrpUrlType;
260:            }
261:
262:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.