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


001:        /**
002:         * $Id: RenderingWrappingProvider.java,v 1.20 2006/05/12 08:46:48 uv199604 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 iPlanet
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.rendering.wrapping;
014:
015:        import com.sun.portal.providers.Provider;
016:        import com.sun.portal.providers.ProviderException;
017:        import com.sun.portal.providers.UnknownEditTypeException;
018:        import com.sun.portal.providers.ProviderEditTypes;
019:        import com.sun.portal.providers.containers.ContainerProvider;
020:        import com.sun.portal.providers.context.ContainerProviderContext;
021:        import com.sun.portal.wireless.providers.containers.rendering.RenderingContainerProvider;
022:        import com.sun.portal.desktop.DesktopRequestThreadLocalizer;
023:        import com.sun.portal.log.common.PortalLogger;
024:
025:        import com.sun.portal.wireless.providers.rendering.JSPRenderingProvider;
026:        import com.sun.portal.wireless.providers.rendering.RenderingUtil;
027:        import javax.servlet.http.HttpServletRequest;
028:        import javax.servlet.http.HttpServletResponse;
029:        import java.net.URL;
030:        import java.util.logging.Level;
031:        import java.util.logging.Logger;
032:
033:        /**   
034:         * The <code>RenderingWrappingProvider</code> class is used to wrap a native
035:         * channel or a container which has AML templates written for it. This can 
036:         * be added to the RenderingContainer. The responsibility of this provider is 
037:         * to always return AML when the parent container is Rendering and return
038:         * native markup when the parent container is Native. 
039:         */
040:
041:        public class RenderingWrappingProvider extends JSPRenderingProvider {
042:
043:            //HttpServletRequest req = null;
044:
045:            private static Logger logger = PortalLogger
046:                    .getLogger(RenderingWrappingProvider.class);
047:
048:            public void init(String name, HttpServletRequest req)
049:                    throws ProviderException {
050:                super .init(name, req);
051:                //this.req = req;
052:            }
053:
054:            /**
055:             * This method is called from the RenderingWrappingProvider's getContent 
056:             * after it creates its content StringBuffer.
057:             * The logic of whether to do the conversion of AML document into device 
058:             * specific markup or to wrap native markup to make it an AML document 
059:             * is implemented in this method. 
060:             * The logic of processing the content is driven by the following table. 
061:
062:             <div align="center">   
063:             <table cellpadding="2" cellspacing="2" border="1" width="60%">
064:             <tbody>
065:             <tr>
066:             <td valign="top" rowspan="2" colspan="2" border="0"><br>
067:             </td>
068:             <th valign="top" rowspan="1" colspan="3" align="center">
069:             Parent Container</th>
070:             
071:             </tr>
072:             <tr>
073:             <td valign="top" ><font color="#000000">Rendering 
074:             Container<br>
075:             </font></td>
076:             <td valign="top" ><font color="#000000">Native
077:             Container</font><br>
078:             </td>
079:             <td valign="top" >Null - top level<br>
080:             
081:             </td>
082:             </tr>
083:             <tr>
084:             <th valign="top" rowspan="2" colspan="1">Client FilePath&nbsp;</th>
085:             <td valign="top">Native filepath e.g. 'wml'<br>
086:             </td>
087:             <td valign="top" align="center" >Wrap with 
088:             '&lt;AmlContainer&gt;'<br>
089:
090:             </td>
091:             <td valign="top" >NOOP<br>
092:             </td>
093:             <td valign="top" >NOOP<br>
094:             </td>
095:             </tr>
096:             <tr>
097:             <td valign="top">Starts with 'aml'<br>
098:
099:             </td>
100:             <td valign="top" align="center" >NOOP<br>
101:             </td>
102:             <td valign="top" >NOOP<br>
103:             </td>
104:             <td valign="top" >Render<br>
105:             </td>
106:             
107:             </tr>
108:             <tr>
109:             </tr>
110:                   
111:             </tbody>   
112:             </table>
113:             &nbsp;&nbsp;&nbsp; <br>
114:             </div>
115:
116:             * @param request   The Http Servlet Request object that gets passed to 
117:             *                  the getContent call of the Provider/Container.
118:             * @param sb        The StringBuffer returned by the getContent call
119:             * @return StringBuffer   The return content driven by the above 
120:             *                        mentioned logic.
121:             * @throws ProviderException
122:             */
123:
124:            public StringBuffer renderContent(HttpServletRequest request,
125:                    StringBuffer sb) throws ProviderException {
126:                ContainerProviderContext cpc = (ContainerProviderContext) getProviderContext();
127:
128:                String parent = cpc.getParentContainerName(getName());
129:                String filepath = cpc.getClientPath();
130:                if (parent == null) {
131:                    // Parent is null .. This is a top level container.
132:                    if (filepath.startsWith("aml")
133:                            || filepath.startsWith("/aml")) {
134:                        // Top level container with filepath starting with 'aml'
135:                        // Render .. return device specific markup
136:                        return RenderingUtil.doRender(request, cpc, getName(),
137:                                sb, true, false);
138:                    } else {
139:                        // Top level container with native filepath .e.g. 'wml' 
140:                        // NOOP
141:                        return sb;
142:                    }
143:                }
144:                return sb;
145:            }
146:
147:            /** 
148:             * Renders the edit content for the wrapped channel.
149:             * @param req   The Http Servlet Request object that gets passed to
150:             *                  the getContent call of the Provider/Container.
151:             * @param sb        The StringBuffer returned by the getContent call
152:             * @return StringBuffer   The return content driven by the above 
153:             *                        mentioned logic.
154:             * @throws ProviderException
155:             */
156:            protected StringBuffer renderEditContent(HttpServletRequest req,
157:                    StringBuffer sb) throws ProviderException {
158:                ContainerProviderContext cpc = (ContainerProviderContext) getProviderContext();
159:                //  It will be set false in RenderingWrappingProvider when it calls
160:                //  the getEdit of its child.
161:                req.setAttribute(getName() + ".shouldRender", Boolean.FALSE);
162:                req.setAttribute(getName() + ".isTopLevel", Boolean.FALSE);
163:
164:                return RenderingUtil.renderEditContent(req, cpc, getName(), sb);
165:            }
166:
167:            /**
168:             * Returns Wrapped Channel markup
169:             * @return sb StringBuffer containing wrapped channel content
170:             * @param req HttpServletRequest
171:             * @param res HttpServletResponse
172:             * @throws ProviderException for error in processing
173:             */
174:
175:            public StringBuffer getWrappedChannelContent(
176:                    HttpServletRequest req, HttpServletResponse res)
177:                    throws ProviderException {
178:                ContainerProviderContext cpc = (ContainerProviderContext) getProviderContext();
179:                String wrappedChannel = getStringProperty("wrappedChannel");
180:                if (cpc.isAuthless(req)) {
181:                    //Need to do the following for Bug#4911170
182:                    cpc.contentChanged(wrappedChannel);
183:                }
184:                StringBuffer sb = cpc
185:                        .getContent(req, res, null, wrappedChannel);
186:
187:                if (logger.isLoggable(Level.FINEST)) {
188:                    String[] param = { "wrappedChannel", wrappedChannel };
189:                    logger.log(Level.FINEST, "PSMA_CSPWPRW0001", param);
190:                    param[0] = "content";
191:                    param[1] = sb.toString();
192:                    logger.log(Level.FINEST, "PSMA_CSPWPRW0001", param);
193:                }
194:                return sb;
195:            }
196:
197:            public StringBuffer getWrappedChannelEdit(HttpServletRequest req,
198:                    HttpServletResponse res) throws ProviderException {
199:                ContainerProviderContext cpc = (ContainerProviderContext) getProviderContext();
200:                String wrappedChannel = getStringProperty("wrappedChannel");
201:                Provider p = cpc.getProvider(req, null, wrappedChannel);
202:                StringBuffer sb = p.getEdit(req, res);
203:                return sb;
204:            }
205:
206:            public String getTitle() throws ProviderException {
207:                ContainerProviderContext cpc = (ContainerProviderContext) getProviderContext();
208:                String wrappedChannel = getStringProperty("wrappedChannel");
209:                //Provider p = cpc.getProvider(req, null, wrappedChannel);
210:                Provider p = cpc.getProvider(DesktopRequestThreadLocalizer
211:                        .getRequest(), null, wrappedChannel);
212:                String title = p.getTitle();
213:                return title;
214:            }
215:
216:            public String getDescription() throws ProviderException {
217:                ContainerProviderContext cpc = (ContainerProviderContext) getProviderContext();
218:                String wrappedChannel = getStringProperty("wrappedChannel");
219:                //Provider p = cpc.getProvider(req, null, wrappedChannel);
220:                Provider p = cpc.getProvider(DesktopRequestThreadLocalizer
221:                        .getRequest(), null, wrappedChannel);
222:                String description = p.getDescription();
223:                return description;
224:            }
225:
226:            public URL getHelp(HttpServletRequest req) throws ProviderException {
227:                ContainerProviderContext cpc = (ContainerProviderContext) getProviderContext();
228:                String wrappedChannel = getStringProperty("wrappedChannel");
229:                Provider p = cpc.getProvider(req, null, wrappedChannel);
230:                URL helpUrl = p.getHelp(req);
231:                return helpUrl;
232:            }
233:
234:            public boolean isPresentable(HttpServletRequest req) {
235:                ContainerProviderContext cpc = (ContainerProviderContext) getProviderContext();
236:                String wrappedChannel = null;
237:                try {
238:                    wrappedChannel = getStringProperty("wrappedChannel");
239:
240:                    if (wrappedChannel == null || "".equals(wrappedChannel)) {
241:                        logger.log(Level.SEVERE, "PSMA_CSPWPRW0004", getName());
242:                        return false;
243:                    }
244:
245:                } catch (ProviderException pe) {
246:                    if (logger.isLoggable(Level.SEVERE)) {
247:                        logger.log(Level.SEVERE, "PSMA_CSPWPRW0002", getName());
248:                    }
249:                    return false;
250:                }
251:                Provider p = cpc.getProvider(req, null, wrappedChannel);
252:
253:                if (p == null) {
254:                    String[] param = { getName(), wrappedChannel };
255:
256:                    logger.log(Level.SEVERE, "PSMA_CSPWPRW0003", param);
257:                    return false;
258:                }
259:
260:                boolean isPresentable = p.isPresentable(req);
261:                return isPresentable;
262:            }
263:
264:            public boolean isEditable() throws ProviderException {
265:                ContainerProviderContext cpc = (ContainerProviderContext) getProviderContext();
266:                String wrappedChannel = getStringProperty("wrappedChannel");
267:                //Provider p = cpc.getProvider(req, null, wrappedChannel);
268:                Provider p = cpc.getProvider(DesktopRequestThreadLocalizer
269:                        .getRequest(), null, wrappedChannel);
270:                boolean isEditable = p.isEditable();
271:                return isEditable;
272:            }
273:
274:            public int getEditType() throws UnknownEditTypeException {
275:                ContainerProviderContext cpc = (ContainerProviderContext) getProviderContext();
276:                String wrappedChannel = null;
277:                try {
278:                    wrappedChannel = getStringProperty("wrappedChannel");
279:                } catch (ProviderException e) {
280:                    if (logger.isLoggable(Level.INFO))
281:                        logger.log(Level.INFO, "PSMA_CSPWPRW0002", getName());
282:                    return ProviderEditTypes.EDIT_SUBSET;
283:                }
284:                //Provider p = cpc.getProvider(req, null, wrappedChannel);
285:                Provider p = cpc.getProvider(DesktopRequestThreadLocalizer
286:                        .getRequest(), null, wrappedChannel);
287:                int editType = p.getEditType();
288:                return editType;
289:            }
290:
291:        }
w__w__w_.__ja_v___a2s_._co___m___ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.