disman
Class Script

java.lang.Object
  |
  +--disman.Script

public class Script
extends java.lang.Object


Field Summary
static int ADMIN_STATUS_DISABLED
          Valid admin state
static int ADMIN_STATUS_EDITING
          Valid admin state
static int ADMIN_STATUS_ENABLED
          Valid admin state
static java.lang.String[] adminStatusStrings
          Array of admin state strings.
static int OPER_STATUS_ACCESS_DENIED
          Valid operation state
static int OPER_STATUS_COMPILATION_FAILED
          Valid operation state
static int OPER_STATUS_COMPILING
          Valid operation state
static int OPER_STATUS_DISABLED
          Valid operation state
static int OPER_STATUS_EDITING
          Valid operation state
static int OPER_STATUS_ENABLED
          Valid operation state
static int OPER_STATUS_GENERIC_ERROR
          Valid operation state
static int OPER_STATUS_NO_RESOURCES_LEFT
          Valid operation state
static int OPER_STATUS_NO_SUCH_SCRIPT
          Valid operation state
static int OPER_STATUS_PROTOCOL_FAILURE
          Valid operation state
static int OPER_STATUS_RETRIEVING
          Valid operation state
static int OPER_STATUS_UNKNOWN_PROTOCOL
          Valid operation state
static int OPER_STATUS_WRONG_LANGUAGE
          Valid operation state
static int OPER_STATUS_WRONG_VERSION
          Valid operation state
static java.lang.String[] operStatusStrings
          Array of operation state strings.
static int ROW_STATUS_ACTIVE
          Valid row status
static int ROW_STATUS_CREATE_AND_GO
          Valid row status
static int ROW_STATUS_CREATE_AND_WAIT
          Valid row status
static int ROW_STATUS_DESTROY
          Valid row status
static int ROW_STATUS_NOT_IN_SERVICE
          Valid row status
static int ROW_STATUS_NOT_READY
          Valid row status
static java.lang.String[] rowStatusStrings
          Array of row status strings.
static int STORAGE_TYPE_NON_VOLATILE
          Valid storage type
static int STORAGE_TYPE_OTHER
          Valid storage type
static int STORAGE_TYPE_PERMANENT
          Valid storage type
static int STORAGE_TYPE_READ_ONLY
          Valid storage type
static int STORAGE_TYPE_VOLATILE
          Valid storage type
static java.lang.String[] storageTypeStrings
          Array of storage type strings.
 
Constructor Summary
Script(Disman disman, java.lang.String owner, java.lang.String name)
          Create a Script object for a given Disman object indexed by a given owner and name by retrieval from the agent.
Script(Disman disman, java.lang.String owner, java.lang.String name, java.lang.String description, Language language, java.lang.String source)
          Create a Script object for a given Disman object indexed by a given owner and name by creating it at the agent.
 
Method Summary
 java.lang.String call()
          Start this script without arguments, block until it has been terminated and return the result string.
 java.lang.String call(java.lang.String argument)
          Start this script with a given argument, block until it has been terminated and return the result string.
 void disable()
          Disable the script.
 void enable()
          Enable this script.
 int getAdminStatus()
          Return an integer value representing the smScriptAdminStatus.
 java.lang.String getAdminStatusString()
          Return a string representing the smScriptAdminStatus.
 java.lang.String getDescription()
          Return the description string (smScriptDescr).
 java.lang.String getError()
          Return the error string (smScriptError).
 Language getLanguage()
          Return the Language object that represents the language this script is written in (smScriptLanguage).
 java.util.Date getLastChange()
          Return the last change time as a Date object (smScriptLastChange).
 int[] getLastChangeTime()
          Return the last change time as an array of integer values representing the MIB value's octets (smScriptLastChange).
 java.lang.String getName()
          Return the name of this Script (smScriptName).
 int getOperStatus()
          Return an integer value representing the smScriptOperStatus.
 java.lang.String getOperStatusString()
          Return a String representing the smScriptOperStatus.
 java.lang.String getOwner()
          Return the owner of this Script (smScriptOwner).
 int getRowStatus()
          Return an integer value representing the smScriptRowStatus.
 java.lang.String getRowStatusString()
          Return a String representing the smScriptRowStatus.
 java.lang.String getSource()
          Return the script source string (smScriptSource).
 int getStorageType()
          Return an integer value representing the smScriptStorageType.
 java.lang.String getStorageTypeString()
          Return a String representing the smScriptStorageType.
 boolean isEnabled()
          Return true, if this script is enabled (smScriptOperStatus == enabled(1)).
 boolean isNonVolatile()
          Return true, if this script is stored non-volatile at the agent.
 boolean isPermanent()
          Return true, if this script is stored permanently at the agent.
 boolean isReadOnly()
          Return true, if this script is stored read-only at the agent.
 boolean isVolatile()
          Return true, if this script is stored volatile at the agent.
 void remove()
          Remove this Script object.
 void setAdminStatus(int status)
          Set the smScriptAdminStatus represented by an integer value.
 void setDescription(java.lang.String description)
          Set the description string (smScriptDescr).
 void setLanguage(Language language)
          Set the Language object that represents the language this script is written in (smScriptLanguage).
 void setNonVolatile()
          Make this script stored non-volatile at the agent.
 void setPermanent()
          Make this script stored permanently at the agent.
 void setReadOnly()
          Make this script stored read-only at the agent.
 void setRowStatus(int status)
          Return an integer value representing the smScriptRowStatus.
 void setSource(java.lang.String source)
          Set the script source string (smScriptSource).
 void setStorageType(int storageType)
          Set the smScriptStorageType represented by an integer value.
 void setVolatile()
          Make this script stored volatile at the agent.
 java.lang.String toString()
          Return a String representation of the Script.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ADMIN_STATUS_ENABLED

