Interface ConnectionManager<T>
-
- Type Parameters:
T
- The type of database handler being used. In the default implementation using Neo4J, this is a GraphDatabaseService instance
- All Known Implementing Classes:
ConnectionManagerImpl
public interface ConnectionManager<T>
Interface providing the general methods to manage the db/backend connection- Author:
- Adrian Martinez Molina <adrian.martinez@kuwaiba.org>
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
closeConnection()
Closes the connection with the databasevoid
commitTransaction()
Commits the current transaction (if supported by the backend)String
getConnectionDetails()
Textual description a bout the connectionT
getConnectionHandler()
Returns the connection handler, which depends on the kind of backed being used.List<ConnectionManager>
getConnectionPool()
Gets the list of spawned connectionsboolean
isSpawned()
Tells if the current manager is one spawned from another.void
openConnection()
Opens a database connection (an probably initialize the connection handler)void
rollbackTransaction()
Rolls back the current transaction (if supported by the backend)void
setConfiguration(Properties properties)
Sets the properties necessary to establish and manage the connection with the database (login, passwd, hostname, etc).void
shutDown()
Releases the resources associated to this ConnectionManager, assuming that closeConnection didn't do it completely.ConnectionManager
spawnConnection()
Creates a new connection from the original onevoid
startTransaction()
Starts a transaction (if supported by the backend)
-
-
-
Method Detail
-
openConnection
void openConnection() throws ConnectionException
Opens a database connection (an probably initialize the connection handler)- Throws:
ConnectionException
- If the attempt to open the connection to the database failed
-
closeConnection
void closeConnection()
Closes the connection with the database
-
startTransaction
void startTransaction()
Starts a transaction (if supported by the backend)
-
commitTransaction
void commitTransaction()
Commits the current transaction (if supported by the backend)
-
rollbackTransaction
void rollbackTransaction()
Rolls back the current transaction (if supported by the backend)
-
spawnConnection
ConnectionManager spawnConnection()
Creates a new connection from the original one- Returns:
- Another connection manager
-
isSpawned
boolean isSpawned()
Tells if the current manager is one spawned from another.- Returns:
-
getConnectionPool
List<ConnectionManager> getConnectionPool()
Gets the list of spawned connections- Returns:
- The list of spawned connections
-
getConnectionHandler
T getConnectionHandler()
Returns the connection handler, which depends on the kind of backed being used.- Returns:
-
shutDown
void shutDown()
Releases the resources associated to this ConnectionManager, assuming that closeConnection didn't do it completely.
-
getConnectionDetails
String getConnectionDetails()
Textual description a bout the connection- Returns:
-
setConfiguration
void setConfiguration(Properties properties)
Sets the properties necessary to establish and manage the connection with the database (login, passwd, hostname, etc). It is typically called before openConnection- Parameters:
properties
- A properties object with the pairs name-value of all properties to be set.
-
-