Hyperic HQ Plugin API v. 5.8.0

org.hyperic.hq.product.jmx
Class MxServerDetector

java.lang.Object
  extended by org.hyperic.hq.product.GenericPlugin
      extended by org.hyperic.hq.product.ServerDetector
          extended by org.hyperic.hq.product.DaemonDetector
              extended by org.hyperic.hq.product.jmx.MxServerDetector
All Implemented Interfaces:
AutoServerDetector, FileServerDetector, RuntimeDiscoverer
Direct Known Subclasses:
SunMxServerDetector

public class MxServerDetector
extends DaemonDetector
implements AutoServerDetector


Nested Class Summary
static class MxServerDetector.MxProcess
           
 
Field Summary
static String PROC_HOME_ENV
           
static String PROC_HOME_PROPERTY
           
protected static String PROC_JAVA
           
static String PROC_MAIN_CLASS
           
static String PROP_PROCESS_QUERY
           
protected static String SUN_JMX_PORT
           
protected static String SUN_JMX_REMOTE
           
 
Fields inherited from class org.hyperic.hq.product.ServerDetector
AUTOINVENTORY_NAME, INSTALLPATH, INVENTORY_ID
 
Fields inherited from class org.hyperic.hq.product.GenericPlugin
config, FILE_DELIM, FILE_DELIM_ESC, PROP_NAME
 
Constructor Summary
MxServerDetector()
           
 
Method Summary
protected  boolean configureLocalMxURL(org.hyperic.util.config.ConfigResponse config, String arg, String query)
           
protected  boolean configureMxURL(org.hyperic.util.config.ConfigResponse config, String arg)
          First checks if the ptql query is specified in the process properties, if not, then it checks to see if the port value is specified, to generate the service URL.
protected  List discoverMxServices(MBeanServerConnection mServer, org.hyperic.util.config.ConfigResponse serverConfig)
           
protected  List discoverServices(org.hyperic.util.config.ConfigResponse serverConfig)
          Override to discover services for the server type of the plugin instance.
 Set discoverServiceTypes(org.hyperic.util.config.ConfigResponse serverConfig)
           
protected  boolean findAndSetURL(org.hyperic.util.config.ConfigResponse config, List<String> args, String processQuery)
          Goes through several checks in order to find the jmx url in the configuration.
protected static String getMxURL(String port)
           
protected  String getProcHomeEnv()
           
protected  String getProcHomeProperty()
           
protected  String getProcMainClass()
           
protected  String getProcQuery()
           
protected  String getProcQuery(String path)
           
protected  List getServerProcessList()
           
protected  ServerResource getServerResource(MxServerDetector.MxProcess process)
           
 List getServerResources(org.hyperic.util.config.ConfigResponse platformConfig)
           
protected  boolean isInstallTypeVersion(MxServerDetector.MxProcess process)
           
protected  String parseMxPort(String arg)
           
protected  void setJmxUrl(MxServerDetector.MxProcess process, org.hyperic.util.config.ConfigResponse config)
          Sets the JMX url.
protected  void setProductConfig(ServerResource server, org.hyperic.util.config.ConfigResponse config, long pid)
           
 
Methods inherited from class org.hyperic.hq.product.DaemonDetector
discoverServerConfig, getFileResources, getPlatformConfig, getProcessQuery, getProcessResources, getProcOpts, getServerResources, isSwitch, newServerResource, newServerResource, setPlatformConfig
 
Methods inherited from class org.hyperic.hq.product.ServerDetector
createServerResource, createServiceResource, discoverResources, discoverServers, findVersionFile, formatAutoInventoryName, formatName, getCanonicalPath, getConfigSchema, getConnectionProtocol, getDocument, getListenAddress, getListenAddress, getManager, getParentDir, getParentDir, getPids, getProcArgs, getProcCwd, getProcExe, getProcExe, getProcModules, getRegistryScanKeys, getRuntimeDiscoverer, getScanOrder, getServerSignature, getServiceConfigs, getServiceInventoryPlugins, getSigar, getTypeProperty, getXPathValue, getXPathValue, init, isInstallTypeVersion, isRuntimeDiscoverySupported, isSSLPort, isWin32ServiceRunning, setAutoApproveConfig, setControlConfig, setControlConfig, setCustomProperties, setCustomProperties, setDescription, setMeasurementConfig, setMeasurementConfig, setProductConfig, setProductConfig
 