public static final int ADMIN_STATUS_ENABLED
Valid admin state

ADMIN_STATUS_DISABLED

public static final int ADMIN_STATUS_DISABLED
Valid admin state

ADMIN_STATUS_EDITING

public static final int ADMIN_STATUS_EDITING
Valid admin state

adminStatusStrings

public static final java.lang.String[] adminStatusStrings
Array of admin state strings.

OPER_STATUS_ENABLED

public static final int OPER_STATUS_ENABLED
Valid operation state

OPER_STATUS_DISABLED

public static final int OPER_STATUS_DISABLED
Valid operation state

OPER_STATUS_EDITING

public static final int OPER_STATUS_EDITING
Valid operation state

OPER_STATUS_RETRIEVING

public static final int OPER_STATUS_RETRIEVING
Valid operation state

OPER_STATUS_COMPILING

public static final int OPER_STATUS_COMPILING
Valid operation state

OPER_STATUS_NO_SUCH_SCRIPT

public static final int OPER_STATUS_NO_SUCH_SCRIPT
Valid operation state

OPER_STATUS_ACCESS_DENIED

public static final int OPER_STATUS_ACCESS_DENIED
Valid operation state

OPER_STATUS_WRONG_LANGUAGE

public static final int OPER_STATUS_WRONG_LANGUAGE
Valid operation state

OPER_STATUS_WRONG_VERSION

public static final int OPER_STATUS_WRONG_VERSION
Valid operation state

OPER_STATUS_COMPILATION_FAILED

public static final int OPER_STATUS_COMPILATION_FAILED
Valid operation state

OPER_STATUS_NO_RESOURCES_LEFT

public static final int OPER_STATUS_NO_RESOURCES_LEFT
Valid operation state

OPER_STATUS_UNKNOWN_PROTOCOL

public static final int OPER_STATUS_UNKNOWN_PROTOCOL
Valid operation state

OPER_STATUS_PROTOCOL_FAILURE

public static final int OPER_STATUS_PROTOCOL_FAILURE
Valid operation state

OPER_STATUS_GENERIC_ERROR

public static final int OPER_STATUS_GENERIC_ERROR
Valid operation state

operStatusStrings

public static final java.lang.String[] operStatusStrings
Array of operation state strings.

STORAGE_TYPE_OTHER

public static final int STORAGE_TYPE_OTHER
Valid storage type

STORAGE_TYPE_VOLATILE

public static final int STORAGE_TYPE_VOLATILE
Valid storage type

STORAGE_TYPE_NON_VOLATILE

public static final int STORAGE_TYPE_NON_VOLATILE
Valid storage type

STORAGE_TYPE_PERMANENT

public static final int STORAGE_TYPE_PERMANENT
Valid storage type

STORAGE_TYPE_READ_ONLY

public static final int STORAGE_TYPE_READ_ONLY
Valid storage type

storageTypeStrings

public static final java.lang.String[] storageTypeStrings
Array of storage type strings.

ROW_STATUS_ACTIVE

public static final int ROW_STATUS_ACTIVE
Valid row status

ROW_STATUS_NOT_IN_SERVICE

public static final int ROW_STATUS_NOT_IN_SERVICE
Valid row status

ROW_STATUS_NOT_READY

