|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.snmp4j.agent.mo.MOScalar<V>
public class MOScalar<V extends org.snmp4j.smi.Variable>
The MOScalar class represents scalar SNMP managed objects.
| Constructor Summary | |
|---|---|
MOScalar(org.snmp4j.smi.OID id,
MOAccess access,
V value)
Creates a scalar MO instance with OID, maximum access level and initial value. |
|
| Method Summary | |
|---|---|
void |
addMOChangeListener(MOChangeListener l)
Adds a MOChangeListener that needs to be informed about
state changes of this scalar. |
void |
addMOValueValidationListener(MOValueValidationListener l)
Adds a value validation listener to check new values. |
protected int |
changeValue(V value)
Changes the value of this scalar on behalf of a commit or undo operation. |
protected boolean |
checkRequestScope(SubRequest request)
Checks whether the request is within the scope of this scalar or not. |
void |
cleanup(SubRequest request)
Cleansup a (sub)request and frees all resources locked during the preparation phase. |
void |
commit(SubRequest request)
Commits a previously prepared SET (sub)request. |
boolean |
covers(org.snmp4j.smi.OID oid)
Checks if this scope covers the supplied OID. |
org.snmp4j.smi.OID |
find(MOScope range)
Finds the first object ID (OID) in the specified search range. |
protected void |
fireAfterMOChange(MOChangeEvent changeEvent)
|
protected void |
fireAfterPrepareMOChange(MOChangeEvent changeEvent)
|
protected void |
fireBeforeMOChange(MOChangeEvent changeEvent)
|
protected void |
fireBeforePrepareMOChange(MOChangeEvent changeEvent)
|
protected void |
fireValidate(MOValueValidationEvent validationEvent)
|
void |
get(SubRequest request)
Processes a GET request and return the result in the supplied sub-request. |
MOAccess |
getAccess()
Gets the access object for this scalar. |
org.snmp4j.smi.OID |
getID()
Gets the unique object ID of the managed object. |
org.snmp4j.smi.OID |
getLowerBound()
Gets the lower bound OID of the scope. |
org.snmp4j.smi.OID |
getOid()
Gets the instance OID of this scalar managed object. |
MOScope |
getScope()
Returns the scope of OIDs that are covered by this scalar's object registration. |
MOScope |
getSingleInstanceScope()
Returns a scope that covers only the scalar instance itself without any possible OIDs down in the tree or at the same level. |
org.snmp4j.smi.OID |
getUpperBound()
Gets the upper bound OID of the scope. |
V |
getValue()
Returns the actual value of this scalar managed object. |
org.snmp4j.smi.Variable |
getValue(org.snmp4j.smi.OID instanceOID)
Returns the variable (a copy thereof) with the specified instance OID managed by this ManagedObject. |
boolean |
isCovered(MOScope other)
Checks whether the supplied scope is covered by this scope. |
boolean |
isLowerIncluded()
Indicates whether the lower bound OID is included in the scope or not. |
boolean |
isOverlapping(MOScope other)
Checks whether the supplied scope overlap with this one, thus sharing at least one OID with the supplied one. |
boolean |
isUpperIncluded()
Indicates whether the upper bound OID is included in the scope or not. |
int |
isValueOK(SubRequest request)
Checks whether the new value contained in the supplied sub-request is a valid value for this object. |
boolean |
isVolatile()
Tests if this instance of a SerializableManagedObject should be serialized or deserialized through persistent storage load or save operation. |
void |
load(MOInput input)
Loads the content of the managed object from the specified input (stream). |
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)
Prepares a SET (sub)request. |
void |
removeMOChangeListener(MOChangeListener l)
Removes a MOChangeListener. |
void |
removeMOValueValidationListener(MOValueValidationListener l)
Removes a value validation listener |
void |
save(MOOutput output)
Saves the (non-volatile) content of this managed object to the specified output (stream). |
int |
setValue(V value)
Sets the value of this scalar managed object without checking it for the correct syntax. |
boolean |
setValue(org.snmp4j.smi.VariableBinding newValueAndInstancceOID)
Sets the value of a particular MIB object instance managed by this ManagedObject. |
void |
setVolatile(boolean isVolatile)
Sets the volatile flag for this instance. |
java.lang.String |
toString()
|
protected java.lang.String |
toStringDetails()
|
void |
undo(SubRequest request)
Compensates (undo) a (sub)request when a commit of another subrequest failed with an error. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public MOScalar(org.snmp4j.smi.OID id,
MOAccess access,
V value)
id - the instance OID of the scalar instance (last sub-identifier should be
zero).access - the maximum access level supported by this instance.value - the initial value of the scalar instance. If the initial value is
null or a Counter syntax, the scalar is created as a
volatile (non-persistent) instance by default.| Method Detail |
|---|
public MOScope getScope()
1.3.6...n <= x < 1.3.6...n+1 where n is the
last subidentifier of the OID registered by the corresponding OBJECT-TYPE
definition. Prior to version 1.1.2, this method returned a scope equal
to the scope now returned by getSingleInstanceScope().
getScope in interface ManagedObjectpublic MOScope getSingleInstanceScope()
public org.snmp4j.smi.OID find(MOScope range)
ManagedObject
find in interface ManagedObjectrange - 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 ManagedObjectrequest - the SubRequest to process.public MOAccess getAccess()
protected boolean checkRequestScope(SubRequest request)
request - a SubRequest.
true if the request is within scope and false
otherwise. In the latter case, the variable of the request is set
to Null.noSuchInstance and the request is marked completed.public boolean next(SubRequest request)
ManagedObject
next in interface ManagedObjectrequest - the SubRequest to process.
true if the search request found an appropriate instance,
false otherwise.public int isValueOK(SubRequest request)
MOValueValidationEvent the registered listeners.
request - the SubRequest with the new value.
SnmpConstants.SNMP_ERROR_SUCCESS if the new value is OK,
any other appropriate SNMPv2/v3 error status if not.public void prepare(SubRequest request)
ManagedObject
prepare in interface ManagedObjectrequest - the SubRequest to process.public void commit(SubRequest request)
ManagedObject
commit in interface ManagedObjectrequest - the SubRequest to process.protected int changeValue(V value)
setValue(Variable value) is called.
value - the new value.
public void undo(SubRequest request)
ManagedObject
undo in interface ManagedObjectrequest - the SubRequest to process.public void cleanup(SubRequest request)
ManagedObject
cleanup in interface ManagedObjectrequest - the SubRequest to process.public org.snmp4j.smi.OID getOid()
public org.snmp4j.smi.OID getLowerBound()
MOScopeMOScope.isLowerIncluded().
getLowerBound in interface MOScopepublic org.snmp4j.smi.OID getUpperBound()
MOScopeMOScope.isUpperIncluded().
getUpperBound in interface MOScopepublic boolean isCovered(MOScope other)
MOScope
isCovered in interface MOScopeother - the MOScope to check
true if the lower bound of other is greater
or equal than the lower bound of this scope and if the upper bound of
other is lower or equal than the upper bound of this scope.public boolean isLowerIncluded()
MOScope
isLowerIncluded in interface MOScopetrue if the lower bound is included.public boolean isUpperIncluded()
MOScope
isUpperIncluded in interface MOScopetrue if the upper bound is included.public V getValue()
value member and
then call super.getValue() in the derived class.
null Variable with the same syntax defined for
this scalar object.public boolean isVolatile()
SerializableManagedObject
isVolatile in interface SerializableManagedObjecttrue if SerializableManagedObject.load(org.snmp4j.agent.io.MOInput) and SerializableManagedObject.save(org.snmp4j.agent.io.MOOutput) should not be
called through a persistent storage operation and false
if these method should be called.public int setValue(V value)
value - a Variable with the with the same syntax defined for
this scalar object (not checked).
public void setVolatile(boolean isVolatile)
isVolatile - if true the state of this object will not be persistently
stored, otherwise the agent may save the state of this object
persistently.public boolean isOverlapping(MOScope other)
MOScope
isOverlapping in interface MOScopeother - a MOScope.
true if there exists at least one OID that is included in
both scopes.public void addMOValueValidationListener(MOValueValidationListener l)
l - a MOValueValidationListener instance.public void removeMOValueValidationListener(MOValueValidationListener l)
l - a MOValueValidationListener instance.protected void fireValidate(MOValueValidationEvent validationEvent)
public org.snmp4j.smi.OID getID()
RegisteredManagedObject
getID in interface RegisteredManagedObject
public void load(MOInput input)
throws java.io.IOException
SerializableManagedObject
load in interface SerializableManagedObjectinput - a MOInput instance.
java.io.IOException - if an MOInput operation fails.
public void save(MOOutput output)
throws java.io.IOException
SerializableManagedObject
save in interface SerializableManagedObjectoutput - a MOOutput instance.
java.io.IOException - if an MOOutput operation fails.public boolean covers(org.snmp4j.smi.OID oid)
MOScope
covers in interface MOScopeoid - an OID.
true if oid is greater or equal the scope's
lower bound and if it is less or equal its upper bound.public java.lang.String toString()
toString in class java.lang.Objectprotected java.lang.String toStringDetails()
public void addMOChangeListener(MOChangeListener l)
MOChangeListener that needs to be informed about
state changes of this scalar.
l - a MOChangeListener instance.public void removeMOChangeListener(MOChangeListener l)
MOChangeListener.
l - a MOChangeListener instance.protected void fireBeforePrepareMOChange(MOChangeEvent changeEvent)
protected void fireAfterPrepareMOChange(MOChangeEvent changeEvent)
protected void fireBeforeMOChange(MOChangeEvent changeEvent)
protected void fireAfterMOChange(MOChangeEvent changeEvent)
public org.snmp4j.smi.Variable getValue(org.snmp4j.smi.OID instanceOID)
ManagedObjectValueAccessManagedObject.
getValue in interface ManagedObjectValueAccessinstanceOID - the instance OID of the value. Thus, for scalar values with .0 suffix
and for tabular objects with table index suffix.
Variable or null if
such a variable does not exist.public boolean setValue(org.snmp4j.smi.VariableBinding newValueAndInstancceOID)
ManagedObjectValueAccessManagedObject. This is a low level operation, thus
no change events will be fired.
setValue in interface ManagedObjectValueAccessnewValueAndInstancceOID - a VariableBinding identifying the object instance to modify
by its OID and the new value by its variable part.
true if the object instance exists and has been modified
successfully, false otherwise.
|
Copyright 2005-2010 Frank Fock (SNMP4J.org) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||