java.lang.Object
org.snmp4j.agent.mo.snmp4j.MOSubtreeProxy
- All Implemented Interfaces:
ManagedObject<SubRequest<?>>,GenericManagedObject
In contrast to
ProxyForwarder, the MOSubtreeProxy provides a proxy implementation for a
single subtree based on the configuration provided by the Snmp4jProxyMib SnmpProxyMIB and SnmpTargetMIB.- Since:
- 2.0
- Version:
- 3.2
- Author:
- Frank Fock
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionMOSubtreeProxy(org.snmp4j.Session session, SnmpTargetMIB targetMIB, org.snmp4j.smi.OctetString proxyName, org.snmp4j.smi.OID subtreeOID, org.snmp4j.smi.OctetString contextEngineID, org.snmp4j.smi.OctetString contextName, org.snmp4j.smi.OctetString targetName) -
Method Summary
Modifier and TypeMethodDescriptionvoidcleanup(SubRequest<?> request) Cleansup a (sub)request and frees all resources locked during the preparation phase.voidcommit(SubRequest<?> request) Commits a previously prepared SET (sub)request.org.snmp4j.smi.OIDFinds the first object ID (OID) in the specified search range.voidget(SubRequest<?> request) Processes a GET request and return the result in the supplied sub-request.org.snmp4j.smi.OctetStringgetScope()Returns the scope of object identifiers this managed object is managing.booleanReturns whether undo of SET operations should be supported by this sub-tree proxy or not.booleannext(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.voidprepare(SubRequest<?> request) Prepares a SET (sub)request.voidvoidsetTargetSubtree(org.snmp4j.smi.OID remoteSubtree) Sets the remote sub-tree OID for the translation between local agent OID and remote agent OID.voidsetTranslation(OIDTranslation translation) Sets a OID translation.voidsetUndoEnabled(boolean undoEnabled) Enables or disables undo support for SET operations.toString()voidundo(SubRequest<?> request) Compensates (undo) a (sub)request when a commit of another subrequest failed with an error.
-
Constructor Details
-
MOSubtreeProxy
public MOSubtreeProxy(org.snmp4j.Session session, SnmpTargetMIB targetMIB, org.snmp4j.smi.OctetString proxyName, org.snmp4j.smi.OID subtreeOID, org.snmp4j.smi.OctetString contextEngineID, org.snmp4j.smi.OctetString contextName, org.snmp4j.smi.OctetString targetName)
-
-
Method Details
-
getScope
Description copied from interface:ManagedObjectReturns the scope of object identifiers this managed object is managing.- Specified by:
getScopein interfaceManagedObject<SubRequest<?>>- Returns:
- the
MOScopethat defines a range (possibly also a single or none instance OID) of object IDs managed by this managed object.
-
find
Description copied from interface:ManagedObjectFinds the first object ID (OID) in the specified search range.- Specified by:
findin interfaceManagedObject<SubRequest<?>>- Parameters:
range- theMOScopefor the search.- Returns:
- the
OIDthat is included in the searchrangeandnullif no such instances could be found.
-
setTargetSubtree
public void setTargetSubtree(org.snmp4j.smi.OID remoteSubtree) Sets the remote sub-tree OID for the translation between local agent OID and remote agent OID. Ifnull, zero length, or equal to0.0, no translation takes place.- Parameters:
remoteSubtree- the OID sub-tree of the target agent to proxy.
-
get
Description copied from interface:ManagedObjectProcesses a GET request and return the result in the supplied sub-request.- Specified by:
getin interfaceManagedObject<SubRequest<?>>- Parameters:
request- theSubRequestto process.
-
next
Description copied from interface:ManagedObjectFinds the successor instance for the object instance ID (OID) given by the supplied sub-request and returns it within the supplied sub-request object.- Specified by:
nextin interfaceManagedObject<SubRequest<?>>- Parameters:
request- theSubRequestto process.- Returns:
trueif the search request found an appropriate instance,falseotherwise.
-
prepare
Description copied from interface:ManagedObjectPrepares a SET (sub)request. This method represents the first phase of a two phase commit. During preparation all necessary resources should be locked in order to be able to execute the commit without claiming additional resources.- Specified by:
preparein interfaceManagedObject<SubRequest<?>>- Parameters:
request- theSubRequestto process.
-
commit
Description copied from interface:ManagedObjectCommits a previously prepared SET (sub)request. This is the second phase of a two phase commit. The change is committed but the resources locked during prepare not freed yet.- Specified by:
commitin interfaceManagedObject<SubRequest<?>>- Parameters:
request- theSubRequestto process.
-
undo
Description copied from interface:ManagedObjectCompensates (undo) a (sub)request when a commit of another subrequest failed with an error. This also frees any resources locked during the preparation phase.- Specified by:
undoin interfaceManagedObject<SubRequest<?>>- Parameters:
request- theSubRequestto process.
-
cleanup
Description copied from interface:ManagedObjectCleansup a (sub)request and frees all resources locked during the preparation phase.- Specified by:
cleanupin interfaceManagedObject<SubRequest<?>>- Parameters:
request- theSubRequestto process.
-
isUndoEnabled
public boolean isUndoEnabled()Returns whether undo of SET operations should be supported by this sub-tree proxy or not. Iftrueis returned, a GET requests will be sent to the target SNMP entity before the SET operation to retrieve the old (undo) value. If the SET operation fails because of some error in this sub-request or any other sub-request of the same SNMP PDU, the already SET value in the target will be reset to the old value.- Returns:
trueif undo values will be retrieved for this sub-tree (default),falseotherwise (SET requests will be committed directly without previous GET).- Since:
- 2.5.0
-
setUndoEnabled
public void setUndoEnabled(boolean undoEnabled) Enables or disables undo support for SET operations. If set totrue, a GET requests will be sent to the target SNMP entity before the SET operation to retrieve the old (undo) value. If the SET operation fails because of some error in this sub-request or any other sub-request of the same SNMP PDU, the already SET value in the target will be reset to the old value.- Parameters:
undoEnabled-trueif undo values should be retrieved for this sub-tree (default),falseotherwise (SET requests will be committed directly without previous GET).- Since:
- 2.5.0
-
getProxyName
public org.snmp4j.smi.OctetString getProxyName() -
getAccess
-
setAccess
-
getTranslation
-
setTranslation
Sets a OID translation. By default it is not active (null).- Parameters:
translation- If notnull, theOIDTranslationcan be used to map between local OID and remote OID and vice versa.
-
toString
-