001    package org.apache.ojb.odmg.states;
002    
003    /* Copyright 2002-2005 The Apache Software Foundation
004     *
005     * Licensed under the Apache License, Version 2.0 (the "License");
006     * you may not use this file except in compliance with the License.
007     * You may obtain a copy of the License at
008     *
009     *     http://www.apache.org/licenses/LICENSE-2.0
010     *
011     * Unless required by applicable law or agreed to in writing, software
012     * distributed under the License is distributed on an "AS IS" BASIS,
013     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014     * See the License for the specific language governing permissions and
015     * limitations under the License.
016     */
017    
018    import org.apache.ojb.odmg.ObjectEnvelope;
019    
020    /**
021     * this state represents old Objects (i.e. already persistent but not changed during tx)
022     * --> no need to do anything for commit or rollback
023     */
024    public class StateOldClean extends ModificationState
025    {
026        private static StateOldClean _instance = new StateOldClean();
027    
028        /**
029         * private constructor: use singleton instance
030         */
031        private StateOldClean()
032        {
033    
034        }
035    
036        /**
037         * perform a checkpoint, i.e. perform updates on underlying db but keep locks on objects
038         */
039        public static StateOldClean getInstance()
040        {
041            return _instance;
042        }
043    
044        /**
045         * return resulting state after marking clean
046         */
047        public ModificationState markClean()
048        {
049            return this;
050        }
051    
052        /**
053         * return resulting state after marking delete
054         */
055        public ModificationState markDelete()
056        {
057            return StateOldDelete.getInstance();
058        }
059    
060        /**
061         * return resulting state after marking dirty
062         */
063        public ModificationState markDirty()
064        {
065            return StateOldDirty.getInstance();
066        }
067    
068        /**
069         * return resulting state after marking new
070         */
071        public ModificationState markNew()
072        {
073            return this;
074        }
075    
076        /**
077         * return resulting state after marking old
078         */
079        public ModificationState markOld()
080        {
081            return this;
082        }
083    
084        /**
085         * rollback the ObjectModification
086         */
087        public void checkpoint(ObjectEnvelope mod)
088        {
089    
090        }
091    
092        /**
093         * commit the associated transaction
094         */
095        public void commit(ObjectEnvelope mod)
096        {
097    
098        }
099    
100        /**
101         *
102         */
103        public void rollback(ObjectEnvelope mod)
104        {
105    
106        }
107    }