use of com.google.security.zynamics.binnavi.Database.Interfaces.IDatabaseListener in project binnavi by google.
the class CDatabase method load.
@Override
public void load() throws CouldntLoadDataException, InvalidDatabaseVersionException, LoadCancelledException {
Preconditions.checkArgument(isConnected(), "IE00686: Not connected to the database");
try {
if (!loadReporter.report(LoadEvents.LOADING_DATABASE)) {
throw new LoadCancelledException();
}
if (!loadReporter.report(LoadEvents.DETERMINING_DATABASE_VERSION)) {
throw new LoadCancelledException();
}
final DatabaseVersion databaseVersion = provider.getDatabaseVersion();
final DatabaseVersion currentVersion = new DatabaseVersion(Constants.PROJECT_VERSION);
if ((databaseVersion.compareTo(currentVersion) != 0) && currentVersion.needsUpgrading(databaseVersion)) {
throw new InvalidDatabaseVersionException(databaseVersion);
}
if (!loadReporter.report(LoadEvents.LOADING_USERS)) {
throw new LoadCancelledException();
}
loadUserManager();
if (!loadReporter.report(LoadEvents.LOADING_VIEW_TAGS)) {
throw new LoadCancelledException();
}
final CTagManager viewTagManager = loadViewTagManager();
if (!loadReporter.report(LoadEvents.LOADING_NODE_TAGS)) {
throw new LoadCancelledException();
}
final CTagManager nodeTagManager = loadNodeTagManager();
if (!loadReporter.report(LoadEvents.LOADING_DEBUGGERS)) {
throw new LoadCancelledException();
}
final DebuggerTemplateManager debuggerDescriptionManager = provider.loadDebuggers();
if (!loadReporter.report(LoadEvents.LOADING_PROJECTS)) {
throw new LoadCancelledException();
}
final List<INaviProject> projects = provider.loadProjects();
if (!loadReporter.report(LoadEvents.LOADING_RAW_MODULES)) {
throw new LoadCancelledException();
}
final List<INaviRawModule> rawModules = provider.loadRawModules();
if (!loadReporter.report(LoadEvents.LOADING_MODULES)) {
throw new LoadCancelledException();
}
final List<INaviModule> modules = provider.loadModules();
debuggerDescriptionManager.addListener(internalDebuggerTemplateListener);
content = new CDatabaseContent(provider, this, listeners, projects, modules, rawModules, viewTagManager, nodeTagManager, debuggerDescriptionManager);
} catch (final CouldntLoadDataException exception) {
loadReporter.report(LoadEvents.LOADING_FINISHED);
close();
throw exception;
} catch (final InvalidDatabaseVersionException exception) {
loadReporter.report(LoadEvents.LOADING_FINISHED);
throw exception;
} catch (final LoadCancelledException exception) {
loadReporter.report(LoadEvents.LOADING_FINISHED);
close();
throw exception;
} finally {
isLoading = false;
}
content.initializeRawModules(content.getModules(), content.getRawModules());
for (final IDatabaseListener listener : listeners) {
try {
listener.loadedDatabase(this);
} catch (final Exception exception) {
CUtilityFunctions.logException(exception);
}
}
loadReporter.report(LoadEvents.LOADING_FINISHED);
}
use of com.google.security.zynamics.binnavi.Database.Interfaces.IDatabaseListener in project binnavi by google.
the class CDatabaseConfiguration method setDriver.
/**
* Changes the driver that is used to connect to the database.
*
* @param driver The new driver string.
*
* @throws IllegalArgumentException Thrown if the given driver is invalid.
*/
public void setDriver(final String driver) {
Preconditions.checkNotNull(driver, "IE00690: Database driver can not be null");
if (driver.equals(getDriver())) {
return;
}
m_driver = driver;
for (final IDatabaseListener listener : m_listeners) {
try {
listener.changedDriver(m_database, driver);
} catch (final Exception exception) {
CUtilityFunctions.logException(exception);
}
}
}
use of com.google.security.zynamics.binnavi.Database.Interfaces.IDatabaseListener in project binnavi by google.
the class CDatabaseConfiguration method setDescription.
/**
* Changes the description of the database.
*
* @param description The new description of the database.
*
* @throws IllegalArgumentException Thrown if the given description is invalid.
*/
public void setDescription(final String description) {
Preconditions.checkNotNull(description, "IE00689: Database description can not be null");
if (description.equals(m_description)) {
return;
}
m_description = description;
for (final IDatabaseListener listener : m_listeners) {
try {
listener.changedDescription(m_database, description);
} catch (final Exception exception) {
CUtilityFunctions.logException(exception);
}
}
}
use of com.google.security.zynamics.binnavi.Database.Interfaces.IDatabaseListener in project binnavi by google.
the class CDatabaseConfiguration method setPassword.
/**
* Changes the password that is used to connect to the database.
*
* @param password The new password.
*
* @throws IllegalArgumentException Thrown if the given password is invalid.
*/
public void setPassword(final String password) {
Preconditions.checkNotNull(password, "IE00691: Database password can not be null");
if (password.equals(getPassword())) {
return;
}
m_password = password;
for (final IDatabaseListener listener : m_listeners) {
try {
listener.changedPassword(m_database, password);
} catch (final Exception exception) {
CUtilityFunctions.logException(exception);
}
}
}
use of com.google.security.zynamics.binnavi.Database.Interfaces.IDatabaseListener in project binnavi by google.
the class CDatabaseConfiguration method setIdentity.
/**
* Changes the identity of the current user in this database.
*
* @param identity The new identity of the user.
*/
public void setIdentity(final String identity) {
Preconditions.checkNotNull(identity, "IE00067: identity argument can not be null");
if (identity.equals(m_identity)) {
return;
}
m_identity = identity;
for (final IDatabaseListener listener : m_listeners) {
try {
listener.changedIdentity(m_database, identity);
} catch (final Exception exception) {
CUtilityFunctions.logException(exception);
}
}
}
Aggregations