Modifier and Type | Method and Description |
---|---|
void |
addConnectionListener(Connection.ConnectionListener listener)
Registers the supplied ConnectionListener to be notified when the status
of the database connection changes.
|
void |
connect()
|
static DbService |
create(String username,
String password,
String dbUrl)
Factory method for creating a DbService instance.
|
void |
disconnect()
Disconnects from
Storage . |
String |
getConnectionUrl() |
void |
removeConnectionListener(Connection.ConnectionListener listener)
Unregisters the supplied ConnectionListener if it was previously
registered via
#addConnectionListener(ConnectionListener) . |
public void connect() throws ConnectionException
DbService
Storage
and registers Storage
instance which
was used for the connection as a service.
connect
in interface DbService
ConnectionException
- If DB connection cannot be established.public void disconnect() throws ConnectionException
DbService
Storage
.
disconnect
in interface DbService
ConnectionException
public String getConnectionUrl()
getConnectionUrl
in interface DbService
public static DbService create(String username, String password, String dbUrl) throws StorageException
username
- password
- dbUrl
- StorageException
- if no storage provider exists for the given dbUrl
.public void addConnectionListener(Connection.ConnectionListener listener)
DbService
addConnectionListener
in interface DbService
listener
- - the listener to be registeredpublic void removeConnectionListener(Connection.ConnectionListener listener)
DbService
#addConnectionListener(ConnectionListener)
.removeConnectionListener
in interface DbService
listener
- - the listener to be unregisteredCopyright © 2014. All rights reserved.