01: /*_############################################################################
02: _##
03: _## SNMP4J-Agent - MOQuery.java
04: _##
05: _## Copyright (C) 2005-2007 Frank Fock (SNMP4J.org)
06: _##
07: _## Licensed under the Apache License, Version 2.0 (the "License");
08: _## you may not use this file except in compliance with the License.
09: _## You may obtain a copy of the License at
10: _##
11: _## http://www.apache.org/licenses/LICENSE-2.0
12: _##
13: _## Unless required by applicable law or agreed to in writing, software
14: _## distributed under the License is distributed on an "AS IS" BASIS,
15: _## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16: _## See the License for the specific language governing permissions and
17: _## limitations under the License.
18: _##
19: _##########################################################################*/
20:
21: package org.snmp4j.agent;
22:
23: /**
24: * A managed object query is used to lookup managed objects, for example in
25: * a {@link MOServer} repository.
26: *
27: * @author Frank Fock
28: * @version 1.1
29: */
30: public interface MOQuery {
31:
32: /**
33: * Gets the search range of this query.
34: * @return
35: * a <code>MORange</code> instance denoting upper and lower bound
36: * of this queries scope.
37: */
38: MOContextScope getScope();
39:
40: /**
41: * Checks whether a managed object matches the internal query criteria
42: * defined by this query.
43: *
44: * @param managedObject
45: * the <code>ManagedObject</code> instance to check.
46: * @return
47: * <code>true</code> if the <code>managedObject</code> matches the query.
48: */
49: boolean matchesQuery(ManagedObject managedObject);
50:
51: /**
52: * Changes the query to no longer match (cover) the specified scope.
53: * If the query's scope is immutable (does not implement the
54: * {@link MutableMOScope} interface, then this method will throw an
55: * {@link UnsupportedOperationException}.
56: * @param scope
57: * a <code>MOScope</code> instance that defines the range of OIDs
58: * that should be no longer in the scope of this query.
59: */
60: void substractScope(MOScope scope);
61:
62: /**
63: * Indicates whether this query is issued on behalf of an intended write
64: * access on the ManagedObjects matched by this query. This information can
65: * be used to optimize query evaluation or to control resource allocation.
66: *
67: * @return
68: * <code>true</code> if this query is performed to change or create a
69: * managed object matching this query and <code>false</code> if the
70: * query is for read-only access on the matched managed objects.
71: * @since 1.1
72: */
73: boolean isWriteAccessQuery();
74: }
|