Hyperic HQ Plugin API v. 4.4.0.2

org.hyperic.hq.product
Class ServerControlPlugin

java.lang.Object
  extended by org.hyperic.hq.product.GenericPlugin
      extended by org.hyperic.hq.product.ControlPlugin
          extended by org.hyperic.hq.product.ServerControlPlugin
Direct Known Subclasses:
MxServerControlPlugin, ScriptControlPlugin

public abstract class ServerControlPlugin
extends ControlPlugin

This class is mainly helpful for control plugins which are script/process driven.


Field Summary
static java.lang.String PROP_PIDFILE
           
static java.lang.String PROP_PROGRAM
           
static java.lang.String PROP_PROGRAMPREFIX
           
 
Fields inherited from class org.hyperic.hq.product.ControlPlugin
DEFAULT_TIMEOUT, manager, PROP_TIMEOUT, RESULT_FAILURE, RESULT_SUCCESS, STATE_RESTARTING, STATE_STARTED, STATE_STARTING, STATE_STOPPED, STATE_STOPPING, STATE_UNKNOWN
 
Fields inherited from class org.hyperic.hq.product.GenericPlugin
config, FILE_DELIM, FILE_DELIM_ESC, PROP_NAME
 
Constructor Summary
ServerControlPlugin()
           
 
Method Summary
 void configure(ConfigResponse config)
           
protected  int doCommand()
           
protected  int doCommand(java.lang.String command)
           
protected  int doCommand(java.lang.String[] args)
           
protected  int doCommand(java.lang.String program, java.lang.String arg)
           
protected  int doCommand(java.lang.String program, java.lang.String[] params)
           
protected  int getBackgroundWaitTime()
           
protected  java.lang.String[] getCommandArgs()
          Override to add any additional arguments to the command line.
protected  java.lang.String[] getCommandEnv()
          Override to pass any addition environment variables to the command.
 ConfigSchema getConfigSchema(TypeInfo info, ConfigResponse config)
          The ConfigSchema used to render config options for this resource in the UI and client shell.
 java.lang.String getControlProgram()
           
protected  java.lang.String getControlProgramDir()
           
 java.lang.String getControlProgramPrefix()
           
protected  int getExitCode()
           
 java.lang.String getInstallPrefix()
           
 java.lang.String getPidFile()
           
protected  void getServerConfigSchema(TypeInfo info, ConfigSchema schema, ConfigResponse response)
           
protected  java.io.File getWorkingDirectory()
           
protected  void handleResult(java.lang.String stateWanted)
           
protected  boolean isBackgroundCommand()
           
protected  boolean isProcessRunning(int pid)
           
protected  boolean isProcessRunning(java.lang.String pidFile)
           
protected  boolean isRunning()
           
protected  void setBackgroundWaitTime(int seconds)
           
 void setControlProgram(java.lang.String val)
           
 void setControlProgramPrefix(java.lang.String val)
           
 void setInstallPrefix(java.lang.String val)
           
 void setPidFile(java.lang.String val)
           
 void shutdown()
          Called when the server or agent is shutdown.
protected  int start(java.lang.String command)
           
protected  boolean useConfigSchema(TypeInfo info)
           
protected  boolean useSigar()
           
protected  void validateControlProgram(java.lang.String name)
           
 
Methods inherited from class org.hyperic.hq.product.ControlPlugin
detectState, doAction, doAction, getActions, getManager, getMessage, getResult, getTimeout, getTimeoutMillis, init, setManager, setMessage, setResult, setTimeout, setTimeout, waitForState
 
Methods inherited from class org.hyperic.hq.product.GenericPlugin
adjustClassPath, getAbsoluteFiles, getConfig, getConfig, getCustomPropertiesSchema, getCustomPropertiesSchema, getCustomPropertiesSchema, getDefaultInstallPath, getLog, getLogName, getManagerProperty, getName, getPlatformName, getPluginClassName, getPluginData, getPluginProperty, getProductPlugin, getProperties, getScriptExtension, getScriptExtension, getScriptExtension, getTypeInfo, getTypeNameProperty, getTypeNameProperty, getTypeProperties, getTypeProperty, getTypeProperty, getTypeProperty, isNetStatEnabled, isWin32, openResource, setData, setName, setTypeInfo, toFileList
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROP_PIDFILE

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

PROP_PROGRAM

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

PROP_PROGRAMPREFIX

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

ServerControlPlugin

public ServerControlPlugin()
Method Detail

getInstallPrefix

public java.lang.String getInstallPrefix()

setInstallPrefix

public void setInstallPrefix(java.lang.String val)

getControlProgram

public java.lang.String getControlProgram()

setControlProgram

public void setControlProgram(java.lang.String val)

getControlProgramPrefix

public java.lang.String getControlProgramPrefix()

setControlProgramPrefix

public void setControlProgramPrefix(java.lang.String val)

getPidFile

public java.lang.String getPidFile()

setPidFile

public void setPidFile(java.lang.String val)

useSigar

protected boolean useSigar()

configure

public void configure(ConfigResponse config)
               throws PluginException
Overrides:
configure in class GenericPlugin
Throws:
PluginException

shutdown

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

Overrides:
shutdown in class GenericPlugin
Throws:
PluginException

getServerConfigSchema

protected void getServerConfigSchema(TypeInfo info,
                                     ConfigSchema schema,
                                     ConfigResponse response)

getConfigSchema

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

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

useConfigSchema

protected boolean useConfigSchema(TypeInfo info)

isRunning

protected boolean isRunning()
Overrides:
isRunning in class ControlPlugin

isProcessRunning

protected boolean isProcessRunning(int pid)

isProcessRunning

protected boolean isProcessRunning(java.lang.String pidFile)

getWorkingDirectory

protected java.io.File getWorkingDirectory()

getControlProgramDir

protected java.lang.String getControlProgramDir()

validateControlProgram

protected void validateControlProgram(java.lang.String name)
                               throws PluginException
Throws:
PluginException

isBackgroundCommand

protected boolean isBackgroundCommand()

getBackgroundWaitTime

protected int getBackgroundWaitTime()
Returns:
Seconds to wait on a background process

setBackgroundWaitTime

protected void setBackgroundWaitTime(int seconds)

getCommandArgs

protected java.lang.String[] getCommandArgs()
Override to add any additional arguments to the command line.


getCommandEnv

protected java.lang.String[] getCommandEnv()
Override to pass any addition environment variables to the command.


doCommand

protected int doCommand()

doCommand

protected int doCommand(java.lang.String command)

doCommand

protected int doCommand(java.lang.String[] args)

doCommand

protected int doCommand(java.lang.String program,
                        java.lang.String arg)

doCommand

protected int doCommand(java.lang.String program,
                        java.lang.String[] params)

getExitCode

protected int getExitCode()
Returns:
program exit code from doCommand()

handleResult

protected void handleResult(java.lang.String stateWanted)

start

protected int start(java.lang.String command)

Hyperic HQ Plugin API v. 4.4.0.2

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