1 /*
2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3 *
4 * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
5 *
6 * The contents of this file are subject to the terms of either the GNU
7 * General Public License Version 2 only ("GPL") or the Common Development
8 * and Distribution License("CDDL") (collectively, the "License"). You
9 * may not use this file except in compliance with the License. You can obtain
10 * a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
11 * or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
12 * language governing permissions and limitations under the License.
13 *
14 * When distributing the software, include this License Header Notice in each
15 * file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
16 * Sun designates this particular file as subject to the "Classpath" exception
17 * as provided by Sun in the GPL Version 2 section of the License file that
18 * accompanied this code. If applicable, add the following below the License
19 * Header, with the fields enclosed by brackets [] replaced by your own
20 * identifying information: "Portions Copyrighted [year]
21 * [name of copyright owner]"
22 *
23 * Contributor(s):
24 *
25 * If you wish your version of this file to be governed by only the CDDL or
26 * only the GPL Version 2, indicate your decision by adding "[Contributor]
27 * elects to include this software in this distribution under the [CDDL or GPL
28 * Version 2] license." If you don't indicate a single choice of license, a
29 * recipient has the option to distribute your version of this file under
30 * either the CDDL, the GPL Version 2 or to extend the choice of license to
31 * its licensees as provided above. However, if you add GPL Version 2 code
32 * and therefore, elected the GPL Version 2 license, then the option applies
33 * only if the new code is made subject to such option by the copyright
34 * holder.
35 */
36
37 package javax.management.j2ee;
38
39 import java.util.Set;
40
41 import javax.management.ObjectName;
42 import javax.management.QueryExp;
43 import javax.management.AttributeList;
44 import javax.management.Attribute;
45 import javax.management.MBeanInfo;
46 import javax.management.InstanceNotFoundException;
47 import javax.management.MBeanException;
48 import javax.management.AttributeNotFoundException;
49 import javax.management.ReflectionException;
50 import javax.management.InvalidAttributeValueException;
51 import javax.management.IntrospectionException;
52
53 import java.rmi.RemoteException;
54
55 /**
56 * The Management interface provides the APIs to navigate and manipulate
57 * managed objects. The J2EE Management EJB component (MEJB) must implement
58 * this as its remote interface.
59 *
60 * @author Hans Hrasna
61 */
62 public interface Management extends javax.ejb.EJBObject {
63
64 /**
65 * Gets the names of managed objects controlled by the MEJB. This method
66 * enables any of the following to be obtained: The names of all managed objects,
67 * the names of a set of managed objects specified by pattern matching on the
68 * <CODE>ObjectName</CODE>, a specific managed object name (equivalent to
69 * testing whether a managed object is registered). When the object name is
70 * null or no domain and key properties are specified, all objects are selected.
71 * It returns the set of J2EEObjectNames for the managed objects selected.
72 *
73 * @param name The object name pattern identifying the managed objects to be retrieved. If
74 * null or no domain and key properties are specified, all the managed objects registered will be retrieved.
75 *
76 * @return A set containing the ObjectNames for the managed objects selected.
77 * If no managed object satisfies the query, an empty set is returned.
78 *
79 * @exception RemoteException A communication exception occurred during the execution of a remote method call
80 */
81 Set queryNames(ObjectName name, QueryExp query) throws RemoteException;
82
83 /**
84 * Checks whether a managed object, identified by its object name, is already registered
85 * with the MEJB.
86 *
87 * @param name The object name of the managed object to be checked.
88 *
89 * @return True if the managed object is already registered in the MEJB, false otherwise.
90 *
91 * @exception RemoteException A communication exception occurred during the execution of a remote method call
92 */
93 boolean isRegistered(ObjectName name) throws RemoteException;
94
95 /**
96 * Returns the number of managed objects registered in the MEJB.
97 *
98 * @exception RemoteException A communication exception occurred during the execution of a remote method call
99 */
100 Integer getMBeanCount() throws RemoteException;
101
102 /**
103 * This method discovers the attributes and operations that a managed object exposes
104 * for management.
105 *
106 * @param name The name of the managed object to analyze
107 *
108 * @return An instance of <CODE>MBeanInfo</CODE> allowing the retrieval of all attributes and operations
109 * of this managed object.
110 *
111 * @exception IntrospectionException An exception occurs during introspection.
112 * @exception InstanceNotFoundException The managed object specified is not found.
113 * @exception ReflectionException An exception occurred when trying to perform reflection on a managed object
114 * @exception RemoteException A communication exception occurred during the execution of a remote method call
115 */
116 MBeanInfo getMBeanInfo(ObjectName name) throws IntrospectionException, InstanceNotFoundException, ReflectionException, RemoteException;
117
118 /**
119 * Gets the value of a specific attribute of a named managed object. The managed object
120 * is identified by its object name.
121 *
122 * @param name The object name of the managed object from which the attribute is to be retrieved.
123 * @param attribute A String specifying the name of the attribute to be
124 * retrieved.
125 *
126 * @return The value of the retrieved attribute.
127 *
128 * @exception AttributeNotFoundException The attribute specified is not accessible in the managed object.
129 * @exception MBeanException Wraps an exception thrown by the managed object's getter.
130 * @exception InstanceNotFoundException The managed object specified is not registered in the MEJB.
131 * @exception ReflectionException An exception occurred when trying to invoke the getAttribute method of a Dynamic MBean
132 * @exception RemoteException A communication exception occurred during the execution of a remote method call
133 */
134 Object getAttribute(ObjectName name, String attribute) throws MBeanException, AttributeNotFoundException, InstanceNotFoundException, ReflectionException, RemoteException;
135
136 /**
137 * Enables the values of several attributes of a named managed object. The managed object
138 * is identified by its object name.
139 *
140 * @param name The object name of the managed object from which the attributes are
141 * retrieved.
142 * @param attributes A list of the attributes to be retrieved.
143 *
144 * @return The list of the retrieved attributes.
145 *
146 * @exception InstanceNotFoundException The managed object specified is not registered in the MEJB.
147 * @exception ReflectionException An exception occurred when trying to invoke the getAttributes method of a Dynamic MBean.
148 * @exception RemoteException A communication exception occurred during the execution of a remote method call
149 */
150 AttributeList getAttributes(ObjectName name, String[] attributes) throws InstanceNotFoundException, ReflectionException, RemoteException;
151
152 /**
153 * Sets the value of a specific attribute of a named managed object. The managed object
154 * is identified by its object name.
155 *
156 * @param name The name of the managed object within which the attribute is to be set.
157 * @param attribute The identification of the attribute to be set and the value it is to be set to.
158 *
159 * @exception InstanceNotFoundException The managed object specified is not registered in the MEJB.
160 * @exception AttributeNotFoundException The attribute specified is not accessible in the managed object.
161 * @exception InvalidAttributeValueException The value specified for the attribute is not valid.
162 * @exception MBeanException Wraps an exception thrown by the managed object's setter.
163 * @exception ReflectionException An exception occurred when trying to invoke the setAttribute method of a Dynamic MBean.
164 * @exception RemoteException A communication exception occurred during the execution of a remote method call
165 */
166 void setAttribute(ObjectName name, Attribute attribute) throws InstanceNotFoundException, AttributeNotFoundException, InvalidAttributeValueException, MBeanException, ReflectionException, RemoteException;
167
168 /**
169 * Sets the values of several attributes of a named managed object. The managed object is
170 * identified by its object name.
171 *
172 * @param name The object name of the managed object within which the attributes are to
173 * be set.
174 * @param attributes A list of attributes: The identification of the
175 * attributes to be set and the values they are to be set to.
176 *
177 * @return The list of attributes that were set, with their new values.
178 *
179 * @exception InstanceNotFoundException The managed object specified is not registered in the MEJB.
180 * @exception ReflectionException An exception occurred when trying to invoke the setAttributes method of a Dynamic MBean.
181 * @exception RemoteException A communication exception occurred during the execution of a remote method call
182 *
183 */
184 AttributeList setAttributes(ObjectName name, AttributeList attributes) throws InstanceNotFoundException, ReflectionException, RemoteException;
185
186 /**
187 * Invokes an operation on a managed object.
188 *
189 * @param name The object name of the managed object on which the method is to be invoked.
190 * @param operationName The name of the operation to be invoked.
191 * @param params An array containing the parameters to be set when the operation is
192 * invoked
193 * @param signature An array containing the signature of the operation. The class objects will
194 * be loaded using the same class loader as the one used for loading the managed object on which the operation was invoked.
195 *
196 * @return The object returned by the operation, which represents the result of invoking the operation on the
197 * managed object specified.
198 *
199 * @exception InstanceNotFoundException The managed object specified is not registered in the MEJB.
200 * @exception MBeanException Wraps an exception thrown by the managed object's invoked method.
201 * @exception ReflectionException Wraps a <CODE>java.lang.Exception</CODE> thrown while trying to invoke the method.
202 * @exception RemoteException A communication exception occurred during the execution of a remote method call
203 */
204 Object invoke(ObjectName name, String operationName, Object[] params, String[] signature) throws InstanceNotFoundException, MBeanException, ReflectionException, RemoteException;
205
206 /**
207 * Returns the default domain name of this MEJB.
208 * @exception RemoteException A communication exception occurred during the execution of a remote method call
209 */
210 String getDefaultDomain() throws RemoteException;
211
212 /**
213 * Returns the listener registry implementation for this MEJB. The listener registry implements the methods
214 * that enable clints to add and remove event notification listeners managed objects
215 * @return An implementation of <CODE>javax.management.j2ee.ListenerRegistration</CODE>
216 *
217 * @exception RemoteException A communication exception occurred during the execution of a remote method call
218 */
219 ListenerRegistration getListenerRegistry() throws RemoteException;
220
221 }