Source code: com/virtuosotechnologies/asaph/xmldatabase/IndexedDatabaseFactory.java
1 /*
2 ================================================================================
3
4 FILE: IndexedDatabaseFactory.java
5
6 PROJECT:
7
8 Asaph
9
10 CONTENTS:
11
12 API for creating and connecting to indexed databases
13
14 PROGRAMMERS:
15
16 Daniel Azuma (DA) <dazuma@kagi.com>
17
18 COPYRIGHT:
19
20 Copyright (C) 2003 Daniel Azuma (dazuma@kagi.com)
21
22 This program is free software; you can redistribute it and/or
23 modify it under the terms of the GNU General Public License as
24 published by the Free Software Foundation; either version 2
25 of the License, or (at your option) any later version.
26
27 This program is distributed in the hope that it will be useful,
28 but WITHOUT ANY WARRANTY; without even the implied warranty of
29 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30 GNU General Public License for more details.
31
32 You should have received a copy of the GNU General Public
33 License along with this program; if not, write to
34 Free Software Foundation, Inc.
35 59 Temple Place, Suite 330
36 Boston, MA 02111-1307 USA
37
38 ================================================================================
39 */
40
41
42 package com.virtuosotechnologies.asaph.xmldatabase;
43
44
45 import java.io.IOException;
46 import java.io.File;
47 import java.net.URL;
48 import org.xml.sax.SAXException;
49 import org.xml.sax.ErrorHandler;
50
51 import com.virtuosotechnologies.asaph.model.SongDatabase;
52
53
54 /**
55 * API for creating and connecting to indexed databases
56 */
57 public interface IndexedDatabaseFactory
58 {
59 /**
60 * Name of this API
61 */
62 public static final String API_NAME = "com.virtuosotechnologies.asaph.xmldatabase.IndexedDatabaseFactory";
63
64
65 /**
66 * Create a new mutable indexed database rooted at the given directory.
67 *
68 * @param directory directory to create
69 * @return database created
70 * @exception IOException fatal error
71 * @exception SAXException fatal error
72 */
73 public SongDatabase createIndexedDatabase(
74 File directory)
75 throws
76 IOException,
77 SAXException;
78
79
80 /**
81 * Open a mutable indexed database backed by the filesystem at the given directory.
82 *
83 * @param directory indexed database to open
84 * @return database opened
85 * @exception IOException fatal error
86 * @exception SAXException fatal error
87 */
88 public SongDatabase openIndexedDatabase(
89 File directory)
90 throws
91 IOException,
92 SAXException;
93
94
95 /**
96 * Open an immutable indexed database backed by the given URL.
97 *
98 * @param url indexed database to open
99 * @param errorHandler handler for errors parsing the index file
100 * @return database opened
101 * @exception IOException fatal error
102 * @exception SAXException fatal error
103 */
104 public SongDatabase openIndexedDatabase(
105 URL url,
106 ErrorHandler errorHandler)
107 throws
108 IOException,
109 SAXException;
110
111
112 /**
113 * Is the given database an indexed database?
114 *
115 * @param database database to check
116 * @return true if it is an indexed database
117 */
118 public boolean isIndexedDatabase(
119 SongDatabase database);
120
121
122 /**
123 * Update a filesystem indexed database from version 0.3 to version 0.4.
124 * This will probably eventually go away.
125 *
126 * @param directory indexed database to update
127 * @exception IOException fatal error
128 * @exception SAXException fatal error
129 */
130 public void updateDatabase04(
131 File directory)
132 throws
133 IOException,
134 SAXException;
135 }