Source Code Cross Referenced for WebContainerImplTest.java in  » Portal » Open-Portal » com » sun » portal » fabric » config » 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 » Open Portal » com.sun.portal.fabric.config 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package com.sun.portal.fabric.config;
002:
003:        import com.sun.portal.fabric.tasks.WebContainer;
004:        import com.sun.portal.fabric.tasks.WebContainerFactory;
005:        import com.sun.portal.fabric.tasks.ConfigurationException;
006:
007:        import com.sun.portal.fabric.mbeans.Portal;
008:        import com.sun.portal.fabric.util.ClasspathGenUtil;
009:
010:        import com.sun.portal.admin.common.context.PSConfigContext;
011:        import com.sun.portal.admin.common.context.PSConfigContextImpl;
012:        import com.sun.portal.admin.common.InstanceAttributes;
013:        import com.sun.portal.log.common.PortalLogger;
014:
015:        import java.util.Map;
016:        import java.util.HashMap;
017:        import java.util.Properties;
018:        import java.util.logging.Logger;
019:        import java.util.logging.Level;
020:        import java.io.FileInputStream;
021:
022:        /**
023:         * This is a Web Conatiner Implementaion test class. It can only be used
024:         * for unit testing the various web conatiner tasks mentioned in WebContainer.java.
025:         * Need to pass the WebContainer property file.
026:         */
027:        public class WebContainerImplTest {
028:
029:            // Customise these values according to your configuration.
030:            private static Logger logger = PortalLogger
031:                    .getLogger(WebContainerImplTest.class);
032:            private static final String portalID = "myPortal";
033:            private static final String domainID = "defaultDomain";
034:
035:            public static void main(String[] args) {
036:                process(args[0]);
037:            }
038:
039:            public static void process(String wcPropName) {
040:                Properties wcProp = new Properties();
041:                try {
042:                    wcProp.load(new FileInputStream(wcPropName));
043:                } catch (Exception e) {
044:                    logger.log(Level.SEVERE, "PSFB_CSPFC0257", e);
045:                }
046:
047:                Map attributes = new HashMap(wcProp);
048:                String host = (String) attributes.get(InstanceAttributes.HOST);
049:                String port = (String) attributes.get(InstanceAttributes.PORT);
050:
051:                // Prepare the instance name from the hostname and the port
052:                String instanceID = null;
053:                int idx = host.indexOf('.');
054:                if (idx > 0) {
055:                    instanceID = host.substring(0, idx) + "_" + port;
056:                } else {
057:                    instanceID = host + "_" + port;
058:                }
059:
060:                instanceID = instanceID.replace('-', '_');
061:
062:                String sysClasspath = System.getProperty("java.class.path");
063:
064:                System.setProperty("com.sun.portal.portal.id", portalID);
065:                System.setProperty("com.sun.portal.instance.id", instanceID);
066:                System.setProperty("java.class.path", sysClasspath + ":"
067:                        + "/etc/opt/SUNWportal" + ":" + "/opt/SUNWportal/lib");
068:
069:                logger.log(Level.INFO, "PSFB_CSPFC0258", instanceID);
070:                logger.log(Level.INFO, "PSFB_CSPFC0259", attributes);
071:
072:                try {
073:
074:                    PSConfigContext cc = new PSConfigContextImpl(domainID);
075:
076:                    attributes.put(InstanceAttributes.NAME, instanceID);
077:                    attributes.put(InstanceAttributes.DESCRIPTION, instanceID);
078:
079:                    // Set the DomainID, portalID, instanceID into the attributes that passed
080:                    //to the webcontainer implementations
081:                    attributes.put(WebContainer.DOMAIN_ID, domainID);
082:                    attributes.put(WebContainer.PORTAL_ID, portalID);
083:
084:                    // Create instance of webcontainer
085:                    WebContainer wc = WebContainerFactory.getWebContainer(
086:                            attributes, true);
087:
088:                    // Invoke configure method to setup the classpath for Portal
089:                    // and Access Manager SDK
090:                    wc.configure(cc);
091:
092:                    // Switch to unconfigure
093:                    // wc.unconfigure(cc);
094:
095:                } catch (ConfigurationException ce) {
096:                    logger.log(Level.SEVERE, "PSFB_CSPFC0260", ce);
097:                } catch (Exception e) {
098:                    logger.log(Level.SEVERE, "PSFB_CSPFC0253", e);
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.