Hyperic HQ Plugin API v. 2.5.dev

## net.hyperic.hq.product
Class ServerDetector

    java.lang.Object
      net.hyperic.hq.product.GenericPlugin
          net.hyperic.hq.product.ServerDetector

All Implemented Interfaces:
  net.hyperic.hq.product.RuntimeDiscoverer

Direct Known Subclasses:
  PlatformServiceDetector

public abstract class ServerDetector
extends GenericPlugin
implements net.hyperic.hq.product.RuntimeDiscoverer

Encapsulate the know-how to determine all kinds of server-specific information about a single type of server.

Field Summary

Fields inherited from class net.hyperic.hq.product.GenericPlugin
`config, FILE_DELIM, FILE_DELIM_ESC, PROP_NAME`

Constructor Summary
`ServerDetector()`

Method Summary
`protected ServerResource` `createServerResource(java.lang.String installpath)` Initialize an ServerResource with default values.
`protected ServiceResource` `createServiceResource(java.lang.String type)`
`net.hyperic.hq.product.RuntimeResourceReport` `discoverResources(int serverId, net.hyperic.hq.appdef.shared.AIPlatformValue platform, ConfigResponse config)` Deprecated. - Plugins should not use this method.
`protected java.util.List` `discoverServers(ConfigResponse config)` Override to discover servers for the server type of the plugin instance.
`protected java.util.List` `discoverServices(ConfigResponse config)` Override to discover services for the server type of the plugin instance.
`protected static java.lang.String` `getCanonicalPath(java.lang.String installpath)` Fixup the installpath.
`protected AutoinventoryPluginManager` `getManager()`
`protected static java.lang.String` `getParentDir(java.lang.String path)` Chop the last element off a path.
`static java.lang.String` `getParentDir(java.lang.String path, int levels)` Chop the last elements off of a path.
`protected static long[]` `getPids(java.lang.String query)` Wrapper for Sigar's ProcessFinder.find method.
`protected static java.lang.String[]` `getProcArgs(long pid)` Wrapper for Sigar.getProcArgs which catches SigarException and returns a String[] with length 0 if the SigarException is caught.
`protected static java.lang.String` `getProcCwd(long pid)` Attempt to get the current working directory of a process.
`protected static java.lang.String` `getProcExe(long pid)`
`protected static java.lang.String` `getProcExe(long pid, java.lang.String name)` Attempt to find the absolute name of the process executable.
`protected static java.util.List` `getProcModules(long pid)` Wrapper for Sigar.getProcModules which catches SigarException and returns a String[] with length 0 if the SigarException is caught.
`java.util.List` `getRegistryScanKeys()` Helper for RegistryServerDetector implementors.
`net.hyperic.hq.product.RuntimeDiscoverer` `getRuntimeDiscoverer()` Deprecated. - Plugins should not use this method.
`net.hyperic.hq.autoinventory.ServerSignature` `getServerSignature()` The server signature is defined by plugins in etc/hq-plugin.xml if the plugin implements FileServerDetector or RegistryServerDetector.
`java.util.List` `getServiceConfigs(java.lang.String type)`
`java.util.Map` `getServiceInventoryPlugins()`
`protected static net.hyperic.sigar.SigarProxy` `getSigar()`
`void` `init(PluginManager manager)` Called when the plugin is loaded on the server and on the agent side.
`boolean` `isRuntimeDiscoverySupported()` If plugins do not override discoverServers or discoverServices, returning false here will prevent those methods from being called.
`boolean` `isWin32ServiceRunning(java.lang.String name)`
`protected void` `setControlConfig(ServerResource server, ConfigResponse config)` Merge default values from server's control ConfigSchema and saves to ServerResource.setControlConfig.
`protected void` `setControlConfig(ServiceResource service, ConfigResponse config)` Merge default values from services's control ConfigSchema and saves to ServiceResource.setControlConfig.
`protected void` `setCustomProperties(ConfigResponse cprops)`
`protected void` `setDescription(java.lang.String description)`
`protected void` `setMeasurementConfig(ServerResource server, ConfigResponse config)` Merge default values from server's measurement ConfigSchema and saves to ServerResource.setMeasurementConfig.
`protected void` `setMeasurementConfig(ServiceResource service, ConfigResponse config)` Merge default values from service's measurement ConfigSchema and saves to ServiceResource.setMeasurementConfig.
`protected void` `setProductConfig(ServerResource server, ConfigResponse config)` Merge default values from server's product ConfigSchema and saves to ServerResource.setProductConfig.
`protected void` `setProductConfig(ServiceResource service, ConfigResponse config)` Merge default values from service's product ConfigSchema and saves to ServiceResource.setProductConfig.

