com.sun.management.snmp.agent
Class SnmpMibNode

java.lang.Object
  extended by com.sun.management.snmp.agent.SnmpMibNode
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
SnmpMibEntry, SnmpMibOid, SnmpMibTable

public abstract class SnmpMibNode
extends Object
implements Serializable

The SnmpMibNode class represents a node in an SNMP MIB.

This class is used internally and by the class generated by mibgen. You should not need to use this class directly.

Since:
Java DMK 5.1
See Also:
Serialized Form

Field Summary
protected static SnmpStatusException noSuchInstanceException
          Contains a predefined exception that is often fired when an object is not found in the MIB.
protected static SnmpStatusException noSuchNameException
           
protected static SnmpStatusException noSuchObjectException
           
protected  int[] varList
          Contains the list of variable identifiers.
 
Constructor Summary
SnmpMibNode()
           
 
Method Summary
abstract  void check(SnmpMibSubRequest req, int depth)
          Generic handling of the check operation.
abstract  void get(SnmpMibSubRequest req, int depth)
          Generic handling of the get operation.
protected static int getNextIdentifier(int[] table, long value)
          This will give the first element greater than value in a sorted array.
 long getNextVarId(long id, Object userData)
          Get the next OID arc corresponding to a readable scalar variable, a branch leading to a subgroup, or a table.
 long getNextVarId(long id, Object userData, int pduVersion)
          Get the next OID arc corresponding to a readable scalar variable, a branch leading to a subgroup, or a table, possibly skipping over those arcs that must not or cannot be returned.
 void getRootOid(Vector result)
          Computes the root OID of the MIB.
abstract  void set(SnmpMibSubRequest req, int depth)
          Generic handling of the set operation.
protected  boolean skipVariable(long id, Object userData, int pduVersion)
          Hook for subclasses.
static void sort(int[] array)
          Sorts the specified integer array.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

varList

protected int[] varList
Contains the list of variable identifiers.


noSuchInstanceException

protected static final SnmpStatusException noSuchInstanceException
Contains a predefined exception that is often fired when an object is not found in the MIB.


noSuchObjectException

protected static final SnmpStatusException noSuchObjectException

noSuchNameException

protected static final SnmpStatusException noSuchNameException
Constructor Detail

SnmpMibNode

public SnmpMibNode()
Method Detail

getNextVarId

public long getNextVarId(long id,
                         Object userData)
                  throws SnmpStatusException
Get the next OID arc corresponding to a readable scalar variable, a branch leading to a subgroup, or a table.

Parameters:
id - Id we start from looking for the next.
userData - A contextual object containing user-data. This object is allocated through the SnmpUserDataFactory for each incoming SNMP request.
Returns:
The next id in this group.
Throws:
SnmpStatusException - If no id is found after the given id.

getNextVarId

public long getNextVarId(long id,
                         Object userData,
                         int pduVersion)
                  throws SnmpStatusException
Get the next OID arc corresponding to a readable scalar variable, a branch leading to a subgroup, or a table, possibly skipping over those arcs that must not or cannot be returned. Calls getNextVarId(long,java.lang.Object) until skipVariable(long,java.lang.Object,int) returns false.

Parameters:
id - Id we start from looking for the next.
userData - A contextual object containing user-data. This object is allocated through the SnmpUserDataFactory for each incoming SNMP request.
pduVersion - Protocol version of the original request PDU.
Returns:
The next id in this group which can be returned using the given PDU's protocol version.
Throws:
SnmpStatusException - If no id is found after the given id.

skipVariable

protected boolean skipVariable(long id,
                               Object userData,
                               int pduVersion)
Hook for subclasses. The default implementation of this method is to always return false. Subclasses should redefine this method so that it returns true when:

Parameters:
id - Id we start from looking for the next.
userData - A contextual object containing user-data. This object is allocated through the SnmpUserDataFactory for each incoming SNMP request.
pduVersion - Protocol version of the original request PDU.
Returns:
true if the variable must be skipped by the get-next algorithm.

get

public abstract void get(SnmpMibSubRequest req,
                         int depth)
                  throws SnmpStatusException
Generic handling of the get operation.

You can override this method if you need to implement some specific policies for minimizing the accesses made to some remote underlying resources.

Parameters:
req - The sub-request that must be handled by this node.
depth - The depth reached in the OID tree.
Throws:
SnmpStatusException - An error occurred while accessing the MIB node.

set

public abstract void set(SnmpMibSubRequest req,
                         int depth)
                  throws SnmpStatusException
Generic handling of the set operation.

You can override this method if you need to implement some specific policies for minimizing the accesses made to some remote underlying resources.

Parameters:
req - The sub-request that must be handled by this node.
depth - The depth reached in the OID tree.
Throws:
SnmpStatusException - An error occurred while accessing the MIB node.

check

public abstract void check(SnmpMibSubRequest req,
                           int depth)
                    throws SnmpStatusException
Generic handling of the check operation.

You can override this method if you need to implement some specific policies for minimizing the accesses made to some remote underlying resources, or if you need to implement some consistency checks between the different values provided in the varbind list.

Parameters:
req - The sub-request that must be handled by this node.
depth - The depth reached in the OID tree.
Throws:
SnmpStatusException - An error occurred while accessing the MIB node.

sort

public static void sort(int[] array)
Sorts the specified integer array.

Parameters:
array - An integer array.

getRootOid

public void getRootOid(Vector result)
Computes the root OID of the MIB.


getNextIdentifier

protected static final int getNextIdentifier(int[] table,
                                             long value)
                                      throws SnmpStatusException
This will give the first element greater than value in a sorted array. If there is no element of the array greater than value, the method will throw a SnmpStatusException.

Parameters:
table - A sorted integer array.
value - The greatest value.
Throws:
SnmpStatusException - If there is no element greater than value.

Open Source build 02
opendmk-1.0-b02 2007.10.01_19:17:46_MEST

Copyright 1998-2007 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.