KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > derby > database > Database


1 /*
2
3    Derby - Class org.apache.derby.database.Database
4
5    Licensed to the Apache Software Foundation (ASF) under one or more
6    contributor license agreements. See the NOTICE file distributed with
7    this work for additional information regarding copyright ownership.
8    The ASF licenses this file to You under the Apache License, Version 2.0
9    (the "License"); you may not use this file except in compliance with
10    the License. You may obtain a copy of the License at
11
12       http://www.apache.org/licenses/LICENSE-2.0
13
14    Unless required by applicable law or agreed to in writing, software
15    distributed under the License is distributed on an "AS IS" BASIS,
16    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17    See the License for the specific language governing permissions and
18    limitations under the License.
19
20  */

21
22 package org.apache.derby.database;
23
24 /*
25   The org.apache.derby.iapi.db.Database interface is all the externally available
26   methods on a database. These are methods that might be called from an
27   SQL-J CALL statement. It is extended by com.ibm.db2j.impl.Database.DatabaseInterface.Database
28   which adds internal methods which are only called from within cloudscape code.
29
30   The Javadoc comment that follows is for external consumption.
31 */

32
33
34 import org.apache.derby.catalog.UUID;
35
36 import java.sql.Timestamp JavaDoc;
37 import java.sql.SQLException JavaDoc;
38 import java.util.Locale JavaDoc;
39 import java.io.File JavaDoc;
40
41 /**
42  * The Database interface provides control over a database
43  * (that is, the stored data and the files the data are stored in),
44  * operations on the database such as backup and recovery,
45  * and all other things that are associated with the database itself.
46  *
47  * @see org.apache.derby.iapi.db.Factory
48  */

49 public interface Database
50 {
51
52     /**
53      * Tells whether the Database is configured as read-only, or the
54      * Database was started in read-only mode.
55      *
56      * @return TRUE means the Database is read-only, FALSE means it is
57      * not read-only.
58      */

59     public boolean isReadOnly();
60
61     /**
62      * Delete all stored prepared statements that were
63      * created for JDBC MetaData queries.
64      *
65      * @exception SQLException thrown on error deleting
66      * the stored prepared statements, most likely
67      * a deadlock or timeout.
68      */

69     public void dropAllJDBCMetaDataSPSes()
70         throws SQLException JavaDoc;
71
72     /**
73      * Backup the database to a backup directory. See online documentation
74      * for more detail about how to use this feature.
75      *
76      * @param backupDir the directory name where the database backup should
77      * go. This directory will be created if not it does not exist.
78      * @param wait if <tt>true</tt>, waits for all the backup blocking
79      * operations in progress to finish.
80      * @exception SQLException Thrown on error
81      */

82     public void backup(String JavaDoc backupDir, boolean wait)
83         throws SQLException JavaDoc;
84
85
86     /**
87      * Backup the database to a backup directory and enable the log archive
88      * mode that will keep the archived log files required for roll-forward
89      * from this version backup.
90      *
91      * @param backupDir The directory name where the
92      * database backup should go. This
93      * directory will be created if it
94      * does not exist.
95      *
96      * @param deleteOnlineArchivedLogFiles If true deletes online archived log
97      * files that exist before this backup;
98      * otherwise they will not be deleted.
99      *
100      * Deletion will occur only after
101      * backup is complete.
102      *
103      * @param wait if <tt>true</tt>, waits for all
104      * the backup blocking operations in
105      * progress to finish.
106      *
107      * @exception SQLException Thrown on error
108      */

109     public void backupAndEnableLogArchiveMode(
110     String JavaDoc backupDir,
111     boolean deleteOnlineArchivedLogFiles,
112     boolean wait)
113         throws SQLException JavaDoc;
114
115
116     /**
117      * Disables the log archival process, i.e No old log files
118      * will be kept around for a roll-forward recovery. Only restore that can
119      * be performed after disabling log archive mode is version recovery.
120      *
121      * @param deleteOnlineArchivedLogFiles If true deletes all online archived
122      * log files that exist before this
123      * call immediately; otherwise they
124      * will not be deleted.
125      *
126      * @exception SQLException Thrown on error
127      */

128     public void disableLogArchiveMode(boolean deleteOnlineArchivedLogFiles)
129         throws SQLException JavaDoc;
130
131
132     /**
133       * Freeze the database temporarily so a backup can be taken.
134       * <P>Please see Cloudscape on line documentation on backup and restore.
135       *
136       * @exception SQLException Thrown on error
137       */

138     public void freeze() throws SQLException JavaDoc;
139
140     /**
141       * Unfreeze the database after a backup has been taken.
142       * <P>Please see Cloudscape on line documentation on backup and restore.
143       *
144       * @exception SQLException Thrown on error
145       */

146     public void unfreeze() throws SQLException JavaDoc;
147
148     /**
149      * Checkpoints the database, that is, flushes all dirty data to disk.
150      * Records a checkpoint in the transaction log, if there is a log.
151      *
152      * @exception SQLException Thrown on error
153      */

154     public void checkpoint() throws SQLException JavaDoc;
155
156     /**
157      * Get the Locale for this database.
158      */

159     public Locale JavaDoc getLocale();
160
161     /**
162         Return the UUID of this database.
163         @deprecated No longer supported.
164
165     */

166     public UUID getId();
167 }
168
169
170
171
Popular Tags