Brooklyn

brooklyn.event.adapter
[Java] Class JmxHelper

java.lang.Object
  brooklyn.event.adapter.JmxHelper

public class JmxHelper

Field Summary
static java.util.Map CLASSES

static java.lang.String JMX_URL_FORMAT

protected static Logger LOG

static java.lang.String RMI_JMX_URL_FORMAT

 
Constructor Summary
JmxHelper(java.lang.String url)

JmxHelper(EntityLocal entity)

JmxHelper(java.lang.String url, java.lang.String user, java.lang.String password)

 
Method Summary
void addNotificationListener(java.lang.String objectName, javax.management.NotificationListener listener)

void addNotificationListener(java.lang.String objectName, javax.management.NotificationListener listener, javax.management.NotificationFilter filter)

void addNotificationListener(javax.management.ObjectName objectName, javax.management.NotificationListener listener)

void addNotificationListener(javax.management.ObjectName objectName, javax.management.NotificationListener listener, javax.management.NotificationFilter filter)

void assertMBeanExistsEventually(javax.management.ObjectName objectName, groovy.time.TimeDuration timeout)

void assertMBeanExistsEventually(javax.management.ObjectName objectName, long timeoutMillis)

void assertMBeanExistsEventually(javax.management.ObjectName objectName, long timeout, java.util.concurrent.TimeUnit timeUnit)

void connect()

attempts to connect immediately

boolean connect(long timeoutMs)

Continuously attempts to connect for for at least the indicated amount of time; or indefinitely if -1.

static javax.management.ObjectName createObjectName(java.lang.String name)

void disconnect()

Disconnects.

java.util.Set doesMBeanExistsEventually(javax.management.ObjectName objectName, groovy.time.TimeDuration timeout)

java.util.Set doesMBeanExistsEventually(javax.management.ObjectName objectName, long timeoutMillis)

java.util.Set doesMBeanExistsEventually(java.lang.String objectName, groovy.time.TimeDuration timeout)

java.util.Set doesMBeanExistsEventually(java.lang.String objectName, long timeout, java.util.concurrent.TimeUnit timeUnit)

java.util.Set doesMBeanExistsEventually(javax.management.ObjectName objectName, long timeout, java.util.concurrent.TimeUnit timeUnit)

javax.management.ObjectInstance findMBean(javax.management.ObjectName objectName)

java.util.Set findMBeans(javax.management.ObjectName objectName)

java.lang.Object getAttribute(javax.management.ObjectName objectName, java.lang.String attribute)

Returns a specific attribute for a JMX javax.management.ObjectName.

protected javax.management.MBeanServerConnection getConnection()

M getProxyObject(java.lang.String objectName, java.lang.Class mbeanInterface)

M getProxyObject(javax.management.ObjectName objectName, java.lang.Class mbeanInterface)

java.lang.String getUrl()

boolean isConnected()

Checks if the JmxHelper is connected.

java.lang.Object operation(java.lang.String objectName, java.lang.String method, java.lang.Object... arguments)

@see #operation(ObjectName, String, Object ...)

java.lang.Object operation(javax.management.ObjectName objectName, java.lang.String method, java.lang.Object... arguments)

Executes an operation on a JMX javax.management.ObjectName.

void reconnect()

Reconnects.

void removeNotificationListener(java.lang.String objectName, javax.management.NotificationListener listener)

void removeNotificationListener(javax.management.ObjectName objectName, javax.management.NotificationListener listener)

void removeNotificationListener(javax.management.ObjectName objectName, javax.management.NotificationListener listener, javax.management.NotificationFilter filter)

void setAttribute(java.lang.String objectName, java.lang.String attribute, java.lang.Object val)

void setAttribute(javax.management.ObjectName objectName, java.lang.String attribute, java.lang.Object val)

static java.lang.String toConnectorUrl(java.lang.String host, java.lang.Integer jmxRmiRegistryPort, java.lang.Integer rmiServerPort, java.lang.String context)

static java.lang.String toConnectorUrl(EntityLocal entity)

javax.management.ObjectName toLiteralObjectName(javax.management.ObjectName objectName)

Converts from an object name pattern to a real object name, by querying with findMBean; if no matching MBean can be found (or if more than one match found) then returns null.

 
Methods inherited from class java.lang.Object
java.lang.Object#wait(), java.lang.Object#wait(long), java.lang.Object#wait(long, int), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()
 

Field Detail

CLASSES

public static final java.util.Map CLASSES


JMX_URL_FORMAT

public static final java.lang.String JMX_URL_FORMAT


LOG

protected static final Logger LOG


RMI_JMX_URL_FORMAT

public static final java.lang.String RMI_JMX_URL_FORMAT


 
Constructor Detail

JmxHelper

public JmxHelper(java.lang.String url)


JmxHelper

public JmxHelper(EntityLocal entity)


JmxHelper

public JmxHelper(java.lang.String url, java.lang.String user, java.lang.String password)


 
Method Detail

addNotificationListener

