Autopsy 4.22.1
Graphical digital forensics platform for The Sleuth Kit and other tools.
DataSourceIngestPipeline.java
Go to the documentation of this file.
1/*
2 * Autopsy Forensic Browser
3 *
4 * Copyright 2014-2021 Basis Technology Corp.
5 * Contact: carrier <at> sleuthkit <dot> org
6 *
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 */
19package org.sleuthkit.autopsy.ingest;
20
21import java.util.List;
22import java.util.Optional;
23import java.util.logging.Level;
24import org.openide.util.NbBundle;
25import org.sleuthkit.autopsy.coreutils.Logger;
26import org.sleuthkit.datamodel.Content;
27
32final class DataSourceIngestPipeline extends IngestPipeline<DataSourceIngestTask> {
33
34 private static final Logger logger = Logger.getLogger(DataSourceIngestPipeline.class.getName());
35 private static final IngestManager ingestManager = IngestManager.getInstance();
36
47 DataSourceIngestPipeline(IngestJobExecutor ingestJobExecutor, List<IngestModuleTemplate> moduleTemplates) {
48 super(ingestJobExecutor, moduleTemplates);
49 }
50
51 @Override
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()));
57 }
58 return module;
59 }
60
61 @Override
62 void prepareForTask(DataSourceIngestTask task) {
63 }
64
65 @Override
66 void cleanUpAfterTask(DataSourceIngestTask task) {
67 ingestManager.setIngestTaskProgressCompleted(task);
68 }
69
74 static final class DataSourcePipelineModule extends IngestPipeline.PipelineModule<DataSourceIngestTask> {
75
76 private final DataSourceIngestModule module;
77
82 DataSourcePipelineModule(DataSourceIngestModule module, String displayName) {
83 super(module, displayName);
84 this.module = module;
85 }
86
87 @Override
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()}); //NON-NLS
95 try {
96 module.process(dataSource, new DataSourceIngestModuleProgress(ingestJobExecutor));
97 logger.log(Level.INFO, "{0} analysis of {1} finished", new Object[]{getDisplayName(), dataSource.getName()}); //NON-NLS
98 } finally {
99 ingestJobExecutor.changeDataSourceIngestProgressBarTitle(NbBundle.getMessage(this.getClass(), "IngestJob.progress.dataSourceIngest.initialDisplayName", dataSource.getName()));
100 ingestJobExecutor.switchDataSourceIngestProgressBarToIndeterminate();
101 }
102 if (!ingestJobExecutor.isCancelled() && ingestJobExecutor.currentDataSourceIngestModuleIsCancelled()) {
103 ingestJobExecutor.currentDataSourceIngestModuleCancellationCompleted(getDisplayName());
104 }
105 }
106
107 }
108
109}

Copyright © 2012-2024 Sleuth Kit Labs. Generated on:
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.