Hyperic HQ Plugin API v. 4.4.0.2

org.hyperic.hq.product.servlet.client
Class JMXRemote

java.lang.Object
  extended by org.hyperic.hq.product.servlet.client.JMXRemote

public class JMXRemote
extends java.lang.Object

Remote proxy for JMX. One instance per managed server. It will cache values to avoid making too many requests. It also include all the constants related with the connection to the remote side.


Field Summary
protected  java.lang.String appPath
           
static java.lang.String AVAIL_DOMAIN
           
static java.lang.String DEFAULT_DOMAIN
           
protected  java.lang.String host
           
protected  java.lang.String jmxUrl
           
static java.lang.Integer ONE
           
protected  int port
           
static java.lang.String PROP_CONNECTOR_TYPE
           
static java.lang.String PROP_CONTEXT
           
static java.lang.String PROP_HOST
           
static java.lang.String PROP_JMX_PASS
           
static java.lang.String PROP_JMX_URL
           
static java.lang.String PROP_JMX_USER
           
static java.lang.String PROP_SERVLET
           
protected  java.lang.String protocol
           
protected  JMXProtocolRequest requestor
           
static java.lang.Integer ZERO
           
 
Constructor Summary
JMXRemote()
           
 
Method Summary
 java.lang.Object getAvailability(Metric jdsn)
          Like a remote value, but any error will result in returning ZERO.
 boolean getAvailability(java.lang.String path)
          Get availability of a servlet or webapp
 long getCacheTimeout()
           
 java.lang.String getHost()
           
static JMXRemote getInstance(java.util.Properties props)
           
 java.lang.String getJmxAttributeServletPath()
           
 java.lang.String getJmxUrl()
           
 java.lang.String getJmxWebappPath()
          Return the (URL) path to the /hyperic-hq/ web application.
 int getPort()
           
 java.lang.String getProtocol()
           
 java.util.jar.Manifest getRemoteInfo()
          Get data for a remote host
 java.util.Set getRemoteMbeans()
          Return the names of the remote mbeans
 java.lang.Object getRemoteMBeanValue(Metric jdsn)
           
 java.lang.Object getRemoteMBeanValue(java.lang.String qry)
          Deprecated. This will get one value at a time, inefficient
 int getStatus()
           
 boolean getURLAvailability(Metric jdsn)
          Get availability of a connector
 java.lang.String getUser()
           
 java.lang.String getValue(java.lang.String oname, java.lang.String att)
           
 void init()
           
 java.lang.Object invoke(java.lang.String oname, java.lang.String operation)
           
static void main(java.lang.String[] args)
           
 java.io.InputStream openUrl(java.lang.String path)
           
 void refresh()
          Refresh the view of the remote system
 void setCacheTimeout(long timeout)
           
 void setHost(java.lang.String host)
           
 void setJmxUrl(java.lang.String jmxUrl)
          Sets the URL for the remote JMX.
 void setPassword(java.lang.String password)
           
 void setPort(int port)
           
 void setProtocol(java.lang.String protocol)
           
 void setUser(java.lang.String user)
           
 void shutdown()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROP_JMX_URL

public static final java.lang.String PROP_JMX_URL
See Also:
Constant Field Values

PROP_JMX_USER

public static final java.lang.String PROP_JMX_USER
See Also:
Constant Field Values

PROP_JMX_PASS

public static final java.lang.String PROP_JMX_PASS
See Also:
Constant Field Values

PROP_CONNECTOR_TYPE

public static final java.lang.String PROP_CONNECTOR_TYPE
See Also:
Constant Field Values

PROP_SERVLET

public static final java.lang.String PROP_SERVLET
See Also:
Constant Field Values

PROP_HOST

public static final java.lang.String PROP_HOST
See Also:
Constant Field Values

PROP_CONTEXT

public static final java.lang.String PROP_CONTEXT
See Also:
Constant Field Values

DEFAULT_DOMAIN

public static final java.lang.String DEFAULT_DOMAIN
See Also:
Constant Field Values

AVAIL_DOMAIN

public static final java.lang.String AVAIL_DOMAIN
See Also:
Constant Field Values

host

protected java.lang.String host

