com.sun.jaw.snmp.agent
Class SnmpMibAgent

java.lang.Object
  |
  +--com.sun.jaw.snmp.agent.SnmpMibAgent
Direct Known Subclasses:
SnmpMib

public abstract class SnmpMibAgent
extends java.lang.Object
implements java.io.Serializable

The SnmpMibAgent is an abstract class for representing a SNMP agent. The class is used by the SNMP adaptor as the entry point in the SNMP agent to query.

See Also:
Serialized Form

Field Summary
protected  Framework cmf
          The reference to the JDMK framework.
protected  java.lang.String mibName
          The name of the MIB.
 
Constructor Summary
SnmpMibAgent()
          Default constructor.
 
Method Summary
abstract  void check(java.util.Vector list)
          Checks if a set operation can be performed.
abstract  void get(java.util.Vector list, int version)
          Processes a get operation.
 java.lang.Boolean getBindingState()
          Indicates whether or not the MIB module is binded to a Snmp adaptor.
abstract  void getBulk(java.util.Vector list, int nonRepeat, int maxRepeat, int version)
          Processes a getBulk operation.
 void getBulkWithGetNext(java.util.Vector list, int nonRepeat, int maxRepeat, int version)
          Processes a getBulk operation using call to getNext.
 Framework getFramework()
          Gets the reference to the JDMK framework in which the SNMP MIB is registered.
 java.lang.String getMibName()
          Gets the mib name.
abstract  void getNext(java.util.Vector list, int version)
          Processes a getNext operation.
abstract  long[] getRootOid()
          Gets the root object identifier of the MIB.
 SnmpMibHandlerSrvIf getSnmpAdaptor()
          Gets the reference to the SNMP adaptor through which the MIB is accessible.
 java.lang.String getSnmpAdaptorName()
          Gets the logicial name of the adaptor to which the mib is binded.
abstract  void init()
          Initializes the MIB (with no registration of the M-beans into the JDMK framework).
abstract  void initCmf(Framework cmf, ObjectName name)
          Initializes the MIB but each single M-bean representing the MIB is inserted into the JDMK framework.
abstract  void set(java.util.Vector list, int version)
          Processes a set operation.
 void setSnmpAdaptor(SnmpMibHandlerSrvIf stack)
          Sets the reference to the SNMP adaptor through which the MIB will be SNMP accessible.
 void setSnmpAdaptorName(java.lang.String name)
          Sets the reference to the SNMP adaptor through which the MIB will be SNMP accessible.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mibName

protected java.lang.String mibName
The name of the MIB.

cmf

protected Framework cmf
The reference to the JDMK framework.
Constructor Detail

SnmpMibAgent

public SnmpMibAgent()
Default constructor.
Method Detail

init

public abstract void init()
                   throws java.lang.IllegalAccessException
Initializes the MIB (with no registration of the M-beans into the JDMK framework).
Throws:
java.lang.IllegalAccessException - The MIB can not be initialized.

initCmf

public abstract void initCmf(Framework cmf,
                             ObjectName name)
                      throws java.lang.IllegalAccessException,
                             ServiceNotFoundException,
                             InstanceAlreadyExistException
Initializes the MIB but each single M-bean representing the MIB is inserted into the JDMK framework.
Parameters:
cmf - The core management framework to register the service with.
name - The object name.
Throws:
java.lang.IllegalAccessException - The MIB can not be initialized.
InstanceAlreadyExistException - A m-bean is already registered in the repository.
ServiceNotFoundException - A requested service is not supported.

getFramework

public Framework getFramework()
Gets the reference to the JDMK framework in which the SNMP MIB is registered.
Returns:
The JDMK framework, null if the mib is not registered in any framework.

getSnmpAdaptor

public SnmpMibHandlerSrvIf getSnmpAdaptor()
Gets the reference to the SNMP adaptor through which the MIB is accessible.
Returns:
The SNMP adaptor.

setSnmpAdaptor

public void setSnmpAdaptor(SnmpMibHandlerSrvIf stack)
Sets the reference to the SNMP adaptor through which the MIB will be SNMP accessible.
Parameters:
stack - The SNMP adaptor.

setSnmpAdaptorName

