KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > instance > InstanceFactory


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
24 package com.sun.enterprise.instance;
25
26 import com.sun.enterprise.config.ConfigException;
27
28
29 /**
30  * A factory to create instance specific objects.
31  */

32 public class InstanceFactory {
33
34    /**
35     * Returns a AppsManager object which provides convenience fuctions
36     * to read and save data related to the specified server id.
37     *
38     * @return a AppsManager for a given configuration context
39     */

40     public static AppsManager createAppsManager(String JavaDoc serverId)
41     throws ConfigException
42     {
43     InstanceEnvironment env = new InstanceEnvironment(serverId);
44     return new AppsManager(env);
45     }
46
47     /**
48      * Returns a AppsManager object which provides convenience fuctions
49      * to read and save data related to the specified server id.
50      *
51      * @return a AppsManager for a given configuration context
52      */

53     public static AppsManager createAppsManager(String JavaDoc installRoot,
54         String JavaDoc serverId) throws ConfigException
55     {
56         return createAppsManager(installRoot, serverId, true);
57     }
58
59     /**
60      * Returns a AppsManager object which provides convenience fuctions
61      * to read and save data related to the specified server id.
62      *
63      * @return a AppsManager for a given configuration context
64      */

65     public static AppsManager createAppsManager(String JavaDoc installRoot,
66         String JavaDoc serverId, boolean useBackupServerXml) throws ConfigException
67     {
68     InstanceEnvironment env = new InstanceEnvironment(installRoot,serverId);
69     return new AppsManager(env, useBackupServerXml);
70     }
71
72     /**
73      * Returns a manager object for the J2EE applicatoins.
74      * AppsManager object provides convenience fuctions
75      * to read and save data related to the given server instance.
76      *
77      * @param env environment object for a particular server instance
78      * @param useBackupServerXml uses back up server configuration if true
79      *
80      * @return manager object for the j2ee applications
81      */

82     public static AppsManager createAppsManager(InstanceEnvironment env,
83             boolean useBackupServerXml) throws ConfigException {
84
85         return new AppsManager(env, useBackupServerXml);
86     }
87    
88     public static EjbModulesManager createEjbModuleManager(String JavaDoc serverId)
89     throws ConfigException
90     {
91     InstanceEnvironment env = new InstanceEnvironment(serverId);
92     return new EjbModulesManager(env);
93     }
94
95     public static EjbModulesManager createEjbModuleManager(String JavaDoc installRoot,
96         String JavaDoc serverId) throws ConfigException
97     {
98     return createEjbModuleManager(installRoot, serverId, true);
99     }
100
101     public static EjbModulesManager createEjbModuleManager(String JavaDoc installRoot,
102         String JavaDoc serverId, boolean useBackupServerXml) throws ConfigException
103     {
104     InstanceEnvironment env = new InstanceEnvironment(installRoot,serverId);
105     return new EjbModulesManager(env, useBackupServerXml);
106     }
107
108     /**
109      * Returns a manager object stand alone ejb modules. It provides
110      * convenience functions to read and save data related to the given
111      * server instance.
112      *
113      * @param env environment object for a particular server instance
114      * @param useBackupServerXml uses back up server configuration if true
115      *
116      * @return manager object for stand alone ejb modules
117      */

118     public static EjbModulesManager createEjbModuleManager(
119             InstanceEnvironment env, boolean useBackupServerXml)
120             throws ConfigException {
121
122         return new EjbModulesManager(env, useBackupServerXml);
123     }
124
125     public static ConnectorModulesManager createConnectorModulesManager(String JavaDoc serverId)
126     throws ConfigException
127     {
128     InstanceEnvironment env = new InstanceEnvironment(serverId);
129     return new ConnectorModulesManager(env);
130     }
131
132
133     // START OF IASRI 4666602
134
public static ConnectorModulesManager createConnectorModuleManager(
135             InstanceEnvironment env, boolean useBackupServerXml)
136             throws ConfigException {
137         return new ConnectorModulesManager(env, useBackupServerXml);
138     }
139
140     // END OF IASRI 4666602
141
public static WebModulesManager createWebModuleManager(String JavaDoc serverId)
142     throws ConfigException
143     {
144     InstanceEnvironment env = new InstanceEnvironment(serverId);
145     return new WebModulesManager(env);
146     }
147
148
149     public static WebModulesManager createWebModuleManager(String JavaDoc installRoot,
150         String JavaDoc serverId) throws ConfigException
151     {
152     return createWebModuleManager(installRoot, serverId, true);
153     }
154
155     public static WebModulesManager createWebModuleManager(String JavaDoc installRoot,
156         String JavaDoc serverId, boolean useBackupServerXml) throws ConfigException
157     {
158     InstanceEnvironment env = new InstanceEnvironment(installRoot,serverId);
159     return new WebModulesManager(env, useBackupServerXml);
160     }
161
162     public static AppclientModulesManager createAppclientModulesManager(String JavaDoc serverId)
163         throws ConfigException
164     {
165     InstanceEnvironment env = new InstanceEnvironment(serverId);
166     return new AppclientModulesManager(env);
167     }
168
169     public static AppclientModulesManager createAppclientModulesManager(InstanceEnvironment env)
170         throws ConfigException
171     {
172     return new AppclientModulesManager(env);
173     }
174
175 }
176
Popular Tags