use of com.google.security.zynamics.binnavi.API.disassembly.DatabaseManager in project binnavi by google.
the class CAddressSpaceNodeMenuBuilder method getPluginAddressSpaces.
/**
* Returns the API address space objects for the address spaces for which the menu was built.
*
* @return The API address space objects.
*/
private List<AddressSpace> getPluginAddressSpaces() {
final DatabaseManager manager = PluginInterface.instance().getDatabaseManager();
for (final Database database : manager) {
if (database.getNative() == m_database) {
for (final Project project : database.getProjects()) {
if (project.getNative() == m_project) {
final List<AddressSpace> allSpaces = project.getAddressSpaces();
final List<AddressSpace> menuSpaces = new ArrayList<AddressSpace>();
for (final INaviAddressSpace addressSpace : m_addressSpaces) {
menuSpaces.add(ObjectFinders.getObject(addressSpace, allSpaces));
}
return menuSpaces;
}
}
}
}
throw new IllegalStateException("IE01159: Unknown database");
}
use of com.google.security.zynamics.binnavi.API.disassembly.DatabaseManager in project binnavi by google.
the class CModuleNodeMenuBuilder method getPluginModules.
/**
* Returns the API module objects for the modules for which the menu was built.
*
* @return The API module objects.
*/
private List<Module> getPluginModules() {
final DatabaseManager manager = PluginInterface.instance().getDatabaseManager();
for (final Database database : manager) {
if (database.getNative() == m_database) {
final List<Module> allModules = database.getModules();
final List<Module> menuModules = new ArrayList<Module>();
for (final INaviModule module : m_modules) {
menuModules.add(ObjectFinders.getObject(module, allModules));
}
return menuModules;
}
}
throw new IllegalStateException("IE01165: Unknown database");
}
use of com.google.security.zynamics.binnavi.API.disassembly.DatabaseManager in project binnavi by google.
the class CProjectNodeMenuBuilder method getPluginProjects.
/**
* Returns the API project objects for the projects for which the menu was built.
*
* @return The API project objects.
*/
private List<Project> getPluginProjects() {
final DatabaseManager manager = PluginInterface.instance().getDatabaseManager();
for (final Database database : manager) {
if (database.getNative() == m_database) {
final List<Project> allProjects = database.getProjects();
final List<Project> menuProjects = new ArrayList<Project>();
for (final INaviProject project : m_projects) {
menuProjects.add(ObjectFinders.getObject(project, allProjects));
}
return menuProjects;
}
}
throw new IllegalStateException("IE01168: Unknown database");
}
use of com.google.security.zynamics.binnavi.API.disassembly.DatabaseManager in project binnavi by google.
the class DatabaseManagerTest method testLifecycle.
@Test
public void testLifecycle() {
final MockDatabaseManagerListener listener = new MockDatabaseManagerListener();
final DatabaseManager manager = new DatabaseManager(CDatabaseManager.instance());
manager.addListener(listener);
manager.addDatabase("Description", "Driver", "Host", "Name", "User", "Password", "identity", true, false);
final IDatabase internalDatabase = CDatabaseManager.instance().iterator().next();
assertEquals("Description", internalDatabase.getConfiguration().getDescription());
assertEquals("Driver", internalDatabase.getConfiguration().getDriver());
assertEquals("User", internalDatabase.getConfiguration().getUser());
assertEquals("Password", internalDatabase.getConfiguration().getPassword());
assertTrue(internalDatabase.getConfiguration().isSavePassword());
assertFalse(internalDatabase.getConfiguration().isAutoConnect());
assertEquals(1, manager.getDatabases().size());
assertEquals("addedDatabase;", listener.events);
assertEquals("Database Manager ['Description']", manager.toString());
final Database database = manager.getDatabases().get(0);
manager.removeDatabase(database);
assertEquals(0, manager.getDatabases().size());
assertEquals("addedDatabase;removedDatabase;", listener.events);
manager.removeListener(listener);
}
Aggregations