diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/AddImageTask.java b/Core/src/org/sleuthkit/autopsy/casemodule/AddImageTask.java index 6c24cd6b9c..718f0bb9fb 100644 --- a/Core/src/org/sleuthkit/autopsy/casemodule/AddImageTask.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/AddImageTask.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2013-2014 Basis Technology Corp. + * Copyright 2013-2016 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -71,6 +71,8 @@ class AddImageTask implements Runnable { String timeZone; boolean noFatOrphans; + private final String dataSourceId; + /* * A thread that updates the progressMonitor with the name of the directory * currently being processed by the AddImageTask @@ -100,27 +102,41 @@ class AddImageTask implements Runnable { currDir)); } } - // this sleep here prevents the UI from locking up + // this sleep here prevents the UI from locking up // due to too frequent updates to the progressMonitor above Thread.sleep(500); } } catch (InterruptedException ie) { - // nothing to do, thread was interrupted externally + // nothing to do, thread was interrupted externally // signaling the end of AddImageProcess } } } - public AddImageTask(String imgPath, String tz, boolean noOrphans, DataSourceProcessorProgressMonitor aProgressMonitor, DataSourceProcessorCallback cbObj) { - + /** + * Constructs a runnable task that adds an image to the case database. + * + * @param dataSourceId An ASCII-printable identifier for the data + * source that is intended to be unique across + * multiple cases (e.g., a UUID). + * @param imagePath Path to the image file. + * @param timeZone The time zone to use when processing dates + * and times for the image, obtained from + * java.util.TimeZone.getID. + * @param ignoreFatOrphanFiles Whether to parse orphans if the image has a + * FAT filesystem. + * @param monitor Progress monitor to report progress during + * processing. + * @param cbObj Callback to call when processing is done. + */ + AddImageTask(String dataSourceId, String imagePath, String timeZone, boolean ignoreFatOrphanFiles, DataSourceProcessorProgressMonitor monitor, DataSourceProcessorCallback cbObj) { currentCase = Case.getCurrentCase(); - - this.imagePath = imgPath; - this.timeZone = tz; - this.noFatOrphans = noOrphans; - + this.dataSourceId = dataSourceId; + this.imagePath = imagePath; + this.timeZone = timeZone; + this.noFatOrphans = ignoreFatOrphanFiles; this.callbackObj = cbObj; - this.progressMonitor = aProgressMonitor; + this.progressMonitor = monitor; } /** @@ -141,7 +157,7 @@ class AddImageTask implements Runnable { progressMonitor.setIndeterminate(true); progressMonitor.setProgress(0); dirFetcher.start(); - addImageProcess.run(new String[]{this.imagePath}); + addImageProcess.run(dataSourceId, new String[]{imagePath}); } catch (TskCoreException ex) { logger.log(Level.SEVERE, "Core errors occurred while running add image on " + imagePath, ex); //NON-NLS hasCritError = true; diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/ImageDSProcessor.java b/Core/src/org/sleuthkit/autopsy/casemodule/ImageDSProcessor.java index 180df86b6b..03065775e2 100644 --- a/Core/src/org/sleuthkit/autopsy/casemodule/ImageDSProcessor.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/ImageDSProcessor.java @@ -142,7 +142,7 @@ public class ImageDSProcessor implements DataSourceProcessor { ignoreFatOrphanFiles = configPanel.getNoFatOrphans(); configured = true; } - addImageTask = new AddImageTask(imagePath, timeZone, ignoreFatOrphanFiles, monitor, cbObj); + addImageTask = new AddImageTask(dataSourceId, imagePath, timeZone, ignoreFatOrphanFiles, monitor, cbObj); new Thread(addImageTask).start(); } @@ -150,8 +150,9 @@ public class ImageDSProcessor implements DataSourceProcessor { * Runs the data source processor in a separate thread without requiring use * the configuration panel. * - * @param dataSourceId A identifier for the data source that is - * unique across multiple cases (e.g., a UUID). + * @param dataSourceId An ASCII-printable identifier for the data + * source that is intended to be unique across + * multiple cases (e.g., a UUID). * @param imagePath Path to the image file. * @param timeZone The time zone to use when processing dates * and times for the image, obtained from @@ -200,13 +201,16 @@ public class ImageDSProcessor implements DataSourceProcessor { * when when processing dates and times for the image. * * @param imagePath Path to the image file. + * @param timeZone The time zone to use when processing dates + * and times for the image, obtained from + * java.util.TimeZone.getID. * @param ignoreFatOrphanFiles Whether to parse orphans if the image has a * FAT filesystem. * * @deprecated Use the run method instead. */ @Deprecated - public void setDataSourceOptions(String imagePath, boolean ignoreFatOrphanFiles) { + public void setDataSourceOptions(String imagePath, String timeZone, boolean ignoreFatOrphanFiles) { this.dataSourceId = UUID.randomUUID().toString(); this.imagePath = imagePath; this.timeZone = Calendar.getInstance().getTimeZone().getID(); diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/LocalDiskDSProcessor.java b/Core/src/org/sleuthkit/autopsy/casemodule/LocalDiskDSProcessor.java index cff54942d2..90fc238d32 100644 --- a/Core/src/org/sleuthkit/autopsy/casemodule/LocalDiskDSProcessor.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/LocalDiskDSProcessor.java @@ -122,7 +122,7 @@ public class LocalDiskDSProcessor implements DataSourceProcessor { ignoreFatOrphanFiles = configPanel.getNoFatOrphans(); configured = true; } - addDiskTask = new AddImageTask(drivePath, timeZone, ignoreFatOrphanFiles, progressMonitor, cbObj); + addDiskTask = new AddImageTask(dataSourceId, drivePath, timeZone, ignoreFatOrphanFiles, progressMonitor, cbObj); new Thread(addDiskTask).start(); } @@ -130,8 +130,9 @@ public class LocalDiskDSProcessor implements DataSourceProcessor { * Runs the data source processor in a separate thread without requiring use * the configuration panel. * - * @param dataSourceId A identifier for the data source that is - * unique across multiple cases (e.g., a UUID). + * @param dataSourceId An ASCII-printable identifier for the data + * source that is intended to be unique across + * multiple cases (e.g., a UUID). * @param drivePath Path to the local drive. * @param timeZone The time zone to use when processing dates * and times for the image, obtained from @@ -180,13 +181,16 @@ public class LocalDiskDSProcessor implements DataSourceProcessor { * when when processing dates and times for the image. * * @param drivePath Path to the local drive. + * @param timeZone The time zone to use when processing dates + * and times for the image, obtained from + * java.util.TimeZone.getID. * @param ignoreFatOrphanFiles Whether to parse orphans if the image has a * FAT filesystem. * * @deprecated Use the run method instead. */ @Deprecated - public void setDataSourceOptions(String drivePath, boolean ignoreFatOrphanFiles) { + public void setDataSourceOptions(String drivePath, String timeZone, boolean ignoreFatOrphanFiles) { this.dataSourceId = UUID.randomUUID().toString(); this.drivePath = drivePath; this.timeZone = Calendar.getInstance().getTimeZone().getID();