Methods inherited from class net.hyperic.hq.product.GenericPlugin

`configure, getAbsoluteFiles, getConfig, getConfig, getConfigSchema, getCustomPropertiesSchema, getCustomPropertiesSchema, getCustomPropertiesSchema, getDefaultInstallPath, getLog, getLogName, getName, getPlatformName, getPluginClassName, getProductPlugin, getProperties, getProperty, getTypeInfo, getTypeNameProperty, getTypeNameProperty, getTypeProperty, getTypeProperty, getTypeProperty, isWin32, openResource, setName, setTypeInfo, shutdown, toFileList`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### ServerDetector

    public ServerDetector()

Method Detail

### getRuntimeDiscoverer

    public net.hyperic.hq.product.RuntimeDiscoverer getRuntimeDiscoverer()

  Deprecated. - Plugins should not use this method.

  See Also:
    `discoverServers(net.hyperic.util.config.ConfigResponse)`, `discoverServices(net.hyperic.util.config.ConfigResponse)`

### isRuntimeDiscoverySupported

    public boolean isRuntimeDiscoverySupported()

  If plugins do not override discoverServers or discoverServices, returning false here will prevent those methods from being called.

  Returns:
    true by default.

### discoverResources

    public net.hyperic.hq.product.RuntimeResourceReport discoverResources(int serverId,
                                                                          net.hyperic.hq.appdef.shared.AIPlatformValue platform,
                                                                          ConfigResponse config)
                                                                   throws PluginException

  Deprecated. - Plugins should not use this method.

  Specified by:
    `discoverResources` in interface `net.hyperic.hq.product.RuntimeDiscoverer`
  Throws:
    `PluginException`
  See Also:
    `discoverServers(net.hyperic.util.config.ConfigResponse)`, `discoverServices(net.hyperic.util.config.ConfigResponse)`

### setDescription

    protected void setDescription(java.lang.String description)

### setCustomProperties

    protected void setCustomProperties(ConfigResponse cprops)

### discoverServers

    protected java.util.List discoverServers(ConfigResponse config)
                                      throws PluginException

  Override to discover servers for the server type of the plugin instance. In most cases plugins will override discoverServices rather than this method. The general use of this method is where a plugin FileServerDetector or AutoServerDetector finds the Admin server and this method discovers the managed server nodes. Such plugins include WebLogic, WebSphere and iPlanet.

  Parameters:
    `config` - Configuration of the parent server resource.
  Returns:
    List of type ServerResource
  Throws:
    `PluginException` - If an error occured during discovery.
  Since:
    1.7
  See Also:
    `discoverServices(net.hyperic.util.config.ConfigResponse)`, `ServerResource`

### discoverServices

    protected java.util.List discoverServices(ConfigResponse config)
                                       throws PluginException

  Override to discover services for the server type of the plugin instance.

  Parameters:
    `config` - Configuration of the parent server resource.
  Returns:
    List of type ServiceResource.
  Throws:
    `PluginException` - If an error occured during discovery.

### init

    public void init(PluginManager manager)
              throws PluginException

  Description copied from class: `GenericPlugin`
  Called when the plugin is loaded on the server and on the agent side.

  Overrides:
    `init` in class `GenericPlugin`
  Parameters:
    `manager` - The plugin manager for this plugin type.
  Throws:
    `PluginException`

### getManager

    protected AutoinventoryPluginManager getManager()

  Returns:
    The plugin manager for this plugin.

### getRegistryScanKeys

    public java.util.List getRegistryScanKeys()

  Helper for RegistryServerDetector implementors. Gets the scan keys from hq-plugin.xml

### getServerSignature

    public net.hyperic.hq.autoinventory.ServerSignature getServerSignature()

  The server signature is defined by plugins in etc/hq-plugin.xml if the plugin implements FileServerDetector or RegistryServerDetector.

### createServerResource

    protected ServerResource createServerResource(java.lang.String installpath)

  Initialize an ServerResource with default values. Defaults are set for:
  - Type - Using getTypeInfo().getName()
  - Name - Using getPlatformName() + " " + Type
  - InstallPath - The installpath param passed to getCanonicalPath.
  - Identifier - The installpath param.

  Parameters:
    `installpath` - Used to set InstallPath and Identifier

