| JavaTM 2 Platform Std. Ed. v1.6.0
javax.management.remote.rmi
Class RMIConnectionImpl
java.lang.Object
javax.management.remote.rmi.RMIConnectionImpl
- All Implemented Interfaces:
- Closeable, Remote, Unreferenced, RMIConnection
public class RMIConnectionImpl - extends Object
- implements RMIConnection, Unreferenced
Implementation of the RMIConnection interface. User
code will not usually reference this class.
- Since:
- 1.5
|
Method Summary |
void |
addNotificationListener(ObjectName name,
ObjectName listener,
MarshalledObject filter,
MarshalledObject handback,
Subject delegationSubject)
Handles the method MBeanServerConnection.addNotificationListener(ObjectName,
ObjectName, NotificationFilter, Object). |
Integer[] |
addNotificationListeners(ObjectName[] names,
MarshalledObject[] filters,
Subject[] delegationSubjects)
Handles the method MBeanServerConnection.addNotificationListener(ObjectName,
NotificationListener, NotificationFilter, Object). |
void |
close()
Closes this connection. |
ObjectInstance |
createMBean(String className,
ObjectName name,
MarshalledObject params,
String[] signature,
Subject delegationSubject)
Handles the method MBeanServerConnection.createMBean(String,
ObjectName, Object[], String[]). |
ObjectInstance |
createMBean(String className,
ObjectName name,
ObjectName loaderName,
MarshalledObject params,
String[] signature,
Subject delegationSubject)
Handles the method MBeanServerConnection.createMBean(String,
ObjectName, ObjectName, Object[], String[]). |
ObjectInstance |
createMBean(String className,
ObjectName name,
ObjectName loaderName,
Subject delegationSubject)
Handles the method MBeanServerConnection.createMBean(String,
ObjectName, ObjectName). |
ObjectInstance |
createMBean(String className,
ObjectName name,
Subject delegationSubject)
Handles the method MBeanServerConnection.createMBean(String,
ObjectName). |
NotificationResult |
fetchNotifications(long clientSequenceNumber,
int maxNotifications,
long timeout)
Retrieves notifications from the connector server. |
Object |
getAttribute(ObjectName name,
String attribute,
Subject delegationSubject)
Handles the method MBeanServerConnection.getAttribute(ObjectName,
String). |
AttributeList |
getAttributes(ObjectName name,
String[] attributes,
Subject delegationSubject)
Handles the method MBeanServerConnection.getAttributes(ObjectName,
String[]). |
String |
getConnectionId()
Returns the connection ID. |
String |
getDefaultDomain(Subject delegationSubject)
Handles the method
MBeanServerConnection.getDefaultDomain(). |
String[] |
getDomains(Subject delegationSubject)
Handles the method
MBeanServerConnection.getDomains(). |
Integer |
getMBeanCount(Subject delegationSubject)
Handles the method
MBeanServerConnection.getMBeanCount(). |
MBeanInfo |
getMBeanInfo(ObjectName name,
Subject delegationSubject)
Handles the method
MBeanServerConnection.getMBeanInfo(ObjectName). |
ObjectInstance |
getObjectInstance(ObjectName name,
Subject delegationSubject)
Handles the method
MBeanServerConnection.getObjectInstance(ObjectName). |
Object |
invoke(ObjectName name,
String operationName,
MarshalledObject params,
String[] signature,
Subject delegationSubject)
Handles the method MBeanServerConnection.invoke(ObjectName,
String, Object[], String[]). |
boolean |
isInstanceOf(ObjectName name,
String className,
Subject delegationSubject)
Handles the method MBeanServerConnection.isInstanceOf(ObjectName,
String). |
boolean |
isRegistered(ObjectName name,
Subject delegationSubject)
Handles the method
MBeanServerConnection.isRegistered(ObjectName). |
Set<ObjectInstance> |
queryMBeans(ObjectName name,
MarshalledObject query,
Subject delegationSubject)
Handles the method MBeanServerConnection.queryMBeans(ObjectName,
QueryExp). |
Set<ObjectName> |
queryNames(ObjectName name,
MarshalledObject query,
Subject delegationSubject)
Handles the method MBeanServerConnection.queryNames(ObjectName,
QueryExp). |
void |
removeNotificationListener(ObjectName name,
ObjectName listener,
MarshalledObject filter,
MarshalledObject handback,
Subject delegationSubject)
Handles the method MBeanServerConnection.removeNotificationListener(ObjectName,
ObjectName, NotificationFilter, Object). |
void |
removeNotificationListener(ObjectName name,
ObjectName listener,
Subject delegationSubject)
Handles the method MBeanServerConnection.removeNotificationListener(ObjectName,
ObjectName). |
void |
removeNotificationListeners(ObjectName name,
Integer[] listenerIDs,
Subject delegationSubject)
Handles the
removeNotificationListener(ObjectName, NotificationListener) and
removeNotificationListener(ObjectName, NotificationListener, NotificationFilter, Object) methods. |
void |
setAttribute(ObjectName name,
MarshalledObject attribute,
Subject delegationSubject)
Handles the method MBeanServerConnection.setAttribute(ObjectName,
Attribute). |
AttributeList |
setAttributes(ObjectName name,
MarshalledObject attributes,
Subject delegationSubject)
Handles the method MBeanServerConnection.setAttributes(ObjectName,
AttributeList). |
String |
toString()
Returns a string representation of this object. |
void |
unreferenced()
Called by the RMI runtime sometime after the runtime determines that
the reference list, the list of clients referencing the remote object,
becomes empty. |
void |
unregisterMBean(ObjectName name,
Subject delegationSubject)
Handles the method
MBeanServerConnection.unregisterMBean(ObjectName). |
RMIConnectionImpl
public RMIConnectionImpl(RMIServerImpl rmiServer,
String connectionId,
ClassLoader defaultClassLoader,
Subject subject,
Map<String,?> env)
- Constructs a new
RMIConnection. This connection can be
used with either the JRMP or IIOP transport. This object does
not export itself: it is the responsibility of the caller to
export it appropriately (see RMIJRMPServerImpl.makeClient(String,Subject) and RMIIIOPServerImpl.makeClient(String,Subject).
- Parameters:
rmiServer - The RMIServerImpl object for which this
connection is created. The behavior is unspecified if this
parameter is null.connectionId - The ID for this connection. The behavior
is unspecified if this parameter is null.defaultClassLoader - The default ClassLoader to be used
when deserializing marshalled objects. Can be null, to signify
the bootstrap class loader.subject - the authenticated subject to be used for
authorization. Can be null, to signify that no subject has
been authenticated.env - the environment containing attributes for the new
RMIServerImpl. Can be null, equivalent to an
empty map.
getConnectionId
public String getConnectionId()
throws IOException
- Description copied from interface:
RMIConnection
Returns the connection ID. This string is different for
every open connection to a given RMI connector server.
- Specified by:
getConnectionId in interface RMIConnection
- Returns:
- the connection ID
- Throws:
IOException - if a general communication exception occurred.- See Also:
RMIConnector.connect
close
public void close()
throws IOException
- Description copied from interface:
RMIConnection
Closes this connection. On return from this method, the RMI
object implementing this interface is unexported, so further
remote calls to it will fail.
- Specified by:
close in interface Closeable- Specified by:
close in interface RMIConnection
- Throws:
IOException - if the connection could not be closed,
or the Remote object could not be unexported, or there was a
communication failure when transmitting the remote close
request.
unreferenced
public void unreferenced()
- Description copied from interface:
Unreferenced
- Called by the RMI runtime sometime after the runtime determines that
the reference list, the list of clients referencing the remote object,
becomes empty.
- Specified by:
unreferenced in interface Unreferenced
createMBean
public ObjectInstance createMBean(String className,
ObjectName name,
Subject delegationSubject)
throws ReflectionException,
InstanceAlreadyExistsException,
MBeanRegistrationException,
MBeanException,
NotCompliantMBeanException,
IOException
- Description copied from interface:
RMIConnection
- Handles the method
MBeanServerConnection.createMBean(String,
ObjectName).
- Specified by:
createMBean in interface RMIConnection
- Parameters:
className - The class name of the MBean to be instantiated.name - The object name of the MBean. May be null.delegationSubject - The Subject containing the
delegation principals or null if the authentication
principal is used instead.
- Returns:
- An
ObjectInstance, containing the
ObjectName and the Java class name of the newly
instantiated MBean. If the contained ObjectName
is n, the contained Java class name is
getMBeanInfo(n).getClassName().
- Throws:
ReflectionException - Wraps a
java.lang.ClassNotFoundException or a
java.lang.Exception that occurred
when trying to invoke the MBean's constructor.
InstanceAlreadyExistsException - The MBean is already
under the control of the MBean server.
MBeanRegistrationException - The
preRegister (MBeanRegistration
interface) method of the MBean has thrown an exception. The
MBean will not be registered.
MBeanException - The constructor of the MBean has
thrown an exception.
NotCompliantMBeanException - This class is not a JMX
compliant MBean.
IOException - if a general communication exception occurred.
createMBean
public ObjectInstance createMBean(String className,
ObjectName name,
ObjectName loaderName,
Subject delegationSubject)
throws ReflectionException,
InstanceAlreadyExistsException,
MBeanRegistrationException,
MBeanException,
NotCompliantMBeanException,
InstanceNotFoundException,
IOException
- Description copied from interface:
RMIConnection
- Handles the method
MBeanServerConnection.createMBean(String,
ObjectName, ObjectName).
- Specified by:
createMBean in interface RMIConnection
- Parameters:
className - The class name of the MBean to be instantiated.name - The object name of the MBean. May be null.loaderName - The object name of the class loader to be used.delegationSubject - The Subject containing the
delegation principals or null if the authentication
principal is used instead.
- Returns:
- An
ObjectInstance, containing the
ObjectName and the Java class name of the newly
instantiated MBean. If the contained ObjectName
is n, the contained Java class name is
getMBeanInfo(n).getClassName().
- Throws:
ReflectionException - Wraps a
java.lang.ClassNotFoundException or a
java.lang.Exception that occurred when trying to
invoke the MBean's constructor.
InstanceAlreadyExistsException - The MBean is already
under the control of the MBean server.
MBeanRegistrationException - The
preRegister (MBeanRegistration
interface) method of the MBean has thrown an exception. The
MBean will not be registered.
MBeanException - The constructor of the MBean has
thrown an exception.
NotCompliantMBeanException - This class is not a JMX
compliant MBean.
InstanceNotFoundException - The specified class loader
is not registered in the MBean server.
IOException - if a general communication exception occurred.
createMBean
public ObjectInstance createMBean(String className,
ObjectName name,
MarshalledObject params,
String[] signature,
Subject delegationSubject)
throws ReflectionException,
InstanceAlreadyExistsException,
MBeanRegistrationException,
MBeanException,
NotCompliantMBeanException,
IOException
- Description copied from interface:
RMIConnection
- Handles the method
MBeanServerConnection.createMBean(String,
ObjectName, Object[], String[]). The Object[]
parameter is wrapped in a MarshalledObject.
- Specified by:
createMBean in interface RMIConnection
- Parameters:
className - The class name of the MBean to be instantiated.name - The object name of the MBean. May be null.params - An array containing the parameters of the
constructor to be invoked, encapsulated into a
MarshalledObject. The encapsulated array can be
null, equivalent to an empty array.signature - An array containing the signature of the
constructor to be invoked. Can be null, equivalent to an empty
array.delegationSubject - The Subject containing the
delegation principals or null if the authentication
principal is used instead.
- Returns:
- An
ObjectInstance, containing the
ObjectName and the Java class name of the newly
instantiated MBean. If the contained ObjectName
is n, the contained Java class name is
getMBeanInfo(n).getClassName().
- Throws:
ReflectionException - Wraps a
java.lang.ClassNotFoundException or a
java.lang.Exception that occurred when trying to
invoke the MBean's constructor.
InstanceAlreadyExistsException - The MBean is already
under the control of the MBean server.
MBeanRegistrationException - The
preRegister (MBeanRegistration
interface) method of the MBean has thrown an exception. The
MBean will not be registered.
MBeanException - The constructor of the MBean has
thrown an exception.
NotCompliantMBeanException - This class is not a JMX
compliant MBean.
IOException - if a general communication exception occurred.
createMBean
public ObjectInstance createMBean(String className,
ObjectName name,
ObjectName loaderName,
MarshalledObject params,
String[] signature,
Subject delegationSubject)
throws ReflectionException,
InstanceAlreadyExistsException,
MBeanRegistrationException,
MBeanException,
NotCompliantMBeanException,
InstanceNotFoundException,
IOException
- Description copied from interface:
RMIConnection
- Handles the method
MBeanServerConnection.createMBean(String,
ObjectName, ObjectName, Object[], String[]). The
Object[] parameter is wrapped in a
MarshalledObject.
- Specified by:
createMBean in interface RMIConnection
- Parameters:
className - The class name of the MBean to be instantiated.name - The object name of the MBean. May be null.loaderName - The object name of the class loader to be used.params - An array containing the parameters of the
constructor to be invoked, encapsulated into a
MarshalledObject. The encapsulated array can be
null, equivalent to an empty array.signature - An array containing the signature of the
constructor to be invoked. Can be null, equivalent to an empty
array.delegationSubject - The Subject containing the
delegation principals or null if the authentication
principal is used instead.
- Returns:
- An
ObjectInstance, containing the
ObjectName and the Java class name of the newly
instantiated MBean. If the contained ObjectName
is n, the contained Java class name is
getMBeanInfo(n).getClassName().
- Throws:
ReflectionException - Wraps a
java.lang.ClassNotFoundException or a
java.lang.Exception that occurred when trying to
invoke the MBean's constructor.
InstanceAlreadyExistsException - The MBean is already
under the control of the MBean server.
MBeanRegistrationException - The
preRegister (MBeanRegistration
interface) method of the MBean has thrown an exception. The
MBean will not be registered.
MBeanException - The constructor of the MBean has
thrown an exception.
NotCompliantMBeanException - This class is not a JMX
compliant MBean.
InstanceNotFoundException - The specified class loader
is not registered in the MBean server.
IOException - if a general communication exception occurred.
unregisterMBean
public void unregisterMBean(ObjectName name,
Subject delegationSubject)
throws InstanceNotFoundException,
MBeanRegistrationException,
IOException
- Description copied from interface:
RMIConnection
- Handles the method
MBeanServerConnection.unregisterMBean(ObjectName).
- Specified by:
unregisterMBean in interface RMIConnection
- Parameters:
name - The object name of the MBean to be unregistered.delegationSubject - The Subject containing the
delegation principals or null if the authentication
principal is used instead.
- Throws:
InstanceNotFoundException - The MBean specified is not
registered in the MBean server.
MBeanRegistrationException - The preDeregister
((MBeanRegistration interface) method of the MBean
has thrown an exception.
IOException - if a general communication exception occurred.
getObjectInstance
public ObjectInstance getObjectInstance(ObjectName name,
Subject delegationSubject)
throws InstanceNotFoundException,
IOException
- Description copied from interface:
RMIConnection
- Handles the method
MBeanServerConnection.getObjectInstance(ObjectName).
- Specified by:
getObjectInstance in interface RMIConnection
- Parameters:
name - The object name of the MBean.delegationSubject - The Subject containing the
delegation principals or null if the authentication
principal is used instead.
- Returns:
- The
ObjectInstance associated with the MBean
specified by name. The contained ObjectName
is name and the contained class name is
getMBeanInfo(name).getClassName().
- Throws:
InstanceNotFoundException - The MBean specified is not
registered in the MBean server.
IOException - if a general communication exception occurred.
queryMBeans
public Set<ObjectInstance> queryMBeans(ObjectName name,
MarshalledObject query,
Subject delegationSubject)
throws IOException
- Description copied from interface:
RMIConnection
- Handles the method
MBeanServerConnection.queryMBeans(ObjectName,
QueryExp). The QueryExp is wrapped in a
MarshalledObject.
- Specified by:
queryMBeans in interface RMIConnection
- Parameters:
name - The object name pattern identifying the MBeans to
be retrieved. If null or no domain and key properties are
specified, all the MBeans registered will be retrieved.query - The query expression to be applied for selecting
MBeans, encapsulated into a MarshalledObject. If
the MarshalledObject encapsulates a null value no
query expression will be applied for selecting MBeans.delegationSubject - The Subject containing the
delegation principals or null if the authentication
principal is used instead.
- Returns:
- A set containing the
ObjectInstance
objects for the selected MBeans. If no MBean satisfies the
query an empty list is returned.
- Throws:
IOException - if a general communication exception occurred.
queryNames
public Set<ObjectName> queryNames(ObjectName name,
MarshalledObject query,
Subject delegationSubject)
throws IOException
- Description copied from interface:
RMIConnection
- Handles the method
MBeanServerConnection.queryNames(ObjectName,
QueryExp). The QueryExp is wrapped in a
MarshalledObject.
- Specified by:
queryNames in interface RMIConnection
- Parameters:
name - The object name pattern identifying the MBean names
to be retrieved. If null or no domain and key properties are
specified, the name of all registered MBeans will be retrieved.query - The query expression to be applied for selecting
MBeans, encapsulated into a MarshalledObject. If
the MarshalledObject encapsulates a null value no
query expression will be applied for selecting MBeans.delegationSubject - The Subject containing the
delegation principals or null if the authentication
principal is used instead.
- Returns:
- A set containing the ObjectNames for the MBeans
selected. If no MBean satisfies the query, an empty list is
returned.
- Throws:
IOException - if a general communication exception occurred.
isRegistered
public boolean isRegistered(ObjectName name,
Subject delegationSubject)
throws IOException
- Description copied from interface:
RMIConnection
- Handles the method
MBeanServerConnection.isRegistered(ObjectName).
- Specified by:
isRegistered in interface RMIConnection
- Parameters:
name - The object name of the MBean to be checked.delegationSubject - The Subject containing the
delegation principals or null if the authentication
principal is used instead.
- Returns:
- True if the MBean is already registered in the MBean
server, false otherwise.
- Throws:
IOException - if a general communication exception occurred.
getMBeanCount
public Integer getMBeanCount(Subject delegationSubject)
throws IOException
- Description copied from interface:
RMIConnection
- Handles the method
MBeanServerConnection.getMBeanCount().
- Specified by:
getMBeanCount in interface RMIConnection
- Parameters:
delegationSubject - The Subject containing the
delegation principals or null if the authentication
principal is used instead.
- Returns:
- the number of MBeans registered.
- Throws:
IOException - if a general communication exception occurred.
getAttribute
public Object getAttribute(ObjectName name,
String attribute,
Subject delegationSubject)
throws MBeanException,
AttributeNotFoundException,
InstanceNotFoundException,
ReflectionException,
IOException
- Description copied from interface:
RMIConnection
- Handles the method
MBeanServerConnection.getAttribute(ObjectName,
String).
- Specified by:
getAttribute in interface RMIConnection
- Parameters:
name - The object name of the MBean from which the
attribute is to be retrieved.attribute - A String specifying the name of the attribute
to be retrieved.delegationSubject - The Subject containing the
delegation principals or null if the authentication
principal is used instead.
- Returns:
- The value of the retrieved attribute.
- Throws:
MBeanException - Wraps an exception thrown by the
MBean's getter.
AttributeNotFoundException - The attribute specified
is not accessible in the MBean.
InstanceNotFoundException - The MBean specified is not
registered in the MBean server.
ReflectionException - Wraps a
java.lang.Exception thrown when trying to invoke
the getter.
IOException - if a general communication exception occurred.- See Also:
RMIConnection.setAttribute(javax.management.ObjectName, java.rmi.MarshalledObject, javax.security.auth.Subject)
getAttributes
public AttributeList getAttributes(ObjectName name,
String[] attributes,
Subject delegationSubject)
throws InstanceNotFoundException,
ReflectionException,
IOException
- Description copied from interface:
RMIConnection
- Handles the method
MBeanServerConnection.getAttributes(ObjectName,
String[]).
- Specified by:
getAttributes in interface RMIConnection
- Parameters:
name - The object name of the MBean from which the
attributes are retrieved.attributes - A list of the attributes to be retrieved.delegationSubject - The Subject containing the
delegation principals or null if the authentication
principal is used instead.
- Returns:
- The list of the retrieved attributes.
- Throws:
InstanceNotFoundException - The MBean specified is not
registered in the MBean server.
ReflectionException - An exception occurred when
trying to invoke the getAttributes method of a Dynamic MBean.
IOException - if a general communication exception occurred.- See Also:
RMIConnection.setAttributes(javax.management.ObjectName, java.rmi.MarshalledObject, javax.security.auth.Subject)
setAttribute
public void setAttribute(ObjectName name,
MarshalledObject attribute,
Subject delegationSubject)
throws InstanceNotFoundException,
AttributeNotFoundException,
InvalidAttributeValueException,
MBeanException,
ReflectionException,
IOException
- Description copied from interface:
RMIConnection
- Handles the method
MBeanServerConnection.setAttribute(ObjectName,
Attribute). The Attribute parameter is wrapped
in a MarshalledObject.
- Specified by:
setAttribute in interface RMIConnection
- Parameters:
name - The name of the MBean within which the attribute is
to be set.attribute - The identification of the attribute to be set
and the value it is to be set to, encapsulated into a
MarshalledObject.delegationSubject - The Subject containing the
delegation principals or null if the authentication
principal is used instead.
- Throws:
InstanceNotFoundException - The MBean specified is not
registered in the MBean server.
AttributeNotFoundException - The attribute specified
is not accessible in the MBean.
InvalidAttributeValueException - The value specified
for the attribute is not valid.
MBeanException - Wraps an exception thrown by the
MBean's setter.
ReflectionException - Wraps a
java.lang.Exception thrown when trying to invoke
the setter.
IOException - if a general communication exception occurred.- See Also:
RMIConnection.getAttribute(javax.management.ObjectName, java.lang.String, javax.security.auth.Subject)
setAttributes
public AttributeList setAttributes(ObjectName name,
MarshalledObject attributes,
Subject delegationSubject)
throws InstanceNotFoundException,
ReflectionException,
IOException
- Description copied from interface:
RMIConnection
- Handles the method
MBeanServerConnection.setAttributes(ObjectName,
AttributeList). The AttributeList parameter is
wrapped in a MarshalledObject.
- Specified by:
setAttributes in interface RMIConnection
- Parameters:
name - The object name of the MBean within which the
attributes are to be set.attributes - A list of attributes: The identification of
the attributes to be set and the values they are to be set to,
encapsulated into a MarshalledObject.delegationSubject - The Subject containing the
delegation principals or null if the authentication
principal is used instead.
- Returns:
- The list of attributes that were set, with their new
values.
- Throws:
InstanceNotFoundException - The MBean specified is not
registered in the MBean server.
ReflectionException - An exception occurred when
trying to invoke the getAttributes method of a Dynamic MBean.
IOException - if a general communication exception occurred.- See Also:
RMIConnection.getAttributes(javax.management.ObjectName, java.lang.String[], javax.security.auth.Subject)
invoke
public Object invoke(ObjectName name,
String operationName,
MarshalledObject params,
String[] signature,
Subject delegationSubject)
throws InstanceNotFoundException,
MBeanException,
ReflectionException,
IOException
- Description copied from interface:
RMIConnection
- Handles the method
MBeanServerConnection.invoke(ObjectName,
String, Object[], String[]). The Object[]
parameter is wrapped in a MarshalledObject.
- Specified by:
invoke in interface RMIConnection
- Parameters:
name - The object name of the MBean on which the method is
to be invoked.operationName - The name of the operation to be invoked.params - An array containing the parameters to be set when
the operation is invoked, encapsulated into a
MarshalledObject. The encapsulated array can be
null, equivalent to an empty array.signature - An array containing the signature of the
operation. The class objects will be loaded using the same
class loader as the one used for loading the MBean on which the
operation was invoked. Can be null, equivalent to an empty
array.delegationSubject - The Subject containing the
delegation principals or null if the authentication
principal is used instead.
- Returns:
- The object returned by the operation, which represents
the result of invoking the operation on the MBean specified.
- Throws:
InstanceNotFoundException - The MBean specified is not
registered in the MBean server.
MBeanException - Wraps an exception thrown by the
MBean's invoked method.
ReflectionException - Wraps a
java.lang.Exception thrown while trying to invoke
the method.
IOException - if a general communication exception occurred.
getDefaultDomain
public String getDefaultDomain(Subject delegationSubject)
throws |