001: /*
002:
003: Derby - Class org.apache.derby.database.Database
004:
005: Licensed to the Apache Software Foundation (ASF) under one or more
006: contributor license agreements. See the NOTICE file distributed with
007: this work for additional information regarding copyright ownership.
008: The ASF licenses this file to You under the Apache License, Version 2.0
009: (the "License"); you may not use this file except in compliance with
010: the License. You may obtain a copy of the License at
011:
012: http://www.apache.org/licenses/LICENSE-2.0
013:
014: Unless required by applicable law or agreed to in writing, software
015: distributed under the License is distributed on an "AS IS" BASIS,
016: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
017: See the License for the specific language governing permissions and
018: limitations under the License.
019:
020: */
021:
022: package org.apache.derby.database;
023:
024: /*
025: The org.apache.derby.iapi.db.Database interface is all the externally available
026: methods on a database. These are methods that might be called from an
027: SQL-J CALL statement. It is extended by com.ibm.db2j.impl.Database.DatabaseInterface.Database
028: which adds internal methods which are only called from within cloudscape code.
029:
030: The Javadoc comment that follows is for external consumption.
031: */
032:
033: import org.apache.derby.catalog.UUID;
034:
035: import java.sql.Timestamp;
036: import java.sql.SQLException;
037: import java.util.Locale;
038: import java.io.File;
039:
040: /**
041: * The Database interface provides control over a database
042: * (that is, the stored data and the files the data are stored in),
043: * operations on the database such as backup and recovery,
044: * and all other things that are associated with the database itself.
045: *
046: * @see org.apache.derby.iapi.db.Factory
047: */
048: public interface Database {
049:
050: /**
051: * Tells whether the Database is configured as read-only, or the
052: * Database was started in read-only mode.
053: *
054: * @return TRUE means the Database is read-only, FALSE means it is
055: * not read-only.
056: */
057: public boolean isReadOnly();
058:
059: /**
060: * Delete all stored prepared statements that were
061: * created for JDBC MetaData queries.
062: *
063: * @exception SQLException thrown on error deleting
064: * the stored prepared statements, most likely
065: * a deadlock or timeout.
066: */
067: public void dropAllJDBCMetaDataSPSes() throws SQLException;
068:
069: /**
070: * Backup the database to a backup directory. See online documentation
071: * for more detail about how to use this feature.
072: *
073: * @param backupDir the directory name where the database backup should
074: * go. This directory will be created if not it does not exist.
075: * @param wait if <tt>true</tt>, waits for all the backup blocking
076: * operations in progress to finish.
077: * @exception SQLException Thrown on error
078: */
079: public void backup(String backupDir, boolean wait)
080: throws SQLException;
081:
082: /**
083: * Backup the database to a backup directory and enable the log archive
084: * mode that will keep the archived log files required for roll-forward
085: * from this version backup.
086: *
087: * @param backupDir The directory name where the
088: * database backup should go. This
089: * directory will be created if it
090: * does not exist.
091: *
092: * @param deleteOnlineArchivedLogFiles If true deletes online archived log
093: * files that exist before this backup;
094: * otherwise they will not be deleted.
095: *
096: * Deletion will occur only after
097: * backup is complete.
098: *
099: * @param wait if <tt>true</tt>, waits for all
100: * the backup blocking operations in
101: * progress to finish.
102: *
103: * @exception SQLException Thrown on error
104: */
105: public void backupAndEnableLogArchiveMode(String backupDir,
106: boolean deleteOnlineArchivedLogFiles, boolean wait)
107: throws SQLException;
108:
109: /**
110: * Disables the log archival process, i.e No old log files
111: * will be kept around for a roll-forward recovery. Only restore that can
112: * be performed after disabling log archive mode is version recovery.
113: *
114: * @param deleteOnlineArchivedLogFiles If true deletes all online archived
115: * log files that exist before this
116: * call immediately; otherwise they
117: * will not be deleted.
118: *
119: * @exception SQLException Thrown on error
120: */
121: public void disableLogArchiveMode(
122: boolean deleteOnlineArchivedLogFiles) throws SQLException;
123:
124: /**
125: * Freeze the database temporarily so a backup can be taken.
126: * <P>Please see Cloudscape on line documentation on backup and restore.
127: *
128: * @exception SQLException Thrown on error
129: */
130: public void freeze() throws SQLException;
131:
132: /**
133: * Unfreeze the database after a backup has been taken.
134: * <P>Please see Cloudscape on line documentation on backup and restore.
135: *
136: * @exception SQLException Thrown on error
137: */
138: public void unfreeze() throws SQLException;
139:
140: /**
141: * Checkpoints the database, that is, flushes all dirty data to disk.
142: * Records a checkpoint in the transaction log, if there is a log.
143: *
144: * @exception SQLException Thrown on error
145: */
146: public void checkpoint() throws SQLException;
147:
148: /**
149: * Get the Locale for this database.
150: */
151: public Locale getLocale();
152:
153: /**
154: Return the UUID of this database.
155: @deprecated No longer supported.
156:
157: */
158: public UUID getId();
159: }
|