{
if (StringUtils.isEmpty(getName()))
{
throw new DatabaseException(messages.databaseInvalidNameDBError(getName()));
}
IDBDeleteDBRequest deleteDatabase = IDBFactory.get().deleteDatabase(getName());
deleteDatabase.onSuccess(new IDBDatabaseDeleteEvent.Handler()
{
@Override
public void onDelete(IDBDatabaseDeleteEvent event)
{
db = null;
if (callback != null)
{
callback.onSuccess();
}
}
});
deleteDatabase.onBlocked(new IDBBlockedEvent.Handler()
{
@Override
public void onBlocked(IDBBlockedEvent event)
{
String message = messages.databaseBlocked(getName());
if (LogConfiguration.loggingIsEnabled())
{
logger.log(Level.SEVERE, message);
}
if (callback != null)
{
callback.onError(message);
}
else if (errorHandler != null)
{
errorHandler.onError(message);
}
}
});
deleteDatabase.onError(new IDBErrorEvent.Handler()
{
@Override
public void onError(IDBErrorEvent event)
{
String message = messages.databaseDeleteError(getName(), event.getName());