Source Code Cross Referenced for CApplet.java in  » Portal » uPortal_rel-2-6-1-GA » org » jasig » portal » channels » 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 » uPortal_rel 2 6 1 GA » org.jasig.portal.channels 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /* Copyright 2001, 2005 The JA-SIG Collaborative.  All rights reserved.
002:         *  See license distributed with this file and
003:         *  available online at http://www.uportal.org/license.html
004:         */
005:
006:        package org.jasig.portal.channels;
007:
008:        import javax.xml.parsers.DocumentBuilderFactory;
009:        import javax.xml.parsers.ParserConfigurationException;
010:
011:        import org.jasig.portal.ChannelCacheKey;
012:        import org.jasig.portal.GeneralRenderingException;
013:        import org.jasig.portal.ICacheable;
014:        import org.jasig.portal.PortalException;
015:        import org.jasig.portal.i18n.LocaleManager;
016:        import org.jasig.portal.utils.ResourceLoader;
017:        import org.jasig.portal.utils.XSLT;
018:        import org.w3c.dom.Document;
019:        import org.w3c.dom.Element;
020:        import org.xml.sax.ContentHandler;
021:
022:        /** <p>Displays an applet. To pass in applet parameters, construct
023:         * channel parameters whose keys start with the string "APPLET."</p>
024:         * <p>For example, the key/value pair
025:         * <code>APPLET.data=foo</code>
026:         * as a channel parameter is translated to an applet parameter as
027:         * <code>data=foo</code></p>
028:         * <p><i>This code was adapted from uPortal 1.0's
029:         * <code>org.jasig.portal.channels.CApplet</code></i></p>
030:         * @author Ken Weiner, kweiner@unicon.net
031:         * @version $Revision: 36683 $
032:         */
033:        public class CApplet extends BaseChannel implements  ICacheable {
034:            private static final String sslLocation = "CApplet/CApplet.ssl";
035:
036:            /**
037:             * Output channel content to the portal
038:             * @param out a sax document handler
039:             */
040:            public void renderXML(ContentHandler out) throws PortalException {
041:                Document doc = null;
042:                try {
043:                    doc = DocumentBuilderFactory.newInstance()
044:                            .newDocumentBuilder().newDocument();
045:                } catch (ParserConfigurationException pce) {
046:                    log.error("Error obtaining a Document", pce);
047:                    throw new GeneralRenderingException(pce);
048:                }
049:
050:                // Create XML doc
051:                Element appletE = doc.createElement("applet");
052:                appletE.setAttribute("code", staticData.getParameter("code"));
053:                appletE.setAttribute("codebase", staticData
054:                        .getParameter("codeBase"));
055:                appletE.setAttribute("width", staticData.getParameter("width"));
056:                appletE.setAttribute("height", staticData
057:                        .getParameter("height"));
058:                appletE.setAttribute("align", "top");
059:                appletE.setAttribute("border", "0");
060:                appletE.setAttribute("archive", staticData
061:                        .getParameter("archive"));
062:
063:                // Take all parameters whose names start with "APPLET." and pass them
064:                // to the applet (after stripping "APPLET.")
065:                java.util.Enumeration allKeys = staticData.keys();
066:                while (allKeys.hasMoreElements()) {
067:                    String p = (String) allKeys.nextElement();
068:                    if (p.startsWith("APPLET.")) {
069:                        Element paramE = doc.createElement("param");
070:                        paramE
071:                                .setAttribute("name", p.substring(7) /*skip "APPLET."*/);
072:                        paramE.setAttribute("value", (String) staticData
073:                                .getParameter(p));
074:                        appletE.appendChild(paramE);
075:                    }
076:                }
077:
078:                doc.appendChild(appletE);
079:
080:                XSLT xslt = XSLT.getTransformer(this , runtimeData.getLocales());
081:                xslt.setXML(doc);
082:                xslt.setXSL(sslLocation, "main", runtimeData.getBrowserInfo());
083:                xslt.setTarget(out);
084:                xslt.transform();
085:            }
086:
087:            // ICachable methods...
088:
089:            public ChannelCacheKey generateKey() {
090:                ChannelCacheKey key = new ChannelCacheKey();
091:                key.setKey(getKey());
092:                key.setKeyScope(ChannelCacheKey.SYSTEM_KEY_SCOPE);
093:                key.setKeyValidity(null);
094:                return key;
095:            }
096:
097:            public boolean isCacheValid(Object validity) {
098:                return true;
099:            }
100:
101:            private String getKey() {
102:                StringBuffer sbKey = new StringBuffer(1024);
103:                sbKey.append("org.jasig.portal.channels.CApplet").append(": ");
104:                sbKey.append("xslUri:");
105:                try {
106:                    String sslUrl = ResourceLoader.getResourceAsURLString(this 
107:                            .getClass(), sslLocation);
108:                    sbKey.append(
109:                            XSLT.getStylesheetURI(sslUrl, runtimeData
110:                                    .getBrowserInfo())).append(", ");
111:                } catch (PortalException pe) {
112:                    sbKey.append("Not available, ");
113:                }
114:                sbKey.append("staticData:").append(staticData.toString());
115:                sbKey.append("locales:").append(
116:                        LocaleManager.stringValueOf(runtimeData.getLocales()));
117:
118:                return sbKey.toString();
119:            }
120:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.