KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > ojb > odmg > states > StateOldClean


1 package org.apache.ojb.odmg.states;
2
3 /* Copyright 2002-2005 The Apache Software Foundation
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */

17
18 import org.apache.ojb.odmg.ObjectEnvelope;
19
20 /**
21  * this state represents old Objects (i.e. already persistent but not changed during tx)
22  * --> no need to do anything for commit or rollback
23  */

24 public class StateOldClean extends ModificationState
25 {
26     private static StateOldClean _instance = new StateOldClean();
27
28     /**
29      * private constructor: use singleton instance
30      */

31     private StateOldClean()
32     {
33
34     }
35
36     /**
37      * perform a checkpoint, i.e. perform updates on underlying db but keep locks on objects
38      */

39     public static StateOldClean getInstance()
40     {
41         return _instance;
42     }
43
44     /**
45      * return resulting state after marking clean
46      */

47     public ModificationState markClean()
48     {
49         return this;
50     }
51
52     /**
53      * return resulting state after marking delete
54      */

55     public ModificationState markDelete()
56     {
57         return StateOldDelete.getInstance();
58     }
59
60     /**
61      * return resulting state after marking dirty
62      */

63     public ModificationState markDirty()
64     {
65         return StateOldDirty.getInstance();
66     }
67
68     /**
69      * return resulting state after marking new
70      */

71     public ModificationState markNew()
72     {
73         return this;
74     }
75
76     /**
77      * return resulting state after marking old
78      */

79     public ModificationState markOld()
80     {
81         return this;
82     }
83
84     /**
85      * rollback the ObjectModification
86      */

87     public void checkpoint(ObjectEnvelope mod)
88     {
89
90     }
91
92     /**
93      * commit the associated transaction
94      */

95     public void commit(ObjectEnvelope mod)
96     {
97
98     }
99
100     /**
101      *
102      */

103     public void rollback(ObjectEnvelope mod)
104     {
105
106     }
107 }
108
Popular Tags