Clean up the DataSourceProcessor Interface definition and the current implementations.

This commit is contained in:
raman-bt 2014-02-12 09:19:06 -05:00
parent 53f420d6ea
commit 53e767dd03
12 changed files with 172 additions and 218 deletions

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2013 Basis Technology Corp. * Copyright 2013-2014 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");
@ -24,8 +24,8 @@ import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.logging.Level; import java.util.logging.Level;
import org.sleuthkit.autopsy.corecomponentinterfaces.DSPCallback; import org.sleuthkit.autopsy.corecomponentinterfaces.DataSourceProcessorCallback;
import org.sleuthkit.autopsy.corecomponentinterfaces.DSPProgressMonitor; import org.sleuthkit.autopsy.corecomponentinterfaces.DataSourceProcessorProgressMonitor;
import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.coreutils.PlatformUtil; import org.sleuthkit.autopsy.coreutils.PlatformUtil;
import org.sleuthkit.datamodel.Content; import org.sleuthkit.datamodel.Content;
@ -45,9 +45,9 @@ import org.sleuthkit.datamodel.TskException;
*/ */
class AddImageTask implements Runnable { class AddImageTask implements Runnable {
private Logger logger = Logger.getLogger(AddImageTask.class.getName()); private final Logger logger = Logger.getLogger(AddImageTask.class.getName());
private Case currentCase; private final Case currentCase;
// true if the process was requested to cancel // true if the process was requested to cancel
private final Object lock = new Object(); // synchronization object for cancelRequested private final Object lock = new Object(); // synchronization object for cancelRequested
@ -59,32 +59,30 @@ import org.sleuthkit.datamodel.TskException;
// true if there was a critical error in adding the data source // true if there was a critical error in adding the data source
private boolean hasCritError = false; private boolean hasCritError = false;
private List<String> errorList = new ArrayList<String>(); private final List<String> errorList = new ArrayList<>();
private DSPProgressMonitor progressMonitor; private final DataSourceProcessorProgressMonitor progressMonitor;
private DSPCallback callbackObj; private final DataSourceProcessorCallback callbackObj;
private final List<Content> newContents = Collections.synchronizedList(new ArrayList<Content>()); private final List<Content> newContents = Collections.synchronizedList(new ArrayList<Content>());
private SleuthkitJNI.CaseDbHandle.AddImageProcess addImageProcess; private SleuthkitJNI.CaseDbHandle.AddImageProcess addImageProcess;
private Thread dirFetcher; private Thread dirFetcher;
private String imagePath; private final String imagePath;
private String dataSourcetype;
String timeZone; String timeZone;
boolean noFatOrphans; boolean noFatOrphans;
/* /*
* A Swingworker that updates the progressMonitor with the name of the * A Swingworker that updates the progressMonitor with the name of the
* directory currently being processed by the AddImageTask * directory currently being processed by the AddImageTask
*/ */
private class CurrentDirectoryFetcher implements Runnable { private class CurrentDirectoryFetcher implements Runnable {
DSPProgressMonitor progressMonitor; DataSourceProcessorProgressMonitor progressMonitor;
SleuthkitJNI.CaseDbHandle.AddImageProcess process; SleuthkitJNI.CaseDbHandle.AddImageProcess process;
CurrentDirectoryFetcher(DSPProgressMonitor aProgressMonitor, SleuthkitJNI.CaseDbHandle.AddImageProcess proc) { CurrentDirectoryFetcher(DataSourceProcessorProgressMonitor aProgressMonitor, SleuthkitJNI.CaseDbHandle.AddImageProcess proc) {
this.progressMonitor = aProgressMonitor; this.progressMonitor = aProgressMonitor;
this.process = proc; this.process = proc;
} }
@ -102,17 +100,18 @@ import org.sleuthkit.datamodel.TskException;
progressMonitor.setProgressText("Adding: " + currDir); progressMonitor.setProgressText("Adding: " + currDir);
} }
} }
// this sleep here prevents the UI from locking up
// due to too frequent updates to the progressMonitor above
Thread.sleep(2 * 1000); Thread.sleep(2 * 1000);
} }
return;
} catch (InterruptedException ie) { } catch (InterruptedException ie) {
return; // nothing to do, thread was interrupted externally
// signaling the end of AddImageProcess
} }
} }
} }
public AddImageTask(String imgPath, String tz, boolean noOrphans, DataSourceProcessorProgressMonitor aProgressMonitor, DataSourceProcessorCallback cbObj ) {
protected AddImageTask(String imgPath, String tz, boolean noOrphans, DSPProgressMonitor aProgressMonitor, DSPCallback cbObj ) {
currentCase = Case.getCurrentCase(); currentCase = Case.getCurrentCase();
@ -134,7 +133,6 @@ import org.sleuthkit.datamodel.TskException;
@Override @Override
public void run() { public void run() {
errorList.clear(); errorList.clear();
//lock DB for writes in this thread //lock DB for writes in this thread
@ -165,9 +163,7 @@ import org.sleuthkit.datamodel.TskException;
postProcess(); postProcess();
// unclock the DB // unclock the DB
SleuthkitCase.dbWriteUnlock(); SleuthkitCase.dbWriteUnlock();
return;
} }
/** /**
@ -181,11 +177,10 @@ import org.sleuthkit.datamodel.TskException;
long imageId = 0; long imageId = 0;
try { try {
imageId = addImageProcess.commit(); imageId = addImageProcess.commit();
} catch (TskException e) { } catch (TskCoreException e) {
logger.log(Level.WARNING, "Errors occured while committing the image", e); logger.log(Level.WARNING, "Errors occured while committing the image", e);
errorList.add(e.getMessage()); errorList.add(e.getMessage());
} finally { } finally {
if (imageId != 0) { if (imageId != 0) {
// get the newly added Image so we can return to caller // get the newly added Image so we can return to caller
Image newImage = currentCase.getSleuthkitCase().getImageById(imageId); Image newImage = currentCase.getSleuthkitCase().getImageById(imageId);
@ -201,7 +196,7 @@ import org.sleuthkit.datamodel.TskException;
newContents.add(newImage); newContents.add(newImage);
} }
logger.log(Level.INFO, "Image committed, imageId: " + imageId); logger.log(Level.INFO, "Image committed, imageId: {0}", imageId);
logger.log(Level.INFO, PlatformUtil.getAllMemUsageInfo()); logger.log(Level.INFO, PlatformUtil.getAllMemUsageInfo());
} }
} }
@ -212,11 +207,9 @@ import org.sleuthkit.datamodel.TskException;
*/ */
private void postProcess() { private void postProcess() {
// cancel the directory fetcher // cancel the directory fetcher
dirFetcher.interrupt(); dirFetcher.interrupt();
if (cancelRequested() || hasCritError) { if (cancelRequested() || hasCritError) {
logger.log(Level.WARNING, "Critical errors or interruption in add image process. Image will not be committed."); logger.log(Level.WARNING, "Critical errors or interruption in add image process. Image will not be committed.");
revert(); revert();
@ -226,32 +219,24 @@ import org.sleuthkit.datamodel.TskException;
logger.log(Level.INFO, "There were errors that occured in add image process"); logger.log(Level.INFO, "There were errors that occured in add image process");
} }
// When everything happens without an error: // When everything happens without an error:
if (!(cancelRequested() || hasCritError)) { if (!(cancelRequested() || hasCritError)) {
try { try {
if (newContents.isEmpty()) { if (addImageProcess != null) {
if (addImageProcess != null) { // commit image
// commit image try {
try { commitImage();
commitImage(); } catch (Exception ex) {
} catch (Exception ex) { errorList.add(ex.getMessage());
errorList.add(ex.getMessage()); // Log error/display warning
// Log error/display warning logger.log(Level.SEVERE, "Error adding image to case.", ex);
logger.log(Level.SEVERE, "Error adding image to case.", ex);
}
} else {
logger.log(Level.SEVERE, "Missing image process object");
} }
} else {
logger.log(Level.SEVERE, "Missing image process object");
} }
else { //already commited?
logger.log(Level.INFO, "Assuming image already committed, will not commit.");
}
// Tell the progress monitor we're done // Tell the progress monitor we're done
progressMonitor.setProgress(100); progressMonitor.setProgress(100);
} catch (Exception ex) { } catch (Exception ex) {
//handle unchecked exceptions post image add //handle unchecked exceptions post image add
errorList.add(ex.getMessage()); errorList.add(ex.getMessage());
@ -265,27 +250,23 @@ import org.sleuthkit.datamodel.TskException;
if (!cancelRequested()) { if (!cancelRequested()) {
doCallBack(); doCallBack();
} }
return;
} }
/* /*
* Call the callback with results, new content, and errors, if any * Call the callback with results, new content, and errors, if any
*/ */
private void doCallBack() private void doCallBack()
{ {
DSPCallback.DSP_Result result; DataSourceProcessorCallback.DataSourceProcessorResult result;
if (hasCritError) { if (hasCritError) {
result = DSPCallback.DSP_Result.CRITICAL_ERRORS; result = DataSourceProcessorCallback.DataSourceProcessorResult.CRITICAL_ERRORS;
} }
else if (!errorList.isEmpty()) { else if (!errorList.isEmpty()) {
result = DSPCallback.DSP_Result.NONCRITICAL_ERRORS; result = DataSourceProcessorCallback.DataSourceProcessorResult.NONCRITICAL_ERRORS;
} }
else { else {
result = DSPCallback.DSP_Result.NO_ERRORS; result = DataSourceProcessorCallback.DataSourceProcessorResult.NO_ERRORS;
} }
// invoke the callback, passing it the result, list of new contents, and list of errors // invoke the callback, passing it the result, list of new contents, and list of errors
@ -307,6 +288,7 @@ import org.sleuthkit.datamodel.TskException;
} }
} }
} }
/* /*
* Interrupt the add image process if it is still running * Interrupt the add image process if it is still running
*/ */
@ -315,7 +297,7 @@ import org.sleuthkit.datamodel.TskException;
try { try {
logger.log(Level.INFO, "interrupt() add image process"); logger.log(Level.INFO, "interrupt() add image process");
addImageProcess.stop(); //it might take time to truly stop processing and writing to db addImageProcess.stop(); //it might take time to truly stop processing and writing to db
} catch (TskException ex) { } catch (TskCoreException ex) {
throw new Exception("Error stopping add-image process.", ex); throw new Exception("Error stopping add-image process.", ex);
} }
} }
@ -324,6 +306,7 @@ import org.sleuthkit.datamodel.TskException;
* Revert - if image has already been added but not committed yet * Revert - if image has already been added but not committed yet
*/ */
private void revert() { private void revert() {
if (!reverted) { if (!reverted) {
logger.log(Level.INFO, "Revert after add image process"); logger.log(Level.INFO, "Revert after add image process");
try { try {

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2011 Basis Technology Corp. * Copyright 2011-2014 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");
@ -29,7 +29,7 @@ import javax.swing.event.ChangeListener;
import org.openide.WizardDescriptor; import org.openide.WizardDescriptor;
import org.openide.util.HelpCtx; import org.openide.util.HelpCtx;
import org.openide.util.Lookup; import org.openide.util.Lookup;
import org.sleuthkit.autopsy.corecomponentinterfaces.DSPProgressMonitor; import org.sleuthkit.autopsy.corecomponentinterfaces.DataSourceProcessorProgressMonitor;
/** /**
* The final panel of the add image wizard. It displays a progress bar and * The final panel of the add image wizard. It displays a progress bar and
@ -59,7 +59,7 @@ class AddImageWizardAddingProgressPanel implements WizardDescriptor.FinishablePa
return dspProgressMonitorImpl; return dspProgressMonitorImpl;
} }
private class DSPProgressMonitorImpl implements DSPProgressMonitor { private class DSPProgressMonitorImpl implements DataSourceProcessorProgressMonitor {
@Override @Override
public void setIndeterminate(final boolean indeterminate) { public void setIndeterminate(final boolean indeterminate) {
// update the progress bar asynchronously // update the progress bar asynchronously

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2011 Basis Technology Corp. * Copyright 2011-2014 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");
@ -82,9 +82,9 @@ final class AddImageWizardChooseDataSourceVisual extends JPanel {
// make a list of core DSPs // make a list of core DSPs
// ensure that the core DSPs are at the top and in a fixed order // ensure that the core DSPs are at the top and in a fixed order
coreDSPTypes.add(ImageDSProcessor.dsType); coreDSPTypes.add(ImageDSProcessor.getType());
coreDSPTypes.add(LocalDiskDSProcessor.dsType); coreDSPTypes.add(LocalDiskDSProcessor.getType());
coreDSPTypes.add(LocalFilesDSProcessor.dsType); coreDSPTypes.add(LocalFilesDSProcessor.getType());
for(String dspType:coreDSPTypes){ for(String dspType:coreDSPTypes){
typeComboBox.addItem(dspType); typeComboBox.addItem(dspType);
@ -120,12 +120,11 @@ final class AddImageWizardChooseDataSourceVisual extends JPanel {
for (DataSourceProcessor dsProcessor: Lookup.getDefault().lookupAll(DataSourceProcessor.class)) { for (DataSourceProcessor dsProcessor: Lookup.getDefault().lookupAll(DataSourceProcessor.class)) {
if (!datasourceProcessorsMap.containsKey(dsProcessor.getType()) ) { if (!datasourceProcessorsMap.containsKey(dsProcessor.getDataSourceType()) ) {
dsProcessor.reset(); datasourceProcessorsMap.put(dsProcessor.getDataSourceType(), dsProcessor);
datasourceProcessorsMap.put(dsProcessor.getType(), dsProcessor);
} }
else { else {
logger.log(Level.SEVERE, "discoverDataSourceProcessors(): A DataSourceProcessor already exists for type = " + dsProcessor.getType() ); logger.log(Level.SEVERE, "discoverDataSourceProcessors(): A DataSourceProcessor already exists for type = " + dsProcessor.getDataSourceType() );
} }
} }
} }
@ -166,7 +165,7 @@ final class AddImageWizardChooseDataSourceVisual extends JPanel {
* Returns the currently selected DS Processor * Returns the currently selected DS Processor
* @return DataSourceProcessor the DataSourceProcessor corresponding to the data source type selected in the combobox * @return DataSourceProcessor the DataSourceProcessor corresponding to the data source type selected in the combobox
*/ */
public DataSourceProcessor getCurrentDSProcessor() { protected DataSourceProcessor getCurrentDSProcessor() {
// get the type of the currently selected panel and then look up // get the type of the currently selected panel and then look up
// the correspodning DS Handler in the map // the correspodning DS Handler in the map
String dsType = (String) typeComboBox.getSelectedItem(); String dsType = (String) typeComboBox.getSelectedItem();
@ -307,7 +306,7 @@ final class AddImageWizardChooseDataSourceVisual extends JPanel {
*/ */
public void updateUI(DocumentEvent e) { public void updateUI(DocumentEvent e) {
// Enable the Next button if the current DSP panel is valid // Enable the Next button if the current DSP panel is valid
this.wizPanel.enableNextButton(getCurrentDSProcessor().validatePanel()); this.wizPanel.enableNextButton(getCurrentDSProcessor().isPanelValid());
} }

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2011 Basis Technology Corp. * Copyright 2011-2014 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");
@ -35,7 +35,7 @@ import org.openide.util.HelpCtx;
import org.openide.util.Lookup; import org.openide.util.Lookup;
import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.datamodel.Content; import org.sleuthkit.datamodel.Content;
import org.sleuthkit.autopsy.corecomponentinterfaces.DSPCallback; import org.sleuthkit.autopsy.corecomponentinterfaces.DataSourceProcessorCallback;
import org.sleuthkit.autopsy.corecomponentinterfaces.DataSourceProcessor; import org.sleuthkit.autopsy.corecomponentinterfaces.DataSourceProcessor;
/** /**
* second panel of add image wizard, allows user to configure ingest modules. * second panel of add image wizard, allows user to configure ingest modules.
@ -229,9 +229,9 @@ class AddImageWizardIngestConfigPanel implements WizardDescriptor.Panel<WizardDe
// get the selected DSProcessor // get the selected DSProcessor
dsProcessor = dataSourcePanel.getComponent().getCurrentDSProcessor(); dsProcessor = dataSourcePanel.getComponent().getCurrentDSProcessor();
DSPCallback cbObj = new DSPCallback () { DataSourceProcessorCallback cbObj = new DataSourceProcessorCallback () {
@Override @Override
public void doneEDT(DSPCallback.DSP_Result result, List<String> errList, List<Content> contents) { public void doneEDT(DataSourceProcessorCallback.DataSourceProcessorResult result, List<String> errList, List<Content> contents) {
dataSourceProcessorDone(result, errList, contents ); dataSourceProcessorDone(result, errList, contents );
} }
@ -255,7 +255,7 @@ class AddImageWizardIngestConfigPanel implements WizardDescriptor.Panel<WizardDe
* Callback for the data source processor. * Callback for the data source processor.
* Invoked by the DSP on the EDT thread, when it finishes processing the data source. * Invoked by the DSP on the EDT thread, when it finishes processing the data source.
*/ */
private void dataSourceProcessorDone(DSPCallback.DSP_Result result, List<String> errList, List<Content> contents) { private void dataSourceProcessorDone(DataSourceProcessorCallback.DataSourceProcessorResult result, List<String> errList, List<Content> contents) {
// disable the cleanup task // disable the cleanup task
cleanupTask.disable(); cleanupTask.disable();
@ -274,7 +274,7 @@ class AddImageWizardIngestConfigPanel implements WizardDescriptor.Panel<WizardDe
//check the result and display to user //check the result and display to user
if (result == DSPCallback.DSP_Result.NO_ERRORS) if (result == DataSourceProcessorCallback.DataSourceProcessorResult.NO_ERRORS)
progressPanel.getComponent().setProgressBarTextAndColor("*Data Source added.", 100, Color.black); progressPanel.getComponent().setProgressBarTextAndColor("*Data Source added.", 100, Color.black);
else else
progressPanel.getComponent().setProgressBarTextAndColor("*Errors encountered in adding Data Source.", 100, Color.red); progressPanel.getComponent().setProgressBarTextAndColor("*Errors encountered in adding Data Source.", 100, Color.red);
@ -282,7 +282,7 @@ class AddImageWizardIngestConfigPanel implements WizardDescriptor.Panel<WizardDe
//if errors, display them on the progress panel //if errors, display them on the progress panel
boolean critErr = false; boolean critErr = false;
if (result == DSPCallback.DSP_Result.CRITICAL_ERRORS) { if (result == DataSourceProcessorCallback.DataSourceProcessorResult.CRITICAL_ERRORS) {
critErr = true; critErr = true;
} }
for ( String err: errList ) { for ( String err: errList ) {

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2013 Basis Technology Corp. * Copyright 2013-2014 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");
@ -23,8 +23,8 @@ import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.logging.Level; import java.util.logging.Level;
import org.sleuthkit.autopsy.corecomponentinterfaces.DSPCallback; import org.sleuthkit.autopsy.corecomponentinterfaces.DataSourceProcessorCallback;
import org.sleuthkit.autopsy.corecomponentinterfaces.DSPProgressMonitor; import org.sleuthkit.autopsy.corecomponentinterfaces.DataSourceProcessorProgressMonitor;
import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.datamodel.AbstractFile; import org.sleuthkit.datamodel.AbstractFile;
import org.sleuthkit.datamodel.Content; import org.sleuthkit.datamodel.Content;
@ -42,22 +42,25 @@ import org.sleuthkit.datamodel.TskCoreException;
*/ */
class AddLocalFilesTask implements Runnable { class AddLocalFilesTask implements Runnable {
private Logger logger = Logger.getLogger(AddLocalFilesTask.class.getName()); private final Logger logger = Logger.getLogger(AddLocalFilesTask.class.getName());
private String dataSourcePath; private final String dataSourcePath;
private DSPProgressMonitor progressMonitor; private final DataSourceProcessorProgressMonitor progressMonitor;
private DSPCallback callbackObj; private final DataSourceProcessorCallback callbackObj;
private Case currentCase; private final Case currentCase;
// synchronization object for cancelRequested
private final Object lock = new Object();
// true if the process was requested to stop // true if the process was requested to stop
private volatile boolean cancelled = false; private volatile boolean cancelRequested = false;
private boolean hasCritError = false; private boolean hasCritError = false;
private List<String> errorList = new ArrayList<String>(); private final List<String> errorList = new ArrayList<>();
private final List<Content> newContents = Collections.synchronizedList(new ArrayList<Content>()); private final List<Content> newContents = Collections.synchronizedList(new ArrayList<Content>());
public AddLocalFilesTask(String dataSourcePath, DataSourceProcessorProgressMonitor aProgressMonitor, DataSourceProcessorCallback cbObj) {
protected AddLocalFilesTask(String dataSourcePath, DSPProgressMonitor aProgressMonitor, DSPCallback cbObj) {
currentCase = Case.getCurrentCase(); currentCase = Case.getCurrentCase();
@ -67,7 +70,7 @@ import org.sleuthkit.datamodel.TskCoreException;
} }
/** /**
* Starts the addImage process, but does not commit the results. * Add local files and directories to the case
* *
* @return * @return
* *
@ -86,7 +89,7 @@ import org.sleuthkit.datamodel.TskCoreException;
final FileManager fileManager = currentCase.getServices().getFileManager(); final FileManager fileManager = currentCase.getServices().getFileManager();
String[] paths = dataSourcePath.split(LocalFilesPanel.FILES_SEP); String[] paths = dataSourcePath.split(LocalFilesPanel.FILES_SEP);
List<String> absLocalPaths = new ArrayList<String>(); List<String> absLocalPaths = new ArrayList<>();
for (String path : paths) { for (String path : paths) {
absLocalPaths.add(path); absLocalPaths.add(path);
} }
@ -95,38 +98,31 @@ import org.sleuthkit.datamodel.TskCoreException;
logger.log(Level.WARNING, "Errors occurred while running add logical files. ", ex); logger.log(Level.WARNING, "Errors occurred while running add logical files. ", ex);
hasCritError = true; hasCritError = true;
errorList.add(ex.getMessage()); errorList.add(ex.getMessage());
} finally { }
}
// handle done // handle done
postProcess(); postProcess();
return;
} }
/**
* private void postProcess() {
* (called by EventDispatch Thread after doInBackground finishes)
*/
protected void postProcess() {
if (cancelled || hasCritError) { if (cancelRequested() || hasCritError) {
logger.log(Level.WARNING, "Handling errors or interruption that occured in logical files process"); logger.log(Level.WARNING, "Handling errors or interruption that occured in logical files process");
} }
if (!errorList.isEmpty()) { if (!errorList.isEmpty()) {
//data error (non-critical) //data error (non-critical)
logger.log(Level.WARNING, "Handling non-critical errors that occured in logical files process"); logger.log(Level.WARNING, "Handling non-critical errors that occured in logical files process");
} }
if (!(cancelled || hasCritError)) { if (!(cancelRequested() || hasCritError)) {
progressMonitor.setProgress(100); progressMonitor.setProgress(100);
progressMonitor.setIndeterminate(false); progressMonitor.setIndeterminate(false);
} }
// invoke the callBack, unless the caller cancelled // invoke the callBack, unless the caller cancelled
if (!cancelled) { if (!cancelRequested()) {
doCallBack(); doCallBack();
} }
@ -137,16 +133,16 @@ import org.sleuthkit.datamodel.TskCoreException;
*/ */
private void doCallBack() private void doCallBack()
{ {
DSPCallback.DSP_Result result; DataSourceProcessorCallback.DataSourceProcessorResult result;
if (hasCritError) { if (hasCritError) {
result = DSPCallback.DSP_Result.CRITICAL_ERRORS; result = DataSourceProcessorCallback.DataSourceProcessorResult.CRITICAL_ERRORS;
} }
else if (!errorList.isEmpty()) { else if (!errorList.isEmpty()) {
result = DSPCallback.DSP_Result.NONCRITICAL_ERRORS; result = DataSourceProcessorCallback.DataSourceProcessorResult.NONCRITICAL_ERRORS;
} }
else { else {
result = DSPCallback.DSP_Result.NO_ERRORS; result = DataSourceProcessorCallback.DataSourceProcessorResult.NO_ERRORS;
} }
// invoke the callback, passing it the result, list of new contents, and list of errors // invoke the callback, passing it the result, list of new contents, and list of errors
@ -156,21 +152,27 @@ import org.sleuthkit.datamodel.TskCoreException;
/* /*
* cancel the files addition, if possible * cancel the files addition, if possible
*/ */
public void cancelTask() { public void cancelTask() {
cancelled = true; synchronized(lock) {
cancelRequested = true;
}
} }
private boolean cancelRequested() {
synchronized (lock) {
return cancelRequested;
}
}
/** /**
* Updates the wizard status with logical file/folder * Updates the wizard status with logical file/folder
*/ */
private class LocalFilesAddProgressUpdater implements FileManager.FileAddProgressUpdater { private class LocalFilesAddProgressUpdater implements FileManager.FileAddProgressUpdater {
private int count = 0; private int count = 0;
private DSPProgressMonitor progressMonitor; private final DataSourceProcessorProgressMonitor progressMonitor;
LocalFilesAddProgressUpdater(DataSourceProcessorProgressMonitor progressMonitor) {
LocalFilesAddProgressUpdater(DSPProgressMonitor progressMonitor) {
this.progressMonitor = progressMonitor; this.progressMonitor = progressMonitor;
} }

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2011-2013 Basis Technology Corp. * Copyright 2011-2014 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");
@ -463,14 +463,7 @@ public class Case implements SleuthkitCase.ErrorObserver {
@Deprecated @Deprecated
void addLocalDataSource(Content newDataSource) { void addLocalDataSource(Content newDataSource) {
try { notifyNewDataSource(newDataSource);
pcs.firePropertyChange(CASE_ADD_DATA_SOURCE, null, newDataSource);
}
catch (Exception e) {
logger.log(Level.SEVERE, "Case listener threw exception", e);
MessageNotifyUtil.Notify.show("Module Error", "A module caused an error listening to Case updates. See log to determine which module. Some data could be incomplete.", MessageNotifyUtil.MessageType.ERROR);
}
CoreComponentControl.openCoreWindows();
} }
/** /**

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2013 Basis Technology Corp. * Copyright 2013-2014 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");
@ -18,17 +18,14 @@
*/ */
package org.sleuthkit.autopsy.casemodule; package org.sleuthkit.autopsy.casemodule;
import java.util.logging.Level;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.List; import java.util.List;
import javax.swing.filechooser.FileFilter; import javax.swing.filechooser.FileFilter;
import org.openide.util.lookup.ServiceProvider; import org.openide.util.lookup.ServiceProvider;
import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.corecomponentinterfaces.DSPProgressMonitor; import org.sleuthkit.autopsy.corecomponentinterfaces.DataSourceProcessorProgressMonitor;
import org.sleuthkit.autopsy.corecomponentinterfaces.DSPCallback; import org.sleuthkit.autopsy.corecomponentinterfaces.DataSourceProcessorCallback;
import org.sleuthkit.autopsy.corecomponentinterfaces.DataSourceProcessor; import org.sleuthkit.autopsy.corecomponentinterfaces.DataSourceProcessor;
/** /**
@ -41,15 +38,13 @@ import org.sleuthkit.autopsy.corecomponentinterfaces.DataSourceProcessor;
@ServiceProvider(service = DataSourceProcessor.class) @ServiceProvider(service = DataSourceProcessor.class)
public class ImageDSProcessor implements DataSourceProcessor { public class ImageDSProcessor implements DataSourceProcessor {
static final Logger logger = Logger.getLogger(ImageDSProcessor.class.getName()); static final Logger logger = Logger.getLogger(ImageDSProcessor.class.getName());
// Data source type handled by this processor // Data source type handled by this processor
protected final static String dsType = "Image File"; private final static String dsType = "Image File";
// The Config UI panel that plugins into the Choose Data Source Wizard // The Config UI panel that plugins into the Choose Data Source Wizard
private ImageFilePanel imageFilePanel; private final ImageFilePanel imageFilePanel;
// The Background task that does the actual work of adding the image // The Background task that does the actual work of adding the image
private AddImageTask addImageTask; private AddImageTask addImageTask;
@ -57,7 +52,7 @@ public class ImageDSProcessor implements DataSourceProcessor {
// true of cancelled by the caller // true of cancelled by the caller
private boolean cancelled = false; private boolean cancelled = false;
DSPCallback callbackObj = null; DataSourceProcessorCallback callbackObj = null;
// set to TRUE if the image options have been set via API and config Jpanel should be ignored // set to TRUE if the image options have been set via API and config Jpanel should be ignored
private boolean imageOptionsSet = false; private boolean imageOptionsSet = false;
@ -67,13 +62,10 @@ public class ImageDSProcessor implements DataSourceProcessor {
private String timeZone; private String timeZone;
private boolean noFatOrphans; private boolean noFatOrphans;
static final GeneralFilter rawFilter = new GeneralFilter(GeneralFilter.RAW_IMAGE_EXTS, GeneralFilter.RAW_IMAGE_DESC); static final GeneralFilter rawFilter = new GeneralFilter(GeneralFilter.RAW_IMAGE_EXTS, GeneralFilter.RAW_IMAGE_DESC);
static final GeneralFilter encaseFilter = new GeneralFilter(GeneralFilter.ENCASE_IMAGE_EXTS, GeneralFilter.ENCASE_IMAGE_DESC); static final GeneralFilter encaseFilter = new GeneralFilter(GeneralFilter.ENCASE_IMAGE_EXTS, GeneralFilter.ENCASE_IMAGE_DESC);
static final List<String> allExt = new ArrayList<String>(); static final List<String> allExt = new ArrayList<>();
static { static {
allExt.addAll(GeneralFilter.RAW_IMAGE_EXTS); allExt.addAll(GeneralFilter.RAW_IMAGE_EXTS);
allExt.addAll(GeneralFilter.ENCASE_IMAGE_EXTS); allExt.addAll(GeneralFilter.ENCASE_IMAGE_EXTS);
@ -81,7 +73,7 @@ public class ImageDSProcessor implements DataSourceProcessor {
static final String allDesc = "All Supported Types"; static final String allDesc = "All Supported Types";
static final GeneralFilter allFilter = new GeneralFilter(allExt, allDesc); static final GeneralFilter allFilter = new GeneralFilter(allExt, allDesc);
static final List<FileFilter> filtersList = new ArrayList<FileFilter>(); static final List<FileFilter> filtersList = new ArrayList<>();
static { static {
filtersList.add(allFilter); filtersList.add(allFilter);
@ -89,7 +81,6 @@ public class ImageDSProcessor implements DataSourceProcessor {
filtersList.add(encaseFilter); filtersList.add(encaseFilter);
} }
/* /*
* A no argument constructor is required for the NM lookup() method to create an object * A no argument constructor is required for the NM lookup() method to create an object
*/ */
@ -100,13 +91,18 @@ public class ImageDSProcessor implements DataSourceProcessor {
} }
// this static method is used by the wizard to determine dsp type for 'core' data source processors
public static String getType() {
return dsType;
}
/** /**
* Returns the Data source type (string) handled by this DSP * Returns the Data source type (string) handled by this DSP
* *
* @return String the data source type * @return String the data source type
**/ **/
@Override @Override
public String getType() { public String getDataSourceType() {
return dsType; return dsType;
} }
@ -118,22 +114,23 @@ public class ImageDSProcessor implements DataSourceProcessor {
@Override @Override
public JPanel getPanel() { public JPanel getPanel() {
imageFilePanel.readSettings(); imageFilePanel.readSettings();
imageFilePanel.select(); imageFilePanel.select();
return imageFilePanel; return imageFilePanel;
} }
/** /**
* Validates the data collected by the JPanel * Validates the data collected by the JPanel
* *
* @return String returns NULL if success, error string if there is any errors * @return String returns NULL if success, error string if there is any errors
**/ **/
@Override @Override
public boolean validatePanel() { public boolean isPanelValid() {
return imageFilePanel.validatePanel(); return imageFilePanel.validatePanel();
} }
/** /**
* Runs the data source processor. * Runs the data source processor.
* This must kick off processing the data source in background * This must kick off processing the data source in background
@ -142,7 +139,7 @@ public class ImageDSProcessor implements DataSourceProcessor {
* @param cbObj callback to call when processing is done. * @param cbObj callback to call when processing is done.
**/ **/
@Override @Override
public void run(DSPProgressMonitor progressMonitor, DSPCallback cbObj) { public void run(DataSourceProcessorProgressMonitor progressMonitor, DataSourceProcessorCallback cbObj) {
callbackObj = cbObj; callbackObj = cbObj;
cancelled = false; cancelled = false;
@ -161,7 +158,6 @@ public class ImageDSProcessor implements DataSourceProcessor {
addImageTask = new AddImageTask(imagePath, timeZone, noFatOrphans, progressMonitor, cbObj); addImageTask = new AddImageTask(imagePath, timeZone, noFatOrphans, progressMonitor, cbObj);
new Thread(addImageTask).start(); new Thread(addImageTask).start();
return;
} }
/** /**
@ -171,15 +167,12 @@ public class ImageDSProcessor implements DataSourceProcessor {
public void cancel() { public void cancel() {
cancelled = true; cancelled = true;
addImageTask.cancelTask(); addImageTask.cancelTask();
return;
} }
/** /**
* Reset the data source processor * Reset the data source processor
**/ **/
@Override @Override
public void reset() { public void reset() {
@ -191,8 +184,6 @@ public class ImageDSProcessor implements DataSourceProcessor {
imagePath = null; imagePath = null;
timeZone = null; timeZone = null;
noFatOrphans = false; noFatOrphans = false;
return;
} }
/** /**
@ -201,7 +192,7 @@ public class ImageDSProcessor implements DataSourceProcessor {
* collect this information from a user. * collect this information from a user.
* *
* @param imgPath path to thew image or first image * @param imgPath path to thew image or first image
* @param String timeZone * @param tz timeZone
* @param noFat whether to parse FAT orphans * @param noFat whether to parse FAT orphans
**/ **/
public void setDataSourceOptions(String imgPath, String tz, boolean noFat) { public void setDataSourceOptions(String imgPath, String tz, boolean noFat) {

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2013 Basis Technology Corp. * Copyright 2013-2014 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");
@ -21,8 +21,8 @@ package org.sleuthkit.autopsy.casemodule;
import javax.swing.JPanel; import javax.swing.JPanel;
import org.openide.util.lookup.ServiceProvider; import org.openide.util.lookup.ServiceProvider;
import org.sleuthkit.autopsy.corecomponentinterfaces.DSPCallback; import org.sleuthkit.autopsy.corecomponentinterfaces.DataSourceProcessorCallback;
import org.sleuthkit.autopsy.corecomponentinterfaces.DSPProgressMonitor; import org.sleuthkit.autopsy.corecomponentinterfaces.DataSourceProcessorProgressMonitor;
import org.sleuthkit.autopsy.corecomponentinterfaces.DataSourceProcessor; import org.sleuthkit.autopsy.corecomponentinterfaces.DataSourceProcessor;
import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.Logger;
@ -33,10 +33,10 @@ public class LocalDiskDSProcessor implements DataSourceProcessor {
static final Logger logger = Logger.getLogger(ImageDSProcessor.class.getName()); static final Logger logger = Logger.getLogger(ImageDSProcessor.class.getName());
// Data source type handled by this processor // Data source type handled by this processor
static protected final String dsType = "Local Disk"; private static final String dsType = "Local Disk";
// The Config UI panel that plugins into the Choose Data Source Wizard // The Config UI panel that plugins into the Choose Data Source Wizard
private LocalDiskPanel localDiskPanel; private final LocalDiskPanel localDiskPanel;
// The Background task that does the actual work of adding the local Disk // The Background task that does the actual work of adding the local Disk
// Adding a local disk is exactly same as adding an Image. // Adding a local disk is exactly same as adding an Image.
@ -45,7 +45,7 @@ public class LocalDiskDSProcessor implements DataSourceProcessor {
// true if cancelled by the caller // true if cancelled by the caller
private boolean cancelled = false; private boolean cancelled = false;
DSPCallback callbackObj = null; DataSourceProcessorCallback callbackObj = null;
// set to TRUE if the image options have been set via API and config Jpanel should be ignored // set to TRUE if the image options have been set via API and config Jpanel should be ignored
private boolean localDiskOptionsSet = false; private boolean localDiskOptionsSet = false;
@ -55,8 +55,6 @@ public class LocalDiskDSProcessor implements DataSourceProcessor {
private String timeZone; private String timeZone;
private boolean noFatOrphans; private boolean noFatOrphans;
/* /*
* A no argument constructor is required for the NM lookup() method to create an object * A no argument constructor is required for the NM lookup() method to create an object
*/ */
@ -67,13 +65,18 @@ public class LocalDiskDSProcessor implements DataSourceProcessor {
} }
// this static method is used by the wizard to determine dsp type for 'core' data source processors
public static String getType() {
return dsType;
}
/** /**
* Returns the Data source type (string) handled by this DSP * Returns the Data source type (string) handled by this DSP
* *
* @return String the data source type * @return String the data source type
**/ **/
@Override @Override
public String getType() { public String getDataSourceType() {
return dsType; return dsType;
} }
@ -94,12 +97,10 @@ public class LocalDiskDSProcessor implements DataSourceProcessor {
* @return String returns NULL if success, error string if there is any errors * @return String returns NULL if success, error string if there is any errors
**/ **/
@Override @Override
public boolean validatePanel() { public boolean isPanelValid() {
return localDiskPanel.validatePanel(); return localDiskPanel.validatePanel();
} }
/** /**
* Runs the data source processor. * Runs the data source processor.
* This must kick off processing the data source in background * This must kick off processing the data source in background
@ -108,7 +109,7 @@ public class LocalDiskDSProcessor implements DataSourceProcessor {
* @param cbObj callback to call when processing is done. * @param cbObj callback to call when processing is done.
**/ **/
@Override @Override
public void run(DSPProgressMonitor progressMonitor, DSPCallback cbObj) { public void run(DataSourceProcessorProgressMonitor progressMonitor, DataSourceProcessorCallback cbObj) {
callbackObj = cbObj; callbackObj = cbObj;
cancelled = false; cancelled = false;
@ -123,15 +124,8 @@ public class LocalDiskDSProcessor implements DataSourceProcessor {
addDiskTask = new AddImageTask(localDiskPath, timeZone, noFatOrphans, progressMonitor, cbObj); addDiskTask = new AddImageTask(localDiskPath, timeZone, noFatOrphans, progressMonitor, cbObj);
new Thread(addDiskTask).start(); new Thread(addDiskTask).start();
return;
} }
/** /**
* Cancel the data source processing * Cancel the data source processing
**/ **/
@ -141,13 +135,11 @@ public class LocalDiskDSProcessor implements DataSourceProcessor {
cancelled = true; cancelled = true;
addDiskTask.cancelTask(); addDiskTask.cancelTask();
return;
} }
/** /**
* Reset the data source processor * Reset the data source processor
**/ **/
@Override @Override
public void reset() { public void reset() {
@ -160,7 +152,6 @@ public class LocalDiskDSProcessor implements DataSourceProcessor {
timeZone = null; timeZone = null;
noFatOrphans = false; noFatOrphans = false;
return;
} }
/** /**
@ -169,7 +160,7 @@ public class LocalDiskDSProcessor implements DataSourceProcessor {
* collect this information from a user. * collect this information from a user.
* *
* @param diskPath path to the local disk * @param diskPath path to the local disk
* @param String timeZone * @param tz time zone
* @param noFat whether to parse FAT orphans * @param noFat whether to parse FAT orphans
**/ **/
public void setDataSourceOptions(String diskPath, String tz, boolean noFat) { public void setDataSourceOptions(String diskPath, String tz, boolean noFat) {

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2013 Basis Technology Corp. * Copyright 2013-2014 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");
@ -21,8 +21,8 @@ package org.sleuthkit.autopsy.casemodule;
import javax.swing.JPanel; import javax.swing.JPanel;
import org.openide.util.lookup.ServiceProvider; import org.openide.util.lookup.ServiceProvider;
import org.sleuthkit.autopsy.corecomponentinterfaces.DSPCallback; import org.sleuthkit.autopsy.corecomponentinterfaces.DataSourceProcessorCallback;
import org.sleuthkit.autopsy.corecomponentinterfaces.DSPProgressMonitor; import org.sleuthkit.autopsy.corecomponentinterfaces.DataSourceProcessorProgressMonitor;
import org.sleuthkit.autopsy.corecomponentinterfaces.DataSourceProcessor; import org.sleuthkit.autopsy.corecomponentinterfaces.DataSourceProcessor;
import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.Logger;
@ -32,10 +32,10 @@ public class LocalFilesDSProcessor implements DataSourceProcessor {
static final Logger logger = Logger.getLogger(LocalFilesDSProcessor.class.getName()); static final Logger logger = Logger.getLogger(LocalFilesDSProcessor.class.getName());
// Data source type handled by this processor // Data source type handled by this processor
protected static final String dsType = "Logical Files"; private static final String dsType = "Logical Files";
// The Config UI panel that plugins into the Choose Data Source Wizard // The Config UI panel that plugins into the Choose Data Source Wizard
private LocalFilesPanel localFilesPanel; private final LocalFilesPanel localFilesPanel;
// The Background task that does the actual work of adding the files // The Background task that does the actual work of adding the files
private AddLocalFilesTask addFilesTask; private AddLocalFilesTask addFilesTask;
@ -43,7 +43,7 @@ public class LocalFilesDSProcessor implements DataSourceProcessor {
// true if cancelled by the caller // true if cancelled by the caller
private boolean cancelled = false; private boolean cancelled = false;
DSPCallback callbackObj = null; DataSourceProcessorCallback callbackObj = null;
// set to TRUE if the image options have been set via API and config Jpanel should be ignored // set to TRUE if the image options have been set via API and config Jpanel should be ignored
private boolean localFilesOptionsSet = false; private boolean localFilesOptionsSet = false;
@ -51,8 +51,6 @@ public class LocalFilesDSProcessor implements DataSourceProcessor {
// data source options // data source options
private String localFilesPath; private String localFilesPath;
/* /*
* A no argument constructor is required for the NM lookup() method to create an object * A no argument constructor is required for the NM lookup() method to create an object
*/ */
@ -62,13 +60,18 @@ public class LocalFilesDSProcessor implements DataSourceProcessor {
localFilesPanel = LocalFilesPanel.getDefault(); localFilesPanel = LocalFilesPanel.getDefault();
} }
// this static method is used by the wizard to determine dsp type for 'core' data source processors
public static String getType() {
return dsType;
}
/** /**
* Returns the Data source type (string) handled by this DSP * Returns the Data source type (string) handled by this DSP
* *
* @return String the data source type * @return String the data source type
**/ **/
@Override @Override
public String getType() { public String getDataSourceType() {
return dsType; return dsType;
} }
@ -82,18 +85,17 @@ public class LocalFilesDSProcessor implements DataSourceProcessor {
localFilesPanel.select(); localFilesPanel.select();
return localFilesPanel; return localFilesPanel;
} }
/** /**
* Validates the data collected by the JPanel * Validates the data collected by the JPanel
* *
* @return String returns NULL if success, error string if there is any errors * @return String returns NULL if success, error string if there is any errors
**/ **/
@Override @Override
public boolean validatePanel() { public boolean isPanelValid() {
return localFilesPanel.validatePanel(); return localFilesPanel.validatePanel();
} }
/** /**
* Runs the data source processor. * Runs the data source processor.
* This must kick off processing the data source in background * This must kick off processing the data source in background
@ -102,7 +104,7 @@ public class LocalFilesDSProcessor implements DataSourceProcessor {
* @param cbObj callback to call when processing is done. * @param cbObj callback to call when processing is done.
**/ **/
@Override @Override
public void run(DSPProgressMonitor progressMonitor, DSPCallback cbObj) { public void run(DataSourceProcessorProgressMonitor progressMonitor, DataSourceProcessorCallback cbObj) {
callbackObj = cbObj; callbackObj = cbObj;
cancelled = false; cancelled = false;
@ -115,7 +117,6 @@ public class LocalFilesDSProcessor implements DataSourceProcessor {
addFilesTask = new AddLocalFilesTask(localFilesPath, progressMonitor, cbObj); addFilesTask = new AddLocalFilesTask(localFilesPath, progressMonitor, cbObj);
new Thread(addFilesTask).start(); new Thread(addFilesTask).start();
return;
} }
/** /**
@ -126,13 +127,12 @@ public class LocalFilesDSProcessor implements DataSourceProcessor {
cancelled = true; cancelled = true;
addFilesTask.cancelTask(); addFilesTask.cancelTask();
return;
} }
/** /**
* Reset the data source processor * Reset the data source processor
**/ **/
@Override @Override
public void reset() { public void reset() {
@ -143,8 +143,6 @@ public class LocalFilesDSProcessor implements DataSourceProcessor {
localFilesOptionsSet = false; localFilesOptionsSet = false;
localFilesPath = null; localFilesPath = null;
return;
} }
/** /**
@ -157,7 +155,7 @@ public class LocalFilesDSProcessor implements DataSourceProcessor {
**/ **/
public void setDataSourceOptions(String filesPath) { public void setDataSourceOptions(String filesPath) {
this.localFilesPath = filesPath; localFilesPath = filesPath;
localFilesOptionsSet = true; localFilesOptionsSet = true;

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2011-2013 Basis Technology Corp. * Copyright 2011-2014 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");
@ -44,7 +44,7 @@ public interface DataSourceProcessor {
enum DSP_PANEL_EVENT { enum DSP_PANEL_EVENT {
UPDATE_UI, // the content of JPanel has changed that MAY warrant updates to the caller UI UPDATE_UI, // the content of JPanel has changed that MAY warrant updates to the caller UI
FOCUS_NEXT // the caller UI may move focus the the next UI element, floowing the panel. FOCUS_NEXT // the caller UI may move focus the the next UI element, following the panel.
}; };
@ -52,7 +52,7 @@ public interface DataSourceProcessor {
* Returns the type of Data Source it handles. * Returns the type of Data Source it handles.
* This name gets displayed in the drop-down listbox * This name gets displayed in the drop-down listbox
**/ **/
String getType(); String getDataSourceType();
/** /**
* Returns the picker panel to be displayed along with any other * Returns the picker panel to be displayed along with any other
@ -65,7 +65,7 @@ public interface DataSourceProcessor {
* Returns true if no errors, or * Returns true if no errors, or
* Returns false if there is an error. * Returns false if there is an error.
**/ **/
boolean validatePanel(); boolean isPanelValid();
/** /**
* Called to invoke the handling of Data source in the background. * Called to invoke the handling of Data source in the background.
@ -74,7 +74,7 @@ public interface DataSourceProcessor {
* @param progressPanel progress panel to be updated while processing * @param progressPanel progress panel to be updated while processing
* *
**/ **/
void run(DSPProgressMonitor progressPanel, DSPCallback dspCallback); void run(DataSourceProcessorProgressMonitor progressPanel, DataSourceProcessorCallback dspCallback);
/** /**
@ -84,9 +84,6 @@ public interface DataSourceProcessor {
/** /**
* Called to reset/reinitialize the DSP. * Called to reset/reinitialize the DSP.
*
**/ **/
void reset(); void reset();
} }

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2013 Basis Technology Corp. * Copyright 2013-2014 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");
@ -30,9 +30,9 @@ import org.sleuthkit.datamodel.Content;
* in the EDT thread. * in the EDT thread.
* *
*/ */
public abstract class DSPCallback { public abstract class DataSourceProcessorCallback {
public enum DSP_Result public enum DataSourceProcessorResult
{ {
NO_ERRORS, NO_ERRORS,
CRITICAL_ERRORS, CRITICAL_ERRORS,
@ -42,10 +42,10 @@ public abstract class DSPCallback {
/* /*
* Invoke the caller supplied callback function on the EDT thread * Invoke the caller supplied callback function on the EDT thread
*/ */
public void done(DSP_Result result, List<String> errList, List<Content> newContents) public void done(DataSourceProcessorResult result, List<String> errList, List<Content> newContents)
{ {
final DSP_Result resultf = result; final DataSourceProcessorResult resultf = result;
final List<String> errListf = errList; final List<String> errListf = errList;
final List<Content> newContentsf = newContents; final List<Content> newContentsf = newContents;
@ -62,5 +62,5 @@ public abstract class DSPCallback {
/* /*
* calling code overrides to provide its own calllback * calling code overrides to provide its own calllback
*/ */
public abstract void doneEDT(DSP_Result result, List<String> errList, List<Content> newContents); public abstract void doneEDT(DataSourceProcessorResult result, List<String> errList, List<Content> newContents);
}; };

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2013 Basis Technology Corp. * Copyright 2013-2014 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,11 +19,11 @@
package org.sleuthkit.autopsy.corecomponentinterfaces; package org.sleuthkit.autopsy.corecomponentinterfaces;
/* /*
* An GUI agnostic DSPProgressMonitor interface for DataSourceProcesssors to * An GUI agnostic DataSourceProcessorProgressMonitor interface for DataSourceProcesssors to
* indicate progress. * indicate progress.
* It models after a JProgressbar though it could use any underlying implementation * It models after a JProgressbar though it could use any underlying implementation
*/ */
public interface DSPProgressMonitor { public interface DataSourceProcessorProgressMonitor {
void setIndeterminate(boolean indeterminate); void setIndeterminate(boolean indeterminate);