KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > blandware > atleap > persistence > core > BackupDAO


1 /*
2  * Copyright 2004 Blandware (http://www.blandware.com)
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package com.blandware.atleap.persistence.core;
17
18 import com.blandware.atleap.common.util.PartialCollection;
19 import com.blandware.atleap.common.util.QueryInfo;
20 import com.blandware.atleap.persistence.exception.BackupFileAccessException;
21
22 import java.util.Date JavaDoc;
23
24 /**
25  * <p>DAO for performing backup/restore database operations</p>
26  * <p/>
27  * <p><a HREF="BackupDAO.java.htm"><i>View Source</i></a></p>
28  *
29  * @author Andrey Grebnev <a HREF="mailto:andrey.grebnev@blandware.com">&lt;andrey.grebnev@blandware.com&gt;</a>
30  * @version $Revision: 1.4 $ $Date: 2006/03/25 09:04:40 $
31  */

32 public interface BackupDAO extends DAO {
33
34     /**
35      * Backup database into file
36      */

37     public void backup() throws BackupFileAccessException;
38
39     /**
40      * <p>
41      * Restores database from archive specified by date. If date is null we will try to restore from initial xml resource
42      * e.g. initial-data.xml
43      * </p>
44      * <p>
45      * If <b>force</b> is <code>false</code>, then, if tables already exist,
46      * nothing will be made at all: all data will remain untouched in database.
47      * </p>
48      *
49      * @param date date of archive
50      * @param force if it is <code>false</code> we will create tables and load data only if tables do not exist. If it is <code>true</code>
51      * we will drop and create tables and load data.
52      */

53     public void restore(Date JavaDoc date, Boolean JavaDoc force) throws BackupFileAccessException;
54
55     /**
56      * Returns whether list of archives is accessible or not (due to directory
57      * permissions, for example)
58      *
59      * @return whether list of archives is accessible
60      */

61     public boolean canListArchives();
62
63     /**
64      * Retrieves filtered/sorted collection of archives.
65      *
66      * @param queryInfo Object that contains information about how to filter and sort data
67      * @return Collection of archives' dates
68      */

69     public PartialCollection listArchives(QueryInfo queryInfo) throws BackupFileAccessException;
70
71     /**
72      * Tries to create a dbbackup directory if it does not exist
73      *
74      * @return true if dbbackup directory already exists or was created
75      * successfully.
76      */

77     public boolean createDirIfNotExists();
78 }
79
Popular Tags