KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > snmp4j > agent > mo > MOMutableRow2PC


1 /*_############################################################################
2   _##
3   _## SNMP4J-Agent - MOMutableRow2PC.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.mo;
23
24 import org.snmp4j.agent.mo.DefaultMOTable.*;
25 import org.snmp4j.agent.request.*;
26
27 /**
28  * The <code>MOMutableRow2PC</code> interface adds support for 2-Phase-Commit
29  * to mutable table rows.
30  *
31  * @author Frank Fock
32  * @version 1.0
33  */

34 public interface MOMutableRow2PC extends MOMutableTableRow {
35
36   /**
37    * Prepares a row for changes described by the supplied change set. If the
38    * modification cannot be successfully prepared, the error status of the
39    * supplied <code>subRequest</code> should be set to the appropriate error
40    * status value.
41    * <p>
42    * This method is called only once per modified row.
43    * @param subRequest
44    * the sub-request that triggered the row change and that can be used
45    * to deny the commit phase by setting its error status.
46    * @param changeSet
47    * a MOTableRow instance that represents the state of the row if all
48    * changes have been applied successfully.
49    */

50   void prepareRow(SubRequest subRequest, MOTableRow changeSet);
51
52   /**
53    * Prepares changing a single column.
54    * @param subRequest
55    * the sub-request that corresponds to the column change. This object
56    * can be used to deny the commit phase by setting its error status.
57    * @param changeSet
58    * a MOTableRow instance that represents the state of the row if all
59    * changes have been applied successfully.
60    * @param column
61    * the column index of the column to be changed.
62    */

63   void prepare(SubRequest subRequest, MOTableRow changeSet, int column);
64
65   /**
66    * Commits changes to single column.
67    * @param subRequest
68    * the sub-request that corresponds to the column change. This object
69    * can be used to deny the commit phase and triggering the undo phase
70    * by setting its error status.
71    * @param changeSet
72    * a MOTableRow instance that represents the state of the row if all
73    * changes have been applied successfully.
74    * @param column
75    * the column index of the column to be changed.
76    */

77   void commit(SubRequest subRequest, MOTableRow changeSet, int column);
78
79   /**
80    * Commits a row as described by the supplied change set. If the
81    * modification cannot be successfully committed, the error status of the
82    * supplied <code>subRequest</code> should be set to
83    * <code>commitFailed</code>. Setting this error should be avoided under
84    * any circumstances.
85    * <p>
86    * This method is called only once per modified row.
87    * @param subRequest
88    * the sub-request that triggered the row change and that can be used
89    * to trigger the undo phase by setting its error status.
90    * @param changeSet
91    * a MOTableRow instance that represents the state of the row if all
92    * changes have been applied successfully.
93    */

94   void commitRow(SubRequest subRequest, MOTableRow changeSet);
95
96   /**
97    * Cleanups resources holds for changes to a single column.
98    * @param subRequest
99    * the sub-request that corresponds to the column change.
100    * @param column
101    * the column index of the changed column.
102    */

103   void cleanup(SubRequest subRequest, int column);
104
105   /**
106    * Cleans up resources for a row.
107    * <p>
108    * This method is called only once per modified row.
109    * @param request
110    * the sub-request that triggered the row change.
111    * @param changeSet
112    * a MOTableRow instance that represents the state of the row if all
113    * changes have been applied successfully.
114    */

115   void cleanupRow(SubRequest request, ChangeSet changeSet);
116
117   /**
118    * Undos the changes to a single column.
119    * @param subRequest
120    * the sub-request that corresponds to the column change.
121    * @param column
122    * the column index of the changed column.
123    */

124   void undo(SubRequest subRequest, int column);
125
126   /**
127    * Undos changes to a row.
128    * <p>
129    * This method is called only once per modified row.
130    * @param request
131    * the sub-request that triggered the row change.
132    * @param changeSet
133    * a MOTableRow instance that represents the state of the row if all
134    * changes have been applied successfully.
135    */

136   void undoRow(SubRequest request, ChangeSet changeSet);
137
138 }
139
Popular Tags