Search in sources :

Example 21 with INaviProject

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

the class Database method convertData.

/**
   * Converts the native objects stored in the database to API objects.
   */
private void convertData() {
    m_viewTagManager = new TagManager(m_database.getContent().getViewTagManager());
    m_nodeTagManager = new TagManager(m_database.getContent().getNodeTagManager());
    m_modules.clear();
    m_projects.clear();
    for (final INaviModule module : m_database.getContent().getModules()) {
        m_modules.add(new Module(this, module, m_nodeTagManager, m_viewTagManager));
    }
    for (final INaviProject project : m_database.getContent().getProjects()) {
        m_projects.add(new Project(this, project, m_nodeTagManager, m_viewTagManager));
    }
    m_debuggerTemplateManager = new DebuggerTemplateManager(m_database.getContent().getDebuggerTemplateManager());
}
Also used : INaviProject(com.google.security.zynamics.binnavi.disassembly.INaviProject) INaviProject(com.google.security.zynamics.binnavi.disassembly.INaviProject) INaviModule(com.google.security.zynamics.binnavi.disassembly.INaviModule) INaviModule(com.google.security.zynamics.binnavi.disassembly.INaviModule) INaviRawModule(com.google.security.zynamics.binnavi.disassembly.INaviRawModule)

Example 22 with INaviProject

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

the class CProjectNode method doubleClicked.

@Override
public void doubleClicked() {
    // Open projects on double-click.
    if (!m_project.isLoaded()) {
        final Action action = CActionProxy.proxy(new CLoadProjectAction(getProjectTree(), new INaviProject[] { m_project }));
        action.actionPerformed(new ActionEvent(this, 0, ""));
    }
}
Also used : Action(javax.swing.Action) CLoadProjectAction(com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.Actions.CLoadProjectAction) INaviProject(com.google.security.zynamics.binnavi.disassembly.INaviProject) ActionEvent(java.awt.event.ActionEvent) CLoadProjectAction(com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.Actions.CLoadProjectAction)

Example 23 with INaviProject

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

the class PostgreSQLViewNotificationParser method parseProjectViewNotification.

/**
   * Parser for the bn_project_views notification. The function uses the
   * projectViewNotificationPattern to parse the incoming {@link PGNotification} into a
   * {@link ViewNotificationContainer}
   *
   * @param notification The {@link PGNotification} to parse.
   * @param provider The {@link SQLProvider} to access the database.
   */
private ViewNotificationContainer parseProjectViewNotification(final PGNotification notification, final SQLProvider provider) {
    final Matcher matcher = projectViewNotificationPattern.matcher(notification.getParameter());
    if (!matcher.find()) {
        throw new IllegalStateException("IE02744: compiled pattern: " + projectViewNotificationPattern.toString() + " did not match notification: " + notification.getParameter());
    }
    final Integer viewId = Integer.parseInt(matcher.group(3));
    final Optional<INaviView> view = Optional.fromNullable(ViewManager.get(provider).getView(viewId));
    final Optional<Integer> projectId = Optional.fromNullable(Integer.parseInt(matcher.group(4)));
    final Optional<INaviProject> project = Optional.fromNullable(provider.findProject(projectId.get()));
    final String databaseOperation = matcher.group(2);
    return new ViewNotificationContainer(viewId, view, projectId, Optional.<INaviModule>absent(), project, databaseOperation);
}
Also used : INaviView(com.google.security.zynamics.binnavi.disassembly.views.INaviView) INaviProject(com.google.security.zynamics.binnavi.disassembly.INaviProject) Matcher(java.util.regex.Matcher) ViewNotificationContainer(com.google.security.zynamics.binnavi.Database.PostgreSQL.Notifications.containers.ViewNotificationContainer)

Example 24 with INaviProject

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

the class PostgreSQLProviderTestSetup method testCreateTraceProject4.

