19 package org.sleuthkit.autopsy.ingest;
 
   21 import java.util.ArrayList;
 
   22 import java.util.Collections;
 
   23 import java.util.Date;
 
   24 import java.util.List;
 
   25 import java.util.concurrent.atomic.AtomicLong;
 
   26 import java.util.logging.Level;
 
   27 import org.openide.util.NbBundle;
 
   28 import org.python.google.common.collect.ImmutableList;
 
   56             this.displayName = displayName;
 
   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);
 
  140     List<AbstractFile> getFiles() {
 
  141         return ImmutableList.copyOf(files);
 
  149     IngestJobSettings getSettings() {
 
  159     boolean hasIngestPipeline() {
 
  169     void addStreamedFiles(List<Long> fileObjIds) {
 
  170         if (ingestMode == Mode.STREAMING) {
 
  171             if (ingestModuleExecutor != null) {
 
  172                 ingestModuleExecutor.addStreamedFiles(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) {
 
  188         ingestModuleExecutor.addDataArtifacts(dataArtifacts);
 
  197     void addAnalysisResults(List<AnalysisResult> results) {
 
  198         ingestModuleExecutor.addAnalysisResults(results);
 
  205     void addStreamedDataSource() {
 
  206         if (ingestMode == Mode.STREAMING) {
 
  207             if (ingestModuleExecutor != null) {
 
  208                 ingestModuleExecutor.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 {
 
  228         if (ingestModuleExecutor != null) {
 
  229             logger.log(Level.SEVERE, 
"Attempt to start ingest job that has already been started");
 
  230             return Collections.emptyList();
 
  233         ingestModuleExecutor = 
new IngestJobExecutor(
this);
 
  234         List<IngestModuleError> errors = 
new ArrayList<>();
 
  235         errors.addAll(ingestModuleExecutor.startUp());
 
  236         if (errors.isEmpty()) {
 
  237             IngestManager.getInstance().fireDataSourceAnalysisStarted(
id, ingestModuleExecutor.getDataSource());
 
  239             cancel(CancellationReason.INGEST_MODULES_STARTUP_FAILED);
 
  249     Mode getIngestMode() {
 
  272         if (ingestModuleExecutor != null) {
 
  285         if (ingestModuleExecutor != null) {
 
  286             snapshot = ingestModuleExecutor.getIngestJobProgressSnapshot(
true);
 
  313         cancellationReason = reason;
 
  324             if (ingestModuleExecutor != null) {
 
  325                 ingestModuleExecutor.cancel(reason);
 
  353     void notifyIngestPipelinesShutDown() {
 
  355         if (!ingestModuleExecutor.isCancelled()) {
 
  356             ingestManager.fireDataSourceAnalysisCompleted(
id, dataSource);
 
  358             IngestManager.getInstance().fireDataSourceAnalysisCancelled(
id, dataSource);
 
  360         ingestManager.finishIngestJob(
this);
 
  401                 return snapshot.getDataSource();
 
  411                 return snapshot.getFileIngestIsRunning();
 
  420                 return new Date(snapshot.getFileIngestStartTime().getTime());
 
  429             DataSourceIngestPipeline.DataSourcePipelineModule getDataSourceLevelIngestModule() {
 
  430                 return snapshot.getDataSourceLevelIngestModule();
 
  440                 return snapshot.isCancelled();
 
  449                 return snapshot.getCancellationReason();
 
  460                 return snapshot.getCancelledDataSourceIngestModules();
 
  488             DataSourceIngestPipeline.DataSourcePipelineModule module = dataSourceProcessingSnapshot.getDataSourceLevelIngestModule();
 
  489             if (module != null) {
 
  554         private final DataSourceIngestPipeline.DataSourcePipelineModule 
module;
 
  569             this.cancelled = ingestJobExecutor.currentDataSourceIngestModuleIsCancelled();
 
  579             return module.getDisplayName();
 
  589             return module.getProcessingStartTime();
 
  613             if (ingestJobExecutor.getCurrentDataSourceIngestModule() == 
module) {
 
  614                 ingestJobExecutor.cancelCurrentDataSourceIngestModule();
 
final DataSourceProcessingSnapshot dataSourceProcessingSnapshot
List< String > getCancelledDataSourceIngestModules()
static synchronized IngestManager getInstance()
CancellationReason(String displayName)
List< IngestModuleTemplate > getEnabledIngestModuleTemplates()
final IngestJobExecutor ingestJobExecutor
boolean fileIngestIsRunning()
DataSourceIngestModuleHandle(IngestJobExecutor ingestJobExecutor, DataSourceIngestPipeline.DataSourcePipelineModule module)
static final Logger logger
void cancel(CancellationReason reason)
final DataSource dataSource
DataSourceIngestModuleHandle runningDataSourceIngestModule()
CancellationReason getCancellationReason()
ProgressSnapshot getSnapshot()
INGEST_MODULES_STARTUP_FAILED
final List< AbstractFile > files
ProgressSnapshot(boolean includeIngestTasksSnapshot)
final IngestJobProgressSnapshot snapshot
final DataSourceIngestPipeline.DataSourcePipelineModule module
final boolean jobCancellationRequested
Date fileIngestStartTime()
ProgressSnapshot getSnapshot(boolean includeIngestTasksSnapshot)
static final AtomicLong nextId
boolean fileIngestIsRunning()
volatile CancellationReason cancellationReason
final CancellationReason jobCancellationReason
synchronized static Logger getLogger(String name)
CancellationReason getCancellationReason()
Date fileIngestStartTime()
volatile IngestJobExecutor ingestModuleExecutor
CancellationReason getCancellationReason()
DataSourceProcessingSnapshot getDataSourceProcessingSnapshot()
final IngestJobSettings settings
DataSourceProcessingSnapshot(IngestJobProgressSnapshot snapshot)