java.lang.Object
org.snmp4j.agent.DefaultMOQuery
- All Implemented Interfaces:
MOContextScope,MOQuery,MOScope
- Direct Known Subclasses:
MOQueryWithSource
The
DefaultMOQuery class is the default implementation of a
managed object query. It is used to lookup managed objects, for example in
a MOServer repository.
The constructor with source object reference has been pushed down into
the new subclass MOQueryWithSource (since version 2.0).- Version:
- 2.0
- Author:
- Frank Fock
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultMOQuery(MOContextScope scope) Creates a context aware query from a context aware OID scope.DefaultMOQuery(MOContextScope scope, boolean isWriteAccessIntended) Creates a context aware query from a context aware OID scope.DefaultMOQuery(MOContextScope scope, boolean isWriteAccessIntended, Object source) Creates a context aware query from a context aware OID scope. -
Method Summary
Modifier and TypeMethodDescriptionbooleancovers(org.snmp4j.smi.OID oid) Checks if this scope covers the supplied OID.org.snmp4j.smi.OctetStringReturns the context name of this scope.org.snmp4j.smi.OIDGets the lower bound OID of the scope.getScope()Gets the search range of this query.Gets the source (Request) object on whose behalf this query is executed.org.snmp4j.smi.OIDGets the upper bound OID of the scope.booleanChecks whether the supplied scope is covered by this scope.booleanIndicates whether the lower bound OID is included in the scope or not.booleanisOverlapping(MOScope other) Checks whether the supplied scope overlap with this one, thus sharing at least one OID with the supplied one.booleanIndicates whether the upper bound OID is included in the scope or not.booleanIndicates whether this query is issued on behalf of an intended write access on the ManagedObjects matched by this query.booleanmatchesQuery(ManagedObject<?> managedObject) Checks whether a managed object matches the internal query criteria defined by this query.voidsubtractScope(MOScope scope) Changes the query to no longer match (cover) the specified scope.toString()
-
Constructor Details
-
DefaultMOQuery
Creates a context aware query from a context aware OID scope.- Parameters:
scope- a scope that defines the possible result set of OIDs from a specific context for this query.
-
DefaultMOQuery
Creates a context aware query from a context aware OID scope.- Parameters:
scope- a scope that defines the possible result set of OIDs from a specific context for this query.isWriteAccessIntended- indicates whether this query serves a write access onManagedObjects or not.- Since:
- 1.1
-
DefaultMOQuery
Creates a context aware query from a context aware OID scope.- Parameters:
scope- a scope that defines the possible result set of OIDs from a specific context for this query.isWriteAccessIntended- indicates whether this query serves a write access onManagedObjects or not.source- the request object that triggered the creation of this query. SeegetSource().- Since:
- 1.1
-
-
Method Details
-
getScope
Gets the search range of this query. -
getSource
Gets the source (Request) object on whose behalf this query is executed. This object reference can be used to determine whether a query needs to updateManagedObjectcontent or not. When the reference is the same as those from the last query then an update is not necessary.- Returns:
- an Object on whose behalf this query is executed which will be in most
cases a
Requestinstance, but code should not rely on that. Ifnullis returned, the query source cannot be determined. - Since:
- 1.1
-
matchesQuery
Checks whether a managed object matches the internal query criteria defined by this query.- Specified by:
matchesQueryin interfaceMOQuery- Parameters:
managedObject- theManagedObjectinstance to check.- Returns:
trueif themanagedObjectmatches the query.
-
subtractScope
Description copied from interface:MOQueryChanges the query to no longer match (cover) the specified scope. If the query's scope is immutable (does not implement theMutableMOScopeinterface, then this method will throw anUnsupportedOperationException.- Specified by:
subtractScopein interfaceMOQuery- Parameters:
scope- aMOScopeinstance that defines the range of OIDs that should be no longer in the scope of this query.
-
toString
-
isWriteAccessQuery
public boolean isWriteAccessQuery()Description copied from interface:MOQueryIndicates whether this query is issued on behalf of an intended write access on the ManagedObjects matched by this query. This information can be used to optimize query evaluation or to control resource allocation.- Specified by:
isWriteAccessQueryin interfaceMOQuery- Returns:
trueif this query is performed to change or create a managed object matching this query andfalseif the query is for read-only access on the matched managed objects.
-
getLowerBound
public org.snmp4j.smi.OID getLowerBound()Description copied from interface:MOScopeGets the lower bound OID of the scope. Whether the lower bound is included or excluded from the scope's region is determined byMOScope.isLowerIncluded().- Specified by:
getLowerBoundin interfaceMOScope- Returns:
- an OID.
-
getUpperBound
public org.snmp4j.smi.OID getUpperBound()Description copied from interface:MOScopeGets the upper bound OID of the scope. Whether the upper bound is included or excluded from the scope's region is determined byMOScope.isUpperIncluded().- Specified by:
getUpperBoundin interfaceMOScope- Returns:
- OID
-
isLowerIncluded
public boolean isLowerIncluded()Description copied from interface:MOScopeIndicates whether the lower bound OID is included in the scope or not.- Specified by:
isLowerIncludedin interfaceMOScope- Returns:
trueif the lower bound is included.
-
isUpperIncluded
public boolean isUpperIncluded()Description copied from interface:MOScopeIndicates whether the upper bound OID is included in the scope or not.- Specified by:
isUpperIncludedin interfaceMOScope- Returns:
trueif the upper bound is included.
-
isCovered
Description copied from interface:MOScopeChecks whether the supplied scope is covered by this scope. -
isOverlapping
Description copied from interface:MOScopeChecks whether the supplied scope overlap with this one, thus sharing at least one OID with the supplied one.- Specified by:
isOverlappingin interfaceMOScope- Parameters:
other- aMOScope.- Returns:
trueif there exists at least one OID that is included in both scopes.
-
covers
public boolean covers(org.snmp4j.smi.OID oid) Description copied from interface:MOScopeChecks if this scope covers the supplied OID. -
getContext
public org.snmp4j.smi.OctetString getContext()Description copied from interface:MOContextScopeReturns the context name of this scope.- Specified by:
getContextin interfaceMOContextScope- Returns:
- the context name of this scope.
-