Package org.neo4j.dbms.api
Interface DatabaseManagementService
- All Known Implementing Classes:
EnterpriseDatabaseManagementService
public interface DatabaseManagementService
The
DatabaseManagementService
provides an API to manage databases and provided access to the managed database services.-
Method Summary
Modifier and TypeMethodDescriptiondefault void
createDatabase
(String databaseName) Create a new database.void
createDatabase
(String databaseName, Configuration databaseSpecificSettings) Create a new database.Retrieve a database service by name.void
dropDatabase
(String databaseName) Drop a database by name.void
Registerslistener
as a listener for database events.void
registerTransactionEventListener
(String databaseName, TransactionEventListener<?> listener) Registerslistener
as a listener for transaction events which are generated from different places in the lifecycle of each transaction in particular database.void
shutdown()
Shutdown database server.void
shutdownDatabase
(String databaseName) Shutdown database with provided name.void
startDatabase
(String databaseName) Starts a already existing database.void
Unregisterslistener
from the list of database event handlers.void
unregisterTransactionEventListener
(String databaseName, TransactionEventListener<?> listener) Unregisterslistener
from the list of transaction event listeners.
-
Method Details
-
database
Retrieve a database service by name.- Parameters:
databaseName
- name of the database.- Returns:
- the database service with the provided name
- Throws:
DatabaseNotFoundException
- if no database service with the given name is found.
-
createDatabase
Create a new database.- Parameters:
databaseName
- name of the database.- Throws:
DatabaseExistsException
- if a database with the provided name already exists
-
createDatabase
void createDatabase(String databaseName, Configuration databaseSpecificSettings) throws DatabaseExistsException Create a new database.- Parameters:
databaseName
- name of the database.databaseSpecificSettings
- settings that are specific to this database. Only a sub-set of settings are supported TODO.- Throws:
DatabaseExistsException
- if a database with the provided name already exists
-
dropDatabase
void dropDatabase(String databaseName) throws DatabaseNotFoundException, DatabaseAliasExistsException Drop a database by name. All data stored in the database will be deleted as well.- Parameters:
databaseName
- name of the database to drop.- Throws:
DatabaseNotFoundException
- if no database with the given name is found.DatabaseAliasExistsException
- if the database exists but has an alias.
-
startDatabase
Starts a already existing database.- Parameters:
databaseName
- name of the database to start.- Throws:
DatabaseNotFoundException
- if no database with the given name is found.
-
shutdownDatabase
Shutdown database with provided name.- Parameters:
databaseName
- name of the database.- Throws:
DatabaseNotFoundException
- if no database with the given name is found.
-
listDatabases
- Returns:
- an alphabetically sorted list of all database names this database server manages.
-
registerDatabaseEventListener
Registerslistener
as a listener for database events. If the specified listener instance has already been registered this method will do nothing.- Parameters:
listener
- the listener to receive events about different states in the database lifecycle.
-
unregisterDatabaseEventListener
Unregisterslistener
from the list of database event handlers. Iflistener
hasn't been registered withregisterDatabaseEventListener(DatabaseEventListener)
prior to calling this method anIllegalStateException
will be thrown. After a successful call to this method thelistener
will no longer receive any database events.- Parameters:
listener
- the listener to receive events about database lifecycle.- Throws:
IllegalStateException
- iflistener
wasn't registered prior to calling this method.
-
registerTransactionEventListener
Registerslistener
as a listener for transaction events which are generated from different places in the lifecycle of each transaction in particular database. To guarantee that the handler gets all events properly it shouldn't be registered when the application is running (i.e. in the middle of one or more transactions). If the specified handler instance has already been registered this method will do nothing.- Parameters:
databaseName
- name of the database to listener transactionslistener
- the listener to receive events about different states in transaction lifecycle.
-
unregisterTransactionEventListener
Unregisterslistener
from the list of transaction event listeners. Ifhandler
hasn't been registered withregisterTransactionEventListener(String, TransactionEventListener)
prior to calling this method anIllegalStateException
will be thrown. After a successful call to this method thelistener
will no longer receive any transaction events.- Parameters:
databaseName
- name of the database to listener transactionslistener
- the listener to receive events about different states in transaction lifecycles.- Throws:
IllegalStateException
- iflistener
wasn't registered prior to calling this method.
-
shutdown
void shutdown()Shutdown database server.
-