### createServiceResource

    protected ServiceResource createServiceResource(java.lang.String type)

  Returns:
    ServiceResource with setType(this, type)

### getParentDir

    protected static java.lang.String getParentDir(java.lang.String path)

  Chop the last element off a path. For example, if you pass in /usr/local/foo then this will return /usr/local If there is not enough to chop off, this throws IllegalArgumentException

### getParentDir

    public static java.lang.String getParentDir(java.lang.String path,
                                                int levels)

  Chop the last elements off of a path.

### getCanonicalPath

    protected static java.lang.String getCanonicalPath(java.lang.String installpath)

  Fixup the installpath. Quotes are removed. Canonicalized to removing double slashes, uppercase drive letter, etc.

### getSigar

    protected static net.hyperic.sigar.SigarProxy getSigar()

  Returns:
    A SigarProxyCache instance with an expiration time of 10 minutes. The cache is cleared by the plugin manager after all AutoServerDetectors have been run.

### getProcArgs

    protected static java.lang.String[] getProcArgs(long pid)

  Wrapper for Sigar.getProcArgs which catches SigarException and returns a String[] with length 0 if the SigarException is caught.

  Parameters:
    `pid` - Process identifier
  Returns:
    Arguments that were passed to the process.

### getProcModules

    protected static java.util.List getProcModules(long pid)

  Wrapper for Sigar.getProcModules which catches SigarException and returns a String[] with length 0 if the SigarException is caught.

  Parameters:
    `pid` - Process identifier

### getProcExe

    protected static java.lang.String getProcExe(long pid)

### getProcExe

    protected static java.lang.String getProcExe(long pid,
                                                 java.lang.String name)

  Attempt to find the absolute name of the process executable. If the name cannot be determined, `null` is returned.

  Parameters:
    `pid` - Process identifier
    `name` - Binary base name to match against
  Returns:
    The process executable name.

### getProcCwd

    protected static java.lang.String getProcCwd(long pid)

  Attempt to get the current working directory of a process. If the directory cannot be determined, `null` is returned.

  Parameters:
    `pid` - Process identifier
  Returns:
    The process current working directory.

### getPids

    protected static long[] getPids(java.lang.String query)

  Wrapper for Sigar's ProcessFinder.find method.

  Parameters:
    `query` - SIGAR Process Table Query
  Returns:
    Array of pids that match the query, length == 0 if there were no matches.

### isWin32ServiceRunning

    public boolean isWin32ServiceRunning(java.lang.String name)

  Parameters:
    `name` - The Service name shown in the Windows service panel Properties General tab, not the Display name. For example, "Terminal Services" is the Display name, "TermService" is the Service name that should be used here.
  Returns:
    true If the service exists and is running, false otherwise.

### setProductConfig

    protected void setProductConfig(ServerResource server,
                                    ConfigResponse config)

  Merge default values from server's product ConfigSchema and saves to ServerResource.setProductConfig.

### setMeasurementConfig

    protected void setMeasurementConfig(ServerResource server,
                                        ConfigResponse config)

  Merge default values from server's measurement ConfigSchema and saves to ServerResource.setMeasurementConfig.

### setControlConfig

    protected void setControlConfig(ServerResource server,
                                    ConfigResponse config)

  Merge default values from server's control ConfigSchema and saves to ServerResource.setControlConfig.

### setProductConfig

    protected void setProductConfig(ServiceResource service,
                                    ConfigResponse config)

  Merge default values from service's product ConfigSchema and saves to ServiceResource.setProductConfig.

### setMeasurementConfig

    protected void setMeasurementConfig(ServiceResource service,
                                        ConfigResponse config)

  Merge default values from service's measurement ConfigSchema and saves to ServiceResource.setMeasurementConfig.

### setControlConfig

    protected void setControlConfig(ServiceResource service,
                                    ConfigResponse config)

  Merge default values from services's control ConfigSchema and saves to ServiceResource.setControlConfig.

### getServiceInventoryPlugins

    public java.util.Map getServiceInventoryPlugins()

### getServiceConfigs

    public java.util.List getServiceConfigs(java.lang.String type)

Hyperic HQ Plugin API v. 2.5.dev

Copyright © 2004-2005 Hyperic LLC support@hyperic.net, All Rights Reserved.