mirror of
https://github.com/elisspace/autopsy.git
synced 2026-09-05 18:14:30 +00:00
Tidy up ImageDSProcessor some more
This commit is contained in:
@@ -24,7 +24,6 @@ import java.util.List;
|
||||
import javax.swing.filechooser.FileFilter;
|
||||
import org.openide.util.NbBundle;
|
||||
import org.openide.util.lookup.ServiceProvider;
|
||||
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||
import org.sleuthkit.autopsy.corecomponentinterfaces.DataSourceProcessorProgressMonitor;
|
||||
import org.sleuthkit.autopsy.corecomponentinterfaces.DataSourceProcessorCallback;
|
||||
import org.sleuthkit.autopsy.corecomponentinterfaces.DataSourceProcessor;
|
||||
@@ -35,7 +34,6 @@ import org.sleuthkit.autopsy.corecomponentinterfaces.DataSourceProcessor;
|
||||
@ServiceProvider(service = DataSourceProcessor.class)
|
||||
public class ImageDSProcessor implements DataSourceProcessor {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(ImageDSProcessor.class.getName());
|
||||
private final static String dsType = NbBundle.getMessage(ImageDSProcessor.class, "ImageDSProcessor.dsType.text");
|
||||
private static final List<String> allExt = new ArrayList<>();
|
||||
private static final GeneralFilter rawFilter = new GeneralFilter(GeneralFilter.RAW_IMAGE_EXTS, GeneralFilter.RAW_IMAGE_DESC);
|
||||
@@ -43,14 +41,6 @@ public class ImageDSProcessor implements DataSourceProcessor {
|
||||
private static final String allDesc = NbBundle.getMessage(ImageDSProcessor.class, "ImageDSProcessor.allDesc.text");
|
||||
private static final GeneralFilter allFilter = new GeneralFilter(allExt, allDesc);
|
||||
private static final List<FileFilter> filtersList = new ArrayList<>();
|
||||
|
||||
static {
|
||||
filtersList.add(allFilter);
|
||||
filtersList.add(rawFilter);
|
||||
filtersList.add(encaseFilter);
|
||||
allExt.addAll(GeneralFilter.RAW_IMAGE_EXTS);
|
||||
allExt.addAll(GeneralFilter.ENCASE_IMAGE_EXTS);
|
||||
}
|
||||
private final ImageFilePanel imageFilePanel;
|
||||
private String imagePath;
|
||||
private String timeZone;
|
||||
@@ -59,9 +49,18 @@ public class ImageDSProcessor implements DataSourceProcessor {
|
||||
private AddImageTask addImageTask;
|
||||
DataSourceProcessorCallback callbackObj = null;
|
||||
|
||||
static {
|
||||
filtersList.add(allFilter);
|
||||
filtersList.add(rawFilter);
|
||||
filtersList.add(encaseFilter);
|
||||
allExt.addAll(GeneralFilter.RAW_IMAGE_EXTS);
|
||||
allExt.addAll(GeneralFilter.ENCASE_IMAGE_EXTS);
|
||||
}
|
||||
|
||||
/*
|
||||
* A no argument constructor is required for the NM lookup() method to
|
||||
* create an object
|
||||
* Constructs an uninitialized data source processor with a configuration
|
||||
* panel. The data source processor will not run if the configuration panel
|
||||
* inputs have not been completed and validated.
|
||||
*/
|
||||
public ImageDSProcessor() {
|
||||
imageFilePanel = ImageFilePanel.createInstance(ImageDSProcessor.class.getName(), filtersList);
|
||||
@@ -89,9 +88,9 @@ public class ImageDSProcessor implements DataSourceProcessor {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the JPanel for collecting the Data source information
|
||||
* Gets the a configuration panel for this data source processor.
|
||||
*
|
||||
* @return JPanel the config panel
|
||||
* @return JPanel The configuration panel.
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
@@ -102,10 +101,9 @@ public class ImageDSProcessor implements DataSourceProcessor {
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates the data collected by the JPanel
|
||||
* Indicates whether or not the inputs to the configuration panel are valid.
|
||||
*
|
||||
* @return String returns NULL if success, error string if there is any
|
||||
* errors
|
||||
* @return True or false.
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
@@ -114,33 +112,28 @@ public class ImageDSProcessor implements DataSourceProcessor {
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs the data source processor. This must kick off processing the data
|
||||
* source in background
|
||||
* Runs the data source processor in a separate thread.
|
||||
*
|
||||
* @param progressMonitor Progress monitor to report progress during
|
||||
* processing
|
||||
* @param cbObj callback to call when processing is done.
|
||||
* processing.
|
||||
* @param cbObj Callback to call when processing is done.
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
public void run(DataSourceProcessorProgressMonitor progressMonitor, DataSourceProcessorCallback cbObj) {
|
||||
callbackObj = cbObj;
|
||||
if (!imageOptionsSet) {
|
||||
//tell the panel to save the current settings
|
||||
imageFilePanel.storeSettings();
|
||||
|
||||
// get the image options from the panel
|
||||
imagePath = imageFilePanel.getContentPaths();
|
||||
timeZone = imageFilePanel.getTimeZone();
|
||||
noFatOrphans = imageFilePanel.getNoFatOrphans();
|
||||
}
|
||||
|
||||
addImageTask = new AddImageTask(imagePath, timeZone, noFatOrphans, progressMonitor, cbObj);
|
||||
new Thread(addImageTask).start();
|
||||
}
|
||||
|
||||
/**
|
||||
* Cancel the data source processing
|
||||
* Cancel the processing of the data source.
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
@@ -149,15 +142,12 @@ public class ImageDSProcessor implements DataSourceProcessor {
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset the data source processor
|
||||
*
|
||||
* Reset the configuration of this data source processor, including its
|
||||
* configuration panel.
|
||||
*/
|
||||
@Override
|
||||
public void reset() {
|
||||
// reset the config panel
|
||||
imageFilePanel.reset();
|
||||
|
||||
// reset state
|
||||
imageOptionsSet = false;
|
||||
imagePath = null;
|
||||
timeZone = null;
|
||||
@@ -165,13 +155,13 @@ public class ImageDSProcessor implements DataSourceProcessor {
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the data source options externally. To be used by a client that does
|
||||
* not have a UI and does not use the JPanel to collect this information
|
||||
* from a user.
|
||||
* Sets the configuration of the data source processor without using the
|
||||
* configuration panel.
|
||||
*
|
||||
* @param imgPath path to thew image or first image
|
||||
* @param tz timeZone
|
||||
* @param noFat whether to parse FAT orphans
|
||||
* @param imgPath Path to the image file.
|
||||
* @param tz The time zone to use when processing dates and times for
|
||||
* the image.
|
||||
* @param noFat Whether to parse orphans if the image has a FAT filesystem.
|
||||
*/
|
||||
public void setDataSourceOptions(String imgPath, String tz, boolean noFat) {
|
||||
this.imagePath = imgPath;
|
||||
|
||||
Reference in New Issue
Block a user