Source Code Cross Referenced for CTimeTitle.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 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 java.util.Date;
009:        import java.util.Map;
010:        import javax.xml.parsers.DocumentBuilderFactory;
011:
012:        import org.jasig.portal.ChannelRuntimeProperties;
013:        import org.jasig.portal.ChannelStaticData;
014:        import org.jasig.portal.PortalEvent;
015:        import org.jasig.portal.channels.support.TitledChannelRuntimeProperties;
016:        import org.w3c.dom.Document;
017:        import org.w3c.dom.Element;
018:
019:        /**
020:         * An example channel that includes the current time in its dynamically generated title.
021:         * @since uPortal 2.5.1
022:         * @version $Revision$ $Date$
023:         */
024:        public final class CTimeTitle extends CAbstractXslt {
025:
026:            /**
027:             * "xslUri" is the name of the ChannelStaticData attribute that we will read and,
028:             * if set to a non-null value, we will use its value as our XSLT URI.  If this
029:             * ChannelStaticData attribute is not set, we will fall back on our default.
030:             */
031:            public static final String XSL_PARAM_KEY = "xslUri";
032:
033:            /**
034:             * By default, we use the XSLT 'TimeTitle.xsl' which will be found
035:             * in the stylesheets subdirectory corresponding to the package of
036:             * this CTimeTitle channel.
037:             */
038:            public static final String DEFAULT_XSL_URI = "CTimeTitle/CTimeTitle.xsl";
039:
040:            protected final Document getXml() throws Exception {
041:                /*
042:                 * Here we build a Document conveying the current time.
043:                 */
044:
045:                Document doc = DocumentBuilderFactory.newInstance()
046:                        .newDocumentBuilder().newDocument();
047:
048:                Element missingPropsElem = doc.createElement("time");
049:                String currentDateTime = new Date().toString();
050:                missingPropsElem.setTextContent(currentDateTime);
051:
052:                doc.appendChild(missingPropsElem);
053:
054:                return doc;
055:            }
056:
057:            protected final String getXsltUri() throws Exception {
058:                try {
059:                    ChannelStaticData staticData = getStaticData();
060:                    String xsltUri = staticData.getParameter(XSL_PARAM_KEY);
061:
062:                    if (xsltUri != null) {
063:                        return xsltUri;
064:                    }
065:
066:                    // if xsltUri was null we will fall back on returning our default.
067:
068:                } catch (RuntimeException rte) {
069:                    log
070:                            .error(
071:                                    "Error checking ChannelStaticData attribute ["
072:                                            + XSL_PARAM_KEY
073:                                            + "] for alternate XSLT; falling back on default value: ["
074:                                            + DEFAULT_XSL_URI + "]", rte);
075:                }
076:
077:                // return our default value
078:                return DEFAULT_XSL_URI;
079:            }
080:
081:            protected final Map getStylesheetParams() throws Exception {
082:                // no parameters
083:                return null;
084:            }
085:
086:            public final void receiveEvent(PortalEvent ev) {
087:                // do nothing - handles no events
088:            }
089:
090:            public final ChannelRuntimeProperties getRuntimeProperties() {
091:                // this channel returns ChannelRuntimeProperties that specify the
092:                // dynamic channel title to be the current time.
093:
094:                log.trace("CTimeTitle.getRuntimeProperties()");
095:
096:                String currentTime = new Date().toString();
097:
098:                return new TitledChannelRuntimeProperties(currentTime);
099:
100:            }
101:
102:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.