19 package org.sleuthkit.autopsy.ingest;
21 import java.util.List;
22 import java.util.Optional;
23 import java.util.logging.Level;
24 import org.openide.util.NbBundle;
32 final class DataSourceIngestPipeline
extends IngestTaskPipeline<DataSourceIngestTask> {
34 private static final Logger logger = Logger.getLogger(DataSourceIngestPipeline.class.getName());
35 private static final IngestManager ingestManager = IngestManager.getInstance();
45 DataSourceIngestPipeline(IngestJobPipeline ingestJobPipeline, List<IngestModuleTemplate> moduleTemplates) {
46 super(ingestJobPipeline, moduleTemplates);
50 Optional<IngestTaskPipeline.PipelineModule<DataSourceIngestTask>> acceptModuleTemplate(IngestModuleTemplate
template) {
51 Optional<IngestTaskPipeline.PipelineModule<DataSourceIngestTask>> module = Optional.empty();
52 if (
template.isDataSourceIngestModuleTemplate()) {
53 DataSourceIngestModule ingestModule =
template.createDataSourceIngestModule();
54 module = Optional.of(
new DataSourcePipelineModule(ingestModule,
template.getModuleName()));
60 void prepareForTask(DataSourceIngestTask task) {
64 void cleanUpAfterTask(DataSourceIngestTask task) {
65 ingestManager.setIngestTaskProgressCompleted(task);
72 static final class DataSourcePipelineModule extends IngestTaskPipeline.PipelineModule<DataSourceIngestTask> {
74 private final DataSourceIngestModule module;
80 DataSourcePipelineModule(DataSourceIngestModule module, String displayName) {
81 super(module, displayName);
86 void executeTask(IngestJobPipeline ingestJobPipeline, DataSourceIngestTask task)
throws IngestModuleException {
87 Content dataSource = task.getDataSource();
88 String progressBarDisplayName = NbBundle.getMessage(this.getClass(),
"IngestJob.progress.dataSourceIngest.displayName", getDisplayName(), dataSource.getName());
89 ingestJobPipeline.updateDataSourceIngestProgressBarDisplayName(progressBarDisplayName);
90 ingestJobPipeline.switchDataSourceIngestProgressBarToIndeterminate();
91 ingestManager.setIngestTaskProgress(task, getDisplayName());
92 logger.log(Level.INFO,
"{0} analysis of {1} starting",
new Object[]{getDisplayName(), dataSource.getName()});
93 module.process(dataSource,
new DataSourceIngestModuleProgress(ingestJobPipeline));
94 logger.log(Level.INFO,
"{0} analysis of {1} finished",
new Object[]{getDisplayName(), dataSource.getName()});
95 if (!ingestJobPipeline.isCancelled() && ingestJobPipeline.currentDataSourceIngestModuleIsCancelled()) {
96 ingestJobPipeline.currentDataSourceIngestModuleCancellationCompleted(getDisplayName());