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
ConstructorDescriptionDefaultMOQuery
(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 TypeMethodDescriptionboolean
covers
(org.snmp4j.smi.OID oid) Checks if this scope covers the supplied OID.org.snmp4j.smi.OctetString
Returns the context name of this scope.org.snmp4j.smi.OID
Gets 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.OID
Gets the upper bound OID of the scope.boolean
Checks whether the supplied scope is covered by this scope.boolean
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
Indicates whether the upper bound OID is included in the scope or not.boolean
Indicates whether this query is issued on behalf of an intended write access on the ManagedObjects matched by this query.boolean
matchesQuery
(ManagedObject<?> managedObject) Checks whether a managed object matches the internal query criteria defined by this query.void
subtractScope
(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 onManagedObject
s 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 onManagedObject
s 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 updateManagedObject
content 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
Request
instance, but code should not rely on that. Ifnull
is 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:
matchesQuery
in interfaceMOQuery
- Parameters:
managedObject
- theManagedObject
instance to check.- Returns:
true
if themanagedObject
matches the query.
-
subtractScope
Description copied from interface:MOQuery
Changes the query to no longer match (cover) the specified scope. If the query's scope is immutable (does not implement theMutableMOScope
interface, then this method will throw anUnsupportedOperationException
.- Specified by:
subtractScope
in interfaceMOQuery
- Parameters:
scope
- aMOScope
instance 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:MOQuery
Indicates 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:
isWriteAccessQuery
in interfaceMOQuery
- Returns:
true
if this query is performed to change or create a managed object matching this query andfalse
if the query is for read-only access on the matched managed objects.
-
getLowerBound
public org.snmp4j.smi.OID getLowerBound()Description copied from interface:MOScope
Gets 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:
getLowerBound
in interfaceMOScope
- Returns:
- an OID.
-
getUpperBound
public org.snmp4j.smi.OID getUpperBound()Description copied from interface:MOScope
Gets 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:
getUpperBound
in interfaceMOScope
- Returns:
- OID
-
isLowerIncluded
public boolean isLowerIncluded()Description copied from interface:MOScope
Indicates whether the lower bound OID is included in the scope or not.- Specified by:
isLowerIncluded
in interfaceMOScope
- Returns:
true
if the lower bound is included.
-
isUpperIncluded
public boolean isUpperIncluded()Description copied from interface:MOScope
Indicates whether the upper bound OID is included in the scope or not.- Specified by:
isUpperIncluded
in interfaceMOScope
- Returns:
true
if the upper bound is included.
-
isCovered
Description copied from interface:MOScope
Checks whether the supplied scope is covered by this scope. -
isOverlapping
Description copied from interface:MOScope
Checks whether the supplied scope overlap with this one, thus sharing at least one OID with the supplied one.- Specified by:
isOverlapping
in interfaceMOScope
- Parameters:
other
- aMOScope
.- Returns:
true
if 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:MOScope
Checks if this scope covers the supplied OID. -
getContext
public org.snmp4j.smi.OctetString getContext()Description copied from interface:MOContextScope
Returns the context name of this scope.- Specified by:
getContext
in interfaceMOContextScope
- Returns:
- the context name of this scope.
-