Hyperic HQ Plugin API v. 2.5.dev

net.hyperic.hq.product
Class GenericPlugin

java.lang.Object
  extended bynet.hyperic.hq.product.GenericPlugin
Direct Known Subclasses:
ConfigTrackPlugin, ControlPlugin, LogTrackPlugin, MeasurementPlugin, ProductPlugin, ServerDetector

public abstract class GenericPlugin
extends java.lang.Object


Field Summary
protected  ConfigResponse config
           
static java.lang.String FILE_DELIM
           
static java.lang.String FILE_DELIM_ESC
           
static java.lang.String PROP_NAME
          Key used to store value of XML resource name attribute.
 
Constructor Summary
GenericPlugin()
           
 
Method Summary
 void configure(ConfigResponse config)
           
protected  java.lang.String[] getAbsoluteFiles(java.lang.String value, java.lang.String dir)
          Expand a String to array of absolute file names.
 ConfigResponse getConfig()
           
 java.lang.String getConfig(java.lang.String key)
          Shortcut, same as getConfig().getValue(key)
 ConfigSchema getConfigSchema(TypeInfo info, ConfigResponse config)
          The ConfigSchema used to render config options for this resource in the UI and client shell.
 ConfigSchema getCustomPropertiesSchema()
           
 ConfigSchema getCustomPropertiesSchema(java.lang.String name)
           
 ConfigSchema getCustomPropertiesSchema(TypeInfo info)
           
 java.lang.String getDefaultInstallPath()
           
protected  org.apache.commons.logging.Log getLog()
          Wrapper for LogFactory.getLog which uses the name returned by getLogName().
protected  java.lang.String getLogName()
          Default name for getLog() method.
 java.lang.String getName()
          Unique name used by PluginManager.getPlugin
protected static java.lang.String getPlatformName()
          Method to assist with naming of resources.
 java.lang.String getPluginClassName(java.lang.String pluginType, java.lang.String resourceType)
           
 ProductPlugin getProductPlugin()
          Get the ProductPlugin that defined the TypeInfo for this plugin instance.
 java.util.Properties getProperties()
          Get all properties defined using <property> in the plugin's hq-plugin.xml
 java.lang.String getProperty(java.lang.String name)
          Get a value defined by a <property> tag in the plugin's hq-plugin.xml
 TypeInfo getTypeInfo()
           
 java.lang.String getTypeNameProperty()
          Shortcut, same as: getTypeNameProperty(getTypeInfo().getName());
 java.lang.String getTypeNameProperty(java.lang.String type)
          Shortcut, same as: getTypeProperty(type, PROP_NAME);
 java.lang.String getTypeProperty(java.lang.String name)
          Shortcut, same as: getTypeProperty(getTypeInfo().getName(), name);
 java.lang.String getTypeProperty(java.lang.String type, java.lang.String name)
          Get a value defined by a <property> tag in the plugin's hq-plugin.xml, within a <server> or <service> tag for this plugin's type.
 java.lang.String getTypeProperty(TypeInfo type, java.lang.String name)
          If name property is not found for the given type, try using the type's parent.
 void init(PluginManager manager)
          Called when the plugin is loaded on the server and on the agent side.
static boolean isWin32()
           
 java.io.InputStream openResource(java.lang.String name)
          Wrapper around ClassLoader.getResource/getResourceAsStream to open a resource from this plugin's .jar file.
 void setName(java.lang.String name)
           
 void setTypeInfo(TypeInfo type)
           
 void shutdown()
          Called when the server or agent is shutdown.
protected  java.util.List toFileList(java.lang.String value)
          Expand a String to List of file names.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROP_NAME

public static final java.lang.String PROP_NAME
Key used to store value of XML resource name attribute.

See Also:
Constant Field Values

config

protected ConfigResponse config

FILE_DELIM

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

FILE_DELIM_ESC

public static final java.lang.String FILE_DELIM_ESC
See Also:
Constant Field Values
Constructor Detail

GenericPlugin

public GenericPlugin()
Method Detail

toFileList

protected java.util.List toFileList(java.lang.String value)
Expand a String to List of file names.

Parameters:
value - Comma delimited list of files
Returns:
List of String file names, which are trimmed and have unescaped any embedded commas ("%2C" -> ",")