public static final int ROW_STATUS_NOT_READY
Valid row status

ROW_STATUS_CREATE_AND_GO

public static final int ROW_STATUS_CREATE_AND_GO
Valid row status

ROW_STATUS_CREATE_AND_WAIT

public static final int ROW_STATUS_CREATE_AND_WAIT
Valid row status

ROW_STATUS_DESTROY

public static final int ROW_STATUS_DESTROY
Valid row status

rowStatusStrings

public static final java.lang.String[] rowStatusStrings
Array of row status strings.
Constructor Detail

Script

public Script(Disman disman,
              java.lang.String owner,
              java.lang.String name)
       throws SnmpException,
              java.io.IOException,
              NoSuchRowException
Create a Script object for a given Disman object indexed by a given owner and name by retrieval from the agent. Owner strings or script names longer than 32 characters are cut to this length.
Parameters:
disman - the Disman object associated with this script
owner - the script owner
name - the script name
Throws:
SnmpException - if an Snmp request fails
java.io.IOException - if a local I/O problem occurs,
NoSuchRowException - if the indexed row of the script table cannot be accessed

Script

public Script(Disman disman,
              java.lang.String owner,
              java.lang.String name,
              java.lang.String description,
              Language language,
              java.lang.String source)
       throws SnmpException,
              java.io.IOException,
              IllegalNameException
Create a Script object for a given Disman object indexed by a given owner and name by creating it at the agent. Description, language, and source get also set, but the script does not get enabled.
Parameters:
disman - the Disman object associated with this script
owner - the script owner
name - the script name
description - the script description string
language - the script language
source - the URL to fetch the script code
Throws:
SnmpException - if an Snmp request fails
java.io.IOException - if a local I/O problem occurs
IllegalNameException -  
Method Detail

remove

public void remove()
            throws SnmpException,
                   java.io.IOException,
                   TimeoutException
Remove this Script object. All Launch objects associated with this script get also removed implicitly. Similarly, all Run objects associated with those launch buttons get also aborted and removed implicitly.
Throws:
TimeoutException - if any of the subsequent actions cannot be finished in time
SnmpException - if an Snmp request fails
java.io.IOException - if a local I/O problem occurs

getOwner

public java.lang.String getOwner()
Return the owner of this Script (smScriptOwner).
Returns:
the script owner

getName

public java.lang.String getName()
Return the name of this Script (smScriptName).
Returns:
the script name

getDescription

public java.lang.String getDescription()
                                throws SnmpException,
                                       java.io.IOException
Return the description string (smScriptDescr).
Returns:
the script description string
Throws:
SnmpException - if an Snmp request fails
java.io.IOException - if a local I/O problem occurs

setDescription

public void setDescription(java.lang.String description)
                    throws SnmpException,
                           java.io.IOException
Set the description string (smScriptDescr).
Parameters:
description - the script description string
Throws:
SnmpException - if an Snmp request fails
java.io.IOException - if a local I/O problem occurs

getLanguage

public Language getLanguage()
                     throws SnmpException,
                            java.io.IOException,
                            InconsistencyException
Return the Language object that represents the language this script is written in (smScriptLanguage).
Returns:
the Language object representing the script's language
Throws:
InconsistencyException - if the language cannot be found
SnmpException - if an Snmp request fails
java.io.IOException - if a local I/O problem occurs

setLanguage

public void setLanguage(Language language)
                 throws SnmpException,
                        java.io.IOException
Set the Language object that represents the language this script is written in (smScriptLanguage).
Parameters:
language - the Language object representing the script's language
Throws:
SnmpException - if an Snmp request fails
java.io.IOException - if a local I/O problem occurs

getSource

public java.lang.String getSource()
                           throws SnmpException,
                                  java.io.IOException
Return the script source string (smScriptSource). Usually, it should be either an URL or an empty string.
Returns:
the script source string
Throws:
SnmpException - if an Snmp request fails
java.io.IOException - if a local I/O problem occurs

setSource

public void setSource(java.lang.String source)
               throws SnmpException,
                      java.io.IOException
Set the script source string (smScriptSource). Usually, it should be either an URL or an empty string.
Parameters:
source - the script source string
Throws:
SnmpException - if an Snmp request fails
java.io.IOException - if a local I/O problem occurs

getAdminStatus

public int getAdminStatus()
                   throws SnmpException,
                          java.io.IOException
Return an integer value representing the smScriptAdminStatus. This method should not be used by high level Script MIB applications.
Returns:
the script's smScriptAdminStatus value
Throws:
SnmpException - if an Snmp request fails
java.io.IOException - if a local I/O problem occurs

