01: /*
02: This file is part of BORG.
03:
04: BORG is free software; you can redistribute it and/or modify
05: it under the terms of the GNU General Public License as published by
06: the Free Software Foundation; either version 2 of the License, or
07: (at your option) any later version.
08:
09: BORG is distributed in the hope that it will be useful,
10: but WITHOUT ANY WARRANTY; without even the implied warranty of
11: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12: GNU General Public License for more details.
13:
14: You should have received a copy of the GNU General Public License
15: along with BORG; if not, write to the Free Software
16: Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17:
18: Copyright 2003 by Mike Berger
19: */
20:
21: package net.sf.borg.model.db.file;
22:
23: import java.util.Collection;
24:
25: import net.sf.borg.model.BorgOption;
26: import net.sf.borg.model.beans.KeyedBean;
27: import net.sf.borg.model.db.BeanDB;
28:
29: /**
30: * Helps create a <code>FileBeanDB</code>.
31: */
32: abstract class FileDBCreator implements BeanDB {
33: abstract void init(String file, boolean shared) throws Exception;
34:
35: // BeanDB delegate methods
36: public final void addObj(KeyedBean bean, boolean crypt)
37: throws Exception {
38: db_.addObj(bean, crypt);
39: }
40:
41: public final void close() throws Exception {
42: db_.close();
43: }
44:
45: public final void delete(int key) throws Exception {
46: db_.delete(key);
47: }
48:
49: public final String getOption(String oname) throws Exception {
50: return db_.getOption(oname);
51: }
52:
53: public final Collection getOptions() throws Exception {
54: return db_.getOptions();
55: }
56:
57: public final int nextkey() throws Exception {
58: return db_.nextkey();
59: }
60:
61: public final KeyedBean newObj() {
62: return db_.newObj();
63: }
64:
65: public final Collection readAll() throws Exception {
66: return db_.readAll();
67: }
68:
69: public final KeyedBean readObj(int key) throws Exception {
70: return db_.readObj(key);
71: }
72:
73: public final void setOption(BorgOption option) throws Exception {
74: db_.setOption(option);
75: }
76:
77: public final boolean isDirty() throws Exception {
78: return db_.isDirty();
79: }
80:
81: public final void sync() {
82: db_.sync();
83: }
84:
85: public final void updateObj(KeyedBean bean, boolean crypt)
86: throws Exception {
87: db_.updateObj(bean, crypt);
88: }
89:
90: // protected //
91: protected BeanDB db_;
92: }
|