Adapt hashdb, keywordsearch config panels for wide use

Made these core configuration mechanisms uniform in support for wider use.
The simple and advanced config panels are now all public with public load/store methods.
This commit is contained in:
Richard Cordovano 2013-12-06 09:56:41 -05:00
parent 95fb091c6b
commit 49374b5354
7 changed files with 30 additions and 18 deletions

View File

@ -54,8 +54,7 @@ public final class HashDatabaseOptionsPanelController extends OptionsPanelContro
@Override @Override
public void cancel() { public void cancel() {
// Reset the XML on cancel getPanel().cancel();
HashDbManager.getInstance().loadLastSavedConfiguration();
} }
@Override @Override

View File

@ -262,6 +262,10 @@ public final class HashDbConfigPanel extends javax.swing.JPanel implements Optio
hashSetManager.save(); hashSetManager.save();
} }
public void cancel() {
HashDbManager.getInstance().loadLastSavedConfiguration();
}
void removeThese(List<HashDb> toRemove) { void removeThese(List<HashDb> toRemove) {
for (HashDb hashDb : toRemove) { for (HashDb hashDb : toRemove) {
hashSetManager.removeHashDatabase(hashDb); hashSetManager.removeHashDatabase(hashDb);

View File

@ -108,7 +108,7 @@ public class HashDbIngestModule extends IngestModuleAbstractFile {
@Override @Override
public void saveSimpleConfiguration() { public void saveSimpleConfiguration() {
if (simpleConfigPanel != null) { if (simpleConfigPanel != null) {
simpleConfigPanel.save(); simpleConfigPanel.store();
} }
} }

View File

@ -41,7 +41,7 @@ public class HashDbSimpleConfigPanel extends javax.swing.JPanel {
private HashDatabasesTableModel knownTableModel; private HashDatabasesTableModel knownTableModel;
private HashDatabasesTableModel knownBadTableModel; private HashDatabasesTableModel knownBadTableModel;
HashDbSimpleConfigPanel() { public HashDbSimpleConfigPanel() {
knownTableModel = new HashDatabasesTableModel(HashDbManager.HashDb.KnownFilesType.KNOWN); knownTableModel = new HashDatabasesTableModel(HashDbManager.HashDb.KnownFilesType.KNOWN);
knownBadTableModel = new HashDatabasesTableModel(HashDbManager.HashDb.KnownFilesType.KNOWN_BAD); knownBadTableModel = new HashDatabasesTableModel(HashDbManager.HashDb.KnownFilesType.KNOWN_BAD);
initComponents(); initComponents();
@ -83,12 +83,12 @@ public class HashDbSimpleConfigPanel extends javax.swing.JPanel {
} }
} }
void load() { public void load() {
knownTableModel.load(); knownTableModel.load();
knownBadTableModel.load(); knownBadTableModel.load();
} }
void save() { public void store() {
HashDbManager.getInstance().save(); HashDbManager.getInstance().save();
} }

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2011 Basis Technology Corp. * Copyright 2011 - 2013 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -19,21 +19,18 @@
package org.sleuthkit.autopsy.keywordsearch; package org.sleuthkit.autopsy.keywordsearch;
import java.util.logging.Level;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.corecomponents.OptionsPanel; import org.sleuthkit.autopsy.corecomponents.OptionsPanel;
/** /**
* Container panel for keyword search advanced configuration options * Container panel for keyword search advanced configuration options
*/ */
final class KeywordSearchConfigurationPanel extends javax.swing.JPanel implements OptionsPanel { public final class KeywordSearchConfigurationPanel extends javax.swing.JPanel implements OptionsPanel {
private static final Logger logger = Logger.getLogger(KeywordSearchConfigurationPanel.class.getName());
private KeywordSearchConfigurationPanel1 listsPanel; private KeywordSearchConfigurationPanel1 listsPanel;
private KeywordSearchConfigurationPanel3 languagesPanel; private KeywordSearchConfigurationPanel3 languagesPanel;
private KeywordSearchConfigurationPanel2 generalPanel; private KeywordSearchConfigurationPanel2 generalPanel;
KeywordSearchConfigurationPanel() { public KeywordSearchConfigurationPanel() {
initComponents(); initComponents();
customizeComponents(); customizeComponents();
} }
@ -45,8 +42,7 @@ final class KeywordSearchConfigurationPanel extends javax.swing.JPanel implement
generalPanel = new KeywordSearchConfigurationPanel2(); generalPanel = new KeywordSearchConfigurationPanel2();
tabbedPane.insertTab("Lists", null, listsPanel, "List configuration", 0); tabbedPane.insertTab("Lists", null, listsPanel, "List configuration", 0);
tabbedPane.insertTab("String Extraction", null, languagesPanel, "String extraction configuration for Keyword Search Ingest", 1); tabbedPane.insertTab("String Extraction", null, languagesPanel, "String extraction configuration for Keyword Search Ingest", 1);
tabbedPane.insertTab("General", null, generalPanel, "General configuration", 2); tabbedPane.insertTab("General", null, generalPanel, "General configuration", 2);
} }
/** /**
@ -94,10 +90,15 @@ final class KeywordSearchConfigurationPanel extends javax.swing.JPanel implement
generalPanel.store(); generalPanel.store();
} }
public void cancel() {
KeywordSearchListsXML.getCurrent().reload();
}
boolean valid() { boolean valid() {
// TODO check whether form is consistent and complete // TODO check whether form is consistent and complete
return true; return true;
} }
// Variables declaration - do not modify//GEN-BEGIN:variables // Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JTabbedPane tabbedPane; private javax.swing.JTabbedPane tabbedPane;
// End of variables declaration//GEN-END:variables // End of variables declaration//GEN-END:variables

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2011 Basis Technology Corp. * Copyright 2011 - 2013 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -27,7 +27,6 @@ import org.sleuthkit.autopsy.coreutils.Logger;
import javax.swing.ListSelectionModel; import javax.swing.ListSelectionModel;
import javax.swing.table.AbstractTableModel; import javax.swing.table.AbstractTableModel;
import javax.swing.table.TableColumn; import javax.swing.table.TableColumn;
import org.sleuthkit.autopsy.coreutils.ModuleSettings;
import org.sleuthkit.autopsy.coreutils.StringExtract.StringExtractUnicodeTable.SCRIPT; import org.sleuthkit.autopsy.coreutils.StringExtract.StringExtractUnicodeTable.SCRIPT;
/** /**
@ -71,6 +70,16 @@ public class KeywordSearchIngestSimplePanel extends javax.swing.JPanel {
reloadEncodings(); reloadEncodings();
} }
public void load() {
reloadLists();
reloadLangs();
reloadEncodings();
}
public void store() {
KeywordSearchListsXML.getCurrent().save();
}
/** This method is called from within the constructor to /** This method is called from within the constructor to
* initialize the form. * initialize the form.
* WARNING: Do NOT modify this code. The content of this method is * WARNING: Do NOT modify this code. The content of this method is

View File

@ -35,8 +35,7 @@ public final class KeywordSearchOptionsPanelController extends OptionsPanelContr
} }
public void cancel() { public void cancel() {
// Reload XML on cancel getPanel().cancel();
KeywordSearchListsXML.getCurrent().reload();
} }
public boolean isValid() { public boolean isValid() {