KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > oracle > toplink > essentials > tools > schemaframework > SequenceDefinition


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, 2005, Oracle. All rights reserved.
22
package oracle.toplink.essentials.tools.schemaframework;
23
24 import java.io.Writer JavaDoc;
25 import oracle.toplink.essentials.internal.sessions.AbstractSession;
26 import oracle.toplink.essentials.exceptions.*;
27
28 /**
29  * <p>
30  * <b>Purpose</b>: Allow a generic way of creating sequences on the different platforms,
31  * and allow optional parameters to be specified.
32  * <p>
33  */

34 public abstract class SequenceDefinition extends DatabaseObjectDefinition {
35     public SequenceDefinition(String JavaDoc name) {
36         super();
37         this.name = name;
38     }
39
40     /**
41      * INTERAL:
42      * Verify whether the sequence exists.
43      */

44     public abstract boolean checkIfExist(AbstractSession session) throws DatabaseException;
45
46     /**
47      * INTERNAL:
48      * Indicates whether alter is supported
49      */

50     public boolean isAlterSupported() {
51         return false;
52     }
53
54     /**
55      * INTERNAL:
56      * By default does nothing.
57      */

58     public void alterOnDatabase(AbstractSession session) throws TopLinkException {
59     }
60
61     /**
62      * INTERNAL:
63      * Execute the SQL required to alter sequence.
64      * By default does nothing.
65      */

66     public void alter(AbstractSession session, Writer JavaDoc writer) throws ValidationException {
67     }
68
69     /**
70      * INTERNAL:
71      */

72     public void createOnDatabase(AbstractSession session) throws TopLinkException {
73         if (checkIfExist(session)) {
74             alterOnDatabase(session);
75         } else {
76             super.createOnDatabase(session);
77         }
78     }
79
80     /**
81      * INTERNAL:
82      * Return a TableDefinition
83      */

84     public TableDefinition buildTableDefinition() {
85         return null;
86     }
87 }
88
Popular Tags