Hyperic HQ Plugin API v. 2.5.dev

net.hyperic.hq.product
Class ServerControlPlugin

java.lang.Object
  extended bynet.hyperic.hq.product.GenericPlugin
      extended bynet.hyperic.hq.product.ControlPlugin
          extended bynet.hyperic.hq.product.ServerControlPlugin

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
           
protected  java.io.ByteArrayOutputStream stdErr
           
protected  java.io.ByteArrayOutputStream stdOut
           
 
Fields inherited from class net.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 net.hyperic.hq.product.GenericPlugin
config, FILE_DELIM, FILE_DELIM_ESC, PROP_NAME
 
Constructor Summary
ServerControlPlugin()
           
 
Method Summary
 void configure(ConfigResponse config)
           
protected  int doCommand(java.lang.String command)
           
protected  int doCommand(java.lang.String program, java.lang.String command)
           
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()
           
 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(int result, java.lang.String stateWanted)
           
protected  boolean isBackgroundCommand()
           
protected  boolean isProcessRunning(int pid)
           
protected  boolean isProcessRunning(java.lang.String pidFile)
           
protected  boolean isRunning()
           
 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 net.hyperic.hq.product.ControlPlugin
detectState, doAction, getActions, getErrorStr, getManager, getResult, getTimeout, getTimeoutMillis, init, setErrorStr, setManager, setResult, setTimeout, setTimeout, waitForState
 
Methods inherited from class net.hyperic.hq.product.GenericPlugin
getAbsoluteFiles, getConfig, getConfig, getCustomPropertiesSchema, getCustomPropertiesSchema, getCustomPropertiesSchema, getDefaultInstallPath, getLog, getLogName, getName, getPlatformName, getPluginClassName, getProductPlugin, getProperties, getProperty, getTypeInfo, getTypeNameProperty, getTypeNameProperty, getTypeProperty, getTypeProperty, getTypeProperty, isWin32, openResource, 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

stdOut

protected java.io.ByteArrayOutputStream stdOut

stdErr

protected java.io.ByteArrayOutputStream stdErr
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

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)

doCommand

protected int doCommand(java.lang.String command)

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()

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(java.lang.String program,
                        java.lang.String command)

handleResult

protected void handleResult(int result,
                            java.lang.String stateWanted)

start

protected int start(java.lang.String command)

Hyperic HQ Plugin API v. 2.5.dev

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