use of com.google.security.zynamics.binnavi.Database.Interfaces.IDatabaseListener in project binnavi by google.
the class CDatabaseConfiguration method setUser.
/**
* Changes the user name that is used to connect to the database.
*
* @param user The new user name.
*
* @throws IllegalArgumentException Thrown if the given user name is invalid.
*/
public void setUser(final String user) {
Preconditions.checkNotNull(user, "IE00692: Database user can not be null");
if (user.equals(getUser())) {
return;
}
m_user = user;
for (final IDatabaseListener listener : m_listeners) {
try {
listener.changedUser(m_database, user);
} catch (final Exception exception) {
CUtilityFunctions.logException(exception);
}
}
}
use of com.google.security.zynamics.binnavi.Database.Interfaces.IDatabaseListener in project binnavi by google.
the class CDatabaseContent method delete.
@Override
public void delete(final INaviModule module) throws CouldntDeleteException {
Preconditions.checkNotNull(module, "IE00670: Module can not be null");
Preconditions.checkArgument(m_database.isConnected(), "IE00671: Database must be connected before you can delete modules");
Preconditions.checkArgument(m_database.isLoaded(), "IE00672: Database must be loaded before you can delete modules");
Preconditions.checkArgument(m_modules.contains(module), "IE00673: Module does not belong to this database");
m_provider.deleteModule(module);
m_modules.remove(module);
for (final IDatabaseListener listener : m_listeners) {
try {
listener.deletedModule(m_database, module);
} catch (final Exception exception) {
CUtilityFunctions.logException(exception);
}
}
removeDeletedModuleFromNamespaces(module);
}
use of com.google.security.zynamics.binnavi.Database.Interfaces.IDatabaseListener in project binnavi by google.
the class CDatabaseContent method refreshRawModules.
@Override
public void refreshRawModules() throws CouldntLoadDataException {
Preconditions.checkArgument(m_database.isConnected(), "IE00687: Not connected to the database");
Preconditions.checkArgument(m_database.isLoaded(), "IE00688: Raw modules were not loaded previously");
final List<INaviRawModule> oldModules = m_rawModules;
final List<INaviRawModule> refreshedModules = m_provider.loadRawModules();
m_rawModules.clear();
m_rawModules.addAll(refreshedModules);
final List<INaviModule> newModules = initializeRawModules(m_modules, refreshedModules);
for (final IDatabaseListener listener : m_listeners) {
try {
listener.changedRawModules(m_database, oldModules, refreshedModules);
} catch (final Exception exception) {
CUtilityFunctions.logException(exception);
}
}
for (final INaviModule naviModule : newModules) {
for (final IDatabaseListener listener : m_listeners) {
try {
listener.addedModule(m_database, naviModule);
} 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 setName.
/**
* Changes the database name.
*
* @param name The new database name.
*/
public void setName(final String name) {
Preconditions.checkNotNull(name, "IE00159: Database name can not be null");
if (name.equals(m_name)) {
return;
}
m_name = name;
for (final IDatabaseListener listener : m_listeners) {
try {
listener.changedName(m_database, name);
} 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 setHost.
/**
* Changes the database host.
*
* @param host The new host value.
*/
public void setHost(final String host) {
Preconditions.checkNotNull(host, "IE00040: Database host can not be null");
if (host.equals(m_host)) {
return;
}
m_host = host;
for (final IDatabaseListener listener : m_listeners) {
try {
listener.changedHost(m_database, host);
} catch (final Exception exception) {
CUtilityFunctions.logException(exception);
}
}
}
Aggregations