com.adventnet.snmp.mibs.agent
Class FileCommand

java.lang.Object
  extended by com.adventnet.snmp.mibs.AgentClauseCommandUtil
      extended by com.adventnet.snmp.mibs.FileCommandUtil
          extended by com.adventnet.snmp.mibs.agent.FileCommand

public class FileCommand
extends com.adventnet.snmp.mibs.FileCommandUtil

FileCommand class is used to implement the FILE-COMMAND construct in the AGENTCLAUSE. The associated OID can refer to a simple file or a table. Rowstatus supported(to create a new row , rowstatus column must be there). To add an new entry into a table,all columner object should have a READ-CREATE access and RowStatus column is set to be 4.


Field Summary
(package private)  java.lang.String fieldSeparator
           
 
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
FileCommand()
           
 
Method Summary
 boolean checkForRowStatusColumnValue(SnmpVarBind varbind, int rowStatusIndex, boolean getNext)
          This function check the value of the "RowStatus" column of a table (if available).
(package private)  boolean createRow(java.util.Vector varbinds)
           
 java.lang.String getAgentClauseString()
          Returns the String having AgentClause object details .
(package private)  java.lang.String getExecCommand(java.lang.String command, long timeout)
          Executes the command string till it times out.
 java.lang.String getFieldSeparator()
          Getter for FieldSeperator used in FILE-COMMAND API users will not require this method etc.
 java.lang.String getFileName()
          getter for FileName.
(package private)  java.lang.String getReqMesg(byte type)
           
(package private)  java.lang.String getReqMesg(SnmpVarBind varbind, byte req)
           
(package private) static boolean isCreateRow(java.util.Vector varbinds, com.adventnet.snmp.mibs.AgentMibOperations mibOps)
           
 java.util.Vector makeInstances(com.adventnet.snmp.mibs.AgentMibNode leafNode)
          This method makes instances of the leafNode and returns a vector which is stored as instances in AgentMibNode.
(package private)  boolean modifyTableElement(SnmpVarBind varbind)
           
 java.io.RandomAccessFile openRandomFile()
          opens the file , which is specified in the name string.
 void parseCommand(java.util.StringTokenizer strTok, java.lang.String str)
           
 void setFieldSeparator(java.lang.String sep)
          Setter for FieldSeperator used in FILE-COMMAND API users will not require this method etc.
(package private)  java.lang.String setReqMesg(SnmpVarBind varbind, java.util.Vector args)
           
(package private)  java.lang.String setReqMesg(java.util.Vector arguments)
           
 
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

fieldSeparator

java.lang.String fieldSeparator
Constructor Detail

FileCommand

public FileCommand()
Method Detail

setFieldSeparator

public void setFieldSeparator(java.lang.String sep)
Setter for FieldSeperator used in FILE-COMMAND API users will not require this method etc.

Overrides:
setFieldSeparator in class com.adventnet.snmp.mibs.FileCommandUtil
Parameters:
sep - having string used as a seperator.
See Also:
()

getFieldSeparator

public java.lang.String getFieldSeparator()
Getter for FieldSeperator used in FILE-COMMAND API users will not require this method etc.

Overrides:
getFieldSeparator in class com.adventnet.snmp.mibs.FileCommandUtil
Returns:
String the field seperator string.
See Also:
()

getReqMesg

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

getReqMesg

java.lang.String getReqMesg(SnmpVarBind varbind,
                            byte req)
                      throws AgentSnmpException
Throws:
AgentSnmpException

setReqMesg

java.lang.String setReqMesg(java.util.Vector arguments)
                      throws AgentSnmpException
Throws:
AgentSnmpException

setReqMesg

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

modifyTableElement

boolean modifyTableElement(SnmpVarBind varbind)
                     throws AgentSnmpException
Throws:
AgentSnmpException

createRow

boolean createRow(java.util.Vector varbinds)
            throws AgentSnmpException
Throws:
AgentSnmpException

isCreateRow

static boolean isCreateRow(java.util.Vector varbinds,
                           com.adventnet.snmp.mibs.AgentMibOperations mibOps)
                    throws AgentSnmpException
Throws:
AgentSnmpException

openRandomFile

public java.io.RandomAccessFile openRandomFile()
                                        throws AgentSnmpException
opens the file , which is specified in the name string.

Throws:
AgentSnmpException

getExecCommand

java.lang.String getExecCommand(java.lang.String command,
                                long timeout)
                          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
Throws:
AgentSnmpException

parseCommand

public void parseCommand(java.util.StringTokenizer strTok,
                         java.lang.String str)
                  throws MibException
Overrides:
parseCommand in class com.adventnet.snmp.mibs.FileCommandUtil
Throws:
MibException

getAgentClauseString

public java.lang.String getAgentClauseString()
Returns the String having AgentClause object details .

Overrides:
getAgentClauseString in class com.adventnet.snmp.mibs.FileCommandUtil

makeInstances

public java.util.Vector makeInstances(com.adventnet.snmp.mibs.AgentMibNode leafNode)
                               throws MibException
This method makes instances of the leafNode and returns a vector which is stored as instances in AgentMibNode. If the node is a part of table then it parses the associated file-table and fills the instances variable. Used by the Agent for initialising and making instances from DEFVAL or

Overrides:
makeInstances in class com.adventnet.snmp.mibs.FileCommandUtil
Parameters:
leafNode - Node where the instances are created
Returns:
vector of InstanceTypes
Throws:
MibException

checkForRowStatusColumnValue

public boolean checkForRowStatusColumnValue(SnmpVarBind varbind,
                                            int rowStatusIndex,
                                            boolean getNext)
                                     throws AgentSnmpException
This function check the value of the "RowStatus" column of a table (if available). Depending upon the value of row satus column the corresponding instance will be allowed to the manager.

Parameters:
varbind - given from the manager.
index - of the RowStatus column of a table.
Returns:
Nothing.
Throws:
AgentSnmpException.
AgentSnmpException

getFileName

public java.lang.String getFileName()
getter for FileName.

Overrides:
getFileName in class com.adventnet.snmp.mibs.FileCommandUtil
Returns:
String having name of the file.