Source Code Cross Referenced for CSecureInfo.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 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 org.jasig.portal.ChannelCacheKey;
009:        import org.jasig.portal.ICacheable;
010:        import org.jasig.portal.IChannel;
011:        import org.jasig.portal.IPrivilegedChannel;
012:        import org.jasig.portal.PortalControlStructures;
013:        import org.jasig.portal.PortalEvent;
014:        import org.jasig.portal.i18n.LocaleManager;
015:        import org.jasig.portal.utils.DocumentFactory;
016:        import org.jasig.portal.utils.XSLT;
017:        import org.w3c.dom.Document;
018:        import org.w3c.dom.Element;
019:        import org.xml.sax.ContentHandler;
020:
021:        import org.apache.xml.serialize.OutputFormat;
022:        import org.apache.xml.serialize.XMLSerializer;
023:
024:        /**
025:         * CSecureInfo is designed to replace channel instances that are required
026:         * to be rendered securely, yet the request does not warrant it.
027:         * <p>
028:         * CSecureInfo provides information in place of the actual channel content
029:         * as it relates to rendering channels that are tagged as secure.
030:         * <p>
031:         * The channel is modeled after CError and borrows code from it liberally.
032:         * 
033:         * @author Keith Stacks, kstacks@sct.com
034:         * @version $Revision: 36729 $
035:         */
036:        public class CSecureInfo extends BaseChannel implements 
037:                IPrivilegedChannel, ICacheable {
038:
039:            protected String str_channelSubscribeId = null;
040:            protected IChannel the_channel = null;
041:
042:            private static final String ssTitle = "info";
043:            private static final String sslLocation = "CSecureInfo/CSecureInfo.ssl";
044:
045:            private PortalControlStructures portcs;
046:
047:            public CSecureInfo() {
048:            }
049:
050:            public CSecureInfo(String channelSubscribeId,
051:                    IChannel channelInstance) {
052:                this ();
053:                this .str_channelSubscribeId = channelSubscribeId;
054:                this .the_channel = channelInstance;
055:            }
056:
057:            public void setPortalControlStructures(PortalControlStructures pcs) {
058:                this .portcs = pcs;
059:            }
060:
061:            public void receiveEvent(PortalEvent ev) {
062:                if (the_channel != null) {
063:                    // propagate the portal events to the normal channel
064:                    the_channel.receiveEvent(ev);
065:                }
066:                super .receiveEvent(ev);
067:            }
068:
069:            public void renderXML(ContentHandler out) {
070:                // XML of the following type is generated:
071:                // <secure>
072:                //  <channel>
073:                //   <id>$channelID</id>
074:                //   <name>$channelName</name>
075:                //  </channel>
076:                // </secure>
077:                //
078:                Document doc = DocumentFactory.getNewDocument();
079:                Element secureEl = doc.createElement("secure");
080:                if (str_channelSubscribeId != null) {
081:                    Element channelEl = doc.createElement("channel");
082:                    Element idEl = doc.createElement("id");
083:                    idEl
084:                            .appendChild(doc
085:                                    .createTextNode(str_channelSubscribeId));
086:                    channelEl.appendChild(idEl);
087:
088:                    // determine channel name
089:                    if (portcs != null) {
090:                        String chName = null;
091:                        try {
092:                            chName = portcs.getUserPreferencesManager()
093:                                    .getUserLayoutManager().getNode(
094:                                            str_channelSubscribeId).getName();
095:                        } catch (Exception e) {
096:                            chName = "undetermined name";
097:                        }
098:                        if (chName != null) {
099:                            Element nameEl = doc.createElement("name");
100:                            nameEl.appendChild(doc.createTextNode(chName));
101:                            channelEl.appendChild(nameEl);
102:                        }
103:                        secureEl.appendChild(channelEl);
104:                    }
105:                }
106:
107:                doc.appendChild(secureEl);
108:
109:                // debug block
110:                if (log.isDebugEnabled()) {
111:                    try {
112:                        java.io.StringWriter outString = new java.io.StringWriter();
113:                        /* This should be reviewed at some point to see if we can use the
114:                         * DOM3 LS capability and hence a standard way of doing this rather
115:                         * than using an internal implementation class.
116:                         */
117:                        OutputFormat format = new OutputFormat();
118:                        format.setOmitXMLDeclaration(true);
119:                        format.setIndenting(true);
120:                        XMLSerializer xsl = new XMLSerializer(outString, format);
121:                        xsl.serialize(doc);
122:                        log.debug(outString.toString());
123:                    } catch (Exception e) {
124:                        log.debug(e, e);
125:                    }
126:                }
127:                // end of debug block
128:
129:                try {
130:                    XSLT xslt = XSLT.getTransformer(this , runtimeData
131:                            .getLocales());
132:                    xslt.setXML(doc);
133:                    xslt.setXSL(sslLocation, ssTitle, runtimeData
134:                            .getBrowserInfo());
135:                    xslt.setTarget(out);
136:                    xslt.setStylesheetParameter("baseActionURL", runtimeData
137:                            .getBaseActionURL());
138:                    xslt.transform();
139:                } catch (Exception e) {
140:                    log
141:                            .error(
142:                                    "CSecureInfo::renderXML() : Error transforming document",
143:                                    e);
144:                }
145:            }
146:
147:            public ChannelCacheKey generateKey() {
148:                ChannelCacheKey k = new ChannelCacheKey();
149:                StringBuffer sbKey = new StringBuffer(1024);
150:
151:                // assume that security information can be cached system-wide
152:                k.setKeyScope(ChannelCacheKey.SYSTEM_KEY_SCOPE);
153:
154:                sbKey
155:                        .append("org.jasig.portal.channels.CSecureInfo: channelID=");
156:                sbKey.append(str_channelSubscribeId);
157:                sbKey.append("locales:").append(
158:                        LocaleManager.stringValueOf(runtimeData.getLocales()));
159:
160:                k.setKey(sbKey.toString());
161:                return k;
162:            }
163:
164:            public boolean isCacheValid(Object validity) {
165:                return true;
166:            }
167:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.