port

protected int port

appPath

protected java.lang.String appPath

jmxUrl

protected java.lang.String jmxUrl

protocol

protected java.lang.String protocol

requestor

protected JMXProtocolRequest requestor

ZERO

public static final java.lang.Integer ZERO

ONE

public static final java.lang.Integer ONE
Constructor Detail

JMXRemote

public JMXRemote()
Method Detail

getInstance

public static JMXRemote getInstance(java.util.Properties props)
                             throws PluginException
Throws:
PluginException

getHost

public java.lang.String getHost()

setHost

public void setHost(java.lang.String host)

getPort

public int getPort()

setPort

public void setPort(int port)

setPassword

public void setPassword(java.lang.String password)

getUser

public java.lang.String getUser()

setUser

public void setUser(java.lang.String user)

getJmxUrl

public java.lang.String getJmxUrl()

setCacheTimeout

public void setCacheTimeout(long timeout)

getCacheTimeout

public long getCacheTimeout()

getJmxWebappPath

public java.lang.String getJmxWebappPath()
Return the (URL) path to the /hyperic-hq/ web application. Defaults to /hyperic-hq/ if the URL doesn't include a path


getJmxAttributeServletPath

public java.lang.String getJmxAttributeServletPath()

setJmxUrl

public void setJmxUrl(java.lang.String jmxUrl)
Sets the URL for the remote JMX. Protocol can be a HTTP or AJP. We require the full URL - with port. Path defaults to covalent-eam/jmx-attributes (for backward compat).

Parameters:
jmxUrl -

getProtocol

public java.lang.String getProtocol()

setProtocol

public void setProtocol(java.lang.String protocol)

init

public void init()
          throws PluginException
Throws:
PluginException

shutdown

public void shutdown()
              throws PluginException
Throws:
PluginException

getURLAvailability

public boolean getURLAvailability(Metric jdsn)
Get availability of a connector


getAvailability

public boolean getAvailability(java.lang.String path)
Get availability of a servlet or webapp


getAvailability

public java.lang.Object getAvailability(Metric jdsn)
                                 throws MetricInvalidException
Like a remote value, but any error will result in returning ZERO.

Throws:
MetricInvalidException

getRemoteMBeanValue

public java.lang.Object getRemoteMBeanValue(Metric jdsn)
                                     throws MetricInvalidException,
                                            MetricUnreachableException
Throws:
MetricInvalidException
MetricUnreachableException

invoke

public java.lang.Object invoke(java.lang.String oname,
                               java.lang.String operation)
                        throws java.lang.Exception
Throws:
java.lang.Exception

getRemoteMBeanValue

public java.lang.Object getRemoteMBeanValue(java.lang.String qry)
                                     throws java.lang.Exception
Deprecated. This will get one value at a time, inefficient

Perform JMX query. XXX: clearly we could optimize and secure this protocol proof-of-concept will do for the moment

Throws:
java.lang.Exception

openUrl

public java.io.InputStream openUrl(java.lang.String path)
                            throws java.lang.Exception
Throws:
java.lang.Exception

getRemoteMbeans

public java.util.Set getRemoteMbeans()
                              throws MetricInvalidException,
                                     MetricUnreachableException
Return the names of the remote mbeans

Throws:
MetricInvalidException
MetricUnreachableException

getValue

public java.lang.String getValue(java.lang.String oname,
                                 java.lang.String att)
                          throws MetricInvalidException,
                                 MetricUnreachableException
Throws:
MetricInvalidException
MetricUnreachableException

getRemoteInfo

public java.util.jar.Manifest getRemoteInfo()
                                     throws MetricInvalidException,
                                            MetricUnreachableException
Get data for a remote host

Throws:
MetricInvalidException
MetricUnreachableException

getStatus

public int getStatus()

refresh

public void refresh()
             throws MetricInvalidException,
                    MetricUnreachableException
Refresh the view of the remote system

Throws:
MetricInvalidException
MetricUnreachableException

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Throws:
java.lang.Exception

Hyperic HQ Plugin API v. 4.4.0.2

Copyright © 2004-2006 Hyperic, Inc. support@hyperic.net, All Rights Reserved.