public class StaticMOGroup extends Object implements ManagedObject, MOGroup
StaticMOGroup
can be used to easily implement static
(read-only) managed objects.
Note: Dynamic variables (see Variable.isDynamic()
) cannot be used to
when using default VariableBinding
s since Variable
s are
cloned when added to them. In order to use dynamic objects (i.e., objects
that may change their value when being accessed), a sub-class of
VariableBinding
needs to be used that overwrites its
VariableBinding.setVariable(org.snmp4j.smi.Variable)
method.
Constructor and Description |
---|
StaticMOGroup(org.snmp4j.smi.OID root,
org.snmp4j.smi.VariableBinding[] vbs)
Creates a static managed object group for the sub-tree with the specified
root OID.
|
Modifier and Type | Method and Description |
---|---|
void |
cleanup(SubRequest request)
Cleansup a (sub)request and frees all resources locked during
the preparation phase.
|
void |
commit(SubRequest request)
Sets the error status of the request to
PDU.commitFailed . |
org.snmp4j.smi.OID |
find(MOScope range)
Finds the first object ID (OID) in the specified search range.
|
void |
get(SubRequest request)
Processes a GET request and return the result in the supplied sub-request.
|
MOScope |
getScope()
Returns the scope of object identifiers this managed object is managing.
|
boolean |
next(SubRequest request)
Finds the successor instance for the object instance ID (OID) given
by the supplied sub-request and returns it within the supplied sub-request
object.
|
void |
prepare(SubRequest request)
Sets the error status of the request to
PDU.notWritable . |
void |
registerMOs(MOServer server,
org.snmp4j.smi.OctetString context)
Registers the managed objects of this group with the server for the
supplied context.
|
String |
toString() |
void |
undo(SubRequest request)
Sets the error status of the request to
PDU.undoFailed . |
void |
unregisterMOs(MOServer server,
org.snmp4j.smi.OctetString context)
Unregisters the managed objects of this group from the supplied server and
from the supplied context.
|
public StaticMOGroup(org.snmp4j.smi.OID root, org.snmp4j.smi.VariableBinding[] vbs)
root
- the root OID of the sub-tree to be registered by this managed object.vbs
- the variable bindings to be returned in this sub-tree.public void registerMOs(MOServer server, org.snmp4j.smi.OctetString context) throws DuplicateRegistrationException
MOGroup
registerMOs
in interface MOGroup
server
- the MOServer
where to register the managed objects.context
- the context to use (may be null
if no specific context
is selected).DuplicateRegistrationException
- if a managed object's scope (i.e. lower bound) is already registered
at the server.public void unregisterMOs(MOServer server, org.snmp4j.smi.OctetString context)
MOGroup
unregisterMOs
in interface MOGroup
server
- the MOServer
where to unregister the managed objects.context
- the context to use (may be null
if no specific context
is selected).public MOScope getScope()
ManagedObject
getScope
in interface ManagedObject
MOScope
that defines a range (possibly also a single
or none instance OID) of object IDs managed by this managed object.public org.snmp4j.smi.OID find(MOScope range)
ManagedObject
find
in interface ManagedObject
range
- the MOScope
for the search.OID
that is included in the search range
and null
if no such instances could be found.public void get(SubRequest request)
ManagedObject
get
in interface ManagedObject
request
- the SubRequest
to process.public boolean next(SubRequest request)
ManagedObject
next
in interface ManagedObject
request
- the SubRequest
to process.true
if the search request found an appropriate instance,
false
otherwise.public void prepare(SubRequest request)
PDU.notWritable
.prepare
in interface ManagedObject
request
- a request to process prepare SET request for.public void commit(SubRequest request)
PDU.commitFailed
.commit
in interface ManagedObject
request
- a request to process commit SET request for.public void undo(SubRequest request)
PDU.undoFailed
.undo
in interface ManagedObject
request
- a request to process undo SET request for.public void cleanup(SubRequest request)
ManagedObject
cleanup
in interface ManagedObject
request
- the SubRequest
to process.Copyright © 2018 SNMP4J.org. All rights reserved.