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 Details

    • database

      GraphDatabaseService database(String databaseName) throws DatabaseNotFoundException
      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

      default void createDatabase(String databaseName) throws DatabaseExistsException
      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

      void startDatabase(String databaseName) throws DatabaseNotFoundException
      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

      void shutdownDatabase(String databaseName) throws DatabaseNotFoundException
      Shutdown database with provided name.
      Parameters:
      databaseName - name of the database.
      Throws:
      DatabaseNotFoundException - if no database with the given name is found.
    • listDatabases

      List<String> listDatabases()
      Returns:
      an alphabetically sorted list of all database names this database server manages.
    • registerDatabaseEventListener

      void registerDatabaseEventListener(DatabaseEventListener listener)
      Registers listener 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

      void unregisterDatabaseEventListener(DatabaseEventListener listener)
      Unregisters listener from the list of database event handlers. If listener hasn't been registered with registerDatabaseEventListener(DatabaseEventListener) prior to calling this method an IllegalStateException will be thrown. After a successful call to this method the listener will no longer receive any database events.
      Parameters:
      listener - the listener to receive events about database lifecycle.
      Throws:
      IllegalStateException - if listener wasn't registered prior to calling this method.
    • registerTransactionEventListener

      void registerTransactionEventListener(String databaseName, TransactionEventListener<?> listener)
      Registers listener 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 transactions
      listener - the listener to receive events about different states in transaction lifecycle.
    • unregisterTransactionEventListener

      void unregisterTransactionEventListener(String databaseName, TransactionEventListener<?> listener)
      Unregisters listener from the list of transaction event listeners. If handler hasn't been registered with registerTransactionEventListener(String, TransactionEventListener) prior to calling this method an IllegalStateException will be thrown. After a successful call to this method the listener will no longer receive any transaction events.
      Parameters:
      databaseName - name of the database to listener transactions
      listener - the listener to receive events about different states in transaction lifecycles.
      Throws:
      IllegalStateException - if listener wasn't registered prior to calling this method.
    • shutdown

      void shutdown()
      Shutdown database server.