public class ConnectionImpl extends Object implements RhinoConnection, MBeanServerConnection
RhinoConnectionFactory
to
obtain instances of this class.Modifier | Constructor and Description |
---|---|
protected |
ConnectionImpl(String[] hosts,
String username,
String password) |
protected |
ConnectionImpl(String[] hosts,
String username,
String password,
boolean attemptRhinoSsl) |
Modifier and Type | Method and Description |
---|---|
void |
addNotificationListener(ObjectName name,
NotificationListener listener,
NotificationFilter filter,
Object handback) |
void |
addNotificationListener(ObjectName name,
ObjectName listener,
NotificationFilter filter,
Object handback) |
void |
connect()
Try to connect this connection.
|
ObjectInstance |
createMBean(String className,
ObjectName name) |
ObjectInstance |
createMBean(String className,
ObjectName name,
Object[] params,
String[] signature) |
ObjectInstance |
createMBean(String className,
ObjectName name,
ObjectName loaderName) |
ObjectInstance |
createMBean(String className,
ObjectName name,
ObjectName loaderName,
Object[] params,
String[] signature) |
protected void |
createMBeanServerConnection(String host,
int port,
String username,
String password) |
void |
disconnect()
Disconnect this connection.
|
Object |
getAttribute(ObjectName name,
String attribute) |
AttributeList |
getAttributes(ObjectName name,
String[] attributes) |
boolean |
getConnectedState()
Whether or not this connection is connected.
|
String |
getDefaultDomain() |
String[] |
getDomains() |
JMXConnector |
getJmxConnector()
Get the JMXConnector associated with this MBeanServer connection.
|
Integer |
getMBeanCount() |
MBeanInfo |
getMBeanInfo(ObjectName name) |
ObjectInstance |
getObjectInstance(ObjectName name) |
String |
getServerHost()
The host name of the current connection.
|
int |
getServerNodeId()
The node ID of the server the current connection is to.
|
int |
getServerPort()
The port of the current connection.
|
RhinoVersion |
getServerRhinoVersion()
The version of Rhino this connection is to.
|
Object |
invoke(ObjectName name,
String operationName,
Object[] params,
String[] signature) |
boolean |
isInstanceOf(ObjectName name,
String className) |
boolean |
isRegistered(ObjectName name) |
Set |
queryMBeans(ObjectName name,
QueryExp query) |
Set |
queryNames(ObjectName name,
QueryExp query) |
void |
reconnect()
Disconnect then connect this connection.
|
void |
removeNotificationListener(ObjectName name,
NotificationListener listener) |
void |
removeNotificationListener(ObjectName name,
NotificationListener listener,
NotificationFilter filter,
Object handback) |
void |
removeNotificationListener(ObjectName name,
ObjectName listener) |
void |
removeNotificationListener(ObjectName name,
ObjectName listener,
NotificationFilter filter,
Object handback) |
void |
setAllowedExecutionContext(ExecutionContext ctx)
Tell this connection to only allow particular connection contexts.
|
void |
setAttribute(ObjectName name,
Attribute attribute) |
AttributeList |
setAttributes(ObjectName name,
AttributeList attributes) |
void |
setNamespace(String namespace)
Set the current Rhino namespace associated with this connection.
|
void |
testConnection()
Test this connection by invoking a basic MBean operation.
|
String |
toString() |
void |
unregisterMBean(ObjectName name) |
protected ConnectionImpl(String[] hosts, String username, String password) throws ConnectionException
ConnectionException
protected ConnectionImpl(String[] hosts, String username, String password, boolean attemptRhinoSsl) throws ConnectionException
ConnectionException
public void setNamespace(String namespace)
RhinoConnection
setNamespace
in interface RhinoConnection
namespace
- the namespace. May be null
to indicate the default namespace.public void connect() throws ConnectionException
RhinoConnection
connect
in interface RhinoConnection
ConnectionException
- if the connection attempt failedpublic void disconnect()
RhinoConnection
disconnect
in interface RhinoConnection
public void testConnection() throws ConnectionException
RhinoConnection
testConnection
in interface RhinoConnection
ConnectionException
- if the test failed and the attempt to automatically reconnect failed.public void reconnect() throws ConnectionException
RhinoConnection
reconnect
in interface RhinoConnection
ConnectionException
- if the connection attempt failedpublic JMXConnector getJmxConnector()
RhinoConnection
getJmxConnector
in interface RhinoConnection
public boolean getConnectedState()
RhinoConnection
getConnectedState
in interface RhinoConnection
public String getServerHost()
RhinoConnection
getServerHost
in interface RhinoConnection
public int getServerPort()
RhinoConnection
getServerPort
in interface RhinoConnection
public int getServerNodeId()
RhinoConnection
getServerNodeId
in interface RhinoConnection
public RhinoVersion getServerRhinoVersion()
RhinoConnection
getServerRhinoVersion
in interface RhinoConnection
public void setAllowedExecutionContext(ExecutionContext ctx)
RhinoConnection
ExecutionContext
for more details.setAllowedExecutionContext
in interface RhinoConnection
ctx
- the context to allowprotected void createMBeanServerConnection(String host, int port, String username, String password) throws ConnectionException, IOException
ConnectionException
IOException
public ObjectInstance createMBean(String className, ObjectName name) throws IOException, ReflectionException, InstanceAlreadyExistsException, MBeanException, NotCompliantMBeanException
createMBean
in interface MBeanServerConnection
IOException
ReflectionException
InstanceAlreadyExistsException
MBeanException
NotCompliantMBeanException
public ObjectInstance createMBean(String className, ObjectName name, ObjectName loaderName) throws IOException, ReflectionException, InstanceAlreadyExistsException, MBeanException, NotCompliantMBeanException, InstanceNotFoundException
createMBean
in interface MBeanServerConnection
IOException
ReflectionException
InstanceAlreadyExistsException
MBeanException
NotCompliantMBeanException
InstanceNotFoundException
public ObjectInstance createMBean(String className, ObjectName name, Object[] params, String[] signature) throws IOException, ReflectionException, InstanceAlreadyExistsException, MBeanException, NotCompliantMBeanException
createMBean
in interface MBeanServerConnection
IOException
ReflectionException
InstanceAlreadyExistsException
MBeanException
NotCompliantMBeanException
public ObjectInstance createMBean(String className, ObjectName name, ObjectName loaderName, Object[] params, String[] signature) throws IOException, ReflectionException, InstanceAlreadyExistsException, MBeanException, NotCompliantMBeanException, InstanceNotFoundException
createMBean
in interface MBeanServerConnection
IOException
ReflectionException
InstanceAlreadyExistsException
MBeanException
NotCompliantMBeanException
InstanceNotFoundException
public void unregisterMBean(ObjectName name) throws IOException, InstanceNotFoundException, MBeanRegistrationException
unregisterMBean
in interface MBeanServerConnection
IOException
InstanceNotFoundException
MBeanRegistrationException
public ObjectInstance getObjectInstance(ObjectName name) throws IOException, InstanceNotFoundException
getObjectInstance
in interface MBeanServerConnection
IOException
InstanceNotFoundException
public Set queryMBeans(ObjectName name, QueryExp query) throws IOException
queryMBeans
in interface MBeanServerConnection
IOException
public Set queryNames(ObjectName name, QueryExp query) throws IOException
queryNames
in interface MBeanServerConnection
IOException
public boolean isRegistered(ObjectName name) throws IOException
isRegistered
in interface MBeanServerConnection
IOException
public Integer getMBeanCount() throws IOException
getMBeanCount
in interface MBeanServerConnection
IOException
public Object getAttribute(ObjectName name, String attribute) throws IOException, MBeanException, AttributeNotFoundException, InstanceNotFoundException, ReflectionException
getAttribute
in interface MBeanServerConnection
IOException
MBeanException
AttributeNotFoundException
InstanceNotFoundException
ReflectionException
public AttributeList getAttributes(ObjectName name, String[] attributes) throws IOException, InstanceNotFoundException, ReflectionException
getAttributes
in interface MBeanServerConnection
IOException
InstanceNotFoundException
ReflectionException
public void setAttribute(ObjectName name, Attribute attribute) throws IOException, InstanceNotFoundException, AttributeNotFoundException, InvalidAttributeValueException, MBeanException, ReflectionException
setAttribute
in interface MBeanServerConnection
IOException
InstanceNotFoundException
AttributeNotFoundException
InvalidAttributeValueException
MBeanException
ReflectionException
public AttributeList setAttributes(ObjectName name, AttributeList attributes) throws IOException, InstanceNotFoundException, ReflectionException
setAttributes
in interface MBeanServerConnection
IOException
InstanceNotFoundException
ReflectionException
public Object invoke(ObjectName name, String operationName, Object[] params, String[] signature) throws IOException, InstanceNotFoundException, MBeanException, ReflectionException
invoke
in interface MBeanServerConnection
IOException
InstanceNotFoundException
MBeanException
ReflectionException
public String getDefaultDomain() throws IOException
getDefaultDomain
in interface MBeanServerConnection
IOException
public String[] getDomains() throws IOException
getDomains
in interface MBeanServerConnection
IOException
public void addNotificationListener(ObjectName name, NotificationListener listener, NotificationFilter filter, Object handback) throws IOException, InstanceNotFoundException
addNotificationListener
in interface MBeanServerConnection
IOException
InstanceNotFoundException
public void addNotificationListener(ObjectName name, ObjectName listener, NotificationFilter filter, Object handback) throws IOException, InstanceNotFoundException
addNotificationListener
in interface MBeanServerConnection
IOException
InstanceNotFoundException
public void removeNotificationListener(ObjectName name, NotificationListener listener) throws IOException, InstanceNotFoundException, ListenerNotFoundException
removeNotificationListener
in interface MBeanServerConnection
IOException
InstanceNotFoundException
ListenerNotFoundException
public void removeNotificationListener(ObjectName name, ObjectName listener) throws IOException, InstanceNotFoundException, ListenerNotFoundException
removeNotificationListener
in interface MBeanServerConnection
IOException
InstanceNotFoundException
ListenerNotFoundException
public void removeNotificationListener(ObjectName name, ObjectName listener, NotificationFilter filter, Object handback) throws IOException, InstanceNotFoundException, ListenerNotFoundException
removeNotificationListener
in interface MBeanServerConnection
IOException
InstanceNotFoundException
ListenerNotFoundException
public void removeNotificationListener(ObjectName name, NotificationListener listener, NotificationFilter filter, Object handback) throws IOException, InstanceNotFoundException, ListenerNotFoundException
removeNotificationListener
in interface MBeanServerConnection
IOException
InstanceNotFoundException
ListenerNotFoundException
public MBeanInfo getMBeanInfo(ObjectName name) throws IOException, InstanceNotFoundException, IntrospectionException, ReflectionException
getMBeanInfo
in interface MBeanServerConnection
IOException
InstanceNotFoundException
IntrospectionException
ReflectionException
public boolean isInstanceOf(ObjectName name, String className) throws IOException, InstanceNotFoundException
isInstanceOf
in interface MBeanServerConnection
IOException
InstanceNotFoundException