Methods inherited from class org.hyperic.hq.product.GenericPlugin
adjustClassPath, configure, getAbsoluteFiles, getConfig, getConfig, getConfigSchema, getCustomPropertiesSchema, getCustomPropertiesSchema, getCustomPropertiesSchema, getDefaultInstallPath, getLog, getLogName, getManagerProperty, getName, getPlatformName, getPluginClassName, getPluginData, getPluginProperty, getPluginVersion, getProductPlugin, getProperties, getScriptExtension, getScriptExtension, getScriptExtension, getTypeInfo, getTypeNameProperty, getTypeNameProperty, getTypeProperties, getTypeProperty, getTypeProperty, isNetStatEnabled, isWin32, openResource, setData, setName, setPluginVersion, setTypeInfo, shutdown, toFileList
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROC_MAIN_CLASS

public static final String PROC_MAIN_CLASS
See Also:
Constant Field Values

PROC_HOME_PROPERTY

public static final String PROC_HOME_PROPERTY
See Also:
Constant Field Values

PROC_HOME_ENV

public static final String PROC_HOME_ENV
See Also:
Constant Field Values

PROP_PROCESS_QUERY

public static final String PROP_PROCESS_QUERY
See Also:
Constant Field Values

PROC_JAVA

protected static final String PROC_JAVA
See Also:
Constant Field Values

SUN_JMX_REMOTE

protected static final String SUN_JMX_REMOTE
See Also:
Constant Field Values

SUN_JMX_PORT

protected static final String SUN_JMX_PORT
See Also:
Constant Field Values
Constructor Detail

MxServerDetector

public MxServerDetector()
Method Detail

getMxURL

protected static String getMxURL(String port)

parseMxPort

protected String parseMxPort(String arg)

configureMxURL

protected boolean configureMxURL(org.hyperic.util.config.ConfigResponse config,
                                 String arg)
First checks if the ptql query is specified in the process properties, if not, then it checks to see if the port value is specified, to generate the service URL.

Returns:
True if configured, otherwise false.

findAndSetURL

protected boolean findAndSetURL(org.hyperic.util.config.ConfigResponse config,
                                List<String> args,
                                String processQuery)
Goes through several checks in order to find the jmx url in the configuration. For each process argument it will check the following: 1) Does it use the ptql query option to detect the process (i.e -Dcom.sun.management.jmxremote=ptql:State.Name...). 2) Does it match -Dcom.sun.management.jmxremote.port=. 3) Did the user configure the jmx.url in the ui(optionally the jmx.username and jmx.password). 4) Does it match the ptql query generated using the install path. 5) Otherwise it returns false.

Parameters:
config -
args -
processQuery -
Returns:
True if the url was set, otherwise false.

configureLocalMxURL

protected boolean configureLocalMxURL(org.hyperic.util.config.ConfigResponse config,
                                      String arg,
                                      String query)

getProcMainClass

protected String getProcMainClass()

getProcHomeProperty

protected String getProcHomeProperty()

getProcHomeEnv

protected String getProcHomeEnv()

getProcQuery

protected String getProcQuery()

getProcQuery

protected String getProcQuery(String path)

getServerProcessList

protected List getServerProcessList()

isInstallTypeVersion

protected boolean isInstallTypeVersion(MxServerDetector.MxProcess process)

setProductConfig

protected void setProductConfig(ServerResource server,
                                org.hyperic.util.config.ConfigResponse config,
                                long pid)

getServerResource

protected ServerResource getServerResource(MxServerDetector.MxProcess process)

setJmxUrl

protected void setJmxUrl(MxServerDetector.MxProcess process,
                         org.hyperic.util.config.ConfigResponse config)
Sets the JMX url. First checks whether the process supplies the jmx.url. Then does some searching for the url.

Parameters:
process -
config -
Throws:
MxRuntimeException - If there is no jmx.url found.

getServerResources

public List getServerResources(org.hyperic.util.config.ConfigResponse platformConfig)
                        throws PluginException
Specified by:
getServerResources in interface AutoServerDetector
Overrides:
getServerResources in class DaemonDetector
Throws:
PluginException

discoverMxServices

protected List discoverMxServices(MBeanServerConnection mServer,
                                  org.hyperic.util.config.ConfigResponse serverConfig)
                           throws PluginException
Throws:
PluginException

discoverServices

protected List discoverServices(org.hyperic.util.config.ConfigResponse serverConfig)
                         throws PluginException
Description copied from class: ServerDetector
Override to discover services for the server type of the plugin instance.

Overrides:
discoverServices in class DaemonDetector
Parameters:
serverConfig - Configuration of the parent server resource.
Returns:
List of type ServiceResource.
Throws:
PluginException - If an error occured during discovery.

discoverServiceTypes

public Set discoverServiceTypes(org.hyperic.util.config.ConfigResponse serverConfig)
                         throws PluginException
Overrides:
discoverServiceTypes in class ServerDetector
Throws:
PluginException

Hyperic HQ Plugin API v. 5.8.0

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