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


001:        /* Copyright 2002 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.car;
007:
008:        import java.io.ByteArrayInputStream;
009:
010:        import org.jasig.portal.ChannelDefinition;
011:        import org.apache.commons.logging.Log;
012:        import org.apache.commons.logging.LogFactory;
013:        import org.jasig.portal.tools.chanpub.ChannelPublisher;
014:        import org.xml.sax.Attributes;
015:        import org.xml.sax.SAXException;
016:        import org.xml.sax.helpers.DefaultHandler;
017:
018:        /**
019:         * Buffers a single channel definition located in a CAR
020:         * channel-definition block and delegates to the chanpub
021:         * ChannelPublisher to publish the channel.  Also strips our groups
022:         * and categories definitions since groups and categories can change
023:         * from site to site. If not specified then ChannelPublisher will
024:         * place in the "Auto-Published" category and grant access to
025:         * admins. Then admins can determine in what category it should be
026:         * placed and to whom it should be granted.
027:         * 
028:         * @author Mark Boyd  {@link <a href="mailto:mark.boyd@engineer.com">mark.boyd@engineer.com</a>}
029:         * @version $Revision: 36690 $
030:         */
031:        public class DefaultChanPubInnerHandler extends DefaultHandler {
032:            private static final Log log = LogFactory
033:                    .getLog(DefaultChanPubInnerHandler.class);
034:            private ParsingContext ctx = null;
035:            private StringBuffer buffer = new StringBuffer();
036:            private StringBuffer charBuf = new StringBuffer();
037:
038:            public DefaultChanPubInnerHandler(ParsingContext ctx) {
039:                this .ctx = ctx;
040:                buffer.append("<!DOCTYPE channel-definition "
041:                        + "SYSTEM \"channelDefinition.dtd\">");
042:            }
043:
044:            public void startElement(String namespaceURI, String localName,
045:                    String qName, Attributes atts) throws SAXException {
046:                // channel definition elements currently have textual content or 
047:                // other elements and don't have attributes so don't cache attribs.
048:                buffer.append('<');
049:                buffer.append(qName);
050:                buffer.append('>');
051:                charBuf = new StringBuffer();
052:            }
053:
054:            public void characters(char[] ch, int start, int length)
055:                    throws SAXException {
056:                charBuf.append(ch, start, length);
057:            }
058:
059:            public void endElement(String namespaceURI, String localName,
060:                    String qName) throws SAXException {
061:                // capture the closing tag info
062:                buffer.append(charBuf.toString());
063:                buffer.append("</");
064:                buffer.append(qName);
065:                buffer.append('>');
066:                // clean out the buffer at end also to properly handle nested elements
067:                charBuf = new StringBuffer();
068:
069:                // now see if this is the last piece of info for this chan-def
070:                if (qName.equals(DescriptorHandler.CHANDEF_TAG_NAME)
071:                        && ctx.getPath().equals(DescriptorHandler.CHANDEFS)) {
072:                    // leaving ext block so push the channel definition into the 
073:                    // channel publisher to be published.
074:                    try {
075:                        byte[] bytes = buffer.toString().getBytes();
076:
077:                        if (log.isInfoEnabled())
078:                            log
079:                                    .info("CAR channel definition '"
080:                                            + buffer.toString()
081:                                            + "' ready to publish.");
082:
083:                        final ByteArrayInputStream is = new ByteArrayInputStream(
084:                                bytes);
085:                        final ChannelPublisher publisher = ChannelPublisher
086:                                .getChannelArchiveInstance();
087:
088:                        ChannelDefinition chanDef = null;
089:
090:                        chanDef = publisher.publishChannel(is);
091:
092:                        if (chanDef != null && log.isInfoEnabled())
093:                            log.info(" Successfully published channel "
094:                                    + chanDef.getTitle() + " with fname "
095:                                    + chanDef.getFName());
096:                    } catch (Exception e) {
097:                        if (log.isInfoEnabled())
098:                            log
099:                                    .info(
100:                                            "A problem occurred during auto publishing.",
101:                                            e);
102:                    }
103:                }
104:            }
105:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.