public class DefaultMOQuery extends Object implements MOQuery
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).Constructor and Description |
---|
DefaultMOQuery(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.
|
Modifier and Type | Method and Description |
---|---|
boolean |
covers(org.snmp4j.smi.OID oid)
Checks if this scope covers the supplied OID.
|
org.snmp4j.smi.OctetString |
getContext()
Returns the context name of this scope.
|
org.snmp4j.smi.OID |
getLowerBound()
Gets the lower bound OID of the scope.
|
MOContextScope |
getScope()
Gets the search range of this query.
|
Object |
getSource()
Gets the source (
Request ) object on whose behalf this query is
executed. |
org.snmp4j.smi.OID |
getUpperBound()
Gets the upper bound OID of the scope.
|
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.
|
boolean |
isWriteAccessQuery()
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 |
substractScope(MOScope scope)
Changes the query to no longer match (cover) the specified scope.
|
String |
toString() |
public DefaultMOQuery(MOContextScope scope)
scope
- a scope that defines the possible result set of OIDs from a specific
context for this query.public DefaultMOQuery(MOContextScope scope, boolean isWriteAccessIntended)
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 on
ManagedObject
s or not.public DefaultMOQuery(MOContextScope scope, boolean isWriteAccessIntended, Object source)
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 on
ManagedObject
s or not.source
- the request object that triggered the creation of this query. See getSource()
.public MOContextScope getScope()
public Object getSource()
Request
) object on whose behalf this query is
executed. This object reference can be used to determine whether a query
needs to update ManagedObject
content or not. When the reference
is the same as those from the last query then an update is not necessary.Request
instance, but code should not rely on that. If
null
is returned, the query source cannot be determined.public boolean matchesQuery(ManagedObject managedObject)
matchesQuery
in interface MOQuery
managedObject
- the ManagedObject
instance to check.true
if the managedObject
matches the
query.public void substractScope(MOScope scope)
MOQuery
MutableMOScope
interface, then this method will throw an
UnsupportedOperationException
.substractScope
in interface MOQuery
scope
- a MOScope
instance that defines the range of OIDs
that should be no longer in the scope of this query.public boolean isWriteAccessQuery()
MOQuery
isWriteAccessQuery
in interface MOQuery
true
if this query is performed to change or create a
managed object matching this query and false
if the
query is for read-only access on the matched managed objects.public org.snmp4j.smi.OID getLowerBound()
MOScope
MOScope.isLowerIncluded()
.getLowerBound
in interface MOScope
public org.snmp4j.smi.OID getUpperBound()
MOScope
MOScope.isUpperIncluded()
.getUpperBound
in interface MOScope
public boolean isLowerIncluded()
MOScope
isLowerIncluded
in interface MOScope
true
if the lower bound is included.public boolean isUpperIncluded()
MOScope
isUpperIncluded
in interface MOScope
true
if the upper bound is included.public boolean isCovered(MOScope other)
MOScope
public boolean isOverlapping(MOScope other)
MOScope
isOverlapping
in interface MOScope
other
- a MOScope
.true
if there exists at least one OID that is included in
both scopes.public boolean covers(org.snmp4j.smi.OID oid)
MOScope
public org.snmp4j.smi.OctetString getContext()
MOContextScope
getContext
in interface MOContextScope
Copyright © 2016 SNMP4J.org. All rights reserved.