KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > oracle > toplink > essentials > internal > databaseaccess > Platform


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the "License"). You may not use this file except
5  * in compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * glassfish/bootstrap/legal/CDDLv1.0.txt or
9  * https://glassfish.dev.java.net/public/CDDLv1.0.html.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * HEADER in each file and include the License file at
15  * glassfish/bootstrap/legal/CDDLv1.0.txt. If applicable,
16  * add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your
18  * own identifying information: Portions Copyright [yyyy]
19  * [name of copyright owner]
20  */

21 // Copyright (c) 1998, 2006, Oracle. All rights reserved.
22
package oracle.toplink.essentials.internal.databaseaccess;
23
24 import java.io.*;
25 import java.util.Map JavaDoc;
26 import oracle.toplink.essentials.exceptions.*;
27 import oracle.toplink.essentials.queryframework.*;
28 import oracle.toplink.essentials.internal.helper.*;
29 import oracle.toplink.essentials.sequencing.Sequence;
30 import oracle.toplink.essentials.internal.sessions.AbstractSession;
31 import oracle.toplink.essentials.sessions.DatabaseSession;
32
33 /**
34  * Platform is private to TopLink. It encapsulates behavior specific to a datasource platform
35  * (eg. Oracle, Sybase, DB2, Attunity, MQSeries), and provides the interface for TopLink to access this behavior.
36  *
37  * @see DatasourcePlatform
38  * @see DatabasePlatform
39  * @see oracle.toplink.essentials.eis.EISPlatform
40  * @see oracle.toplink.essentials.xml.XMLPlatform
41  * @see oracle.toplink.essentials.sdk.SDKPlatform
42  *
43  * @since OracleAS TopLink 10<i>g</i> (10.0.3)
44  */

45 public interface Platform extends Serializable, Cloneable JavaDoc {
46     public Object JavaDoc clone();
47
48     /**
49      * Convert the object to the appropriate type by invoking the appropriate
50      * ConversionManager method
51      * @param object - the object that must be converted
52      * @param javaClass - the class that the object must be converted to
53      * @exception - ConversionException, all exceptions will be thrown as this type.
54      * @return - the newly converted object
55      */

56     public Object JavaDoc convertObject(Object JavaDoc sourceObject, Class JavaDoc javaClass) throws ConversionException;
57
58     /**
59      * Copy the state into the new platform.
60      */

61     public void copyInto(Platform platform);
62
63     /**
64      * The platform hold its own instance of conversion manager to allow customization.
65      */

66     public ConversionManager getConversionManager();
67
68     /**
69      * The platform hold its own instance of conversion manager to allow customization.
70      */

71     public void setConversionManager(ConversionManager conversionManager);
72
73     /**
74      * Return the qualifier for the table. Required by some
75      * databases such as Oracle and DB2
76      */

77     public String JavaDoc getTableQualifier();
78
79     /**
80      * Answer the timestamp from the server.
81      */

82     public java.sql.Timestamp JavaDoc getTimestampFromServer(AbstractSession session, String JavaDoc sessionName);
83
84     /**
85      * This method can be overridden by subclasses to return a
86      * query that will return the timestamp from the server.
87      * return null if the time should be the local time.
88      */

89     public ValueReadQuery getTimestampQuery();
90
91     public boolean isAccess();
92
93     public boolean isAttunity();
94
95     public boolean isCloudscape();
96
97     public boolean isDerby();
98
99     public boolean isDB2();
100
101     public boolean isDBase();
102
103     public boolean isHSQL();
104
105     public boolean isInformix();
106
107     public boolean isMySQL();
108
109     public boolean isODBC();
110
111     public boolean isOracle();
112
113     public boolean isPointBase();
114
115     public boolean isSQLAnywhere();
116
117     public boolean isSQLServer();
118
119     public boolean isSybase();
120
121     public boolean isTimesTen();
122
123     public boolean isPostgreSQL();
124         
125     /**
126      * Set the qualifier for the table. Required by some
127      * databases such as Oracle and DB2
128      */

129     public void setTableQualifier(String JavaDoc qualifier);
130
131     /**
132      * Can override the default query for returning a timestamp from the server.
133      * See: getTimestampFromServer
134      */

135     public void setTimestampQuery(ValueReadQuery tsQuery);
136
137     /**
138      * Add the parameter.
139      * Convert the parameter to a string and write it.
140      */

141     public void appendParameter(Call call, Writer writer, Object JavaDoc parameter);
142
143     /**
144      * Allow for the platform to handle the representation of parameters specially.
145      */

146     public Object JavaDoc getCustomModifyValueForCall(Call call, Object JavaDoc value, DatabaseField field, boolean shouldBind);
147
148     /**
149      * Allow for the platform to handle the representation of parameters specially.
150      */

151     public boolean shouldUseCustomModifyForCall(DatabaseField field);
152
153     /**
154      * Get default sequence.
155      * Sequence name shouldn't be altered -
156      * don't do: getDefaultSequence().setName(newName).
157      */

158     public Sequence getDefaultSequence();
159
160     /**
161      * Set default sequence.
162      * The sequence should have a unique name
163      * that shouldn't be altered after the sequence has been set:
164      * don't do: getDefaultSequence().setName(newName)).
165      * Default constructors for Sequence subclasses
166      * set name to "SEQ".
167      */

168     public void setDefaultSequence(Sequence sequence);
169
170     /**
171      * Add sequence.
172      * The sequence should have a unique name
173      * that shouldn't be altered after the sequence has been added -
174      * don't do: getSequence(name).setName(newName))
175      */

176     public void addSequence(Sequence sequence);
177
178     /**
179      * Get sequence corresponding to the name.
180      * The name shouldn't be altered -
181      * don't do: getSequence(name).setName(newName)
182      */

183     public Sequence getSequence(String JavaDoc seqName);
184
185     /**
186      * Remove sequence corresponding to the name
187      * (the sequence was added through addSequence method)
188      */

189     public Sequence removeSequence(String JavaDoc seqName);
190
191     /**
192      * Remove all sequences that were added throud addSequence method.
193      */

194     public void removeAllSequences();
195
196     /**
197      * INTERNAL:
198      * Returns a map of sequence names to Sequences (may be null).
199      */

200     public Map JavaDoc getSequences();
201
202     /**
203      * INTERNAL:
204      * Used only for writing into XML or Java.
205      */

206     public Map JavaDoc getSequencesToWrite();
207
208     /**
209      * INTERNAL:
210      * Used only for writing into XML or Java.
211      */

212     public Sequence getDefaultSequenceToWrite();
213
214     /**
215      * INTERNAL:
216      * Used only for reading from XML.
217      */

218     public void setSequences(Map JavaDoc sequences);
219
220     /**
221      * INTERNAL:
222      * Indicates whether defaultSequence is the same as platform default sequence.
223      */

224     public boolean usesPlatformDefaultSequence();
225     
226     /**
227      * INTERNAL:
228      * Platform specific sequencing initialization.
229      * This internal method should only be called by SequencingManager.
230      */

231     public void platformSpecificSequencingInitialization(DatabaseSession session);
232 }
233
Popular Tags