|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.sun.management.snmp.agent.SnmpMibAgent
public abstract class SnmpMibAgent
Abstract class for representing an SNMP agent. The class is used by the SNMP protocol adaptor as the entry point in the SNMP agent to query.
Field Summary | |
---|---|
protected String |
mibName
The object name of the MIB. |
protected MBeanServer |
server
The reference to the MBean server. |
Constructor Summary | |
---|---|
SnmpMibAgent()
Default constructor. |
Method Summary | |
---|---|
void |
check(SnmpMibRequest req)
Checks if a set operation can be performed. |
void |
get(SnmpMibRequest req)
Processes a get operation. |
boolean |
getBindingState()
Indicates whether or not the MIB module is bound to a SNMP protocol adaptor. |
void |
getBulk(SnmpMibRequest req,
int nonRepeat,
int maxRepeat)
Processes a getBulk operation. |
MBeanServer |
getMBeanServer()
Gets the reference to the MBean server in which the SNMP MIB is registered. |
String |
getMibName()
Gets the MIB name. |
void |
getNext(SnmpMibRequest req)
Processes a getNext operation. |
abstract long[] |
getRootOid()
Gets the root object identifier of the MIB. |
SnmpMibHandler |
getSnmpAdaptor()
Gets the reference to the SNMP protocol adaptor to which the MIB is bound. |
ObjectName |
getSnmpAdaptorName()
Gets the object name of the SNMP protocol adaptor to which the MIB is bound. |
abstract void |
init()
Initializes the MIB (with no registration of the MBeans into the MBean server). |
static SnmpMibRequest |
newMibRequest(SnmpEngine engine,
SnmpPdu reqPdu,
Vector vblist,
int version,
Object userData,
String principal,
int securityLevel,
int securityModel,
byte[] contextName,
byte[] accessContextName)
This is a factory method for creating new SnmpMibRequest objects. |
static SnmpMibRequest |
newMibRequest(SnmpPdu reqPdu,
Vector vblist,
int version,
Object userData)
This is a factory method for creating new SnmpMibRequest objects. |
void |
postDeregister()
Not used in this context. |
void |
postRegister(Boolean registrationDone)
Not used in this context. |
void |
preDeregister()
Not used in this context. |
abstract ObjectName |
preRegister(MBeanServer server,
ObjectName name)
Initializes the MIB but each single MBean representing the MIB is inserted into the MBean server. |
void |
set(SnmpMibRequest req)
Processes a set operation. |
void |
setSnmpAdaptor(SnmpMibHandler stack)
Sets the reference to the SNMP protocol adaptor through which the MIB will be SNMP accessible and add this new MIB in the SNMP MIB handler. |
void |
setSnmpAdaptor(SnmpMibHandler stack,
SnmpOid[] oids)
Sets the reference to the SNMP protocol adaptor through which the MIB will be SNMP accessible and add this new MIB in the SNMP MIB handler. |
void |
setSnmpAdaptor(SnmpMibHandler stack,
String contextName)
Sets the reference to the SNMP protocol adaptor through which the MIB will be SNMP accessible and adds this new MIB in the SNMP MIB handler. |
void |
setSnmpAdaptor(SnmpMibHandler stack,
String contextName,
SnmpOid[] oids)
Sets the reference to the SNMP protocol adaptor through which the MIB will be SNMP accessible and adds this new MIB in the SNMP MIB handler. |
void |
setSnmpAdaptorName(ObjectName name)
Sets the reference to the SNMP protocol adaptor through which the MIB will be SNMP accessible and add this new MIB in the SNMP MIB handler associated to the specified name . |
void |
setSnmpAdaptorName(ObjectName name,
SnmpOid[] oids)
Sets the reference to the SNMP protocol adaptor through which the MIB will be SNMP accessible and add this new MIB in the SNMP MIB handler associated to the specified name . |
void |
setSnmpAdaptorName(ObjectName name,
String contextName)
Sets the reference to the SNMP protocol adaptor through which the MIB will be SNMP accessible and add this new MIB in the SNMP MIB handler associated to the specified name . |
void |
setSnmpAdaptorName(ObjectName name,
String contextName,
SnmpOid[] oids)
Sets the reference to the SNMP protocol adaptor through which the MIB will be SNMP accessible and add this new MIB in the SNMP MIB handler associated to the specified name . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected String mibName
protected MBeanServer server
Constructor Detail |
---|
public SnmpMibAgent()
Method Detail |
---|
public abstract void init() throws IllegalAccessException
IllegalAccessException
- The MIB can not be initialized.public abstract ObjectName preRegister(MBeanServer server, ObjectName name) throws Exception
preRegister
in interface MBeanRegistration
server
- The MBean server to register the service with.name
- The object name.
Exception
public void postRegister(Boolean registrationDone)
postRegister
in interface MBeanRegistration
public void preDeregister() throws Exception
preDeregister
in interface MBeanRegistration
Exception
public void postDeregister()
postDeregister
in interface MBeanRegistration
public void get(SnmpMibRequest req) throws SnmpStatusException
get
operation.
This method must update the SnmpVarBinds contained in the
SnmpMibRequest
req parameter.
get
in interface SnmpMibAgentMBean
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.get(SnmpMibRequest)
public void getNext(SnmpMibRequest req) throws SnmpStatusException
getNext
operation.
This method must update the SnmpVarBinds contained in the
SnmpMibRequest
req parameter.
getNext
in interface SnmpMibAgentMBean
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.getNext(SnmpMibRequest)
public void getBulk(SnmpMibRequest req, int nonRepeat, int maxRepeat) throws SnmpStatusException
getBulk
operation.
This method must update the SnmpVarBinds contained in the
SnmpMibRequest
req parameter.
getBulk
in interface SnmpMibAgentMBean
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.getBulk(SnmpMibRequest,int,int)
public void set(SnmpMibRequest req) throws SnmpStatusException
set
operation.
This method must update the SnmpVarBinds contained in the
SnmpMibRequest
req parameter.
This method is called during the second phase of the SET two-phase
commit.
set
in interface SnmpMibAgentMBean
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 check(SnmpMibRequest)
method instead.set(SnmpMibRequest)
public void check(SnmpMibRequest req) throws SnmpStatusException
set
operation can be performed.
If the operation can not be performed, the method should raise an
SnmpStatusException
.
This method is called during the first phase of the SET two-phase
commit.
check
in interface SnmpMibAgentMBean
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.check(SnmpMibRequest)
public abstract long[] getRootOid()
The root object identifier is the object identifier uniquely identifying the MIB.
public MBeanServer getMBeanServer()
getMBeanServer
in interface SnmpMibAgentMBean
public SnmpMibHandler getSnmpAdaptor()
getSnmpAdaptor
in interface SnmpMibAgentMBean
public void setSnmpAdaptor(SnmpMibHandler stack)
setSnmpAdaptor
in interface SnmpMibAgentMBean
stack
- The SNMP MIB handler.public void setSnmpAdaptor(SnmpMibHandler stack, SnmpOid[] oids)
setSnmpAdaptor
in interface SnmpMibAgentMBean
stack
- The SNMP MIB handler.oids
- The set of OIDs this agent implements.
If null or oids.length == 0, this is equivalent to calling
setSnmpAdaptor(SnmpMibHandler stack)
public void setSnmpAdaptor(SnmpMibHandler stack, String contextName)
setSnmpAdaptor
in interface SnmpMibAgentMBean
stack
- The SNMP MIB handler.contextName
- The MIB context name. If null or
contextName.length == 0, will be registered in the default context.
IllegalArgumentException
- If the parameter is null.public void setSnmpAdaptor(SnmpMibHandler stack, String contextName, SnmpOid[] oids)
setSnmpAdaptor
in interface SnmpMibAgentMBean
stack
- The SNMP MIB handler.contextName
- The MIB context name. If null or
contextName.length == 0, will be registered in the default context.oids
- The set of OIDs this agent implements.
If null or oids.length == 0, this is equivalent to calling
setSnmpAdaptor(SnmpMibHandler stack, String contextName)
IllegalArgumentException
- If the parameter is null.public ObjectName getSnmpAdaptorName()
getSnmpAdaptorName
in interface SnmpMibAgentMBean
public void setSnmpAdaptorName(ObjectName name) throws InstanceNotFoundException, ServiceNotFoundException
name
.
If this MIB was previously added in an SnmpMibHandler,
it will be removed from it.
setSnmpAdaptorName
in interface SnmpMibAgentMBean
name
- The name of the SNMP protocol adaptor.
InstanceNotFoundException
- The SNMP protocol adaptor does
not exist in the MBean server.
ServiceNotFoundException
- This SNMP MIB is not registered
in the MBean server or the requested service is not supported.public void setSnmpAdaptorName(ObjectName name, SnmpOid[] oids) throws InstanceNotFoundException, ServiceNotFoundException
name
.
This method is to be called to set a specific agent to a specific OID. This can be useful when dealing with MIB overlapping.
Some OID can be implemented in more than one MIB. In this case, the OID nearer agent will be used on SNMP operations.
If this MIB was previously added in an SnmpMibHandler,
it will be removed from it.
setSnmpAdaptorName
in interface SnmpMibAgentMBean
name
- The name of the SNMP protocol adaptor.oids
- The set of OIDs this agent implements.
If null or oids.length == 0, this is equivalent to calling
setSnmpAdaptorName(ObjectName name)
InstanceNotFoundException
- The SNMP protocol adaptor does
not exist in the MBean server.
ServiceNotFoundException
- This SNMP MIB is not registered
in the MBean server or the requested service is not supported.public void setSnmpAdaptorName(ObjectName name, String contextName) throws InstanceNotFoundException, ServiceNotFoundException
name
.
If this MIB was previously added in an SnmpMibHandler in the specified
context, it will be removed from it for this context.
setSnmpAdaptorName
in interface SnmpMibAgentMBean
name
- The name of the SNMP protocol adaptor.contextName
- The MIB context name. If null or
contextName.length == 0, will be registered in the default context.
InstanceNotFoundException
- The SNMP protocol adaptor does
not exist in the MBean server.
ServiceNotFoundException
- This SNMP MIB is not registered
in the MBean server or the requested service is not supported.public void setSnmpAdaptorName(ObjectName name, String contextName, SnmpOid[] oids) throws InstanceNotFoundException, ServiceNotFoundException
name
.
If this MIB was previously added in an SnmpMibHandler in the specified
context, it will be removed from it for this context.
setSnmpAdaptorName
in interface SnmpMibAgentMBean
name
- The name of the SNMP protocol adaptor.contextName
- The MIB context name. If null or
contextName.length == 0, will be registered in the default context.oids
- The set of OIDs this agent implements.
If null or oids.length == 0, this is equivalent to calling
setSnmpAdaptorName(ObjectName name)
InstanceNotFoundException
- The SNMP protocol adaptor does
not exist in the MBean server.
ServiceNotFoundException
- This SNMP MIB is not registered
in the MBean server or the requested service is not supported.public boolean getBindingState()
getBindingState
in interface SnmpMibAgentMBean
true
if the MIB module is bound,
false
otherwise.public String getMibName()
getMibName
in interface SnmpMibAgentMBean
public static SnmpMibRequest newMibRequest(SnmpPdu reqPdu, Vector vblist, int version, Object userData)
reqPdu
- The received PDU.vblist
- The vector of SnmpVarBind objects in which the
MIB concerned by this request is involved.version
- The protocol version of the SNMP request.userData
- User allocated contextual data.
public static SnmpMibRequest newMibRequest(SnmpEngine engine, SnmpPdu reqPdu, Vector vblist, int version, Object userData, String principal, int securityLevel, int securityModel, byte[] contextName, byte[] accessContextName)
engine
- The local engine.reqPdu
- The received pdu.vblist
- The vector of SnmpVarBind objects in which the
MIB concerned by this request is involved.version
- The protocol version of the SNMP request.userData
- User allocated contextual data.
|
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 |