001: /**
002: * JOnAS: Java(TM) Open Application Server
003: * Copyright (C) 1999 Bull S.A.
004: * Contact: jonas-team@objectweb.org
005: *
006: * This library is free software; you can redistribute it and/or
007: * modify it under the terms of the GNU Lesser General Public
008: * License as published by the Free Software Foundation; either
009: * version 2.1 of the License, or any later version.
010: *
011: * This library is distributed in the hope that it will be useful,
012: * but WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014: * Lesser General Public License for more details.
015: *
016: * You should have received a copy of the GNU Lesser General Public
017: * License along with this library; if not, write to the Free Software
018: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
019: * USA
020: *
021: * --------------------------------------------------------------------------
022: * $Id: RMIConnector.java 9118 2006-07-05 13:23:44Z sauthieg $
023: * --------------------------------------------------------------------------
024: */package org.objectweb.jonas.jmx;
025:
026: import java.rmi.Remote;
027: import java.rmi.RemoteException;
028:
029: import javax.management.Attribute;
030: import javax.management.AttributeList;
031: import javax.management.AttributeNotFoundException;
032: import javax.management.InstanceNotFoundException;
033: import javax.management.IntrospectionException;
034: import javax.management.InvalidAttributeValueException;
035: import javax.management.MBeanException;
036: import javax.management.MBeanInfo;
037: import javax.management.NotificationFilter;
038: import javax.management.NotificationListener;
039: import javax.management.ObjectName;
040: import javax.management.QueryExp;
041: import javax.management.ReflectionException;
042:
043: /**
044: * Interface for JMX Remote Calls. Only methods used by the management applications are listed here,
045: * but potentially we could list all operations from JMXServer.
046: *
047: * @author Michel Bruno and Guillaume Riviere
048: */
049: public interface RMIConnector extends Remote {
050:
051: /**
052: * Gets the names of MBeans controlled by the MBean server.
053: * @param name - The object name pattern identifying the MBeans to be retrieved.
054: * @param query - The query expression to be applied for selecting MBeans.
055: * @return A set containing the ObjectNames for the MBeans selected.
056: * If no MBean satisfies the query, an empty list is returned.
057: */
058: public java.util.Set queryNames(ObjectName name, QueryExp query)
059: throws RemoteException;
060:
061: /**
062: * Checks whether an MBean, identified by its object name, is
063: * already registered with the MBean server.
064: * @param name - The object name pattern identifying the MBeans
065: */
066: public boolean isRegistered(ObjectName name) throws RemoteException;
067:
068: /**
069: * Gets the value of a specific attribute of a named MBean.
070: * @param name - The name of the MBean
071: * @param attribute - the name of the attribute to be retrieved.
072: * @return The value of the retrieved attribute.
073: */
074: public java.lang.Object getAttribute(ObjectName name,
075: String attribute) throws MBeanException,
076: AttributeNotFoundException, InstanceNotFoundException,
077: ReflectionException, RemoteException;
078:
079: public AttributeList getAttributes(ObjectName name,
080: String[] attributes) throws InstanceNotFoundException,
081: ReflectionException, RemoteException;
082:
083: /**
084: * Sets the value of a specific attribute of a named MBean.
085: * @param name - The name of the MBean
086: */
087: public void setAttribute(ObjectName name, Attribute attribute)
088: throws InstanceNotFoundException,
089: AttributeNotFoundException, InvalidAttributeValueException,
090: MBeanException, ReflectionException, RemoteException;
091:
092: public AttributeList setAttributes(ObjectName name,
093: AttributeList attributes) throws InstanceNotFoundException,
094: ReflectionException, RemoteException;
095:
096: /**
097: * Invokes an operation on an MBean.
098: * @param name - The name of the MBean
099: * @param operationName - The name of the operation to be invoked.
100: * @param params - An array containing the parameters to be set when the operation is invoked
101: * @param signature - An array containing the signature of the operation.
102: * The class objects will be loaded using the same class loader as the one
103: * used for loading the MBean on which the operation was invoked.
104: * @return The object returned by the operation
105: */
106: public Object invoke(ObjectName name, String operationName,
107: Object[] params, String[] signature)
108: throws InstanceNotFoundException, MBeanException,
109: ReflectionException, RemoteException;
110:
111: /**
112: * This method discovers the attributes and operations that an MBean
113: * exposes for management.
114: * @param name - The name of the MBean to analyze
115: * @return An instance of MBeanInfo allowing the retrieval of all
116: * attributes and operations of this MBean.
117: */
118: public MBeanInfo getMBeanInfo(ObjectName name)
119: throws InstanceNotFoundException, IntrospectionException,
120: ReflectionException, RemoteException;
121:
122: /**
123: * Adds a listener to a registered MBean.
124: * @param name - The name of the MBean on which the listener should be added.
125: * @param listener - The listener object which will handle the notifications emitted by the registered MBean.
126: * @param listener - The listener object which will handle the notifications emitted by the registered MBean.
127: * @param filter - The filter object. If filter is null, no filtering will be performed before handling notifications.
128: * @param handback - The context to be sent to the listener when a notification is emitted.
129: */
130: public void addNotificationListener(ObjectName name,
131: NotificationListener listener, NotificationFilter filter,
132: Object handback) throws InstanceNotFoundException,
133: RemoteException;
134:
135: /**
136: * Adds a listener to a registered MBean.
137: * @param name - The name of the MBean on which the listener should be added.
138: * @param listener - The object name of the listener which will handle the notifications emitted by the registered MBean.
139: * @param listener - The listener object which will handle the notifications emitted by the registered MBean.
140: * @param filter - The filter object. If filter is null, no filtering will be performed before handling notifications.
141: * @param handback - The context to be sent to the listener when a notification is emitted.
142: */
143: public void addNotificationListener(ObjectName name,
144: ObjectName listener, NotificationFilter filter,
145: Object handback) throws InstanceNotFoundException,
146: RemoteException;
147: }
|