@Test
public void testCreateTraceProject4() throws CouldntSaveDataException {
    final INaviProject project = loadProject();
    final TraceList trace = getProvider().createTrace(project, "Trace Name", "Trace Description");
    assertEquals("Trace Name", trace.getName());
    assertEquals("Trace Description", trace.getDescription());
    assertEquals(0, trace.getEventCount());
}
Also used : INaviProject(com.google.security.zynamics.binnavi.disassembly.INaviProject) TraceList(com.google.security.zynamics.binnavi.debug.models.trace.TraceList) ExpensiveBaseTest(com.google.security.zynamics.binnavi.disassembly.types.ExpensiveBaseTest) Test(org.junit.Test)

Example 25 with INaviProject

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

the class PostgreSQLProviderTest method testTraceFunctionsSetDescription1.

@Test
public void testTraceFunctionsSetDescription1() throws CouldntLoadDataException, LoadCancelledException, CouldntSaveDataException {
    final INaviProject project = getProvider().createProject("SOME_PROJECT");
    getProvider().createTrace(project, "SOME_TRACE", "SOME_TRACE_DESCRIPTION");
    project.load();
    final TraceList trace = project.getContent().getTraces().get(0);
    assertEquals("SOME_TRACE_DESCRIPTION", project.getContent().getTraces().get(0).getDescription());
    final String description = "boing boing";
    PostgreSQLTraceFunctions.setDescription((AbstractSQLProvider) getProvider(), trace, description);
    project.close();
    INaviProject project2 = null;
    for (final INaviProject cProject : getProvider().loadProjects()) {
        if (cProject.getConfiguration().getId() == project.getConfiguration().getId()) {
            project2 = cProject;
        }
    }
    getProvider().createTrace(project2, "SOME_TRACE_2", "SOME_TRACE_DESCRIPTION_2");
    project2.load();
    final TraceList trace2 = project2.getContent().getTraces().get(0);
    assertEquals(description, trace2.getDescription());
}
Also used : INaviProject(com.google.security.zynamics.binnavi.disassembly.INaviProject) TraceList(com.google.security.zynamics.binnavi.debug.models.trace.TraceList) ExpensiveBaseTest(com.google.security.zynamics.binnavi.disassembly.types.ExpensiveBaseTest) Test(org.junit.Test)

Aggregations

INaviProject (com.google.security.zynamics.binnavi.disassembly.INaviProject)45 Test (org.junit.Test)31 ExpensiveBaseTest (com.google.security.zynamics.binnavi.disassembly.types.ExpensiveBaseTest)27 TraceList (com.google.security.zynamics.binnavi.debug.models.trace.TraceList)6 ViewNotificationContainer (com.google.security.zynamics.binnavi.Database.PostgreSQL.Notifications.containers.ViewNotificationContainer)5 CouldntLoadDataException (com.google.security.zynamics.binnavi.Database.Exceptions.CouldntLoadDataException)4 CouldntSaveDataException (com.google.security.zynamics.binnavi.Database.Exceptions.CouldntSaveDataException)4 PostgreSQLViewNotificationParser (com.google.security.zynamics.binnavi.Database.PostgreSQL.Notifications.parsers.PostgreSQLViewNotificationParser)4 CProject (com.google.security.zynamics.binnavi.disassembly.CProject)4 INaviModule (com.google.security.zynamics.binnavi.disassembly.INaviModule)4 MockProject (com.google.security.zynamics.binnavi.disassembly.MockProject)4 LoadCancelledException (com.google.security.zynamics.binnavi.Database.Exceptions.LoadCancelledException)3 CAddressSpace (com.google.security.zynamics.binnavi.disassembly.AddressSpaces.CAddressSpace)3 UnrelocatedAddress (com.google.security.zynamics.binnavi.disassembly.UnrelocatedAddress)3 INaviView (com.google.security.zynamics.binnavi.disassembly.views.INaviView)3 SQLException (java.sql.SQLException)3 ArrayList (java.util.ArrayList)3 CouldntConnectException (com.google.security.zynamics.binnavi.Database.Exceptions.CouldntConnectException)2 CouldntInitializeDatabaseException (com.google.security.zynamics.binnavi.Database.Exceptions.CouldntInitializeDatabaseException)2 CouldntLoadDriverException (com.google.security.zynamics.binnavi.Database.Exceptions.CouldntLoadDriverException)2