KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > lutris > appserver > server > sql > oracle > OracleLogicalDatabase


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: OracleLogicalDatabase.java,v 1.1 2004/09/03 13:42:52 sinisa Exp $
22  */

23 package com.lutris.appserver.server.sql.oracle;
24
25 import java.sql.SQLException JavaDoc;
26 import com.lutris.appserver.server.sql.ConnectionAllocator;
27 import com.lutris.appserver.server.sql.DBQuery;
28 import com.lutris.appserver.server.sql.DBTransaction;
29 import com.lutris.appserver.server.sql.ObjectIdAllocator;
30 import com.lutris.appserver.server.sql.standard.StandardLogicalDatabase;
31 import com.lutris.appserver.server.sql.DatabaseManagerConfiguration;
32 import com.lutris.util.Config;
33 import com.lutris.util.ConfigException;
34
35 /**
36  * Represents a logical database with Oracle specific capabilities.
37  *
38  * @see StandardLogicalDatabase
39  * @author Paul Morgan
40  * @since LBS1.8
41  * @version $Revision: 1.1 $
42  */

43 public class OracleLogicalDatabase extends StandardLogicalDatabase {
44
45     /**
46      * Creates and configures a single logical database with oracle
47      * specific enhancements.
48      *
49      * @see StandardLogicalDatabase#StandardLogicalDatabase
50      * @param dbName
51      * The logical name of the database.
52      * @param dbConfig
53      * The configuration object for this logical database.
54      * @exception ConfigException
55      * If there is an error in the configuration file.
56      * @exception SQLException
57      * If a SQL error occurs.
58      */

59     public OracleLogicalDatabase(String JavaDoc dbName, Config dbConfig)
60         throws ConfigException, SQLException JavaDoc {
61         super.init(dbName, dbConfig);
62     }
63     
64     /**
65      * Creates and configures a single logical database with oracle
66      * specific enhancements.
67      *
68      * @see StandardLogicalDatabase#StandardLogicalDatabase
69      * @param dbName
70      * The logical name of the database.
71      * @param dbConfig
72      * The configuration object for this logical database.
73      * @param dbManagerConf
74      * The configuration object of DatabaseManager.
75      * @exception ConfigException
76      * If there is an error in the configuration file.
77      * @exception SQLException
78      * If a SQL error occurs.
79      */

80     public OracleLogicalDatabase(String JavaDoc dbName, Config dbConfig, DatabaseManagerConfiguration dbManagerConf)
81         throws ConfigException, SQLException JavaDoc {
82         super.init(dbName, dbConfig, dbManagerConf);
83     }
84
85     /**
86      * Default constructor to configure a single logical database.
87      * Note that the <CODE>init()</CODE> method must be called to
88      * configure the database.
89      *
90      * @see StandardLogicalDatabase#StandardLogicalDatabase
91      */

92     public OracleLogicalDatabase() {
93         super();
94     }
95     
96     /**
97      * Return the connection allocator.
98      *
99      * @param connectionConfig
100      * The configuration object for the connection allocator.
101      * @exception ConfigException
102      * If there is an error in the configuration file.
103      * @return
104      * The connection allocator.
105      */

106     public ConnectionAllocator loadConnectionAllocator(Config connectionConfig)
107         throws ConfigException {
108         return new OracleConnectionAllocator(this, connectionConfig);
109     }
110
111     /**
112      * Return the object id allocator.
113      *
114      * @param objIdConfig
115      * The configuration object for the object id allocator.
116      * @exception ConfigException
117      * If there is an error in the configuration file.
118      * @return
119      * The object id allocator.
120      */

121     public ObjectIdAllocator loadObjectIdAllocator(Config objIdConfig)
122         throws ConfigException {
123         return new OracleObjectIdAllocator(this, objIdConfig);
124     }
125
126     /**
127      * Return a transaction for use on this oracle logical database.
128      *
129      * @return The transaction object.
130      * @exception SQLException
131      * if a SQL error occurs.
132      */

133     public DBTransaction createTransaction()
134         throws SQLException JavaDoc {
135         return new OracleDBTransaction((OracleDBConnection) connectionAllocator.allocate());
136     }
137
138     /**
139      * Return a query for use on this logical database.
140      *
141      * @return The query object.
142      * @exception SQLException
143      * if a SQL error occurs.
144      */

145     public DBQuery createQuery()
146         throws SQLException JavaDoc {
147         return new OracleDBQuery(connectionAllocator.allocate());
148     }
149
150     /**
151      * Return a description of the logical database type.
152      *
153      * @return The type.
154      */

155     public String JavaDoc getType() {
156         return "Oracle";
157     }
158 }
159
Popular Tags