KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > continuent > sequoia > controller > backup > Backuper


1 /**
2  * Sequoia: Database clustering technology.
3  * Copyright (C) 2005 Emic Networks.
4  * Contact: sequoia@continuent.org
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18  * Initial developer(s): Emmanuel Cecchet.
19  * Contributor(s): ______________________.
20  */

21
22 package org.continuent.sequoia.controller.backup;
23
24 import java.io.IOException JavaDoc;
25 import java.util.ArrayList JavaDoc;
26 import java.util.Date JavaDoc;
27
28 import org.continuent.sequoia.common.exceptions.BackupException;
29 import org.continuent.sequoia.controller.backend.DatabaseBackend;
30
31 /**
32  * This interface defines a Backuper that is in charge of doing backup/restore
33  * operations and manage dumps according to its own internal format. The user
34  * will manipulate logical names and the Backuper is responsible to maintain the
35  * logical name/physical name mapping.
36  *
37  * @author <a HREF="mailto:emmanuel.cecchet@emicnetworks.com">Emmanuel Cecchet</a>
38  * @version 1.0
39  */

40 public interface Backuper
41 {
42
43   //
44
// Backuper information
45
//
46

47   /**
48    * Returns a String representing the format handled by this Backuper. This
49    * field should be human readable and as detailed as possible so that no
50    * confusion can be made by the administrator.
51    *
52    * @return the Backuper specific format
53    */

54   String JavaDoc getDumpFormat();
55
56   /**
57    * Retrieve the backuper options that were used to initialize the backuper.
58    *
59    * @return the backuper options
60    * @see #setOptions(String)
61    */

62   String JavaDoc getOptions();
63
64   /**
65    * Options that can be set at backuper initialization. These options are
66    * provided in the definition of the Backuper element (see dtd).
67    *
68    * @param options Backuper specific options
69    */

70   void setOptions(String JavaDoc options);
71
72   //
73
// Backup/Restore operations
74
//
75

76   /**
77    * Create a backup from the content of a backend.
78    *
79    * @param backend the target backend to backup
80    * @param login the login to use to connect to the database for the backup
81    * operation
82    * @param password the password to use to connect to the database for the
83    * backup operation
84    * @param dumpName the name of the dump to create
85    * @param path the path where to store the dump
86    * @param tables the list of tables to backup, null means all tables
87    * @return the timestamp for the dump if the backup was sucessful, null
88    * otherwise
89    * @throws BackupException if the backup operation fails
90    */

91   Date JavaDoc backup(DatabaseBackend backend, String JavaDoc login, String JavaDoc password,
92       String JavaDoc dumpName, String JavaDoc path, ArrayList JavaDoc tables) throws BackupException;
93
94   /**
95    * Restore a dump on a specific backend.
96    *
97    * @param backend the target backend to restore to
98    * @param login the login to use to connect to the database for the restore
99    * operation
100    * @param password the password to use to connect to the database for the
101    * restore operation
102    * @param dumpName the name of the dump to restore
103    * @param path the path where to retrieve the dump
104    * @param tables the list of tables to restore, null means all tables
105    * @throws BackupException if the restore operation failed
106    */

107   void restore(DatabaseBackend backend, String JavaDoc login, String JavaDoc password,
108       String JavaDoc dumpName, String JavaDoc path, ArrayList JavaDoc tables) throws BackupException;
109
110   //
111
// Dump manipulation functions
112
//
113

114   /**
115    * Delete the specified dump.
116    *
117    * @param path the path where to retrieve the dump
118    * @param dumpName the dump to delete
119    * @throws BackupException if we failed to delete the dump
120    */

121   void deleteDump(String JavaDoc path, String JavaDoc dumpName) 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 JavaDoc path, String JavaDoc dumpName)
140       throws BackupException, IOException JavaDoc;
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 JavaDoc;
151
152 }
153
Popular Tags