getAdminStatusString

public java.lang.String getAdminStatusString()
                                      throws SnmpException,
                                             java.io.IOException
Return a string representing the smScriptAdminStatus.
Returns:
the script's smScriptAdminStatus string
Throws:
SnmpException - if an Snmp request fails
java.io.IOException - if a local I/O problem occurs

setAdminStatus

public void setAdminStatus(int status)
                    throws SnmpException,
                           java.io.IOException
Set the smScriptAdminStatus represented by an integer value. This method should not be used by high level Script MIB applications.
Parameters:
status - the script's smScriptAdminStatus value
Throws:
SnmpException - if an Snmp request fails
java.io.IOException - if a local I/O problem occurs

getOperStatus

public int getOperStatus()
                  throws SnmpException,
                         java.io.IOException
Return an integer value representing the smScriptOperStatus. This method should not be used by high level Script MIB applications.
Returns:
the script's smScriptOperStatus value
Throws:
SnmpException - if an Snmp request fails
java.io.IOException - if a local I/O problem occurs

getOperStatusString

public java.lang.String getOperStatusString()
                                     throws SnmpException,
                                            java.io.IOException
Return a String representing the smScriptOperStatus.
Returns:
the script's smScriptOperStatus string
Throws:
SnmpException - if an Snmp request fails
java.io.IOException - if a local I/O problem occurs

isEnabled

public boolean isEnabled()
                  throws SnmpException,
                         java.io.IOException
Return true, if this script is enabled (smScriptOperStatus == enabled(1)).
Returns:
true, if script is enabled
Throws:
SnmpException - if an Snmp request fails
java.io.IOException - if a local I/O problem occurs

enable

public void enable()
            throws ScriptEnableException,
                   TimeoutException,
                   SnmpException,
                   java.io.IOException
Enable this script. Wait synchronously until the agent confirmed that the script is enabled. Otherwise, a ScriptEnableException or a TimeoutException will be thrown.
Throws:
ScriptEnableException - if the script cannot be enabled for a certain reason
TimeoutException - if the script cannot be enabled in time
SnmpException - if an Snmp request fails
java.io.IOException - if a local I/O problem occurs

disable

public void disable()
             throws TimeoutException,
                    SnmpException,
                    java.io.IOException
Disable the script. Wait synchronously until the agent confirmed that the script is disabled.
Throws:
TimeoutException - if the script cannot be disabled in time
SnmpException - if an Snmp request fails
java.io.IOException - if a local I/O problem occurs

getStorageType

public int getStorageType()
                   throws SnmpException,
                          java.io.IOException
Return an integer value representing the smScriptStorageType. This method should not be used by high level Script MIB applications.
Returns:
the script's smScriptStorageType value
Throws:
SnmpException - if an Snmp request fails
java.io.IOException - if a local I/O problem occurs

getStorageTypeString

public java.lang.String getStorageTypeString()
                                      throws SnmpException,
                                             java.io.IOException
Return a String representing the smScriptStorageType.
Returns:
the script's smScriptStorageType string
Throws:
SnmpException - if an Snmp request fails
java.io.IOException - if a local I/O problem occurs

isVolatile

public boolean isVolatile()
                   throws SnmpException,
                          java.io.IOException
Return true, if this script is stored volatile at the agent. (smScriptStorageType == volatile(2)).
Returns:
true, if script is volatile
Throws:
SnmpException - if an Snmp request fails
java.io.IOException - if a local I/O problem occurs

isNonVolatile

public boolean isNonVolatile()
                      throws SnmpException,
                             java.io.IOException
Return true, if this script is stored non-volatile at the agent. (smScriptStorageType == nonVolatile(3)).
Returns:
true, if script is volatile
Throws:
SnmpException - if an Snmp request fails
java.io.IOException - if a local I/O problem occurs

isPermanent

public boolean isPermanent()
                    throws SnmpException,
                           java.io.IOException
Return true, if this script is stored permanently at the agent. (smScriptStorageType == permanent(4)).
Returns:
true, if script is permanent
Throws:
SnmpException - if an Snmp request fails
java.io.IOException - if a local I/O problem occurs

isReadOnly

public boolean isReadOnly()
                   throws SnmpException,
                          java.io.IOException
Return true, if this script is stored read-only at the agent. (smScriptStorageType == readOnly(5)).
Returns:
true, if script is read-only
Throws:
SnmpException - if an Snmp request fails
java.io.IOException - if a local I/O problem occurs

