KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > system > ServiceControllerMBean


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.system;
23
24 import java.util.Collection JavaDoc;
25 import java.util.List JavaDoc;
26
27 import javax.management.ObjectName JavaDoc;
28
29 import org.jboss.deployers.spi.DeploymentException;
30 import org.jboss.deployment.DeploymentInfo;
31 import org.jboss.deployment.DeploymentState;
32 import org.jboss.mx.util.ObjectNameFactory;
33 import org.w3c.dom.Element JavaDoc;
34
35 /**
36  * ServiceController MBean interface.
37  *
38  * @see org.jboss.system.Service
39  */

40 public interface ServiceControllerMBean
41 {
42    /** The default ObjectName */
43    ObjectName JavaDoc OBJECT_NAME = ObjectNameFactory.create("jboss.system:service=ServiceController");
44    
45    /**
46     * Plugin a ServiceBinding policy
47     *
48     * @param serviceBinding policy
49     */

50    void setServiceBinding(ServiceBinding serviceBinding);
51    
52    /**
53     * Lists the ServiceContexts of deployed mbeans
54     *
55     * @return the list of ServiceContexts for mbeans deployed through ServiceController.
56     */

57    List JavaDoc<ServiceContext> listDeployed();
58
59    /**
60     * The <code>listIncompletelyDeployed</code> method returns the
61     * service contexts for the mbeans whose status is not CREATED,
62     * RUNNING, STOPPED or DESTROYED. An MBean that has reached one
63     * of the above states has its dependencies resolved.
64     *
65     * @return a List<ServiceContext>
66     */

67    List JavaDoc<ServiceContext> listIncompletelyDeployed();
68
69    /**
70     * lists ObjectNames of deployed mbeans deployed through
71     * serviceController.
72     *
73     * @return a list of ObjectNames of deployed mbeans.
74     */

75    List JavaDoc<ObjectName JavaDoc> listDeployedNames();
76
77    /**
78     * Gets the Configuration attribute of the ServiceController object
79     *
80     * @param objectNames Description of Parameter
81     * @return The Configuration value
82     * @throws Exception Description of Exception
83     */

84    String JavaDoc listConfiguration(ObjectName JavaDoc[] objectNames) throws Exception JavaDoc;
85
86    /**
87     * Go through the mbeans of the DeploymentInfo and validate that
88     * they are in a state at least equal to that of the argument state
89     *
90     * @param di the deployment info
91     * @param state the deployment state
92     */

93    void validateDeploymentState(DeploymentInfo di, DeploymentState state);
94
95    /**
96     * Deploy the beans; deploy means "instantiate and configure" so the MBean
97     * is created in the MBeanServer. You must call "create" and "start" separately
98     * on the MBean to affect the service lifecycle deploy doesn't bother with service
99     * lifecycle only MBean instanciation/registration/configuration.
100     *
101     * @param config
102     * @param loaderName
103     * @return Description of the Returned Value
104     * @throws DeploymentException
105     */

106    List JavaDoc<ObjectName JavaDoc> install(Element JavaDoc config, ObjectName JavaDoc loaderName) throws DeploymentException;
107
108    /**
109     * Register the mbean against the microkernel with no dependencies.
110     *
111     * @see #register(ObjectName, java.util.Collection)
112     * @param serviceName the object name
113     * @throws Exception for any error
114     */

115    void register(ObjectName JavaDoc serviceName) throws Exception JavaDoc;
116
117    /**
118     * Register the mbean against the microkernel with dependencies.
119     *
120     * @param serviceName the object name
121     * @param depends the dependencies
122     * @throws Exception for any error
123     */

124    void register(ObjectName JavaDoc serviceName, Collection JavaDoc<ObjectName JavaDoc> depends) throws Exception JavaDoc;
125
126    /**
127     * Create a service
128     *
129     * @param serviceName Description of Parameter
130     * @throws Exception Description of Exception
131     */

132    void create(ObjectName JavaDoc serviceName) throws Exception JavaDoc;
133
134    /**
135     * Create a service with given dependencies
136     *
137     * @param serviceName Description of Parameter
138     * @param depends the dependencies
139     * @throws Exception Description of Exception
140     */

141    void create(ObjectName JavaDoc serviceName, Collection JavaDoc<ObjectName JavaDoc> depends) throws Exception JavaDoc;
142
143    /**
144     * Starts the indicated service
145     *
146     * @param serviceName Description of Parameter
147     * @throws Exception Description of Exception
148     */

149    void start(ObjectName JavaDoc serviceName) throws Exception JavaDoc;
150
151    /**
152     * Stops and restarts the indicated service
153     *
154     * @param serviceName Description of Parameter
155     * @throws Exception Description of Exception
156     */

157    void restart(ObjectName JavaDoc serviceName) throws Exception JavaDoc;
158
159    /**
160     * Stop the indicated service
161     *
162     * @param serviceName Description of Parameter
163     * @throws Exception Description of Exception
164     */

165    void stop(ObjectName JavaDoc serviceName) throws Exception JavaDoc;
166
167    /**
168     * Destroy the indicated service
169     *
170     * @param serviceName Description of Parameter
171     * @throws Exception Description of Exception
172     */

173    void destroy(ObjectName JavaDoc serviceName) throws Exception JavaDoc;
174
175    /**
176     * This MBean is going bye bye
177     *
178     * @param objectName Description of Parameter
179     * @throws Exception Description of Exception
180     */

181    void remove(ObjectName JavaDoc objectName) throws Exception JavaDoc;
182
183    /**
184     * Describe <code>shutdown</code> method here.
185     */

186    void shutdown();
187
188    /**
189     * Lookup the ServiceContext for the given serviceName
190     *
191     * @param serviceName the service name
192     * @return the service context
193     */

194    ServiceContext getServiceContext(ObjectName JavaDoc serviceName);
195 }
196
Popular Tags