Source Code Cross Referenced for RegisterChannelType.java in  » Portal » uPortal_rel-2-6-1-GA » org » jasig » portal » tools » 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.tools 
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.tools;
007:
008:        import org.jasig.portal.ChannelRegistryStoreFactory;
009:        import org.jasig.portal.ChannelType;
010:        import org.jasig.portal.IChannelRegistryStore;
011:        import org.jasig.portal.RDBMServices;
012:
013:        /**
014:         * <p>A tool for registering a new channel type with uPortal.
015:         * Channel types are defined by a java class name and an associated
016:         * channel publishing document.  Once added with this tool, a channel
017:         * type will be available to channel publishers for the production
018:         * of new channel definitions based on the channel type.</p>
019:         * <p>Usage: RegisterChannelType <class> <name> <description> <CPD URI></p>
020:         * @author Ken Weiner, kweiner@unicon.net
021:         * @version $Revision: 35664 $
022:         */
023:        public class RegisterChannelType {
024:            protected static IChannelRegistryStore chanRegStore = null;
025:
026:            public static void main(String[] args) {
027:                RDBMServices.setGetDatasourceFromJndi(false); /*don't try jndi when not in web app */
028:
029:                // Enforce that exactly 4 arguments are given: class, name, description, and URI
030:                // and that no arguments are empty
031:                if (args.length == 4) {
032:                    try {
033:                        msg(register(args[0].trim(), args[1].trim(), args[2]
034:                                .trim(), args[3].trim()));
035:                    } catch (IllegalArgumentException e) {
036:                        msg(e.getMessage());
037:                        printHelp();
038:                    } catch (Exception e) {
039:                        e.printStackTrace();
040:                    }
041:                } else {
042:                    printHelp();
043:                }
044:            }
045:
046:            /**
047:             * Utility method for checking validity of type parameters.
048:             * @param name
049:             * @param value
050:             * @throws IllegalArgumentException
051:             */
052:            private static void checkValidity(String name, String value)
053:                    throws IllegalArgumentException {
054:                if (value == null || value.length() == 0)
055:                    throw new IllegalArgumentException(
056:                            "Parameter '"
057:                                    + name
058:                                    + "' must be specified when publishing a channel type.");
059:            }
060:
061:            /**
062:             * Registers a new channel type for the given parameters or updates an
063:             * existing type with the specified parameters if an existing type is found
064:             * having the specified uri.
065:             */
066:            public static String register(String clazz, String name,
067:                    String description, String uri) throws Exception {
068:                clazz = clazz.trim();
069:                name = name.trim();
070:                description = description.trim();
071:                uri = uri.trim();
072:
073:                checkValidity("<class>", clazz);
074:                checkValidity("<name>", name);
075:                checkValidity("<description>", description);
076:                checkValidity("<CPD URI>", uri);
077:
078:                boolean isNew = false;
079:                chanRegStore = ChannelRegistryStoreFactory
080:                        .getChannelRegistryStoreImpl();
081:                ChannelType[] types = chanRegStore.getChannelTypes();
082:                ChannelType chanType = null;
083:
084:                for (int i = 0; i < types.length && chanType == null; i++) {
085:                    if (types[i].getCpdUri().equals(uri))
086:                        chanType = types[i];
087:                }
088:                if (chanType == null) // new one being defined
089:                {
090:                    isNew = true;
091:                    chanType = chanRegStore.newChannelType();
092:                }
093:
094:                chanType.setJavaClass(clazz);
095:                chanType.setName(name);
096:                chanType.setDescription(description);
097:                chanType.setCpdUri(uri);
098:                chanRegStore.saveChannelType(chanType);
099:                return "The \"" + name + "\" channel type has been "
100:                        + (isNew ? "added" : "updated") + " successfully.";
101:            }
102:
103:            private static void msg(String msg) {
104:                System.out.println(msg);
105:            }
106:
107:            private static void printHelp() {
108:                msg("Usage: RegisterChannelType <class> <name> <description> <CPD URI>");
109:                msg("  <class> = Fully qualified channel java class. Ex: org.jasig.portal.channels.CImage");
110:                msg("  <name> = Name of channel type.  Ex: Image channel");
111:                msg("  <description> = Description of channel type.  Ex: Displays image with optional title and subtitle");
112:                msg("  <CPD URI> = URL or classpath-relative path to channel publishing document.  Ex: /org/jasig/portal/channels/CImage/CImage.cpd");
113:            }
114:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.