com.adventnet.snmp.mibs.agent
Class InterprettedAgent

java.lang.Object
  |
  +--com.adventnet.snmp.snmp2.agent.Cache
        |
        +--com.adventnet.snmp.mibs.agent.InterprettedAgent

public class InterprettedAgent
extends Cache

InterprettedAgent class interprets all the AGENTCLAUSE commands in a MIB file and registers the AGENTCLAUSES to the VarBindRequestHandler

This class files requires that the MibFile be loaded. Loading of MIBs etc will all be done by this class

AgentMibOperations instance which provides users with utilities for getting MibNodes etc is provided by this class

Typical API users using AGENTCLAUSE will implement InitSnmpAgentData interface for getting a handle to SnmpAgent

getMibOperations() to get a reference to MibOperations which can be used to get references to MibNodes etc

See Also:
Serialized Form

Field Summary
(package private)  java.util.Vector mibCache
           
(package private)  java.lang.String mibModules
           
(package private)  AgentMibOperations mibOps
          The miboperations which is handy for all mib related operations.
 
Fields inherited from class com.adventnet.snmp.snmp2.agent.Cache
cache, debug
 
Constructor Summary
InterprettedAgent()
          constructor with reference to SnmpAgent which is used later on by the Interpretted Agent to register listeners etc.
 
Method Summary
 MibModule addMib(java.lang.String mibFile)
          adds the Mib to the list of modules already loaded.
(package private)  void addMibModule(java.lang.String mibFile)
          This is for SnmpAgent which just ignores MibModules
 void addRegistrationListener(RegistrationListener l)
          Add method for registration listener which is interested in registered events.
 boolean attachObject(SnmpAgentData agentObject, AgentMibNode node)
          Used by application programmes to attach an SnmpAgentData object to a AgentMibNode.
 boolean attachObject(SnmpAgentData agentObject, java.lang.String nodeName)
          Used by application programmes to attach an SnmpAgentData object to a AgentMibNode.
static java.lang.String decodeInstance(int[] instance_oid, LeafSyntax syntax)
          Deprecated. since Agent Builder 3.0 This method is used by AgentClause to decode index for table implemetations.
static java.util.Vector decodeInstance(int[] instance_oid, java.util.Vector indexMibNodes)
          This method is used by AgentMibModule's makeInstances to decode index for table implemetations returns a Vector of Strings
 boolean deleteMIB(MibModule module)
          Delete the MibModule
 boolean deleteMIB(java.lang.String moduleName)
          Delete the MibModule from a set of mib module whaic are already loaded.
 boolean detachObject(AgentMibNode detachNode)
          Used by application programmes to detach an AgentMibNode's ClassCommand object.
 boolean detachObject(java.lang.String nodeName)
          Used by application programmes to detach an AgentMibNode's data object.
 AgentMibOperations getAgentMibOperation()
          Getter for AgentMiboperations .
 AgentMibOperations getAgentMibOperations()
          Getter for AgentMibOperations,which has node information.
 java.lang.String getFileName(java.lang.String moduleName)
          Getter for fileName,returns the name of the file from mib module.
 MibModule getMibModule(java.lang.String name)
          Utility method to get a reference to loaded MibModules.
 java.lang.String getMibModules()
          Get the MIBs loaded in this applet/application
 MibNode getMibNode(SnmpOID oid)
          Utility method to get a reference to loaded MibNodes
 MibNode getMibNode(java.lang.String name)
          Utility method to get a reference to loaded MibNodes
(package private)  boolean isAgentClauseForTable(AgentMibNode node)
          This method is used to avoid the registration of a table column if it is having table with agent clause.
 boolean isDebug()
          checks whether debug is true or false.
 void register()
          This method registers the AGENTCLAUSES etc Note : if addMib is used for adding this needent be invoked This method needs to be invoked when the mibs are loaded through a AgentMibOperations created by the user and a subsequent setAgentMibOperatioins.
 void removeRegistrationListener(RegistrationListener l)
          Deletes the RegistrationsListener from the Holder , which is having listener lists.
 void setAgentMibOperations(AgentMibOperations mibs)
          setter for AgentMibOperations
 void setDebug(boolean val)
          Setter for debug values,To display error message.
 void setMibModules(java.lang.String mibFiles)
          parse the MibFiles in this application and setupAgent clauses.
(package private)  void setUpAgentClause(MibModule module)
          Setup AGENTCLAUSE
(package private)  void setUpAgentClauseForNode(AgentMibNode node)
           
(package private)  void updateMibs(java.lang.String mibModules)
           
 
Methods inherited from class com.adventnet.snmp.snmp2.agent.Cache
getFromCache, getMibOperations, putInCache, setMibOperations
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mibOps

AgentMibOperations mibOps
The miboperations which is handy for all mib related operations.

mibModules

java.lang.String mibModules

mibCache

java.util.Vector mibCache
Constructor Detail

InterprettedAgent

public InterprettedAgent()
constructor with reference to SnmpAgent which is used later on by the Interpretted Agent to register listeners etc.

initializes AgentMibOperations.

Method Detail

getAgentMibOperations

public AgentMibOperations getAgentMibOperations()
Getter for AgentMibOperations,which has node information.
Returns:
AgentMibOperations having node inforation.
See Also:
().

setDebug

public void setDebug(boolean val)
Setter for debug values,To display error message. By default value is set to false.
Overrides:
setDebug in class Cache
Tags copied from class: Cache
Parameters:
val - true to set debug false to unset

