001: /**
002: * Sequoia: Database clustering technology.
003: * Copyright (C) 2005 Emic Networks.
004: * Contact: sequoia@continuent.org
005: *
006: * Licensed under the Apache License, Version 2.0 (the "License");
007: * you may not use this file except in compliance with the License.
008: * You may obtain a copy of the License at
009: *
010: * http://www.apache.org/licenses/LICENSE-2.0
011: *
012: * Unless required by applicable law or agreed to in writing, software
013: * distributed under the License is distributed on an "AS IS" BASIS,
014: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015: * See the License for the specific language governing permissions and
016: * limitations under the License.
017: *
018: * Initial developer(s): Emmanuel Cecchet.
019: * Contributor(s): ______________________.
020: */package org.continuent.sequoia.controller.backup;
021:
022: import java.io.IOException;
023: import java.util.ArrayList;
024: import java.util.Date;
025:
026: import org.continuent.sequoia.common.exceptions.BackupException;
027: import org.continuent.sequoia.controller.backend.DatabaseBackend;
028:
029: /**
030: * This interface defines a Backuper that is in charge of doing backup/restore
031: * operations and manage dumps according to its own internal format. The user
032: * will manipulate logical names and the Backuper is responsible to maintain the
033: * logical name/physical name mapping.
034: *
035: * @author <a href="mailto:emmanuel.cecchet@emicnetworks.com">Emmanuel Cecchet</a>
036: * @version 1.0
037: */
038: public interface Backuper {
039:
040: //
041: // Backuper information
042: //
043:
044: /**
045: * Returns a String representing the format handled by this Backuper. This
046: * field should be human readable and as detailed as possible so that no
047: * confusion can be made by the administrator.
048: *
049: * @return the Backuper specific format
050: */
051: String getDumpFormat();
052:
053: /**
054: * Retrieve the backuper options that were used to initialize the backuper.
055: *
056: * @return the backuper options
057: * @see #setOptions(String)
058: */
059: String getOptions();
060:
061: /**
062: * Options that can be set at backuper initialization. These options are
063: * provided in the definition of the Backuper element (see dtd).
064: *
065: * @param options Backuper specific options
066: */
067: void setOptions(String options);
068:
069: //
070: // Backup/Restore operations
071: //
072:
073: /**
074: * Create a backup from the content of a backend.
075: *
076: * @param backend the target backend to backup
077: * @param login the login to use to connect to the database for the backup
078: * operation
079: * @param password the password to use to connect to the database for the
080: * backup operation
081: * @param dumpName the name of the dump to create
082: * @param path the path where to store the dump
083: * @param tables the list of tables to backup, null means all tables
084: * @return the timestamp for the dump if the backup was sucessful, null
085: * otherwise
086: * @throws BackupException if the backup operation fails
087: */
088: Date backup(DatabaseBackend backend, String login, String password,
089: String dumpName, String path, ArrayList tables)
090: throws BackupException;
091:
092: /**
093: * Restore a dump on a specific backend.
094: *
095: * @param backend the target backend to restore to
096: * @param login the login to use to connect to the database for the restore
097: * operation
098: * @param password the password to use to connect to the database for the
099: * restore operation
100: * @param dumpName the name of the dump to restore
101: * @param path the path where to retrieve the dump
102: * @param tables the list of tables to restore, null means all tables
103: * @throws BackupException if the restore operation failed
104: */
105: void restore(DatabaseBackend backend, String login,
106: String password, String dumpName, String path,
107: ArrayList tables) throws BackupException;
108:
109: //
110: // Dump manipulation functions
111: //
112:
113: /**
114: * Delete the specified dump.
115: *
116: * @param path the path where to retrieve the dump
117: * @param dumpName the dump to delete
118: * @throws BackupException if we failed to delete the dump
119: */
120: void deleteDump(String path, String dumpName)
121: throws BackupException;
122:
123: //
124: // Remote dump copy
125: //
126:
127: /**
128: * Client side: Fetch a remote dump from specified dump server.
129: *
130: * @param dumpTransferInfo the address and session key of the dump server to
131: * contact for fetching.
132: * @param path the path part of the remote dump spec (interpreted by server)
133: * @param dumpName the name part of the remote dump spec (interpreted by
134: * server)
135: * @throws BackupException in any error case: authentication error, transfer
136: * error, else.
137: * @throws IOException if an error occurs during the transfer
138: */
139: void fetchDump(DumpTransferInfo dumpTransferInfo, String path,
140: String dumpName) throws BackupException, IOException;
141:
142: /**
143: * Server side: setup a server and returns a DumpTransferInfo suitable for
144: * authenticated communication by a client using fetchDump().
145: *
146: * @return a DumpTransferInfo to be used by a client for authenticated
147: * communication upon fetchDump invocation.
148: * @throws IOException if an error occurs during the transfer
149: */
150: DumpTransferInfo setupDumpServer() throws IOException;
151:
152: }
|