KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > jbi > serviceengine > install > ServiceEngineObjectFactoryImpl


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23 package com.sun.enterprise.jbi.serviceengine.install;
24 import com.sun.enterprise.admin.common.MBeanServerFactory;
25 import com.sun.enterprise.jbi.serviceengine.ServiceEngineException;
26 import javax.management.MBeanServer JavaDoc;
27 import javax.management.MBeanServerConnection JavaDoc;
28
29
30
31 /**
32  *
33  * @author Manisha Umbarje
34  */

35 public class ServiceEngineObjectFactoryImpl
36         implements ServiceEngineObjectFactory {
37     
38     private static ServiceEngineObjectFactoryImpl factoryObj = null;
39     private MBeanServer JavaDoc mbeanServer;
40     private Installer installer;
41     private MBeanHelper helper;
42     private String JavaDoc defaultDomainName;
43     
44     /** Creates a new instance of ServiceEngineObjectFactory */
45     private ServiceEngineObjectFactoryImpl() {
46     }
47     
48     
49     public static ServiceEngineObjectFactoryImpl getInstance() {
50         if(factoryObj == null)
51             factoryObj = new ServiceEngineObjectFactoryImpl();
52         return factoryObj;
53     }
54      
55     public Installer createInstaller() {
56         if (installer == null)
57             installer = new InstallerImpl(createMBeanHelper());
58         return installer;
59     }
60     
61     public MBeanHelper createMBeanHelper() {
62         if(helper == null) {
63             helper = new MBeanHelper(createMBeanServerConnection());
64         }
65         return helper;
66     }
67     public MBeanServerConnection JavaDoc createMBeanServerConnection() {
68         try {
69            return MBeanServerFactory .getMBeanServer();
70         } catch(Exception JavaDoc e) {
71             e.printStackTrace();
72         }
73         return null;
74     }
75 }
76
Popular Tags