isDebug

public boolean isDebug()
checks whether debug is true or false.
Overrides:
isDebug in class Cache
Tags copied from class: Cache
Returns:
true if debug is on

setAgentMibOperations

public void setAgentMibOperations(AgentMibOperations mibs)
setter for AgentMibOperations
Parameters:
mibs - having node details.
See Also:
()

addMibModule

void addMibModule(java.lang.String mibFile)
This is for SnmpAgent which just ignores MibModules

setMibModules

public void setMibModules(java.lang.String mibFiles)
parse the MibFiles in this application and setupAgent clauses.
Parameters:
a - white-space separated list of mib files.
See Also:
()

getMibModules

public java.lang.String getMibModules()
Get the MIBs loaded in this applet/application
Returns:
a white-space separated list of mib files.
See Also:
()

getFileName

public java.lang.String getFileName(java.lang.String moduleName)
Getter for fileName,returns the name of the file from mib module.
Parameters:
moduleName - mib module name.
Returns:
String name of the file.

updateMibs

void updateMibs(java.lang.String mibModules)

addMib

public MibModule addMib(java.lang.String mibFile)
adds the Mib to the list of modules already loaded.
Returns:
null on errors

getMibModule

public MibModule getMibModule(java.lang.String name)
Utility method to get a reference to loaded MibModules.

Alternate ways of getting references would be through the getAgentMibOperations() and do a getMibModule(name)

Parameters:
name - required mibmodule name.
Returns:
MibModule

getMibNode

public MibNode getMibNode(java.lang.String name)
Utility method to get a reference to loaded MibNodes

Alternate ways of getting references would be through the getAgentMib , com.adventnet.snmp.mibs.AgentMibNodeOperations() and do a getMibModule(name)

Parameters:
name - of the MibNode eg: "sysDescr"
See Also:
MibNode

getMibNode

public MibNode getMibNode(SnmpOID oid)
Utility method to get a reference to loaded MibNodes

Alternate ways of getting references would be through the getAgentMibOperations() and do a getMibModule(name)

Parameters:
SnmpOID - (varbind.getObjectID() should give you a reference to the OID)
See Also:
MibNode, AgentMibNode

register

public void register()
              throws java.lang.NullPointerException
This method registers the AGENTCLAUSES etc Note : if addMib is used for adding this needent be invoked This method needs to be invoked when the mibs are loaded through a AgentMibOperations created by the user and a subsequent setAgentMibOperatioins. In typical cases consider using InterprettedAgent.addMibModule(String mibFile)

setUpAgentClause

void setUpAgentClause(MibModule module)
Setup AGENTCLAUSE

isAgentClauseForTable

boolean isAgentClauseForTable(AgentMibNode node)
This method is used to avoid the registration of a table column if it is having table with agent clause.
Parameters:
node - the AgentMibNode to register
Returns:
true not to register other wise register.

setUpAgentClauseForNode

void setUpAgentClauseForNode(AgentMibNode node)

deleteMIB

public boolean deleteMIB(java.lang.String moduleName)
Delete the MibModule from a set of mib module whaic are already loaded.
Parameters:
moduleName - name of the module to be deleted.

detachObject

public boolean detachObject(java.lang.String nodeName)
Used by application programmes to detach an AgentMibNode's data object.
Parameters:
nodename - AgentMibNode whose data object will be detached
Returns:
true if data object is detached else false

detachObject

public boolean detachObject(AgentMibNode detachNode)
Used by application programmes to detach an AgentMibNode's ClassCommand object.
Parameters:
node - AgentMibNode whose data object will be detached
Returns:
true if data object is detached else false

deleteMIB

public boolean deleteMIB(MibModule module)
Delete the MibModule

decodeInstance

public static java.lang.String decodeInstance(int[] instance_oid,
                                              LeafSyntax syntax)
Deprecated. since Agent Builder 3.0 This method is used by AgentClause to decode index for table implemetations.

See Also:
AgentMibUtil.decodeInstance()

attachObject

public boolean attachObject(SnmpAgentData agentObject,
                            java.lang.String nodeName)
Used by application programmes to attach an SnmpAgentData object to a AgentMibNode.
Parameters:
agentObject - data object to be attached
node - nodeLabel to which the data object will be attached
Returns:
true if data object is attached else false

attachObject

public boolean attachObject(SnmpAgentData agentObject,
                            AgentMibNode node)
Used by application programmes to attach an SnmpAgentData object to a AgentMibNode.
Parameters:
agentObject - data object to be attached
node - AgentMibNode to which the data object will be attached
Returns:
true if data object is attached else false

decodeInstance

public static java.util.Vector decodeInstance(int[] instance_oid,
                                              java.util.Vector indexMibNodes)
                                       throws java.lang.Exception
This method is used by AgentMibModule's makeInstances to decode index for table implemetations returns a Vector of Strings
See Also:
AgentUtil.decodeInstance

addRegistrationListener

public void addRegistrationListener(RegistrationListener l)
Add method for registration listener which is interested in registered events.
Parameters:
l - having RegistrationListener details.

removeRegistrationListener

public void removeRegistrationListener(RegistrationListener l)
Deletes the RegistrationsListener from the Holder , which is having listener lists.
Parameters:
l - RegistrationListener to be removed.

getAgentMibOperation

public AgentMibOperations getAgentMibOperation()
Getter for AgentMiboperations .