001: /*
002: * BEGIN_HEADER - DO NOT EDIT
003: *
004: * The contents of this file are subject to the terms
005: * of the Common Development and Distribution License
006: * (the "License"). You may not use this file except
007: * in compliance with the License.
008: *
009: * You can obtain a copy of the license at
010: * https://open-esb.dev.java.net/public/CDDLv1.0.html.
011: * See the License for the specific language governing
012: * permissions and limitations under the License.
013: *
014: * When distributing Covered Code, include this CDDL
015: * HEADER in each file and include the License file at
016: * https://open-esb.dev.java.net/public/CDDLv1.0.html.
017: * If applicable add the following below this CDDL HEADER,
018: * with the fields enclosed by brackets "[]" replaced with
019: * your own identifying information: Portions Copyright
020: * [year] [name of copyright owner]
021: */
022:
023: /*
024: * @(#)UIMBeanFactory.java
025: * Copyright 2004-2007 Sun Microsystems, Inc. All Rights Reserved.
026: *
027: * END_HEADER - DO NOT EDIT
028: */
029: package com.sun.jbi.ui.runtime.mbeans;
030:
031: import javax.jbi.JBIException;
032:
033: import com.sun.esb.management.api.administration.AdministrationService;
034: import com.sun.esb.management.api.configuration.ConfigurationService;
035: import com.sun.esb.management.api.deployment.DeploymentService;
036: import com.sun.esb.management.api.installation.InstallationService;
037: import com.sun.esb.management.api.performance.PerformanceMeasurementService;
038: import com.sun.esb.management.api.runtime.RuntimeManagementService;
039: import com.sun.esb.management.impl.administration.AdministrationServiceMBeanImpl;
040: import com.sun.esb.management.impl.configuration.ConfigurationServiceMBeanImpl;
041: import com.sun.esb.management.impl.deployment.DeploymentServiceMBeanImpl;
042: import com.sun.esb.management.impl.installation.InstallationServiceMBeanImpl;
043: import com.sun.esb.management.impl.performance.PerformanceMeasurementServiceMBeanImpl;
044: import com.sun.esb.management.impl.runtime.RuntimeManagementServiceMBeanImpl;
045: import com.sun.jbi.EnvironmentContext;
046:
047: /**
048: * This class is a default factory implemenation that creates the UIMBean impl
049: * for RI runtime
050: *
051: * @author graj
052: */
053: public class UIMBeanFactory {
054: /**
055: * property that can be set for creating different UIMBeanFactory
056: * implemenation
057: */
058: public static String UIMBEAN_FACTORY_CLASS_PROP = "com.sun.jbi.tools.uimbean.factory";
059:
060: /**
061: * Default impl class for the ESB UIMBeanFactory
062: */
063: public static String DEFAULT_ESB_UIMBEAN_FACTORY_CLASS = "com.sun.jbi.esb.ui.admin.runtime.mbeans.UIMBeanFactoryESBImpl";
064:
065: /**
066: * Default impl class for the RI UIMBeanFactory
067: */
068: public static String DEFAULT_RI_UIMBEAN_FACTORY_CLASS = "com.sun.jbi.ui.runtime.mbeans.UIMBeanFactoryReferenceImpl";
069:
070: /**
071: * factory instance
072: */
073: private static UIMBeanFactory sUIMBeanFactory = null;
074:
075: /**
076: * RI factory instance
077: */
078: private static UIMBeanFactory sUIMBeanFactoryReference = null;
079:
080: /** Creates a new instance of UIMBeanFactory */
081: public UIMBeanFactory() {
082: // check the system properties and intialize if there is a different
083: // UIMBeanFactory impl exists
084: }
085:
086: /**
087: * Returns a configured instance of the UIMBeanFactory class.
088: *
089: * @return The instance of the UIMBeanFactory
090: */
091: public static UIMBeanFactory getInstance() {
092: /*
093: * if (null == sUIMBeanFactory) { String factoryImplClass =
094: * System.getProperty( UIMBEAN_FACTORY_CLASS_PROP,
095: * DEFAULT_ESB_UIMBEAN_FACTORY_CLASS);
096: *
097: * ToolsLogManager.getRuntimeLogger().info( "UIMBeanFactory Impl Class
098: * Name from System properties " + factoryImplClass);
099: *
100: * try { Class cl = Class.forName(factoryImplClass); sUIMBeanFactory =
101: * (UIMBeanFactory) cl.newInstance(); } catch (Exception ex) {
102: * ToolsLogManager .getRuntimeLogger() .log( Level.FINER, "Exception
103: * occured loading UIMBeanFactory Impl Class Name from System properties " +
104: * factoryImplClass, ex); ToolsLogManager .getRuntimeLogger() .info(
105: * "Creating default UIMBeanFactory which creates RI UIMBean Impl");
106: * sUIMBeanFactory = new UIMBeanFactory(); } } return sUIMBeanFactory;
107: */
108: // Added new
109: sUIMBeanFactory = getReferenceInstance();
110: return sUIMBeanFactory;
111: }
112:
113: /**
114: * Returns a configured instance of the UIMBeanFactory class.
115: *
116: * @return The instance of the UIMBeanFactory
117: */
118: public static UIMBeanFactory getReferenceInstance() {
119: if (null == sUIMBeanFactoryReference) {
120: sUIMBeanFactoryReference = new UIMBeanFactoryReferenceImpl();
121: }
122: return sUIMBeanFactoryReference;
123: }
124:
125: /**
126: * creates the UIMBean implemenation.
127: *
128: * @param aContext
129: * jbi context
130: * @throws javax.jbi.JBIException
131: * on error
132: * @return UIMBean implemenation
133: */
134: public JBIAdminCommandsUIMBean createJBIAdminCommandsUIMBean(
135: EnvironmentContext aContext) throws JBIException {
136: return new JBIAdminCommandsUIMBeanImpl(aContext);
137: }
138:
139: /**
140: * Creates the CAPS Management Administration Service implementation.
141: *
142: * @param aContext
143: * jbi context
144: * @throws javax.jbi.JBIException
145: * on error
146: * @return CAPS Management Service implementation
147: */
148: public AdministrationService createJavaCAPSAdministrationServiceMBean(
149: EnvironmentContext aContext) throws JBIException {
150: return new AdministrationServiceMBeanImpl(aContext);
151: }
152:
153: /**
154: * Creates the CAPS Management Deployment Service implementation.
155: *
156: * @param aContext
157: * jbi context
158: * @throws javax.jbi.JBIException
159: * on error
160: * @return CAPS Management Service implementation
161: */
162: public DeploymentService createJavaCAPSDeploymentServiceMBean(
163: EnvironmentContext aContext) throws JBIException {
164: return new DeploymentServiceMBeanImpl(aContext);
165: }
166:
167: /**
168: * Creates the CAPS Management Installation Service implementation.
169: *
170: * @param aContext
171: * jbi context
172: * @throws javax.jbi.JBIException
173: * on error
174: * @return CAPS Management Service implementation
175: */
176: public InstallationService createJavaCAPSInstallationServiceMBean(
177: EnvironmentContext aContext) throws JBIException {
178: return new InstallationServiceMBeanImpl(aContext);
179: }
180:
181: /**
182: * Creates the CAPS Management Configuration Service implementation.
183: *
184: * @param aContext
185: * jbi context
186: * @throws javax.jbi.JBIException
187: * on error
188: * @return CAPS Management Service implementation
189: */
190: public ConfigurationService createJavaCAPSConfigurationServiceMBean(
191: EnvironmentContext aContext) throws JBIException {
192: return new ConfigurationServiceMBeanImpl(aContext);
193: }
194:
195: /**
196: * Creates the CAPS Runtime Management Service implementation.
197: *
198: * @param aContext
199: * jbi context
200: * @throws javax.jbi.JBIException
201: * on error
202: * @return CAPS Management Service implementation
203: */
204: public RuntimeManagementService createJavaCAPSRuntimeManagementServiceMBean(
205: EnvironmentContext aContext) throws JBIException {
206: return new RuntimeManagementServiceMBeanImpl(aContext);
207: }
208:
209: /**
210: * Creates the CAPS Performance Measurement Service implementation.
211: *
212: * @param aContext
213: * jbi context
214: * @throws javax.jbi.JBIException
215: * on error
216: * @return CAPS Management Service implementation
217: */
218: public PerformanceMeasurementService createJavaCAPSPerformanceMeasurementServiceMBean(
219: EnvironmentContext aContext) throws JBIException {
220: return new PerformanceMeasurementServiceMBeanImpl(aContext);
221: }
222:
223: /**
224: * creates the JBIStatisticsMBean.
225: * @param aContext EnvironmentContext
226: * @throws javax.jbi.JBIException on error
227: * @return UIMBean implemenation
228: */
229: public JBIStatisticsMBean createJBIStatisticsMBean(
230: EnvironmentContext aContext) throws JBIException {
231: return new JBIStatisticsMBeanImpl(aContext);
232: }
233:
234: }
|