public void addNotificationListener(java.lang.String objectName, javax.management.NotificationListener listener)


addNotificationListener

public void addNotificationListener(java.lang.String objectName, javax.management.NotificationListener listener, javax.management.NotificationFilter filter)


addNotificationListener

public void addNotificationListener(javax.management.ObjectName objectName, javax.management.NotificationListener listener)


addNotificationListener

public void addNotificationListener(javax.management.ObjectName objectName, javax.management.NotificationListener listener, javax.management.NotificationFilter filter)


assertMBeanExistsEventually

public void assertMBeanExistsEventually(javax.management.ObjectName objectName, groovy.time.TimeDuration timeout)


assertMBeanExistsEventually

public void assertMBeanExistsEventually(javax.management.ObjectName objectName, long timeoutMillis)


assertMBeanExistsEventually

public void assertMBeanExistsEventually(javax.management.ObjectName objectName, long timeout, java.util.concurrent.TimeUnit timeUnit)


connect

public void connect()
attempts to connect immediately


connect

public boolean connect(long timeoutMs)
Continuously attempts to connect for for at least the indicated amount of time; or indefinitely if -1. This method is useful when you are not sure if the system you are trying to connect to already is up and running. This method doesn't throw an Exception, but returns true on success, false otherwise. TODO: What happens if already connected?
Parameters:
timeoutMs
Returns:


createObjectName

public static javax.management.ObjectName createObjectName(java.lang.String name)


disconnect

public void disconnect()
Disconnects. Method doesn't throw an exception. Can safely be called if already disconnected. This method is threadsafe.


doesMBeanExistsEventually

public java.util.Set doesMBeanExistsEventually(javax.management.ObjectName objectName, groovy.time.TimeDuration timeout)


doesMBeanExistsEventually

public java.util.Set doesMBeanExistsEventually(javax.management.ObjectName objectName, long timeoutMillis)


doesMBeanExistsEventually

public java.util.Set doesMBeanExistsEventually(java.lang.String objectName, groovy.time.TimeDuration timeout)


doesMBeanExistsEventually

public java.util.Set doesMBeanExistsEventually(java.lang.String objectName, long timeout, java.util.concurrent.TimeUnit timeUnit)


doesMBeanExistsEventually

public java.util.Set doesMBeanExistsEventually(javax.management.ObjectName objectName, long timeout, java.util.concurrent.TimeUnit timeUnit)


findMBean

public javax.management.ObjectInstance findMBean(javax.management.ObjectName objectName)


findMBeans

public java.util.Set findMBeans(javax.management.ObjectName objectName)


getAttribute

public java.lang.Object getAttribute(javax.management.ObjectName objectName, java.lang.String attribute)
Returns a specific attribute for a JMX javax.management.ObjectName.


getConnection

protected javax.management.MBeanServerConnection getConnection()


getProxyObject

public M getProxyObject(java.lang.String objectName, java.lang.Class mbeanInterface)


getProxyObject

public M getProxyObject(javax.management.ObjectName objectName, java.lang.Class mbeanInterface)


getUrl

public java.lang.String getUrl()


isConnected

public boolean isConnected()
Checks if the JmxHelper is connected. Returned value could be stale as soon as it is received. This method is thread safe.
Returns:
true if connected, false otherwise.


operation

public java.lang.Object operation(java.lang.String objectName, java.lang.String method, java.lang.Object... arguments)
See Also:
operation(ObjectName, String, Object ...)


operation

public java.lang.Object operation(javax.management.ObjectName objectName, java.lang.String method, java.lang.Object... arguments)
Executes an operation on a JMX javax.management.ObjectName.


reconnect

public void reconnect()
Reconnects. If it already is connected, it disconnects first.
throws:
IOException


removeNotificationListener

public void removeNotificationListener(java.lang.String objectName, javax.management.NotificationListener listener)


removeNotificationListener

public void removeNotificationListener(javax.management.ObjectName objectName, javax.management.NotificationListener listener)


removeNotificationListener

public void removeNotificationListener(javax.management.ObjectName objectName, javax.management.NotificationListener listener, javax.management.NotificationFilter filter)


setAttribute

public void setAttribute(java.lang.String objectName, java.lang.String attribute, java.lang.Object val)


setAttribute

public void setAttribute(javax.management.ObjectName objectName, java.lang.String attribute, java.lang.Object val)


toConnectorUrl

public static java.lang.String toConnectorUrl(java.lang.String host, java.lang.Integer jmxRmiRegistryPort, java.lang.Integer rmiServerPort, java.lang.String context)


toConnectorUrl

public static java.lang.String toConnectorUrl(EntityLocal entity)


toLiteralObjectName

public javax.management.ObjectName toLiteralObjectName(javax.management.ObjectName objectName)
Converts from an object name pattern to a real object name, by querying with findMBean; if no matching MBean can be found (or if more than one match found) then returns null. If the supplied object name is not a pattern then just returns that. If the


 

Brooklyn Multi-Cloud Application Management Platform
brooklyncentral.github.com. Apache License. © 2012.