Add local/remote ingest job event filter to hash lookup and keyword search option panels

This commit is contained in:
Richard Cordovano 2015-04-20 16:51:33 -04:00
parent 4008c3fe4f
commit 10f262ec9a
4 changed files with 19 additions and 25 deletions

View File

@ -66,7 +66,7 @@ public class AutopsyEvent extends PropertyChangeEvent implements Serializable {
* @param sourceType The source type of the event, local or remote.
*/
@Override
public Object getSource() {
public SourceType getSource() {
return sourceType;
}

View File

@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2011 - 2013 Basis Technology Corp.
* Copyright 2011 - 2015 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -38,6 +38,7 @@ import javax.swing.table.TableCellRenderer;
import org.openide.util.NbBundle;
import org.sleuthkit.autopsy.corecomponents.OptionsPanel;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.events.AutopsyEvent;
import org.sleuthkit.autopsy.ingest.IngestManager;
import org.sleuthkit.datamodel.TskCoreException;
import org.sleuthkit.autopsy.modules.hashdatabase.HashDbManager.HashDb;
@ -56,8 +57,8 @@ public final class HashLookupSettingsPanel extends IngestModuleGlobalSettingsPan
.getMessage(HashLookupSettingsPanel.class, "HashDbConfigPanel.errorGettingPathText");
private static final String ERROR_GETTING_INDEX_STATUS_TEXT = NbBundle
.getMessage(HashLookupSettingsPanel.class, "HashDbConfigPanel.errorGettingIndexStatusText");
private HashDbManager hashSetManager = HashDbManager.getInstance();
private HashSetTableModel hashSetTableModel = new HashSetTableModel();
private final HashDbManager hashSetManager = HashDbManager.getInstance();
private final HashSetTableModel hashSetTableModel = new HashSetTableModel();
public HashLookupSettingsPanel() {
initComponents();
@ -69,7 +70,7 @@ public final class HashLookupSettingsPanel extends IngestModuleGlobalSettingsPan
IngestManager.getInstance().addIngestJobEventListener(new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
if (isIngestJobEvent(evt)) {
if (isLocalIngestJobEvent(evt)) {
EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
@ -227,10 +228,8 @@ public final class HashLookupSettingsPanel extends IngestModuleGlobalSettingsPan
return shortenedPath;
}
private boolean isIngestJobEvent(PropertyChangeEvent evt) {
return evt.getPropertyName().equals(IngestManager.IngestJobEvent.STARTED.toString())
|| evt.getPropertyName().equals(IngestManager.IngestJobEvent.COMPLETED.toString())
|| evt.getPropertyName().equals(IngestManager.IngestJobEvent.CANCELLED.toString());
private boolean isLocalIngestJobEvent(PropertyChangeEvent evt) {
return evt instanceof AutopsyEvent && ((AutopsyEvent)evt).getSource() == AutopsyEvent.SourceType.Local;
}
@Override

View File

@ -39,6 +39,7 @@ import javax.swing.table.TableColumn;
import org.openide.util.NbBundle;
import org.openide.util.actions.SystemAction;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.events.AutopsyEvent;
import org.sleuthkit.autopsy.ingest.IngestManager;
import org.sleuthkit.autopsy.ingest.IngestManager.IngestJobEvent;
@ -119,10 +120,7 @@ class DropdownListSearchPanel extends KeywordSearchPanel {
IngestManager.getInstance().addIngestJobEventListener(new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
String changed = evt.getPropertyName();
if (changed.equals(IngestJobEvent.STARTED.toString())
|| changed.equals(IngestJobEvent.COMPLETED.toString())
|| changed.equals(IngestJobEvent.CANCELLED.toString())) {
if (evt instanceof AutopsyEvent && ((AutopsyEvent) evt).getSource() == AutopsyEvent.SourceType.Local) {
EventQueue.invokeLater(new Runnable() {
@Override
public void run() {

View File

@ -42,6 +42,7 @@ import javax.swing.filechooser.FileNameExtensionFilter;
import javax.swing.table.AbstractTableModel;
import javax.swing.table.TableColumn;
import org.sleuthkit.autopsy.corecomponents.OptionsPanel;
import org.sleuthkit.autopsy.events.AutopsyEvent;
import org.sleuthkit.autopsy.ingest.IngestManager;
import org.sleuthkit.autopsy.ingest.IngestManager.IngestJobEvent;
@ -93,7 +94,7 @@ class GlobalEditListPanel extends javax.swing.JPanel implements ListSelectionLis
lsm.addListSelectionListener(new ListSelectionListener() {
@Override
public void valueChanged(ListSelectionEvent e) {
if (lsm.isSelectionEmpty() || currentKeywordList.isLocked() || IngestManager.getInstance().isIngestRunning() ) {
if (lsm.isSelectionEmpty() || currentKeywordList.isLocked() || IngestManager.getInstance().isIngestRunning()) {
deleteWordButton.setEnabled(false);
} else {
deleteWordButton.setEnabled(true);
@ -129,16 +130,13 @@ class GlobalEditListPanel extends javax.swing.JPanel implements ListSelectionLis
IngestManager.getInstance().addIngestJobEventListener(new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
String changed = evt.getPropertyName();
if (changed.equals(IngestJobEvent.STARTED.toString())
|| changed.equals(IngestJobEvent.COMPLETED.toString())
|| changed.equals(IngestJobEvent.CANCELLED.toString())) {
if (evt instanceof AutopsyEvent && ((AutopsyEvent) evt).getSource() == AutopsyEvent.SourceType.Local) {
EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
setButtonStates();
}
});
});
}
}
});
@ -147,14 +145,14 @@ class GlobalEditListPanel extends javax.swing.JPanel implements ListSelectionLis
void setButtonStates() {
boolean isIngestRunning = IngestManager.getInstance().isIngestRunning();
boolean isListSelected = currentKeywordList != null;
// items that only need a selected list
boolean canEditList = ((isListSelected == true) && (isIngestRunning == false));
ingestMessagesCheckbox.setEnabled(canEditList);
ingestMessagesCheckbox.setSelected(currentKeywordList != null && currentKeywordList.getIngestMessages());
listOptionsLabel.setEnabled(canEditList);
listOptionsSeparator.setEnabled(canEditList);
// items that need an unlocked list w/out ingest running
boolean isListLocked = ((isListSelected == false) || (currentKeywordList.isLocked()));
boolean canAddWord = isListSelected && !isIngestRunning && !isListLocked;
@ -164,8 +162,7 @@ class GlobalEditListPanel extends javax.swing.JPanel implements ListSelectionLis
keywordOptionsLabel.setEnabled(canAddWord);
keywordOptionsSeparator.setEnabled(canAddWord);
deleteListButton.setEnabled(canAddWord);
// items that need a non-empty list
if ((currentKeywordList == null) || (currentKeywordList.getKeywords().isEmpty())) {
saveListButton.setEnabled(false);
@ -446,7 +443,7 @@ class GlobalEditListPanel extends javax.swing.JPanel implements ListSelectionLis
private void exportButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exportButtonActionPerformed
final String FEATURE_NAME = NbBundle.getMessage(this.getClass(),
"KeywordSearchEditListPanel.exportButtonAction.featureName.text");
"KeywordSearchEditListPanel.exportButtonAction.featureName.text");
JFileChooser chooser = new JFileChooser();
final String EXTENSION = "xml"; //NON-NLS
@ -474,7 +471,7 @@ class GlobalEditListPanel extends javax.swing.JPanel implements ListSelectionLis
if (selFile.exists()) {
shouldWrite = KeywordSearchUtil.displayConfirmDialog(FEATURE_NAME,
NbBundle.getMessage(this.getClass(), "KeywordSearchEditListPanel.exportButtonActionPerformed.fileExistPrompt",
selFile.getName()), KeywordSearchUtil.DIALOG_MESSAGE_TYPE.WARN);
selFile.getName()), KeywordSearchUtil.DIALOG_MESSAGE_TYPE.WARN);
}
if (!shouldWrite) {
return;