KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > snmp4j > agent > ManagedObject


1 /*_############################################################################
2   _##
3   _## SNMP4J-Agent - ManagedObject.java
4   _##
5   _## Copyright (C) 2005-2007 Frank Fock (SNMP4J.org)
6   _##
7   _## Licensed under the Apache License, Version 2.0 (the "License");
8   _## you may not use this file except in compliance with the License.
9   _## 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
22 package org.snmp4j.agent;
23
24 import org.snmp4j.smi.OID;
25 import org.snmp4j.agent.request.SubRequest;
26
27 /**
28  * The <code>ManagedObject</code> interface defines the basic operations
29  * for all SNMP(4J) manageable objects.
30  *
31  * @author Frank Fock
32  * @version 1.0
33  */

34 public interface ManagedObject {
35
36   /**
37    * Returns the scope of object identifiers this managed object is managing.
38    * @return
39    * the <code>MOScope</code> that defines a range (possibly also a single
40    * or none instance OID) of object IDs managed by this managed object.
41    */

42   MOScope getScope();
43
44   /**
45    * Finds the first object ID (OID) in the specified search range.
46    * @param range
47    * the <code>MOScope</code> for the search.
48    * @return
49    * the <code>OID</code> that is included in the search <code>range</code>
50    * and <code>null</code> if no such instances could be found.
51    */

52   OID find(MOScope range);
53
54   /**
55    * Processes a GET request and return the result in the supplied sub-request.
56    *
57    * @param request
58    * the <code>SubRequest</code> to process.
59    */

60   void get(SubRequest request);
61
62   /**
63    * Finds the successor instance for the object instance ID (OID) given
64    * by the supplied sub-request and returns it within the supplied sub-request
65    * object.
66    *
67    * @param request
68    * the <code>SubRequest</code> to process.
69    * @return
70    * <code>true</code> if the search request found an appropriate instance,
71    * <code>false</code> otherwise.
72    */

73   boolean next(SubRequest request);
74
75   /**
76    * Prepares a SET (sub)request. This method represents the first phase of a
77    * two phase commit. During preparation all necessary resources should be
78    * locked in order to be able to execute the commit without claiming
79    * additional resources.
80    *
81    * @param request
82    * the <code>SubRequest</code> to process.
83    */

84   void prepare(SubRequest request);
85
86   /**
87    * Commits a previously prepared SET (sub)request. This is the second phase
88    * of a two phase commit. The change is committed but the resources locked
89    * during prepare not freed yet.
90    * @param request
91    * the <code>SubRequest</code> to process.
92    */

93   void commit(SubRequest request);
94
95   /**
96    * Compensates (undo) a (sub)request when a commit of another subrequest
97    * failed with an error. This also frees any resources locked during
98    * the preparation phase.
99    * @param request
100    * the <code>SubRequest</code> to process.
101    */

102   void undo(SubRequest request);
103
104   /**
105    * Cleansup a (sub)request and frees all resources locked during
106    * the preparation phase.
107    * @param request
108    * the <code>SubRequest</code> to process.
109    */

110   void cleanup(SubRequest request);
111
112 }
113
Popular Tags