KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > lutris > appserver > server > sql > CoreDataStruct


1 /*
2  * Enhydra Java Application Server Project
3  *
4  * The contents of this file are subject to the Enhydra Public License
5  * Version 1.1 (the "License"); you may not use this file except in
6  * compliance with the License. You may obtain a copy of the License on
7  * the Enhydra web site ( http://www.enhydra.org/ ).
8  *
9  * Software distributed under the License is distributed on an "AS IS"
10  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
11  * the License for the specific terms governing rights and limitations
12  * under the License.
13  *
14  * The Initial Developer of the Enhydra Application Server is Lutris
15  * Technologies, Inc. The Enhydra Application Server and portions created
16  * by Lutris Technologies, Inc. are Copyright Lutris Technologies, Inc.
17  * All Rights Reserved.
18  *
19  * Contributor(s):
20  *
21  * $Id: CoreDataStruct.java,v 1.1 2004/09/03 13:42:38 sinisa Exp $
22  */

23 package com.lutris.appserver.server.sql;
24
25 import org.enhydra.dods.cache.Condition;
26
27 /**
28  * Base class from which the data objects are derived.
29  *
30  * @version $Revision: 1.1 $
31  * @author Kyle Clark
32  */

33 abstract public class CoreDataStruct {
34
35     /**
36      * The 'oid' and 'version' column names are made public so
37      * they can be modified by StandardDatabaseManager.
38      * These could be maintained in the LogicalDatabase but that
39      * would require extensive modifications to DBTransaction and
40      * DBQuery.
41      * This means that you are currently limited to using the
42      * same column names for all databases in applications using
43      * multiple databases.
44      */

45     private static String JavaDoc oidColumnName = "oid";
46     private static String JavaDoc versionColumnName = "version";
47     // The object id associated with this object.
48
protected ObjectId oId;
49     // The version of this object.
50
protected int version = 0;
51     // The next version of this object.
52
protected int newVersion = 0;
53
54     /**
55      * Public constructor.
56      */

57     public CoreDataStruct() {}
58
59     /**
60      * Returns the object identifier column name.
61      * @return the object identifier column name.
62      */

63     protected static String JavaDoc get_OIdColumnName() {
64         return oidColumnName;
65     }
66
67     /**
68      * Sets the object identifier column name.
69      * @param _oidColumnName Name of object identifier column.
70      */

71     protected static void set_OIdColumnName(String JavaDoc _oidColumnName) {
72         oidColumnName = _oidColumnName;
73     }
74
75     /**
76      * Returns the version column name.
77      * @return the version column name.
78      */

79     protected static String JavaDoc get_versionColumnName() {
80         return versionColumnName;
81     }
82
83     /**
84      * Sets the version column name.
85      * @param _versionColumnName Name of version column.
86      */

87     protected static void set_versionColumnName(String JavaDoc _versionColumnName) {
88         CoreDataStruct.versionColumnName = _versionColumnName;
89     }
90
91     /**
92      * @deprecated Use set_Version()
93      * @param _version the object's version.
94      */

95     protected void setVersion(int _version) {
96         set_Version(_version);
97     }
98
99     /**
100      * Sets this object's version.
101      * @param _version the object's version.
102      */

103     protected void set_Version(int _version) {
104         version = _version;
105     }
106
107     /**
108      * @deprecated Use get_Version()
109      * @return this object's version.
110      */

111     protected int getVersion() {
112         return get_Version();
113     }
114
115     /**
116      * Returns this object's version.
117      * @return this object's version.
118      */

119     protected int get_Version() {
120         return version;
121     }
122
123     /**
124      * @deprecated Use get_OId()
125      * @return this object's identifier.
126      */

127     public ObjectId getOId() {
128         return get_OId();
129     }
130
131     /**
132      * Returns this object's identifier.
133      * @return this object's identifier.
134      */

135     public ObjectId get_OId() {
136         return oId;
137     }
138
139     /**
140      * @deprecated Use set_OId()
141      * @param oId this object's identifier.
142      */

143     protected void setOId(ObjectId oId) {
144         set_OId(oId);
145     }
146
147     /**
148      * Sets this object's identifier.
149      * @param oId this object's identifier.
150      */

151     protected void set_OId(ObjectId oId) {
152         this.oId = oId;
153     }
154
155     /**
156      * Subclass should override this method if wants to use it.
157      * This method checks if this DataStruct object satisfies condition cond.
158      *
159      * @param cond Condition of the query.
160      * @return true if this DataStruct object satisfies condition of this query,
161      * otherwise false.
162      */

163     public boolean compareCond(Condition cond) {
164         return false;
165     }
166
167     /**
168      * Subclass should override this method if wants to use it.
169      * Returns this object's handle (identifier as a string).
170      * @return This object's identifier as a string.
171      *
172      * @exception DatabaseManagerException
173      * If a connection to the database cannot be established, etc.
174      * @deprecated Use get_Handle() instead.
175      */

176     public String JavaDoc getHandle() throws DatabaseManagerException {
177         return null;
178     }
179
180     /**
181      * Subclass should override this method if wants to use it.
182      * Returns this object's handle (identifier as a string).
183      * @return This object's identifier as a string.
184      *
185      * @exception DatabaseManagerException
186      * If a connection to the database cannot be established, etc.
187      */

188     public String JavaDoc get_Handle() throws DatabaseManagerException {
189         return null;
190     }
191
192     /**
193      * Subclass should override this method if wants to use it.
194      * Returns this object's cache handle (String in the form:
195      * "<database_name>.<indetifier_as_String>").
196      *
197      * @return cache handle.
198      * @exception DatabaseManagerException
199      * If a connection to the database cannot be established, etc.
200      */

201     public String JavaDoc get_CacheHandle() throws DatabaseManagerException {
202         return null;
203     }
204
205     /**
206      * Subclass should override this method if wants to use it.
207      * Returns the name of the logical database for which was this object
208      * created.
209      *
210      * @return logical database name.
211      */

212     public String JavaDoc get_Database() {
213         return null;
214     }
215     
216     /**
217      * @return CoreDataStruct new empty instance
218      */

219     abstract public CoreDataStruct dumpData(boolean incrementVersion);
220 }
221
Popular Tags