Search in sources :

Example 6 with INaviRawModule

use of com.google.security.zynamics.binnavi.disassembly.INaviRawModule in project binnavi by google.

the class AbstractModuleCreator method initializeModule.

@Override
public void initializeModule(final SQLProvider sqlProvider, final INaviModule module, final CModuleInitializeReporter reporter) throws CouldntSaveDataException {
    final int moduleId = module.getConfiguration().getId();
    final INaviRawModule rawModule = module.getConfiguration().getRawModule();
    if (!rawModule.isComplete()) {
        throw new CouldntSaveDataException("E00008: Raw module is incomplete");
    }
    try {
        reporter.report(ModuleInitializeEvents.Starting);
        final String query = " { call import(?,?,?) } ";
        final CallableStatement call = getProvider().getConnection().getConnection().prepareCall(query);
        call.setInt(1, rawModule.getId());
        call.setInt(2, moduleId);
        call.setInt(3, CUserManager.get(getProvider()).getCurrentActiveUser().getUserId());
        call.execute();
        module.setInitialized();
    } catch (final SQLException exception) {
        throw new CouldntSaveDataException(exception);
    } finally {
        reporter.report(ModuleInitializeEvents.Finished);
    }
}
Also used : INaviRawModule(com.google.security.zynamics.binnavi.disassembly.INaviRawModule) SQLException(java.sql.SQLException) CouldntSaveDataException(com.google.security.zynamics.binnavi.Database.Exceptions.CouldntSaveDataException) CallableStatement(java.sql.CallableStatement)

Aggregations

INaviRawModule (com.google.security.zynamics.binnavi.disassembly.INaviRawModule)6 CouldntLoadDataException (com.google.security.zynamics.binnavi.Database.Exceptions.CouldntLoadDataException)4 SQLException (java.sql.SQLException)4 CouldntSaveDataException (com.google.security.zynamics.binnavi.Database.Exceptions.CouldntSaveDataException)3 CConnection (com.google.security.zynamics.binnavi.Database.CConnection)2 IDatabaseListener (com.google.security.zynamics.binnavi.Database.Interfaces.IDatabaseListener)2 INaviModule (com.google.security.zynamics.binnavi.disassembly.INaviModule)2 ResultSet (java.sql.ResultSet)2 ArrayList (java.util.ArrayList)2 CouldntConnectException (com.google.security.zynamics.binnavi.Database.Exceptions.CouldntConnectException)1 CouldntDeleteException (com.google.security.zynamics.binnavi.Database.Exceptions.CouldntDeleteException)1 CouldntInitializeDatabaseException (com.google.security.zynamics.binnavi.Database.Exceptions.CouldntInitializeDatabaseException)1 CouldntLoadDriverException (com.google.security.zynamics.binnavi.Database.Exceptions.CouldntLoadDriverException)1 CouldntUpdateDatabaseException (com.google.security.zynamics.binnavi.Database.Exceptions.CouldntUpdateDatabaseException)1 InvalidDatabaseException (com.google.security.zynamics.binnavi.Database.Exceptions.InvalidDatabaseException)1 InvalidDatabaseVersionException (com.google.security.zynamics.binnavi.Database.Exceptions.InvalidDatabaseVersionException)1 InvalidExporterDatabaseFormatException (com.google.security.zynamics.binnavi.Database.Exceptions.InvalidExporterDatabaseFormatException)1 LoadCancelledException (com.google.security.zynamics.binnavi.Database.Exceptions.LoadCancelledException)1 CTagManager (com.google.security.zynamics.binnavi.Tagging.CTagManager)1 DebuggerTemplate (com.google.security.zynamics.binnavi.debug.debugger.DebuggerTemplate)1