001    /*
002     * Copyright 2001,2004 The Apache Software Foundation.
003     * 
004     * Licensed under the Apache License, Version 2.0 (the "License");
005     * you may not use this file except in compliance with the License.
006     * You may obtain a copy of the License at
007     * 
008     *      http://www.apache.org/licenses/LICENSE-2.0
009     * 
010     * Unless required by applicable law or agreed to in writing, software
011     * distributed under the License is distributed on an "AS IS" BASIS,
012     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013     * See the License for the specific language governing permissions and
014     * limitations under the License.
015     */
016    
017    package org.apache.commons.scaffold.util;
018    
019    
020    import java.util.Map;
021    
022    
023    /**
024     *  Simple interface to describe public methods on a
025     *  data access object.
026     *
027     * @author Ted Husted
028     * @version $Revision: 155464 $ $Date: 2005-02-26 13:26:54 +0000 (Sat, 26 Feb 2005) $
029     */
030    public interface Storable {
031    
032    
033        /**
034         * Commit record to storage.
035         */
036        public void store() throws Exception;
037    
038    
039        /**
040         * Retrieve record from storage.
041         */
042        public void retrieve() throws Exception;
043    
044    
045        /**
046         * Permenantly delete record.
047         */
048        public void delete() throws Exception;
049    
050    
051        /**
052         * Mark entry for deletion.
053         */
054        public void recycle() throws Exception;
055    
056    
057        /**
058         * Unmark entry for deletion.
059         */
060        public void restore() throws Exception;
061    
062    
063    
064        /**
065         * Return this object's primary key.
066         */
067        public Object getStorageKey();
068    
069    
070        /**
071         * Set this object's primary key.
072         */
073        public void setStorageKey(Object key);
074    
075    
076        /**
077         * Obtain a new primary key for this object.
078         */
079        public void allocateKey() throws Exception;
080    
081    
082    
083        /**
084         * Cache the result object of an operation.
085         */
086        public void setResult(Object result);
087    
088    
089        /**
090         * Return the result object of an operation.
091         */
092        public Object getResult();
093    
094    
095        /**
096         * Set a result code for an operation.
097         */
098        public void setResultCode(int resultCode);
099    
100    
101        /**
102         * Return the result code from an operation.
103         */
104        public int getResultCode();
105    
106    
107    
108        /**
109         * Populate this object from a Map.
110         */
111        public void populate(Map parameters) throws Exception;
112    
113    }