use of com.google.security.zynamics.binnavi.Database.CDatabase in project binnavi by google.
the class CDatabaseFunctions method addNewDatabase.
/**
* Adds a new database with default information to the list of known databases.
*
* @param projectTree Project tree of the main window.
*/
public static void addNewDatabase(final JTree projectTree) {
final CDatabase newDatabase = new CDatabase("New Database", CJdbcDriverNames.jdbcPostgreSQLDriverName, "localhost", "new_database", "user", "password", "identity", false, false);
CDatabaseManager.instance().addDatabase(newDatabase);
CNodeExpander.setSelectionPath(projectTree, newDatabase);
}
use of com.google.security.zynamics.binnavi.Database.CDatabase in project binnavi by google.
the class PostgreSQLNotificationProviderTest method setUp.
@Before
public void setUp() throws IOException, CouldntLoadDriverException, CouldntConnectException, IllegalStateException, CouldntLoadDataException, InvalidDatabaseException, CouldntInitializeDatabaseException, InvalidExporterDatabaseFormatException, LoadCancelledException, CPartialLoadException, InvalidDatabaseVersionException {
final String[] parts = CConfigLoader.loadPostgreSQL();
databaseOne = new CDatabase("DATABASEONE", CJdbcDriverNames.jdbcPostgreSQLDriverName, parts[0], "test_disassembly", parts[1], parts[2], parts[3], false, false);
databaseOne.connect();
databaseOne.load();
databaseOneModuleTwo = databaseOne.getContent().getModule(2);
databaseOneModuleTwo.load();
databaseOneFunction = databaseOneModuleTwo.getContent().getFunctionContainer().getFunction(new CAddress("7C880394", 16));
databaseOneView = databaseOneModuleTwo.getContent().getViewContainer().getView(databaseOneFunction);
databaseOneView.load();
databaseTwo = new CDatabase("DATABASETWO", CJdbcDriverNames.jdbcPostgreSQLDriverName, parts[0], "test_disassembly", parts[1], parts[2], parts[3], false, false);
databaseTwo.connect();
databaseTwo.load();
databaseTwoModuleTwo = databaseTwo.getContent().getModule(2);
databaseTwoModuleTwo.load();
databaseTwoFunction = databaseTwoModuleTwo.getContent().getFunctionContainer().getFunction(new CAddress("7C880394", 16));
databaseTwoView = databaseTwoModuleTwo.getContent().getViewContainer().getView(databaseTwoFunction);
databaseTwoView.load();
}
use of com.google.security.zynamics.binnavi.Database.CDatabase in project binnavi by google.
the class PostgreSQLTypeInstanceFunctionsTests method setUp.
@Before
public void setUp() throws IOException, CouldntLoadDriverException, CouldntConnectException, IllegalStateException, CouldntLoadDataException, InvalidDatabaseException, CouldntInitializeDatabaseException, CouldntSaveDataException, InvalidExporterDatabaseFormatException, InvalidDatabaseVersionException, LoadCancelledException, FileReadException {
final String[] parts = CConfigLoader.loadPostgreSQL();
database = new CDatabase("None", CJdbcDriverNames.jdbcPostgreSQLDriverName, parts[0], "test_disassembly", parts[1], parts[2], parts[3], false, false);
database.connect();
database.load();
try {
final Field privateProviderField = CDatabase.class.getDeclaredField("provider");
privateProviderField.setAccessible(true);
provider = (SQLProvider) privateProviderField.get(database);
} catch (final Exception exception) {
throw new RuntimeException(exception);
}
provider.createDebuggerTemplate("Test Debugger", "localhost", 2222);
final CProject project = provider.createProject("Test Project");
provider.createAddressSpace(project, "Test Address Space");
ConfigManager.instance().read();
module = database.getContent().getModules().get(0);
}
use of com.google.security.zynamics.binnavi.Database.CDatabase in project binnavi by google.
the class PostgreSQLConvertCalcTest method setUp.
@Before
public void setUp() throws IOException, CouldntLoadDriverException, CouldntConnectException, IllegalStateException, CouldntLoadDataException, InvalidDatabaseException, CouldntInitializeDatabaseException, InvalidExporterDatabaseFormatException, InvalidDatabaseVersionException, LoadCancelledException {
final String[] parts = CConfigLoader.loadPostgreSQL();
database = new CDatabase("None", CJdbcDriverNames.jdbcPostgreSQLDriverName, parts[0], "test_import", parts[1], parts[2], parts[3], false, false);
database.connect();
database.load();
}
use of com.google.security.zynamics.binnavi.Database.CDatabase in project binnavi by google.
the class DatabaseManager method addDatabase.
// ESCA-JAVA0138: Takes more than 5 arguments to define the whole database in one step.
// ! Adds a new database.
/**
* Adds a new database configuration to the database manager.
*
* @param description The description of the new database configuration. This is the text that is
* displayed in the project tree.
* @param driver The driver that is used to connect to the database.
* @param host Host address of the database server.
* @param name The name of the database on the database server.
* @param user The user that is used to connect to the database.
* @param password The password that is used to connect to the database.
* @param identity The identity under which the current user operates.
* @param savePassword Flag that indicates whether the password should be saved in the
* configuration file.
* @param autoConnect Flag that indicates whether this a connection to this database is
* established automatically when BinNavi starts.
* @return The created database.
*
* @throws IllegalArgumentException Thrown if any of the passed arguments are null.
*/
public Database addDatabase(final String description, final String driver, final String host, final String name, final String user, final String password, final String identity, final boolean savePassword, final boolean autoConnect) {
Preconditions.checkNotNull(description, "Error: description argument can not be null");
Preconditions.checkNotNull(driver, "Error: driver argument can not be null");
Preconditions.checkNotNull(host, "Error: host argument can not be null");
Preconditions.checkNotNull(name, "Error: name argument can not be null");
final IDatabase newDatabase = m_manager.addDatabase(new CDatabase(description, driver, host, name, user, password, identity, savePassword, autoConnect));
return ObjectFinders.getObject(newDatabase, m_databases);
}
Aggregations