19package org.sleuthkit.autopsy.ingest;
21import java.util.ArrayList;
22import java.util.Collections;
25import java.util.concurrent.atomic.AtomicLong;
26import java.util.logging.Level;
27import org.openide.util.NbBundle;
28import org.python.google.common.collect.ImmutableList;
29import org.sleuthkit.autopsy.coreutils.Logger;
30import org.sleuthkit.datamodel.AbstractFile;
31import org.sleuthkit.datamodel.AnalysisResult;
32import org.sleuthkit.datamodel.DataArtifact;
33import org.sleuthkit.datamodel.DataSource;
39public final class IngestJob {
46 NOT_CANCELLED(NbBundle.getMessage(IngestJob.class,
"IngestJob.cancelReason.notCancelled.text")),
47 USER_CANCELLED(NbBundle.getMessage(IngestJob.class,
"IngestJob.cancelReason.cancelledByUser.text")),
49 OUT_OF_DISK_SPACE(NbBundle.getMessage(IngestJob.class,
"IngestJob.cancelReason.outOfDiskSpace.text")),
50 SERVICES_DOWN(NbBundle.getMessage(IngestJob.class,
"IngestJob.cancelReason.servicesDown.text")),
51 CASE_CLOSED(NbBundle.getMessage(IngestJob.class,
"IngestJob.cancelReason.caseClosed.text"));
73 private final static AtomicLong
nextId =
new AtomicLong(0L);
74 private final long id;
76 private final List<AbstractFile>
files =
new ArrayList<>();
94 this.files.addAll(
files);
129 DataSource getDataSource() {
140 List<AbstractFile> getFiles() {
141 return ImmutableList.copyOf(
files);
149 IngestJobSettings getSettings() {
159 boolean hasIngestPipeline() {
169 void addStreamedFiles(List<Long> fileObjIds) {
174 logger.log(Level.SEVERE,
"Attempted to add streamed files with no ingest pipeline");
177 logger.log(Level.SEVERE,
"Attempted to add streamed files to batch ingest job");
187 void addDataArtifacts(List<DataArtifact> dataArtifacts) {
197 void addAnalysisResults(List<AnalysisResult> results) {
205 void addStreamedDataSource() {
210 logger.log(Level.SEVERE,
"Attempted to start data source analaysis with no ingest pipeline");
213 logger.log(Level.SEVERE,
"Attempted to add streamed ingest files to batch ingest job");
227 synchronized List<IngestModuleError> start() throws InterruptedException {
229 logger.log(Level.SEVERE,
"Attempt to start ingest job that has already been started");
230 return Collections.emptyList();
234 List<IngestModuleError> errors =
new ArrayList<>();
236 if (errors.isEmpty()) {
237 IngestManager.getInstance().fireDataSourceAnalysisStarted(
id,
ingestModuleExecutor.getDataSource());
249 Mode getIngestMode() {
353 void notifyIngestPipelinesShutDown() {
356 ingestManager.fireDataSourceAnalysisCompleted(
id,
dataSource);
358 IngestManager.getInstance().fireDataSourceAnalysisCancelled(
id,
dataSource);
360 ingestManager.finishIngestJob(
this);
411 return snapshot.getFileIngestIsRunning();
420 return new Date(
snapshot.getFileIngestStartTime().getTime());
429 DataSourceIngestPipeline.DataSourcePipelineModule getDataSourceLevelIngestModule() {
430 return snapshot.getDataSourceLevelIngestModule();
449 return snapshot.getCancellationReason();
460 return snapshot.getCancelledDataSourceIngestModules();
489 if (module !=
null) {
554 private final DataSourceIngestPipeline.DataSourcePipelineModule
module;
579 return module.getDisplayName();
589 return module.getProcessingStartTime();
synchronized static Logger getLogger(String name)
final IngestJobExecutor ingestJobExecutor
DataSourceIngestModuleHandle(IngestJobExecutor ingestJobExecutor, DataSourceIngestPipeline.DataSourcePipelineModule module)
final DataSourceIngestPipeline.DataSourcePipelineModule module
DataSourceProcessingSnapshot(IngestJobProgressSnapshot snapshot)
List< String > getCancelledDataSourceIngestModules()
Date fileIngestStartTime()
final IngestJobProgressSnapshot snapshot
CancellationReason getCancellationReason()
boolean fileIngestIsRunning()
DataSourceIngestModuleHandle runningDataSourceIngestModule()
final CancellationReason jobCancellationReason
DataSourceProcessingSnapshot getDataSourceProcessingSnapshot()
CancellationReason getCancellationReason()
ProgressSnapshot(boolean includeIngestTasksSnapshot)
final boolean jobCancellationRequested
final DataSourceProcessingSnapshot dataSourceProcessingSnapshot
Date fileIngestStartTime()
boolean fileIngestIsRunning()
final List< AbstractFile > files
static final Logger logger
volatile CancellationReason cancellationReason
final DataSource dataSource
void cancel(CancellationReason reason)
final IngestJobSettings settings
ProgressSnapshot getSnapshot()
ProgressSnapshot getSnapshot(boolean includeIngestTasksSnapshot)
volatile IngestJobExecutor ingestModuleExecutor
CancellationReason getCancellationReason()
static final AtomicLong nextId
List< IngestModuleTemplate > getEnabledIngestModuleTemplates()
static synchronized IngestManager getInstance()
INGEST_MODULES_STARTUP_FAILED
CancellationReason(String displayName)