setStorageType

public void setStorageType(int storageType)
                    throws SnmpException,
                           java.io.IOException
Set the smScriptStorageType represented by an integer value. This method should not be used by high level Script MIB applications.
Parameters:
storageType - the script's smScriptStorageType value
Throws:
SnmpException - if an Snmp request fails
java.io.IOException - if a local I/O problem occurs

setVolatile

public void setVolatile()
                 throws SnmpException,
                        java.io.IOException
Make this script stored volatile at the agent. (smScriptStorageType == volatile(2)).
Throws:
SnmpException - if an Snmp request fails
java.io.IOException - if a local I/O problem occurs

setNonVolatile

public void setNonVolatile()
                    throws SnmpException,
                           java.io.IOException
Make this script stored non-volatile at the agent. (smScriptStorageType == nonVolatile(3)).
Throws:
SnmpException - if an Snmp request fails
java.io.IOException - if a local I/O problem occurs

setPermanent

public void setPermanent()
                  throws SnmpException,
                         java.io.IOException
Make this script stored permanently at the agent. (smScriptStorageType == permanent(4)).
Throws:
SnmpException - if an Snmp request fails
java.io.IOException - if a local I/O problem occurs

setReadOnly

public void setReadOnly()
                 throws SnmpException,
                        java.io.IOException
Make this script stored read-only at the agent. (smScriptStorageType == readOnly(5)).
Throws:
SnmpException - if an Snmp request fails
java.io.IOException - if a local I/O problem occurs

getRowStatus

public int getRowStatus()
                 throws SnmpException,
                        java.io.IOException
Return an integer value representing the smScriptRowStatus. This method should not be used by high level Script MIB applications.
Returns:
the script's smScriptRowStatus value
Throws:
SnmpException - if an Snmp request fails
java.io.IOException - if a local I/O problem occurs

getRowStatusString

public java.lang.String getRowStatusString()
                                    throws SnmpException,
                                           java.io.IOException
Return a String representing the smScriptRowStatus.
Returns:
the script's smScriptRowStatus string
Throws:
SnmpException - if an Snmp request fails
java.io.IOException - if a local I/O problem occurs

setRowStatus

public void setRowStatus(int status)
                  throws SnmpException,
                         java.io.IOException
Return an integer value representing the smScriptRowStatus. This method should not be used by high level Script MIB applications.
Parameters:
status - the script's smScriptRowStatus value
Throws:
SnmpException - if an Snmp request fails
java.io.IOException - if a local I/O problem occurs

getError

public java.lang.String getError()
                          throws java.io.IOException,
                                 SnmpException,
                                 DismanReadException
Return the error string (smScriptError).
Returns:
the error string
Throws:
SnmpException - if an Snmp request fails
java.io.IOException - if a local I/O problem occurs

getLastChangeTime

public int[] getLastChangeTime()
                        throws java.io.IOException,
                               SnmpException
Return the last change time as an array of integer values representing the MIB value's octets (smScriptLastChange). This method should not be used by high level Script MIB applications.
Returns:
the array of octets of the smScriptLastChange
Throws:
SnmpException - if an Snmp request fails
java.io.IOException - if a local I/O problem occurs

getLastChange

public java.util.Date getLastChange()
                             throws java.io.IOException,
                                    SnmpException
Return the last change time as a Date object (smScriptLastChange).
Returns:
Date object representing the script's last change time, or null if the script has not yet been modified.
Throws:
SnmpException - if an Snmp request fails
java.io.IOException - if a local I/O problem occurs

call

public java.lang.String call()
                      throws TimeoutException,
                             SnmpException,
                             java.io.IOException
Start this script without arguments, block until it has been terminated and return the result string. The required launch button is created implicitly.
Returns:
the result string
Throws:
TimeoutException - if any of the subsequent actions cannot be finished in time
SnmpException - if an Snmp request fails
java.io.IOException - if a local I/O problem occurs

call

public java.lang.String call(java.lang.String argument)
                      throws TimeoutException,
                             SnmpException,
                             java.io.IOException
Start this script with a given argument, block until it has been terminated and return the result string. The required launch button is created and deleted implicitly.
Parameters:
agument - the argument string to be passed to the script
Returns:
the result string
Throws:
TimeoutException - if any of the subsequent actions cannot be finished in time
SnmpException - if an Snmp request fails
java.io.IOException - if a local I/O problem occurs

toString

public java.lang.String toString()
Return a String representation of the Script. Overrides java.lang.Object.
Overrides:
toString in class java.lang.Object