Source Code Cross Referenced for DesktopDispatcherProvider.java in  » Portal » Open-Portal » com » sun » portal » wireless » providers » containers » 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.wireless.providers.containers 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         * $Id: DesktopDispatcherProvider.java,v 1.18 2006/08/05 13:42:44 ss150821 Exp $
003:         * Copyright 2002 Sun Microsystems, Inc. All
004:         * rights reserved. Use of this product is subject
005:         * to license terms. Federal Acquisitions:
006:         * Commercial Software -- Government Users
007:         * Subject to Standard License Terms and
008:         * Conditions.
009:         *
010:         * Sun, Sun Microsystems, the Sun logo, and Sun ONE
011:         * are trademarks or registered trademarks of Sun Microsystems,
012:         * Inc. in the United States and other countries.
013:         */package com.sun.portal.wireless.providers.containers;
014:
015:        import com.sun.portal.providers.Provider;
016:        import com.sun.portal.providers.containers.ContainerProviderAdapter;
017:        import com.sun.portal.providers.ProviderException;
018:        import com.sun.portal.providers.UnknownEditTypeException;
019:        import com.sun.portal.providers.context.ContainerProviderContext;
020:        import com.sun.portal.providers.context.ProviderContextException;
021:        import com.sun.mobile.util.MAPConfigProperties;
022:        import com.sun.portal.log.common.PortalLogger;
023:
024:        import javax.servlet.http.HttpServletRequest;
025:        import javax.servlet.http.HttpServletResponse;
026:        import java.util.Map;
027:        import java.util.List;
028:        import java.util.Set;
029:        import java.util.logging.Level;
030:        import java.util.logging.Logger;
031:        import java.net.URL;
032:
033:        public class DesktopDispatcherProvider extends ContainerProviderAdapter {
034:
035:            private static final String MA_MAIL_JSP = "MAMailJSP";
036:
037:            private static final String DESKTOP_DISPATCHER = "WirelessDesktopDispatcher";
038:
039:            private static final String DESKTOPCONTAINER = "desktopContainer";
040:
041:            private static final String SELECTEDCLIENTS = "selectedClients";
042:
043:            private static final String GENERICHTML = "genericHTML";
044:
045:            private static final String PARENTCLIENTS = "parentId";
046:
047:            private static final String STOREPROFILEINCLIENT = "storeProfileInClient";
048:
049:            private static Logger logger = PortalLogger
050:                    .getLogger(DesktopDispatcherProvider.class);
051:
052:            private Provider desktop = null;
053:
054:            public void init(String n, HttpServletRequest req)
055:                    throws ProviderException {
056:                super .init(n, req);
057:
058:                desktop = getDesktopProvider(req);
059:            }
060:
061:            private Provider getDesktopProvider(HttpServletRequest request)
062:                    throws ProviderException {
063:
064:                if (desktop == null
065:                        || getContainerProviderContext().isAuthless(request)) {
066:                    desktop = initDesktopProvider(request);
067:                }
068:
069:                return desktop;
070:
071:            }
072:
073:            private Provider initDesktopProvider(HttpServletRequest request)
074:                    throws ProviderException {
075:
076:                ContainerProviderContext context = getContainerProviderContext();
077:                List filters = null;
078:                try {
079:                    filters = context.getClientPropertiesFilters();
080:                } catch (ProviderContextException e) {
081:                    throw new ProviderException(
082:                            "WirelessDesktopDispatcher.initDesktopProvider(): ",
083:                            e);
084:                }
085:
086:                String desktopName = getStringProperty(DESKTOPCONTAINER,
087:                        filters);
088:
089:                if (logger.isLoggable(Level.FINEST)) {
090:                    Object[] param = { "clientFilters", filters };
091:                    logger.log(Level.FINEST, "PSMA_CSPWPC0001", param);
092:                    param[0] = "desktopName";
093:                    param[1] = desktopName;
094:                    logger.log(Level.FINEST, "PSMA_CSPWPC0001", param);
095:                }
096:
097:                // add client if it is not on selected list
098:                if (!context.isAuthless(request)) {
099:                    Map selectedClients = getMapProperty(SELECTEDCLIENTS);
100:                    String clientType = context.getClientType();
101:
102:                    boolean genericHTML;
103:                    try {
104:                        genericHTML = Boolean.valueOf(
105:                                context.getClientTypeProperty(GENERICHTML))
106:                                .booleanValue();
107:                    } catch (Exception e) {
108:                        genericHTML = false;
109:                    }
110:
111:                    // if client is UAProf, then use it's first ancestor client
112:                    boolean isUAProf = (context.getClientTypeProperties(
113:                            clientType, MAPConfigProperties.get(
114:                                    STOREPROFILEINCLIENT, null)) != null);
115:
116:                    if (isUAProf) {
117:                        try {
118:                            Set parents = context.getClientTypeProperties(
119:                                    clientType, PARENTCLIENTS);
120:                            clientType = (String) parents.iterator().next();
121:
122:                            if (logger.isLoggable(Level.FINEST))
123:                                logger.log(Level.FINEST, "PSMA_CSPWPC0002",
124:                                        clientType);
125:
126:                        } catch (Exception e) {
127:                            if (logger.isLoggable(Level.INFO))
128:                                logger.log(Level.INFO, "PSMA_CSPWPC0003", e);
129:                        }
130:                    }
131:
132:                    if (!genericHTML)
133:                        addClientTypeToMaMailJSP(context, clientType);
134:
135:                    if (!genericHTML
136:                            && !selectedClients.containsKey(clientType)) {
137:                        selectedClients.put(clientType, "");
138:                        setMapProperty(SELECTEDCLIENTS, selectedClients);
139:
140:                        if (logger.isLoggable(Level.FINEST))
141:                            logger.log(Level.FINEST, "PSMA_CSPWPC0004",
142:                                    clientType);
143:                    }
144:                }
145:
146:                return context.getProvider(request, getName(), desktopName);
147:
148:            }
149:
150:            private void addClientTypeToMaMailJSP(
151:                    ContainerProviderContext context, String clientType) {
152:                // Add this client type to the MAMailJSP channel if not present there
153:                // already. - 6330973
154:                try {
155:                    Map maMailClients = context.getCollectionProperty(
156:                            MA_MAIL_JSP, SELECTEDCLIENTS);
157:                    if (!maMailClients.containsKey(clientType)) {
158:                        maMailClients.put(clientType, "");
159:                        context.setCollectionProperty(MA_MAIL_JSP,
160:                                SELECTEDCLIENTS, maMailClients);
161:                    }
162:                } catch (ProviderContextException e) {
163:                    if (logger.isLoggable(Level.WARNING))
164:                        logger
165:                                .log(Level.WARNING, "PSMA_CSPWPC0005",
166:                                        clientType);
167:                }
168:            }
169:
170:            public boolean isPresentable(HttpServletRequest request) {
171:
172:                try {
173:                    return getDesktopProvider(request).isPresentable(request);
174:                } catch (ProviderException prEx) {
175:                    if (logger.isLoggable(Level.INFO))
176:                        logger.log(Level.INFO, "", prEx);
177:                }
178:                return false;
179:            }
180:
181:            public StringBuffer getContent(HttpServletRequest request,
182:                    HttpServletResponse response) throws ProviderException {
183:
184:                return getDesktopProvider(request)
185:                        .getContent(request, response);
186:            }
187:
188:            public int getEditType() throws UnknownEditTypeException {
189:                return desktop.getEditType();
190:            }
191:
192:            public boolean isEditable() throws ProviderException {
193:                return desktop.isEditable();
194:            }
195:
196:            public StringBuffer getEdit(HttpServletRequest request,
197:                    HttpServletResponse response) throws ProviderException {
198:
199:                return getDesktopProvider(request).getEdit(request, response);
200:
201:            }
202:
203:            public URL processEdit(HttpServletRequest request,
204:                    HttpServletResponse response) throws ProviderException {
205:
206:                return getDesktopProvider(request).processEdit(request,
207:                        response);
208:            }
209:
210:            // Not customer public.
211:            public static Map getSelectedClients(
212:                    ContainerProviderContext context)
213:                    throws ProviderContextException {
214:
215:                return context.getCollectionProperty(DESKTOP_DISPATCHER,
216:                        SELECTEDCLIENTS);
217:            }
218:
219:            // Not customer public.
220:            public static String getClientContainerName(
221:                    ContainerProviderContext context, String clientType)
222:                    throws ProviderContextException {
223:
224:                List filters = context.getClientPropertiesFilters(clientType);
225:                return context.getStringProperty(DESKTOP_DISPATCHER,
226:                        DESKTOPCONTAINER, filters);
227:            }
228:
229:            // Not customer public.
230:            public static void removeClient(HttpServletRequest request,
231:                    ContainerProviderContext context, String clientType)
232:                    throws ProviderContextException {
233:
234:                if (!context.isAuthless(request)) {
235:                    Map selectedClients = getSelectedClients(context);
236:                    selectedClients.remove(clientType);
237:                    context.setCollectionProperty(DESKTOP_DISPATCHER,
238:                            SELECTEDCLIENTS, selectedClients);
239:                }
240:            }
241:
242:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.