com.adventnet.snmp.mibs.agent
Class ReadWriteCommand

java.lang.Object
  |
  +--com.adventnet.snmp.mibs.AgentClauseCommandUtil
        |
        +--com.adventnet.snmp.mibs.ReadWriteCommandUtil
              |
              +--com.adventnet.snmp.mibs.agent.ReadWriteCommand

public class ReadWriteCommand
extends ReadWriteCommandUtil

ReadWriteCommand class is used to implement the READ-COMMAND and WRITE-COMMAND constructs in the AGENTCLAUSE.

This can be used only with scalar objects.

The Read or Write command should be given in the Mib creation and the given command (ping,ls ..) is executed and the result is send as response for the request .


Field Summary
(package private)  int commandType
           
(package private)  java.lang.String defaultValue
           
 
Fields inherited from class com.adventnet.snmp.mibs.ReadWriteCommandUtil
commandType, defaultValue
 
Fields inherited from class com.adventnet.snmp.mibs.AgentClauseCommandUtil
AT_START, command_string, EACH_TIME, FIRST_TIME, instantiate, mibOperations, name, node, runTime, timeout
 
Constructor Summary
ReadWriteCommand()
           
 
Method Summary
 java.lang.String getAgentClauseString()
          Overrides of AgentClause class.
 int getCommandType()
          getter for commandType in which the command type (READ WRITE) is stored.
 java.lang.String getDefaultValue()
          gets the defaultValue for the WriteCommand .
(package private)  java.lang.String getProcOutput(java.lang.String command)
          Executes the command string till it times out.
 java.lang.String getReadCommandString()
           
(package private)  java.lang.String getReqMesg(byte type)
           
(package private)  java.lang.String getReqMesg(SnmpVarBind varbind, byte type)
           
 java.lang.String getWriteCommandString(java.util.Vector args)
          getter for Write command String.
 java.util.Vector makeInstances(AgentMibNode leafNode)
          overrides of AgentClause interface .
 void parseCommand(java.util.StringTokenizer strTok, java.lang.String str)
          Following methods are used by the previous parseClause method to interpret different COMMAND syntax.
 void setCommandType(int type)
          Setter for commandType in which the command type (READ WRITE) is stored.
 void setDefaultValue(java.lang.String defVal)
          sets the defaultValue for the WriteCommand .
 void setParamString(java.lang.String param)
           
(package private)  java.lang.String setReqMesg(SnmpVarBind varbind, java.util.Vector args)
           
(package private)  java.lang.String setReqMesg(java.util.Vector args)
           
 
Methods inherited from class com.adventnet.snmp.mibs.AgentClauseCommandUtil
getCommandString, getName, getTimeout, initialize, isRunTime, setAgentMibOperations, setCommandString, setName, setRunTime, setTimeout
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

commandType

int commandType

defaultValue

java.lang.String defaultValue
Constructor Detail

ReadWriteCommand

public ReadWriteCommand()
Method Detail

getCommandType

public int getCommandType()
getter for commandType in which the command type (READ WRITE) is stored.
Overrides:
getCommandType in class ReadWriteCommandUtil
See Also:
setCommandType()

setCommandType

public void setCommandType(int type)
Setter for commandType in which the command type (READ WRITE) is stored.
Overrides:
setCommandType in class ReadWriteCommandUtil
See Also:
getCommandType()

setDefaultValue

public void setDefaultValue(java.lang.String defVal)
sets the defaultValue for the WriteCommand . used in MibEditorUI.
Overrides:
setDefaultValue in class ReadWriteCommandUtil
See Also:
getDefaultValue()

getDefaultValue

public java.lang.String getDefaultValue()
gets the defaultValue for the WriteCommand . used in MibEditorUI.
Overrides:
getDefaultValue in class ReadWriteCommandUtil
See Also:
setDefaultValue()

getReadCommandString

public java.lang.String getReadCommandString()
Overrides:
getReadCommandString in class ReadWriteCommandUtil

getWriteCommandString

public java.lang.String getWriteCommandString(java.util.Vector args)
getter for Write command String. Default arguments of Write write command is replaced with proper aruments.
Overrides:
getWriteCommandString in class ReadWriteCommandUtil
Parameters:
args - rhe arguments for WRITE COMMAND.
Returns:
String.

setParamString

public void setParamString(java.lang.String param)
Overrides:
setParamString in class ReadWriteCommandUtil

parseCommand

public void parseCommand(java.util.StringTokenizer strTok,
                         java.lang.String str)
                  throws MibException
Following methods are used by the previous parseClause method to interpret different COMMAND syntax.
Overrides:
parseCommand in class ReadWriteCommandUtil

getAgentClauseString

public java.lang.String getAgentClauseString()
Overrides of AgentClause class. Returns string having comments.
Overrides:
getAgentClauseString in class ReadWriteCommandUtil

getReqMesg

java.lang.String getReqMesg(byte type)
                      throws AgentSnmpException

getReqMesg

java.lang.String getReqMesg(SnmpVarBind varbind,
                            byte type)
                      throws AgentSnmpException

setReqMesg

java.lang.String setReqMesg(java.util.Vector args)
                      throws AgentSnmpException

setReqMesg

java.lang.String setReqMesg(SnmpVarBind varbind,
                            java.util.Vector args)
                      throws AgentSnmpException

getProcOutput

java.lang.String getProcOutput(java.lang.String command)
                         throws AgentSnmpException
Executes the command string till it times out.
Parameters:
command - command to be executed
timeout - time in millisecs after which the process is terminated
Returns:
returns the output of the executed program

makeInstances

public java.util.Vector makeInstances(AgentMibNode leafNode)
                               throws MibException
overrides of AgentClause interface . returns the object of type Vector.
Overrides:
makeInstances in class ReadWriteCommandUtil