|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
The song database manager API exported by the maingui plugin.
This API has some thread-safe methods and some methods that must be called from the AWT/Swing thread. See the individual method documentation for specifics.
Field Summary | |
static ClassConstrainedKey |
DATABASE_DIRTY_KEY
Database property for the dirty bit. |
static ClassConstrainedKey |
DATABASE_ICON_KEY
Database property for the database icon. |
static ClassConstrainedKey |
DATABASE_IDENTIFIER_KEY
Database property for the database identifier. |
static ClassConstrainedKey |
DATABASE_NAME_KEY
Database property for the database name. |
Method Summary | |
void |
addDatabaseListener(DatabaseListener listener)
Add a DatabaseListener to the main gui. |
DatabaseIdentifier |
createDatabaseIdentifier(String connectorName,
String locator)
Create a new DatabaseIdentifier from a connector name and a locator string. |
URI |
databaseIdentifierToURI(DatabaseIdentifier di)
Create an URI for a DatabaseIdentifier. |
PropertySet |
getDatabaseProperties(SongDatabase database)
Get a PropertySet providing a view of the properties of the given database. |
ObjectSet |
getOpenDatabaseSet()
Get an ObjectSet view of the open databases. |
DatabaseController |
openDatabase(SongDatabase database,
PropertySet properties,
DatabaseHandler handler)
Add a database to the list of open databases. |
SongDatabase |
openIdentifiedDatabase(DatabaseIdentifier identifier)
Attempt to open the SongDatabase referenced by the given identifier. |
void |
registerDatabaseConnector(String name,
StringID version,
DatabaseConnector connector)
Register a database connector. |
void |
removeDatabaseListener(DatabaseListener listener)
Remove a DatabaseListener from the main gui. |
boolean |
setDatabaseDirtyBit(SongDatabase database)
Set the dirty bit for a SongDatabase. |
DatabaseConnector |
unregisterDatabaseConnector(String name,
StringID version)
Unregister a database connector. |
DatabaseIdentifier |
uriToDatabaseIdentifier(URI uri)
Create a new DatabaseIdentifier from an URI. |
Field Detail |
public static final ClassConstrainedKey DATABASE_DIRTY_KEY
public static final ClassConstrainedKey DATABASE_NAME_KEY
public static final ClassConstrainedKey DATABASE_ICON_KEY
public static final ClassConstrainedKey DATABASE_IDENTIFIER_KEY
Method Detail |
public void registerDatabaseConnector(String name, StringID version, DatabaseConnector connector) throws DuplicateConnectorException
This method is fully synchronized and thread-safe.
name
- unique name for the connector. This name serves as a serializable
reference to the connector.
Characters allowed include alphanumeric characters, ".", "_" and "$".version
- a version number.connector
- the DatabaseConnector to register
DuplicateConnectorNameException
- tried to register a duplicate connector
with the same name and version.
DuplicateConnectorException
public DatabaseConnector unregisterDatabaseConnector(String name, StringID version)
This method is fully synchronized and thread-safe.
name
- unique name for the connector.version
- a version number.
public DatabaseController openDatabase(SongDatabase database, PropertySet properties, DatabaseHandler handler)
This method is not thread-safe, and should only be called from the AWT/Swing thread.
database
- the database to openproperties
- initial properties for the databasehandler
- a DatabaseHandler for the database
public ObjectSet getOpenDatabaseSet()
This method is not thread-safe, and should only be called from the AWT/Swing thread. The returned ObjectSet is similarly not thread-safe and should only be accessed from the AWT/Swing thread.
public PropertySet getDatabaseProperties(SongDatabase database)
This method is not thread-safe, and should only be called from the AWT/Swing thread. The returned PropertySet is similarly not thread-safe and should only be accessed from the AWT/Swing thread.
database
- SongDatabase to query
IllegalArgumentException
- the given database is not openpublic boolean setDatabaseDirtyBit(SongDatabase database)
This method is not thread-safe, and should only be called from the AWT/Swing thread.
database
- SongDatabase to mark dirty
IllegalArgumentException
- the given database is not openpublic DatabaseIdentifier createDatabaseIdentifier(String connectorName, String locator)
This method is fully synchronized and thread-safe.
connectorName
- Connector name.
Characters allowed include alphanumeric characters, ".", "_" and "$".locator
- Locator string.
public DatabaseIdentifier uriToDatabaseIdentifier(URI uri) throws URISyntaxException
This method is fully synchronized and thread-safe.
uri
- the URI to parse.
URISyntaxException
- unable to parse the URIpublic URI databaseIdentifierToURI(DatabaseIdentifier di) throws URISyntaxException
This method is fully synchronized and thread-safe.
di
- the DatabaseIdentifier.
URISyntaxException
- unable to build URIpublic SongDatabase openIdentifiedDatabase(DatabaseIdentifier identifier) throws SongDatabaseFailedException, UnrecognizedDatabaseIdentifierException
This method is fully synchronized and thread-safe. Note that because it may be time-consuming, this method should normally be called off the gui thread (e.g. in an AsyncJob).
identifier
- identifier for the database to open
SongDatabaseFailedException
- an error occurred while opening the database.
This will usually have a cause exception, such as IOException or SQLException.
UnrecognizedDatabaseIdentifierException
- no connector agreed to open the databasepublic void addDatabaseListener(DatabaseListener listener)
This method is fully synchronized and thread-safe.
listener
- DatabaseListenerpublic void removeDatabaseListener(DatabaseListener listener)
This method is fully synchronized and thread-safe.
listener
- DatabaseListener
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |