KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > mx > server > ServerConfig


1 /*
2 * JBoss, Home of Professional Open Source
3 * Copyright 2005, JBoss Inc., and individual contributors as indicated
4 * by the @authors tag. See the copyright.txt in the distribution for a
5 * full listing of individual contributors.
6 *
7 * This is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU Lesser General Public License as
9 * published by the Free Software Foundation; either version 2.1 of
10 * the License, or (at your option) any later version.
11 *
12 * This software is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this software; if not, write to the Free
19 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21 */

22 package org.jboss.mx.server;
23
24 import javax.management.MBeanServerBuilder JavaDoc;
25 import javax.management.ObjectName JavaDoc;
26
27 import org.jboss.mx.standardmbean.StandardMBeanDelegateFactory;
28 import org.jboss.mx.util.ObjectNameFactory;
29 import org.jboss.util.Classes;
30
31 /**
32  * Server configuration.
33  *
34  * @author <a HREF="mailto:adrian@jboss.com">Adrian Brock</a>.
35  * @version $Revision: 37459 $
36  */

37 public abstract class ServerConfig
38 {
39    // Constants ---------------------------------------------------
40

41    /** The instance */
42    private static ServerConfig instance;
43
44    /**
45     * The name of the protected implementation domain
46     * Pass this object to the registry in the values map as the key and value
47     * to register in this domain
48     */

49    private final static String JavaDoc JMI_DOMAIN = "JMImplementation";
50
51    /** The default domain */
52    private final static String JavaDoc DEFAULT_DOMAIN = "DefaultDomain";
53
54    /** The MBeanServerDelegate ObjectName */
55    private static final ObjectName JavaDoc mbeanServerDelegateName = ObjectNameFactory.create(JMI_DOMAIN + ":type=MBeanServerDelegate");
56    
57    /** The server config property */
58    public final static String JavaDoc SERVER_CONFIG_CLASS_PROPERTY = "jbossmx.server.config.class";
59   
60    /** The default server config class */
61    public final static String JavaDoc DEFAULT_SERVER_CONFIG_CLASS = "org.jboss.mx.server.JBossMXServerConfig";
62    
63    /** The mbean server builder property */
64    public final static String JavaDoc MBEAN_SERVER_BUILDER_CLASS_PROPERTY = "javax.management.builder.initial";
65
66    // Attributes --------------------------------------------------
67

68    // Static ------------------------------------------------------
69

70    public static synchronized ServerConfig getInstance()
71    {
72       if (instance != null)
73          return instance;
74       instance = (ServerConfig) Classes.instantiate(ServerConfig.class, SERVER_CONFIG_CLASS_PROPERTY, DEFAULT_SERVER_CONFIG_CLASS);
75       return instance;
76    }
77    
78    // Constructors ------------------------------------------------
79

80    /**
81     * No external construction
82     */

83    protected ServerConfig()
84    {
85    }
86
87    // Public ------------------------------------------------------
88

89    /**
90     * Get the default domain
91     *
92     * @return the default domain
93     */

94    public String JavaDoc getDefaultDomain()
95    {
96       return DEFAULT_DOMAIN;
97    }
98
99    /**
100     * Get the implementation domain
101     *
102     * @return the implementation domain
103     */

104    public String JavaDoc getJMIDomain()
105    {
106       return JMI_DOMAIN;
107    }
108    
109    /**
110     * Get the MBeanServer delegate name
111     *
112     * @return the ObjectName of the MBeanServerDelegate
113     */

114    public ObjectName JavaDoc getMBeanServerDelegateName()
115    {
116       return mbeanServerDelegateName;
117    }
118
119    /**
120     * Get the MBeanServer builder
121     *
122     * @return the mbeanserver builder
123     */

124    public MBeanServerBuilder JavaDoc getMBeanServerBuilder()
125    {
126       String JavaDoc defaultMBeanServerBuilder = getDefaultMBeanServerBuilderClassName();
127       return (MBeanServerBuilder JavaDoc) Classes.instantiate(MBeanServerBuilder JavaDoc.class, MBEAN_SERVER_BUILDER_CLASS_PROPERTY, defaultMBeanServerBuilder);
128       
129    }
130
131    /**
132     * Get the default loader repository name
133     *
134     * @return the default loader repository name
135     */

136    public abstract ObjectName JavaDoc getLoaderRepositoryName();
137
138    /**
139     * Get the standardmbean delegate factory
140     *
141     * @return the factory
142     */

143    public abstract StandardMBeanDelegateFactory getStandardMBeanDelegateFactory();
144    
145    // Protected ---------------------------------------------------
146

147    protected abstract String JavaDoc getDefaultMBeanServerBuilderClassName();
148    
149    // Private -----------------------------------------------------
150

151    // Inner classes -----------------------------------------------
152
}
153
Popular Tags