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 IngestPipeline<DataSourceIngestTask> {
34 private static final Logger logger = Logger.getLogger(DataSourceIngestPipeline.class.getName());
35 private static final IngestManager ingestManager = IngestManager.getInstance();
47 DataSourceIngestPipeline(IngestJobExecutor ingestJobExecutor, List<IngestModuleTemplate> moduleTemplates) {
48 super(ingestJobExecutor, moduleTemplates);
52 Optional<IngestPipeline.PipelineModule<DataSourceIngestTask>> acceptModuleTemplate(IngestModuleTemplate
template) {
53 Optional<IngestPipeline.PipelineModule<DataSourceIngestTask>> module = Optional.empty();
54 if (
template.isDataSourceIngestModuleTemplate()) {
55 DataSourceIngestModule ingestModule =
template.createDataSourceIngestModule();
56 module = Optional.of(
new DataSourcePipelineModule(ingestModule,
template.getModuleName()));
62 void prepareForTask(DataSourceIngestTask task) {
66 void cleanUpAfterTask(DataSourceIngestTask task) {
67 ingestManager.setIngestTaskProgressCompleted(task);
74 static final class DataSourcePipelineModule extends IngestPipeline.PipelineModule<DataSourceIngestTask> {
76 private final DataSourceIngestModule module;
82 DataSourcePipelineModule(DataSourceIngestModule module, String displayName) {
83 super(module, displayName);
88 void process(IngestJobExecutor ingestJobExecutor, DataSourceIngestTask task)
throws IngestModuleException {
89 Content dataSource = task.getDataSource();
90 String progressBarDisplayName = NbBundle.getMessage(this.getClass(),
"IngestJob.progress.dataSourceIngest.displayName", getDisplayName(), dataSource.getName());
91 ingestJobExecutor.changeDataSourceIngestProgressBarTitle(progressBarDisplayName);
92 ingestJobExecutor.switchDataSourceIngestProgressBarToIndeterminate();
93 ingestManager.setIngestTaskProgress(task, getDisplayName());
94 logger.log(Level.INFO,
"{0} analysis of {1} starting",
new Object[]{getDisplayName(), dataSource.getName()});
95 module.process(dataSource,
new DataSourceIngestModuleProgress(ingestJobExecutor));
96 logger.log(Level.INFO,
"{0} analysis of {1} finished",
new Object[]{getDisplayName(), dataSource.getName()});
97 if (!ingestJobExecutor.isCancelled() && ingestJobExecutor.currentDataSourceIngestModuleIsCancelled()) {
98 ingestJobExecutor.currentDataSourceIngestModuleCancellationCompleted(getDisplayName());