}
public void initDatabaseInstance() {
if (database == null) {
// OPEN IT
final OServerUserConfiguration replicatorUser = manager.getServerInstance().getUser(
ODistributedAbstractPlugin.REPLICATOR_USER);
database = (ODatabaseDocumentTx) manager.getServerInstance().openDatabase("document", databaseName, replicatorUser.name,
replicatorUser.password);
} else if (database.isClosed()) {
// DATABASE CLOSED, REOPEN IT
final OServerUserConfiguration replicatorUser = manager.getServerInstance().getUser(
ODistributedAbstractPlugin.REPLICATOR_USER);
database.open(replicatorUser.name, replicatorUser.password);
} else {
// After initialize database, create replicator user in DB and reset database with OSecurityShared instead of OSecurityNull