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


001:        package com.sun.portal.sra.admin.mbeans;
002:
003:        import java.util.Properties;
004:        import java.util.List;
005:
006:        import com.sun.portal.admin.common.context.PSConfigContext;
007:        import com.sun.portal.admin.common.PSMBeanException;
008:        import com.sun.portal.sra.admin.mbeans.exceptions.NoSuchSraServerTypeException;
009:
010:        /**
011:         * @version 1.0
012:         * @created 04-Mar-2005 9:58:14 PM
013:         * @author Sandeep Soni
014:         */
015:
016:        public class SraServerFactory {
017:            public static SraServer createServerInstance(int serviceIdentifier,
018:                    Properties configProperties, PSConfigContext cc)
019:                    throws NoSuchSraServerTypeException, PSMBeanException {
020:                SraServer server = null;
021:                switch (serviceIdentifier) {
022:                case SraServer.INSTANCE_TYPE_GATEWAY:
023:                    server = new Gateway(cc);
024:                    server.createInstance(configProperties);
025:                    break;
026:                case SraServer.INSTANCE_TYPE_REWRITER_PROXY:
027:                    server = new RewriterProxy(cc);
028:                    server.createInstance(configProperties);
029:                    break;
030:                case SraServer.INSTANCE_TYPE_NETLET_PROXY:
031:                    server = new NetletProxy(cc);
032:                    server.createInstance(configProperties);
033:                    break;
034:                default:
035:                    StringBuffer sb = new StringBuffer(
036:                            "No such SRA Server of type " + serviceIdentifier
037:                                    + " is known.\n");
038:                    sb
039:                            .append("Valid values are SraServer.INSTANCE_TYPE_GATEWAY, SraServer.INSTANCE_TYPE_REWRITER_PROXY and SraServer.INSTANCE_TYPE_NETLET_PROXY");
040:                    throw new NoSuchSraServerTypeException(sb.toString());
041:                }
042:                return server;
043:            }
044:
045:            public static boolean deleteServerInstance(int serviceIdentifier,
046:                    String instanceName, PSConfigContext cc)
047:                    throws NoSuchSraServerTypeException, Exception {
048:                boolean status = false;
049:                SraServer server = getServerComponent(serviceIdentifier,
050:                        instanceName, cc);
051:                if (server == null)
052:                    return status;
053:                status = server.deleteInstance();
054:                return status;
055:            }
056:
057:            public static boolean startServerInstance(int serviceIdentifier,
058:                    String instanceName, PSConfigContext cc)
059:                    throws NoSuchSraServerTypeException, Exception {
060:                boolean status = false;
061:                SraServer server = getServerComponent(serviceIdentifier,
062:                        instanceName, cc);
063:                if (server == null)
064:                    return status;
065:                status = server.start();
066:                return status;
067:            }
068:
069:            public static boolean stopServerInstance(int serviceIdentifier,
070:                    String instanceName, PSConfigContext cc)
071:                    throws NoSuchSraServerTypeException, Exception {
072:                boolean status = false;
073:                SraServer server = getServerComponent(serviceIdentifier,
074:                        instanceName, cc);
075:                if (server == null)
076:                    return status;
077:                status = server.stop();
078:                return status;
079:            }
080:
081:            public static boolean isServerInstanceStarted(PSConfigContext cc,
082:                    int serviceIdentifier, String instanceName,
083:                    String hostname, int portNumber)
084:                    throws NoSuchSraServerTypeException, Exception {
085:                boolean status = false;
086:                SraServer server = getServerComponent(serviceIdentifier,
087:                        instanceName, cc);
088:                if (server == null)
089:                    return status;
090:                return server.isStarted(hostname, portNumber);
091:            }
092:
093:            public static boolean isServerInstanceStopped(PSConfigContext cc,
094:                    int serviceIdentifier, String instanceName,
095:                    String hostname, int portNumber)
096:                    throws NoSuchSraServerTypeException, Exception {
097:                boolean status = false;
098:                SraServer server = getServerComponent(serviceIdentifier,
099:                        instanceName, cc);
100:                if (server == null)
101:                    return status;
102:                return server.isStopped(hostname, portNumber);
103:            }
104:
105:            public static List getInstancesFromProfile(int serviceIdentifier,
106:                    String instanceName) throws NoSuchSraServerTypeException,
107:                    Exception {
108:                switch (serviceIdentifier) {
109:                case SraServer.INSTANCE_TYPE_GATEWAY:
110:                    return SraServerImpl.getServerInstanceInfoFromProfile(
111:                            Gateway.COMPONENT_NAME,
112:                            Gateway.ATTRIBUTE_GATEWAY_LISTS, instanceName);
113:                case SraServer.INSTANCE_TYPE_REWRITER_PROXY:
114:                    return SraServerImpl.getServerInstanceInfoFromProfile(
115:                            RewriterProxy.COMPONENT_NAME,
116:                            RewriterProxy.ATTRIBUTE_RWP_LISTS, instanceName);
117:                case SraServer.INSTANCE_TYPE_NETLET_PROXY:
118:                    return SraServerImpl.getServerInstanceInfoFromProfile(
119:                            NetletProxy.COMPONENT_NAME,
120:                            NetletProxy.ATTRIBUTE_NLP_LISTS, instanceName);
121:                default:
122:                    StringBuffer sb = new StringBuffer(
123:                            "No such SRA Server of type " + serviceIdentifier
124:                                    + " is known.\n");
125:                    sb
126:                            .append("Valid values are SraServer.INSTANCE_TYPE_GATEWAY, SraServer.INSTANCE_TYPE_REWRITER_PROXY and SraServer.INSTANCE_TYPE_NETLET_PROXY");
127:                    throw new NoSuchSraServerTypeException(sb.toString());
128:                }
129:            }
130:
131:            /*
132:             * Given an instance name and the type of SRA Server to get, this factory
133:             * method will create an instance of that server type with all properties of
134:             * that instance So for example calling
135:             * SraServerComponentFactory.getServerComponent("gateway" , "default" );
136:             * will create an object of type Gateway which implements
137:             * SraServerComponent. The returned component will have read all confg
138:             * values from its corresponding property files and config files and is
139:             * guaranteeed to be populated with data you can use.
140:             */
141:            public static SraServer getServerComponent(int serviceIdentifier,
142:                    String instanceName, PSConfigContext cc)
143:                    throws NoSuchSraServerTypeException {
144:                SraServer server = null;
145:
146:                switch (serviceIdentifier) {
147:                case SraServer.INSTANCE_TYPE_GATEWAY:
148:                    server = new Gateway(instanceName, cc);
149:                    break;
150:                case SraServer.INSTANCE_TYPE_REWRITER_PROXY:
151:                    server = new RewriterProxy(instanceName, cc);
152:                    break;
153:                case SraServer.INSTANCE_TYPE_NETLET_PROXY:
154:                    server = new NetletProxy(instanceName, cc);
155:                    break;
156:                default:
157:                    StringBuffer sb = new StringBuffer(
158:                            "No such SRA Server of type " + serviceIdentifier
159:                                    + " is known.\n");
160:                    sb
161:                            .append("Valid values are SraServer.INSTANCE_TYPE_GATEWAY, SraServer.INSTANCE_TYPE_REWRITER_PROXY and SraServer.INSTANCE_TYPE_NETLET_PROXY");
162:                    throw new NoSuchSraServerTypeException(sb.toString());
163:                }
164:                return server;
165:            }
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.