19 package org.sleuthkit.autopsy.ingest;
21 import java.util.ArrayList;
22 import java.util.Date;
23 import java.util.List;
34 final class FileIngestPipeline {
36 private static final IngestManager ingestManager = IngestManager.getInstance();
37 private final DataSourceIngestJob job;
38 private final List<PipelineModule> modules =
new ArrayList<>();
39 private Date startTime;
40 private volatile boolean running;
51 FileIngestPipeline(DataSourceIngestJob job, List<IngestModuleTemplate> moduleTemplates) {
53 for (IngestModuleTemplate
template : moduleTemplates) {
54 if (
template.isFileIngestModuleTemplate()) {
55 PipelineModule module =
new PipelineModule(
template.createFileIngestModule(),
template.getModuleName());
67 return this.modules.isEmpty();
86 return this.startTime;
94 synchronized List<IngestModuleError> startUp() {
95 this.startTime =
new Date();
97 List<IngestModuleError> errors =
new ArrayList<>();
98 for (PipelineModule module : this.modules) {
100 module.startUp(
new IngestJobContext(this.job));
101 }
catch (Throwable ex) {
102 errors.add(
new IngestModuleError(module.getDisplayName(), ex));
114 synchronized List<IngestModuleError> process(FileIngestTask task) {
115 List<IngestModuleError> errors =
new ArrayList<>();
116 AbstractFile file = task.getFile();
117 for (PipelineModule module : this.modules) {
119 FileIngestPipeline.ingestManager.setIngestTaskProgress(task, module.getDisplayName());
120 module.process(file);
121 }
catch (Throwable ex) {
122 errors.add(
new IngestModuleError(module.getDisplayName(), ex));
123 String msg = ex.getMessage();
127 MessageNotifyUtil.Notify.error(module.getDisplayName() +
" Error", msg);
129 if (this.job.isCancelled()) {
134 if (!this.job.isCancelled()) {
135 IngestManager.getInstance().fireFileIngestDone(file);
137 FileIngestPipeline.ingestManager.setIngestTaskProgressCompleted(task);
146 synchronized List<IngestModuleError> shutDown() {
147 List<IngestModuleError> errors =
new ArrayList<>();
148 for (PipelineModule module : this.modules) {
151 }
catch (Throwable ex) {
152 errors.add(
new IngestModuleError(module.getDisplayName(), ex));
153 String msg = ex.getMessage();
157 MessageNotifyUtil.Notify.error(module.getDisplayName() +
" Error", msg);
160 this.running =
false;
189 String getClassName() {
190 return module.getClass().getCanonicalName();
198 String getDisplayName() {
ProcessResult process(AbstractFile file)
void startUp(IngestJobContext context)
IngestModule.ProcessResult process(AbstractFile file)
void startUp(IngestJobContext context)
final FileIngestModule module