public void setSnmpAdaptorName(java.lang.String name)
                        throws InstanceNotFoundException,
                               java.lang.IllegalAccessException,
                               ServiceNotFoundException
Sets the reference to the SNMP adaptor through which the MIB will be SNMP accessible.
Parameters:
name - The name of the SNMP adaptor.
Throws:
InstanceNotFoundException - The m-bean does not exist in the repository.
java.lang.IllegalAccessException - The method has tried to access a class that is not public and in another package.
ServiceNotFoundException - The requested service is not supported.

getSnmpAdaptorName

public java.lang.String getSnmpAdaptorName()
Gets the logicial name of the adaptor to which the mib is binded.
Returns:
The name of the SNMP adaptor.

getBindingState

public java.lang.Boolean getBindingState()
Indicates whether or not the MIB module is binded to a Snmp adaptor. As a reminder, only binded mibs can be accessed through SNMP protocol.
Returns:
True if the MIB module is binded, false otherwise.

get

public abstract void get(java.util.Vector list,
                         int version)
                  throws SnmpStatusException
Processes a get operation.
Parameters:
list - The variable list to be retrieved. A vector of SnmpVarBind objects.
version - The version of the protocol for the requested operation.
Returns:
The list variable should be updated with the result of the operation.
Throws:
SnmpStatusException - An error occured during the operation.

getBulk

public abstract void getBulk(java.util.Vector list,
                             int nonRepeat,
                             int maxRepeat,
                             int version)
                      throws SnmpStatusException
Processes a getBulk operation.
Parameters:
list - The variable list to be retrieved. A vector of SnmpVarBind objects.
nonRepeat - The number of variables, starting with the dirst variable in the variable-bindings, for which a single lexicographic successor is requested.
maxRepeat - The number of lexicographic successors requested for each of the last R variables. R is the number of variables following the first nonRepeat variables for which multiple lexicographic successors are requested.
version - The version of the protocol for the requested operation.
Returns:
The list variable should be updated with the result of the operation.
Throws:
SnmpStatusException - An error occured during the operation.

getNext

public abstract void getNext(java.util.Vector list,
                             int version)
                      throws SnmpStatusException
Processes a getNext operation.
Parameters:
list - The variable list to be retrieved. A vector of SnmpVarBind objects.
version - The version of the protocol for the requested operation.
Returns:
The list variable should be updated with the result of the operation.
Throws:
SnmpStatusException - An error occured during the operation.

set

public abstract void set(java.util.Vector list,
                         int version)
                  throws SnmpStatusException
Processes a set operation.
Parameters:
list - The variable list to be set. A vector of SnmpVarBind objects.
version - The version of the protocol for the requested operation.
Returns:
The list variable should be updated with the result of the operation.
Throws:
SnmpStatusException - An error occured during the operation.

check

public abstract void check(java.util.Vector list)
                    throws SnmpStatusException
Checks if a set operation can be performed. If the operation can not be performed, the method should emit a SnmpStatusException.
Parameters:
list - The variable list to be set. A vector of SnmpVarBind objects.
Throws:
SnmpStatusException - The operation can not be performed.

getRootOid

public abstract long[] getRootOid()
Gets the root object identifier of the MIB.

The root object identifier is the object identifier uniquely identifying the MIB.

Returns:
The root object identifier.

getMibName

public java.lang.String getMibName()
Gets the mib name.
Returns:
The mib name.

getBulkWithGetNext

public void getBulkWithGetNext(java.util.Vector list,
                               int nonRepeat,
                               int maxRepeat,
                               int version)
                        throws SnmpStatusException
Processes a getBulk operation using call to getNext. The method implements the getBulk operation by calling appropriately the getNext method.
Parameters:
list - The variable list to be retrieved. A vector of SnmpVarBind objects.
nonRepeat - The number of variables, starting with the dirst variable in the variable-bindings, for which a single lexicographic successor is requested.
maxRepeat - The number of lexicographic successors requested for each of the last R variables. R is the number of variables following the first nonRepeat variables for which multiple lexicographic successors are requested.
version - The version of the protocol for the requested operation.
Returns:
The variable list containing returned values.
Throws:
SnmpStatusException - An error occured during the operation.