com.virtuosotechnologies.asaph.xmldatabase
Interface IndexedDatabaseFactory


public interface IndexedDatabaseFactory

API for creating and connecting to indexed databases.

This API is fully synchronized and thread-safe.


Field Summary
static StringID CURRENT_INDEX_XML_FORMAT_CODE
          The format code given to the indexes of databases created by this factory.
 
Method Summary
 SongDatabase createIndexedDatabase(File directory)
          Create a new mutable indexed database rooted at the given directory.
 StringID getDatabaseIndexXMLFormatCode(SongDatabase database)
          Return the format code for the given SongDatabase index.
 boolean isIndexedDatabase(SongDatabase database)
          Is the given database an indexed database?
 SongDatabase openIndexedDatabase(File directory)
          Open a mutable indexed database backed by the filesystem at the given directory.
 SongDatabase openIndexedDatabase(URL url, ErrorHandler errorHandler)
          Open an immutable indexed database backed by the given URL.
 

Field Detail

CURRENT_INDEX_XML_FORMAT_CODE

public static final StringID CURRENT_INDEX_XML_FORMAT_CODE
The format code given to the indexes of databases created by this factory.

Method Detail

createIndexedDatabase

public SongDatabase createIndexedDatabase(File directory)
                                   throws IOException,
                                          SAXException
Create a new mutable indexed database rooted at the given directory.

Parameters:
directory - directory to create
Returns:
database created
Throws:
IOException - fatal error
SAXException - fatal error

openIndexedDatabase

public SongDatabase openIndexedDatabase(File directory)
                                 throws IOException,
                                        SAXException
Open a mutable indexed database backed by the filesystem at the given directory.

Parameters:
directory - indexed database to open
Returns:
database opened
Throws:
IOException - fatal error
SAXException - fatal error

openIndexedDatabase

public SongDatabase openIndexedDatabase(URL url,
                                        ErrorHandler errorHandler)
                                 throws IOException,
                                        SAXException
Open an immutable indexed database backed by the given URL.

Parameters:
url - indexed database to open
errorHandler - handler for errors parsing the index file
Returns:
database opened
Throws:
IOException - fatal error
SAXException - fatal error

isIndexedDatabase

public boolean isIndexedDatabase(SongDatabase database)
Is the given database an indexed database?

Parameters:
database - database to check
Returns:
true if it is an indexed database

getDatabaseIndexXMLFormatCode

public StringID getDatabaseIndexXMLFormatCode(SongDatabase database)
Return the format code for the given SongDatabase index. This is an indication of the format of the xml last associated with the index of this database. If the index is newly parsed from xml, this is the format given by that xml file. If the index was most recently unparsed to xml, this is the format written. If the index has never been associated with xml (i.e. it has been newly created as an empty database, or the index file was missing), this method will return null. The database must be an indexed SongDatabase.

Parameters:
database - SongDatabase to query
Returns:
the format code for the index, or null
Throws:
IllegalArgumentException - the song isn't a simple SongDatabase