getAbsoluteFiles

protected java.lang.String[] getAbsoluteFiles(java.lang.String value,
                                              java.lang.String dir)
Expand a String to array of absolute file names.

Parameters:
value - Expanded using toFileList()
dir - Parent directory used to resolve relative file names.
Returns:
Array of absolute file names.

isWin32

public static boolean isWin32()
Returns:
true if the current platform is in the Windows family.

getPlatformName

protected static java.lang.String getPlatformName()
Method to assist with naming of resources.

Returns:
The hostname of the current platform.

getName

public java.lang.String getName()
Unique name used by PluginManager.getPlugin

Returns:
Name of the plugin instance.

setName

public void setName(java.lang.String name)

getTypeInfo

public TypeInfo getTypeInfo()
Returns:
The TypeInfo of this plugin from ProductPlugin.getTypes

setTypeInfo

public void setTypeInfo(TypeInfo type)

getConfigSchema

public ConfigSchema getConfigSchema(TypeInfo info,
                                    ConfigResponse config)
The ConfigSchema used to render config options for this resource in the UI and client shell.

Parameters:
info - The TypeInfo of this plugin from ProductPlugin.getTypes
config - ConfigReponse of the parent resource (if any).
Returns:
ConfigSchema for this resource.

getCustomPropertiesSchema

public ConfigSchema getCustomPropertiesSchema(java.lang.String name)

getCustomPropertiesSchema

public ConfigSchema getCustomPropertiesSchema(TypeInfo info)

getCustomPropertiesSchema

public ConfigSchema getCustomPropertiesSchema()

getProperty

public java.lang.String getProperty(java.lang.String name)
Get a value defined by a <property> tag in the plugin's hq-plugin.xml


getProperties

public java.util.Properties getProperties()
Get all properties defined using <property> in the plugin's hq-plugin.xml


getTypeProperty

public java.lang.String getTypeProperty(java.lang.String type,
                                        java.lang.String name)
Get a value defined by a <property> tag in the plugin's hq-plugin.xml, within a <server> or <service> tag for this plugin's type.

Same as: getProperty(type + "." + name);


getTypeProperty

public java.lang.String getTypeProperty(TypeInfo type,
                                        java.lang.String name)
If name property is not found for the given type, try using the type's parent. If not found using parent's type, try using top-level properties from hq-plugin.xml.


getTypeProperty

public java.lang.String getTypeProperty(java.lang.String name)
Shortcut, same as: getTypeProperty(getTypeInfo().getName(), name);


getTypeNameProperty

public java.lang.String getTypeNameProperty(java.lang.String type)
Shortcut, same as: getTypeProperty(type, PROP_NAME);


getTypeNameProperty

public java.lang.String getTypeNameProperty()
Shortcut, same as: getTypeNameProperty(getTypeInfo().getName());


init

public void init(PluginManager manager)
          throws PluginException
Called when the plugin is loaded on the server and on the agent side.

Parameters:
manager - The plugin manager for this plugin type.
Throws:
PluginException

shutdown

public void shutdown()
              throws PluginException
Called when the server or agent is shutdown. Use this method to cleanup any resources that were created during the init() method.

Throws:
PluginException

getConfig

public ConfigResponse getConfig()

getConfig

public java.lang.String getConfig(java.lang.String key)
Shortcut, same as getConfig().getValue(key)


configure

public void configure(ConfigResponse config)
               throws PluginException
Throws:
PluginException

getDefaultInstallPath

public java.lang.String getDefaultInstallPath()

getLogName

protected java.lang.String getLogName()
Default name for getLog() method.


getLog

protected org.apache.commons.logging.Log getLog()
Wrapper for LogFactory.getLog which uses the name returned by getLogName().


getProductPlugin

public ProductPlugin getProductPlugin()
Get the ProductPlugin that defined the TypeInfo for this plugin instance.


openResource

public java.io.InputStream openResource(java.lang.String name)
                                 throws java.io.IOException
Wrapper around ClassLoader.getResource/getResourceAsStream to open a resource from this plugin's .jar file.

Throws:
java.io.IOException

getPluginClassName

public java.lang.String getPluginClassName(java.lang.String pluginType,
                                           java.lang.String resourceType)

Hyperic HQ Plugin API v. 2.5.dev

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