Created dummy AddArchiveTask

This commit is contained in:
Eugene Livis 2017-10-18 16:40:35 -04:00
parent 89f48e8c38
commit ab4f586f32
3 changed files with 109 additions and 18 deletions

View File

@ -0,0 +1,84 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2011-2017 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.sleuthkit.autopsy.experimental.autoingest;
import org.sleuthkit.autopsy.corecomponentinterfaces.DataSourceProcessorCallback;
import org.sleuthkit.autopsy.corecomponentinterfaces.DataSourceProcessorProgressMonitor;
import org.sleuthkit.autopsy.coreutils.Logger;
/*
* A runnable that adds an archive data source to the case database.
*/
public class AddArchiveTask implements Runnable {
private final Logger logger = Logger.getLogger(AddArchiveTask.class.getName());
private final String deviceId;
private final String imagePath;
private final DataSourceProcessorProgressMonitor progressMonitor;
private final DataSourceProcessorCallback callback;
private boolean criticalErrorOccurred;
/*
* The cancellation requested flag and SleuthKit add image process are
* guarded by a monitor (called a lock here to avoid confusion with the
* progress monitor) to synchronize cancelling the process (setting the flag
* and calling its stop method) and calling either its commit or revert
* method. The built-in monitor of the add image process can't be used for
* this because it is already used to synchronize its run (init part),
* commit, revert, and currentDirectory methods.
*
* TODO (AUT-2021): Merge SleuthkitJNI.AddImageProcess and AddImageTask
*/
private final Object tskAddImageProcessLock;
/**
* Constructs a runnable task that adds an image to the case database.
*
* @param deviceId An ASCII-printable identifier for the device associated
* with the data source that is intended to be unique across multiple cases
* (e.g., a UUID).
* @param imagePath Path to the image file.
* @param progressMonitor Progress monitor to report progress during
* processing.
* @param callback Callback to call when processing is done.
*/
AddArchiveTask(String deviceId, String imagePath, DataSourceProcessorProgressMonitor progressMonitor, DataSourceProcessorCallback callback) {
this.deviceId = deviceId;
this.imagePath = imagePath;
this.callback = callback;
this.progressMonitor = progressMonitor;
tskAddImageProcessLock = new Object();
}
/**
* Adds the archive to the case database.
*/
@Override
public void run() {
}
/*
* Attempts to cancel adding the image to the case database.
*/
public void cancelTask() {
}
}

View File

@ -61,7 +61,7 @@ public class ArchiveExtractorDataSourceProcessor implements DataSourceProcessor,
private final static String DATA_SOURCE_TYPE = NbBundle.getMessage(ArchiveExtractorDataSourceProcessor.class, "ArchiveExtractorDataSourceProcessor.dsType.text");
private static GeneralFilter zipFilter;
private static List<FileFilter> archiveFilters = new ArrayList<>();
private static final List<FileFilter> archiveFilters = new ArrayList<>();
private static final String AUTO_INGEST_MODULE_OUTPUT_DIR = "AutoIngest";
@ -70,6 +70,8 @@ public class ArchiveExtractorDataSourceProcessor implements DataSourceProcessor,
private String imagePath;
private boolean setDataSourceOptionsCalled;
private AddArchiveTask addArchiveTask;
/**
* Constructs an archive data source processor that
* implements the DataSourceProcessor service provider interface to allow
@ -171,22 +173,32 @@ public class ArchiveExtractorDataSourceProcessor implements DataSourceProcessor,
* is started and uses the callback object to signal task completion and
* return results.
*
* This method should not be called unless isPanelValid returns true.
*
* @param progressMonitor Progress monitor that will be used by the
* background task to report progress.
* @param callback Callback that will be used by the background task
* to return results.
* @param deviceId An ASCII-printable identifier for the device
* associated with the data source that is
* intended to be unique across multiple cases
* (e.g., a UUID).
* @param imagePath Path to the image file.
* @param progressMonitor Progress monitor for reporting progress
* during processing.
* @param callback Callback to call when processing is done.
*/
public void run(String deviceId, String imageFolderPath, DataSourceProcessorProgressMonitor progressMonitor, DataSourceProcessorCallback callback) {
//List<String> imageFilePaths = getImageFilePaths(imageFolderPath);
//addImagesTask = new AddCellebritePhysicalReportTask(deviceId, imageFilePaths, timeZone, progressMonitor, callback);
//new Thread(addImagesTask).start();
}
public void run(String deviceId, String imagePath, DataSourceProcessorProgressMonitor progressMonitor, DataSourceProcessorCallback callback) {
addArchiveTask = new AddArchiveTask(deviceId, imagePath, progressMonitor, callback);
new Thread(addArchiveTask).start();
}
/**
* Requests cancellation of the background task that adds a data source to
* the case database, after the task is started using the run method. This
* is a "best effort" cancellation, with no guarantees that the case
* database will be unchanged. If cancellation succeeded, the list of new
* data sources returned by the background task will be empty.
*/
@Override
public void cancel() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
if (null != addArchiveTask) {
addArchiveTask.cancelTask();
}
}
@Override

View File

@ -37,7 +37,6 @@ import java.time.Duration;
import java.time.Instant;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Date;
import java.util.EnumSet;
@ -59,9 +58,6 @@ import java.util.concurrent.TimeUnit;
import java.util.logging.Level;
import java.util.stream.Collectors;
import javax.annotation.concurrent.GuardedBy;
import javax.annotation.concurrent.Immutable;
import javax.annotation.concurrent.ThreadSafe;
import org.openide.util.Exceptions;
import org.openide.util.Lookup;
import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.casemodule.Case.CaseType;
@ -101,7 +97,6 @@ import org.sleuthkit.autopsy.ingest.IngestJobSettings;
import org.sleuthkit.autopsy.ingest.IngestJobStartResult;
import org.sleuthkit.autopsy.ingest.IngestManager;
import org.sleuthkit.autopsy.ingest.IngestModuleError;
import org.sleuthkit.datamodel.Content;
/**
* An auto ingest manager is responsible for processing auto ingest jobs defined