com.ikokoon.serenity.persistence
Class IDataBase.DataBaseManager

java.lang.Object
  extended by com.ikokoon.serenity.persistence.IDataBase.DataBaseManager
Enclosing interface:
IDataBase

public static class IDataBase.DataBaseManager
extends java.lang.Object

This class manages the databases if there are more than one. It also listens to events that the databases might throw like a close and so on.

Since:
12.08.09
Version:
01.00
Author:
Michael Couck

Constructor Summary
IDataBase.DataBaseManager()
           
 
Method Summary
static void addDataBaseListener(java.lang.String dataBaseFile, IDataBaseListener dataBaseListener)
           
static void fireDataBaseEvent(java.lang.String dataBaseFile, IDataBaseEvent dataBaseEvent)
           
static
<E extends IDataBase>
IDataBase
getDataBase(java.lang.Class<E> klass, java.lang.String dataBaseFile, IDataBase internalDataBase)
          Accesses a database.
static java.util.Map<java.lang.String,IDataBase> getDataBases()
          Access to all the databases in the current VM.
static void removeDataBaseListener(java.lang.String dataBaseFile, IDataBaseListener dataBaseListener)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IDataBase.DataBaseManager

public IDataBase.DataBaseManager()
Method Detail

getDataBases

public static java.util.Map<java.lang.String,IDataBase> getDataBases()
Access to all the databases in the current VM.

Returns:
all the databases

getDataBase

public static final <E extends IDataBase> IDataBase getDataBase(java.lang.Class<E> klass,
                                                                java.lang.String dataBaseFile,
                                                                IDataBase internalDataBase)
Accesses a database. In the case the database is not open one will be instantiated on the database file specified. In the case the database is open but not the right type of database, the old one will be closed and the new one will be opened on the database file, otherwise the database is returned.

Type Parameters:
E - the database type
Parameters:
klass - the class of database to initialise
dataBaseFile - the database file to open the database on
create - whether to create a new database, i.e. deleting the old database file and creating a new one
Returns:
the database

addDataBaseListener

public static void addDataBaseListener(java.lang.String dataBaseFile,
                                       IDataBaseListener dataBaseListener)

removeDataBaseListener

public static void removeDataBaseListener(java.lang.String dataBaseFile,
                                          IDataBaseListener dataBaseListener)

fireDataBaseEvent

public static void fireDataBaseEvent(java.lang.String dataBaseFile,
                                     IDataBaseEvent dataBaseEvent)


Copyright © 2010. All Rights Reserved.