|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sun.management.snmp.agent.SnmpMibAgent
com.sun.management.snmp.agent.SnmpMib
public abstract class SnmpMib
Abstract class for representing an SNMP MIB.
When compiling a SNMP MIB, among all the classes generated by
mibgen
, there is one which extends SnmpMib
for representing a whole MIB.
The class is used by the SNMP protocol adaptor as the entry point in
the MIB.
This generated class can be subclassed in your code in order to plug in your own specific behavior.
Field Summary | |
---|---|
protected SnmpMibOid |
root
The top element in the Mib tree. |
Fields inherited from class com.sun.management.snmp.agent.SnmpMibAgent |
---|
mibName, server |
Constructor Summary | |
---|---|
SnmpMib()
Default constructor. |
Method Summary | |
---|---|
void |
check(SnmpMibRequest req)
Checks if a set operation can be performed. |
void |
get(SnmpMibRequest req)
Processes a get operation. |
void |
getBulk(SnmpMibRequest req,
int nonRepeat,
int maxRepeat)
Processes a getBulk operation. |
protected ObjectName |
getGroupObjectName(String name,
String oid,
String defaultName)
This callback should return the ObjectName associated to the group identified by the given groupName . |
protected String |
getGroupOid(String groupName,
String defaultOid)
This callback should return the OID associated to the group identified by the given groupName . |
void |
getNext(SnmpMibRequest req)
Processes a getNext operation. |
abstract SnmpMibTable |
getRegisteredTableMeta(String name)
Returns a registered SNMP Table metadata node. |
long[] |
getRootOid()
Gets the root object identifier of the MIB. |
protected void |
registerGroupNode(String groupName,
String groupOid,
ObjectName groupObjName,
SnmpMibNode node,
Object group,
MBeanServer server)
Register an SNMP group and its metadata node in the MIB. |
abstract void |
registerTableMeta(String name,
SnmpMibTable table)
Register an SNMP Table metadata node in the MIB. |
void |
set(SnmpMibRequest req)
Processes a set operation. |
Methods inherited from class com.sun.management.snmp.agent.SnmpMibAgent |
---|
getBindingState, getMBeanServer, getMibName, getSnmpAdaptor, getSnmpAdaptorName, init, newMibRequest, newMibRequest, postDeregister, postRegister, preDeregister, preRegister, setSnmpAdaptor, setSnmpAdaptor, setSnmpAdaptor, setSnmpAdaptor, setSnmpAdaptorName, setSnmpAdaptorName, setSnmpAdaptorName, setSnmpAdaptorName |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected SnmpMibOid root
Constructor Detail |
---|
public SnmpMib()
Method Detail |
---|
protected String getGroupOid(String groupName, String defaultOid)
This callback should return the OID associated to the group
identified by the given groupName
.
This method is provided as a hook to plug-in some custom specific behavior. Although doing so is discouraged you might want to subclass this method in order to store & provide more metadata information (mapping OID <-> symbolic name) within the agent, or to "change" the root of the MIB OID by prefixing the defaultOid by an application dependent OID string, for instance.
The default implementation of this method is to return the given
defaultOid
groupName
- The java-ized name of the SNMP group.defaultOid
- The OID defined in the MIB for that group
(in dot notation).
groupName
,
in dot-notation.protected ObjectName getGroupObjectName(String name, String oid, String defaultName) throws MalformedObjectNameException
This callback should return the ObjectName associated to the
group identified by the given groupName
.
This method is provided as a hook to plug-in some custom
specific behavior. You might want to override this method
in order to provide a different object naming scheme than
that proposed by default by mibgen
.
This method is only meaningful if the MIB is registered in the MBeanServer, otherwise, it will not be called.
The default implementation of this method is to return an ObjectName
built from the given defaultName
.
name
- The java-ized name of the SNMP group.oid
- The OID returned by getGroupOid() - in dot notation.defaultName
- The name by default generated by
mibgen
name
MalformedObjectNameException
protected void registerGroupNode(String groupName, String groupOid, ObjectName groupObjName, SnmpMibNode node, Object group, MBeanServer server) throws NotCompliantMBeanException, MBeanRegistrationException, InstanceAlreadyExistsException, IllegalAccessException
Register an SNMP group and its metadata node in the MIB.
This method is provided as a hook to plug-in some custom specific behavior. You might want to override this method if you want to set special links between the MBean, its metadata node, its OID or ObjectName etc..
If the MIB is not registered in the MBeanServer, the
server
and groupObjName
parameters will be
null
.
If the given group MBean is not null
, and if the
server
and groupObjName
parameters are
not null, then this method will also automatically register the
group MBean with the given MBeanServer server
.
groupName
- The java-ized name of the SNMP group.groupOid
- The OID as returned by getGroupOid() - in dot
notation.groupObjName
- The ObjectName as returned by getGroupObjectName().
This parameter may be null
if the
MIB is not registered in the MBeanServer.node
- The metadata node, as returned by the metadata
factory method for this group.group
- The MBean for this group, as returned by the
MBean factory method for this group.server
- The MBeanServer in which the groups are to be
registered. This parameter will be null
if the MIB is not registered, otherwise it is a
reference to the MBeanServer in which the MIB is
registered.
NotCompliantMBeanException
MBeanRegistrationException
InstanceAlreadyExistsException
IllegalAccessException
public abstract void registerTableMeta(String name, SnmpMibTable table)
Register an SNMP Table metadata node in the MIB.
This method is used internally and you should never need to
call it directly.
It is used to establish the link
between an SNMP table metadata node and its bean-like counterpart.
The group metadata nodes will create and register their
underlying table metadata nodes in the MIB using this
method.
The metadata nodes will be later retrieved from the MIB by the
bean-like table objects using the getRegisterTableMeta() method.
name
- The java-ized name of the SNMP table.table
- The SNMP table metadata node - usually this
corresponds to a mibgen
generated
object.public abstract SnmpMibTable getRegisteredTableMeta(String name)
This method is used internally and you should never need to call it directly.
public void get(SnmpMibRequest req) throws SnmpStatusException
get
operation.
get
in interface SnmpMibAgentMBean
get
in class SnmpMibAgent
req
- The SnmpMibRequest object holding the list of variable to
be retrieved. This list is composed of
SnmpVarBind
objects.
SnmpStatusException
- An error occurred during the operation.SnmpMibAgent.get(SnmpMibRequest)
public void set(SnmpMibRequest req) throws SnmpStatusException
set
operation.
set
in interface SnmpMibAgentMBean
set
in class SnmpMibAgent
req
- The SnmpMibRequest object holding the list of variable to
be set. This list is composed of
SnmpVarBind
objects.
SnmpStatusException
- An error occurred during the operation.
Throwing an exception in this method will break the
atomicity of the SET operation. Care must be taken so that
the exception is thrown in the SnmpMibAgent.check(SnmpMibRequest)
method instead.SnmpMibAgent.set(SnmpMibRequest)
public void check(SnmpMibRequest req) throws SnmpStatusException
set
operation can be performed.
If the operation cannot be performed, the method will raise a
SnmpStatusException
.
check
in interface SnmpMibAgentMBean
check
in class SnmpMibAgent
req
- The SnmpMibRequest object holding the list of variable to
be set. This list is composed of
SnmpVarBind
objects.
SnmpStatusException
- The set
operation
cannot be performed.SnmpMibAgent.check(SnmpMibRequest)
public void getNext(SnmpMibRequest req) throws SnmpStatusException
getNext
operation.
getNext
in interface SnmpMibAgentMBean
getNext
in class SnmpMibAgent
req
- The SnmpMibRequest object holding the list of
OIDs from which the next variables should be retrieved.
This list is composed of SnmpVarBind
objects.
SnmpStatusException
- An error occurred during the operation.SnmpMibAgent.getNext(SnmpMibRequest)
public void getBulk(SnmpMibRequest req, int nonRepeat, int maxRepeat) throws SnmpStatusException
getBulk
operation.
The method implements the getBulk
operation by calling
appropriately the getNext
method.
getBulk
in interface SnmpMibAgentMBean
getBulk
in class SnmpMibAgent
req
- The SnmpMibRequest object holding the list of variable to
be retrieved. This list is composed of
SnmpVarBind
objects.nonRepeat
- The number of variables, starting with the first
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.
SnmpStatusException
- An error occurred during the operation.SnmpMibAgent.getBulk(SnmpMibRequest,int,int)
public long[] getRootOid()
In order to be accurate, the method should be called once the
MIB is fully initialized (that is, after a call to init
or preRegister
).
getRootOid
in class SnmpMibAgent
|
Open Source build 02 opendmk-1.0-b02 2007.10.01_19:17:46_MEST |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |