|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.sun.jdmk.comm.GenericHttpConnectorClient
The GenericHttpConnectorClient
class provides an implementation of the
RemoteMBeanServer
interface based on the
HTTP protocol.
Querying a Java Dynamic Management agent with the HTTP connector implies that an instance
of GenericHttpConnectorServer
is
running on the remote Java Dynamic Management agent.
In order to identify the Java Dynamic Management agent the connector needs to communicate
with, the method connect
needs to be invoked.
It is possible to request the use of a specific proxy through the java properties
http.proxyHost=
host and http.proxyPort=
port for HTTP, and
https.proxyHost=
host and https.proxyPort=
port for HTTPS.
The authentication information required to configure the connector is provided by the ConnectorAddress
parameter in the method connect
.
The following port numbers are used by default:
This class implements the ClientNotificationHandler
interface
to receive notifications from a remote MBean, and the HeartBeatClientHandler
interface to be able to detect any communication problem with the connector server and
notify it to the manager that created it.
RemoteMBeanServer
,
HeartBeatClientHandler
,
GenericHttpConnectorServer
, Serialized FormFields inherited from interface com.sun.jdmk.comm.ClientNotificationHandler |
DISCARD_NEW,
DISCARD_OLD,
NO_CACHE_LIMIT,
PULL_MODE,
PUSH_MODE |
Constructor Summary | |
GenericHttpConnectorClient()
Constructs a connector client. |
|
GenericHttpConnectorClient(java.net.InetAddress add)
|
Method Summary | |
void |
addHeartBeatNotificationListener(NotificationListener listener,
NotificationFilter filter,
java.lang.Object handback)
Adds the specified heartbeat listener to receive heartbeat notifications from this connector client. |
void |
addNotificationListener(ObjectName name,
NotificationListener listener,
NotificationFilter filter,
java.lang.Object handback)
Adds a listener to a registered MBean. |
void |
addProxy(Proxy proxy)
Deprecated. No more useful. |
void |
clearCache()
Clear the notification cache. |
java.lang.String |
connect(ConnectorAddress mbeanServerAddress)
Initializes the communication with the remote MBeanServer. |
ObjectInstance |
createMBean(java.lang.String className,
ObjectName name)
Creates an registers an instance of an MBean in the remote object server. |
ObjectInstance |
createMBean(java.lang.String className,
ObjectName name,
java.lang.Object[] params,
java.lang.String[] signature)
Creates and registers an instance of an MBean in the remote object server. |
ObjectInstance |
createMBean(java.lang.String className,
ObjectName name,
ObjectName loaderName)
Creates and registers an instance of an MBean in the remote object server. |
ObjectInstance |
createMBean(java.lang.String className,
ObjectName name,
ObjectName loaderName,
java.lang.Object[] params,
java.lang.String[] signature)
Creates and registers an instance of an MBean in the remote object server. |
void |
disconnect()
Terminates the communication with the MBeanServer. |
java.lang.Object |
getAttribute(ObjectName name,
java.lang.String attribute)
Gets the value of a specific attribute of a named MBean. |
AttributeList |
getAttributes(ObjectName name,
java.lang.String[] attributes)
Allows to retrieve the values of several attributes of an MBean. |
int |
getCacheSize()
Get the cache size of notifications waiting to be forwarded. |
java.lang.String |
getClassForProxyMBean(ObjectInstance instance)
Given the object name and the Java class name of the MBean(ObjectInstance), this method returns the name of the Java class of the corresponding ProxyMBean. |
java.lang.ClassLoader |
getClassLoader()
Deprecated. No more useful. |
java.lang.String |
getDefaultDomain()
Returns the default domain used for the MBean naming. |
java.util.Set |
getGenericProxies(java.util.Set instances)
Deprecated. It is not multi-user safe. |
GenericProxy |
getGenericProxy(ObjectInstance instance)
Deprecated. It is not multi-user safe. |
int |
getHeartBeatPeriod()
Gets the heartbeat period in milliseconds. |
int |
getHeartBeatRetries()
Gets the number of retries. |
java.lang.String |
getHost()
|
Mapper |
getMapper()
Deprecated. No more useful. |
java.lang.Integer |
getMBeanCount()
Returns the number of MBeans controlled by the MBeanServer. |
MBeanInfo |
getMBeanInfo(ObjectName name)
This method supplies the exposed attributes and actions of the MBean. |
ConnectorAddress |
getMBeanServerAddress()
Returns the exact address of the MBeanServer to which the ConnectorClient is connected. |
java.lang.String |
getMBeanServerId()
Return a string which represents the MBeanServer identification. |
int |
getMode()
Gets the notification forwarding mode. |
void |
getNotifications()
Retrieves all notifications in the cache. |
ObjectInstance |
getObjectInstance(ObjectName name)
Gets the ObjectInstance for a given MBean registered with the MBeanServer. |
OperationContext |
getOperationContext()
Get the OperationContext that was last given to setOperationContext, or null if setOperationContext was never called. |
int |
getOverflowCount()
Get the number of notifications discarded since last forwarding because the cache limit has been reached. |
int |
getOverflowMode()
Returns whether to discard the oldest message ( DISCARD_OLD ) or the
the newest meesage (DISCARD_NEW ), if the cache size excceds. |
int |
getPeriod()
Gets the period for notification forwarding in milliseconds. |
Proxy |
getProxyMBean(ObjectInstance instance)
Deprecated. It is not multi-user safe. |
java.util.Set |
getProxyMBeans(java.util.Set instances)
Deprecated. It is not multi-user safe. |
java.lang.Object |
invoke(ObjectName name,
java.lang.String methodName,
java.lang.Object[] arguments,
java.lang.String[] signature)
Invokes a method of an MBean. |
boolean |
isConnected()
Checks whether a communication with the MBeanServer is established. |
boolean |
isInstanceOf(ObjectName name,
java.lang.String className)
Returns true if the MBean specified is an instance of the specified class, false otherwise. |
boolean |
isRegistered(ObjectName name)
Checks whether an MBean, identified by its object name, is already registered with the MBeanServer. |
java.util.Set |
queryMBeans(ObjectName name,
QueryExp query)
Gets MBeans controlled by the MBeanServer. |
java.util.Set |
queryNames(ObjectName name,
QueryExp query)
Gets the names of MBeans controlled by the MBeanServer. |
void |
removeHeartBeatNotificationListener(NotificationListener listener)
Removes the specified heartbeat listener so that it no longer receives heartbeat notifications from this connector client. |
void |
removeNotificationListener(ObjectName name,
NotificationListener listener)
Removes a listener from a registered MBean. |
void |
removeProxy(Proxy proxy)
Deprecated. No more useful. |
void |
setAttribute(ObjectName name,
Attribute attribute)
Sets the value of a specific attribute of a named MBean. |
AttributeList |
setAttributes(ObjectName name,
AttributeList attributes)
Allows to modify the values of several attributes of an MBean. |
int |
setCacheSize(int size,
boolean discardOverflow)
Set the cache size of notifications waiting to be forwarded. |
void |
setClassLoader(java.lang.ClassLoader loader)
Deprecated. No more useful |
void |
setHeartBeatPeriod(int period)
Specifies the heartbeat period in milliseconds. |
void |
setHeartBeatRetries(int nretries)
Sets the number of retries. |
void |
setMapper(Mapper mapper)
Deprecated. No more useful. |
void |
setMode(int mode)
Sets the notification forwarding mode, it is the agent to push notifications to the client, if set to PULL_MODE , it is the client to retrive notifications from the agent. |
void |
setOperationContext(OperationContext c)
Set the OperationContext of this connector. |
void |
setOverflowCount(int count)
Sets the number of notifications discarded, this number indicates the number of notifications discarded because the cache limit has been reached. |
void |
setOverflowMode(int of)
Specify whether to discard the oldest message ( DISCARD_OLD ) or the
the newest message (DISCARD_NEW ), if the cache size excceds. |
void |
setPeriod(int period)
Specifies the period for notification forwarding in milliseconds. |
boolean |
supports(java.lang.String feature)
Returns true if the connector server supports the given feature, false otherwise. |
void |
unregisterMBean(ObjectName name)
Deletes an instance of an MBean in the remote MBean server. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Constructor Detail |
public GenericHttpConnectorClient()
public GenericHttpConnectorClient(java.net.InetAddress add)
Method Detail |
public void setOperationContext(OperationContext c)
Set the OperationContext of this connector. This context will be sent along with each request and can be recovered by the server, which can make it available to the operations it invokes.
The saved OperationContext will be a clone of the object
c
made using its clone
method.
c
- the new OperationContext. It may be null to indicate that
there is no context. The previous OperationContext, if any, is lost.c
does not implement the Cloneable
interface.public OperationContext getOperationContext()
public java.lang.String getHost()
public java.lang.String connect(ConnectorAddress mbeanServerAddress)
MBeanServerAddress
- The address for the MBeanServer to
contact (MBeanServer identification, protocol specification).RemoteMBeanServer
has already been connected and
disconnected and the specified ConnectorAddress
doesn't identify the same MBeanServer
.RemoteMBeanServer
was already connected or a
problem was encountered in the connection to the connector
server.ConnectorServer
was not
correct. Login based authentication failed.public void disconnect()
public boolean isConnected()
public ConnectorAddress getMBeanServerAddress()
public java.lang.String getMBeanServerId()
getMbeanServerId
still returns
the previous MbeanServer
identification.public ObjectInstance createMBean(java.lang.String className, ObjectName name) throws ReflectionException, InstanceAlreadyExistsException, MBeanRegistrationException, MBeanException, NotCompliantMBeanException
className
- The name of the Java class to be used by the MBeanServer for creating the MBean.name
- The name of the MBean to be created.ConnectorServer
was
not correct. Login based authentication failed.public ObjectInstance createMBean(java.lang.String className, ObjectName name, ObjectName loaderName) throws ReflectionException, InstanceAlreadyExistsException, MBeanRegistrationException, MBeanException, NotCompliantMBeanException, InstanceNotFoundException
className
- The name of the Java class to be used by the MBeanServer for creating the MBean.name
- The name of the MBean to be created.loaderName
- The name of the class loader to be used by the MBeanServer.ConnectorServer
was
not correct. Login based authentication failed.public ObjectInstance createMBean(java.lang.String className, ObjectName name, java.lang.Object[] params, java.lang.String[] signature) throws ReflectionException, InstanceAlreadyExistsException, MBeanRegistrationException, MBeanException, NotCompliantMBeanException
className
- The name of the Java class to be used by the MBeanServer for creating
the MBean.name
- The name of the MBean to be created.params
- An array containing the parameters of the constructor to be invoked.
A parameter can be any Java object that is serializable
.signature
- An array containing the signature of the constructor to be invoked.ConnectorServer
was
not correct. Login based authentication failed.public ObjectInstance createMBean(java.lang.String className, ObjectName name, ObjectName loaderName, java.lang.Object[] params, java.lang.String[] signature) throws ReflectionException, InstanceAlreadyExistsException, MBeanRegistrationException, MBeanException, NotCompliantMBeanException, InstanceNotFoundException
className
- The name of the Java class to be used by the MBeanServer for creating
the MBean.name
- The name of the MBean to be created.loaderName
- The name of the class loader to be used by the MBeanServer.params
- An array containing the parameters of the constructor to be invoked.
A parameter can be any Java object that is serializable
.signature
- An array containing the signature of the constructor to be invoked.ConnectorServer
was
not correct. Login based authentication failed.public void unregisterMBean(ObjectName name) throws InstanceNotFoundException, MBeanRegistrationException
name
- The name of the MBean to be deleted.ConnectorServer
was
not correct. Login based authentication failed.public Proxy getProxyMBean(ObjectInstance instance) throws ProxyMBeanInstantiationException
ProxyMBean
representing a remote MBean identified by this ObjectInstance
.
If the ProxyMBean
cannot be instantiated the method throws a ProxyMBeanInstantiationException
.instance
- The Objectinstance
identifying the MBean.ProxyMBean
representing the MBean.ProxyMBean
.public java.util.Set getProxyMBeans(java.util.Set instances) throws ProxyMBeanInstantiationException
ProxyMBean
s representing MBeans controlled by the remote MBeanServer
.instances
- The set of object instances identifying the MBeans.ProxyMBean
s representing the MBeans.ProxyMBean
s.public GenericProxy getGenericProxy(ObjectInstance instance)
GenericProxy
representing a remote MBean identified by this ObjectInstance
.instance
- The object instance identifying the MBean.GenericProxy
object associated with the MBean.public java.util.Set getGenericProxies(java.util.Set instances)
GenericProxy
s representing MBeans controlled by the remote MBeanServer
.instances
- The set of object instances identifying the MBeans.GenericProxy
s representing the MBeans.public void addProxy(Proxy proxy)
public void removeProxy(Proxy proxy)
public java.util.Set queryNames(ObjectName name, QueryExp query)
name
- The object name pattern identifying the MBean names to be retrieved. If
null or empty, the names of all the registered MBeans will be retrieved.query
- The query expression to be applied for selecting MBeans.ConnectorServer
was
not correct. Login based authentication failed.public java.util.Set queryMBeans(ObjectName name, QueryExp query)
name
- The object name pattern identifying the MBeans to be retrieved. If
null or empty all the MBeans registered will be retrieved.query
- The query expression to be applied for selecting MBeans.ConnectorServer
was
not correct. Login based authentication failed.public boolean isRegistered(ObjectName name)
name
- The object name of the MBean to be checked.ConnectorServer
was
not correct. Login based authentication failed.public java.lang.Object getAttribute(ObjectName name, java.lang.String attribute) throws MBeanException, AttributeNotFoundException, InstanceNotFoundException, ReflectionException
name
- The object name of the MBean from which the attribute is to be retrieved.attribute
- The name of the attribute to be retrieved.serializable
.ConnectorServer
was
not correct. Login based authentication failed.public AttributeList getAttributes(ObjectName name, java.lang.String[] attributes) throws InstanceNotFoundException
name
- The object name of the MBean from within which the
attributes are to be retrieved.attributes
- A list of the attributes to be retrieved.serializable
.ConnectorServer
was
not correct. Login based authentication failed.public void setAttribute(ObjectName name, Attribute attribute) throws InstanceNotFoundException, AttributeNotFoundException, InvalidAttributeValueException, MBeanException, ReflectionException
name
- The name of the MBean within which the attribute is to be set.attribute
- The modification to be performed: The identification of the attribute to
be set, the value it is to be set to, and the operator to apply.
The value of the attribute can be any Java object that is serializable
.ConnectorServer
was
not correct. Login based authentication failed.public AttributeList setAttributes(ObjectName name, AttributeList attributes) throws InstanceNotFoundException
name
- The object name of the MBean from within which the attributes are
to be set.attributes
- A list of the attributes to be set, their values and, optionally, the
operators to apply.
The value of the attributes can be any Java object that is serializable
.serializable
.ConnectorServer
was
not correct. Login based authentication failed.public java.lang.Object invoke(ObjectName name, java.lang.String methodName, java.lang.Object[] arguments, java.lang.String[] signature) throws InstanceNotFoundException, MBeanException, ReflectionException
name
- The name of the MBean on which the method is to be invoked.methodName
- The name of the method to be invoked.arguments
- An array containing the arguments to be set when the method is invoked.
An argument can be any Java object that is serializable
.signature
- An array containing the signature of the method.serializable
.ConnectorServer
was
not correct. Login based authentication failed.public MBeanInfo getMBeanInfo(ObjectName name) throws InstanceNotFoundException, IntrospectionException, ReflectionException
name
- The name of the MBean whose attributes and actions will be returned.ConnectorServer
was
not correct. Login based authentication failed.public ObjectInstance getObjectInstance(ObjectName name) throws InstanceNotFoundException
name
- The object name of the MBean.ConnectorServer
was
not correct. Login based authentication failed.public java.lang.Integer getMBeanCount()
ConnectorServer
was
not correct. Login based authentication failed.public java.lang.String getDefaultDomain()
ConnectorServer
was
not correct. Login based authentication failed.public boolean isInstanceOf(ObjectName name, java.lang.String className) throws InstanceNotFoundException
name
- The ObjectName
of the MBean.className
- The name of the class.public boolean supports(java.lang.String feature)
public java.lang.ClassLoader getClassLoader()
public void setClassLoader(java.lang.ClassLoader loader)
ProxyMBean
s.ClassLoader
- The instance of the ClassLoader
to use.public Mapper getMapper()
null
if it is the default mapper.
The default mapper is an instance of the DefaultMapper
class.public void setMapper(Mapper mapper)
mapper
- The instance of the mapping service to be used. If the given
mapper value is null
then the mapper service will be set to the default mapper.public java.lang.String getClassForProxyMBean(ObjectInstance instance) throws ProxyMBeanInstantiationException
instance
- The ObjectInstance (ObjectName, Java class name) of the MBean which
is represented by the ProxyMBean.public void setMode(int mode) throws java.lang.IllegalArgumentException
PULL_MODE
, it is the client to retrive notifications from the agent.
The default value is PUSH_MODE
.
mode
- set to PUSH_MODE
or PULL_MODE
.PUSH_MODE
nor PULL_MODE
.ConnectorServer
was
not correct. Login based authentication failed.public int getMode()
PUSH_MODE
, it is the agent to push notifications to the client, if set to
PULL_MODE
, it is the client to retrive notifications from the agent.
The default value is PUSH_MODE
.
ConnectorServer
was
not correct. Login based authentication failed.public void getNotifications()
ConnectorServer
was
not correct. Login based authentication failed.public void setPeriod(int period)
If set to equal to or less than zero and the pull mode is used, no pull will be done. A user should
explicitly call getNotifications
to retrieve all notifications in the cache.
This method has no effect in the push mode in the current implementation.
The default value is 1000 milliseconds.
period
- The period in milliseconds.ConnectorServer
was
not correct. Login based authentication failed.public int getPeriod()
The default value is 1000 milliseconds.
ConnectorServer
was
not correct. Login based authentication failed.public void clearCache()
ConnectorServer
was
not correct. Login based authentication failed.public int setCacheSize(int size, boolean discardOverflow) throws JMRuntimeException
If set to NO_CACHE_LIMIT
, notifications will never be discarded,
but this may lead to OutOfMemory errors under stressed conditions. If set to zero, any
notification will be discarded without being sent.
The default value is NO_CACHE_LIMIT
.
size
- the maximum number of notifications in the cache.discardOverflow
- effective only if current number of cached notifications exceeds the new size:
if true, discard excess notifications; if false, the cache size will not be changed.ConnectorServer
was
not correct. Login based authentication failed.public int getCacheSize()
If set to NO_CACHE_LIMIT
or a negative value, notifications will never be discarded,
but this may lead to OutOfMemory errors under stressed conditions.
The default value is NO_CACHE_LIMIT
.
ConnectorServer
was
not correct. Login based authentication failed.public void setOverflowCount(int count)
This count will be reset to zero if no more listener exists at the client side, because in this case the notification server will remove all information about this notification client.
count
- The new value to set to overflow count.ConnectorServer
was
not correct. Login based authentication failed.public int getOverflowCount()
This count will be reset to zero if no more listener exists at the client side, because in this case the notification server will remove all information about this notification client.
ConnectorServer
was
not correct. Login based authentication failed.public void setOverflowMode(int of) throws java.lang.IllegalArgumentException
DISCARD_OLD
) or the
the newest message (DISCARD_NEW
), if the cache size excceds.
The default mode is DISCARD_OLD
.
of
- The overflow mode to specify.DISCARD_NEW
nor DISCARD_OLD
.ConnectorServer
was
not correct. Login based authentication failed.public int getOverflowMode()
DISCARD_OLD
) or the
the newest meesage (DISCARD_NEW
), if the cache size excceds.
The default mode is DISCARD_OLD
.
ConnectorServer
was
not correct. Login based authentication failed.public void addNotificationListener(ObjectName name, NotificationListener listener, NotificationFilter filter, java.lang.Object handback) throws InstanceNotFoundException
name
- The name of the MBean on which the listener should be added.listener
- The listener object which will handle the notifications emitted by the registered MBean.filter
- The filter object. If filter is null, no filtering will be performed before handling notifications.handback
- The context to be sent to the listener when a notification is emitted.ConnectorServer
was
not correct. Login based authentication failed.public void removeNotificationListener(ObjectName name, NotificationListener listener) throws InstanceNotFoundException, ListenerNotFoundException
name
- The name of the MBean on which the listener should be removed.listener
- The listener object which will handle the notifications emitted by the registered MBean.
This method will remove all the information related to this listener.ConnectorServer
was
not correct. Login based authentication failed.public int getHeartBeatPeriod()
The default value is 10000 milliseconds.
public void setHeartBeatPeriod(int period)
If set to zero no check will be carried out for the associated connector server being alive. As the heartbeat is driven by the manager this would also prevent the connector server from being aware of the aliveness of this connector client.
The default value is 10000 milliseconds.
period
- The heartbeat period in milliseconds.public int getHeartBeatRetries()
The default value is 6 times.
public void setHeartBeatRetries(int nretries)
The default value is 6 times.
nretries
- The number of retries.public void addHeartBeatNotificationListener(NotificationListener listener, NotificationFilter filter, java.lang.Object handback)
listener
- The heartbeat listener which will handle the notifications emitted by the connector client.filter
- The filter object. If filter is null, no filtering will be performed before handling notifications.handback
- The context to be sent to the listener when a notification is emitted.public void removeHeartBeatNotificationListener(NotificationListener listener)
listener
- The heartbeat listener which will handle the notifications emitted by the connector client.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |