Autopsy  4.20.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
AnalysisResultIngestPipeline.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2021-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  */
19 package org.sleuthkit.autopsy.ingest;
20 
21 import java.util.List;
22 import java.util.Optional;
23 import org.sleuthkit.datamodel.AnalysisResult;
24 
29 public class AnalysisResultIngestPipeline extends IngestPipeline<AnalysisResultIngestTask> {
30 
41  AnalysisResultIngestPipeline(IngestJobExecutor ingestJobExecutor, List<IngestModuleTemplate> moduleTemplates) {
42  super(ingestJobExecutor, moduleTemplates);
43  }
44 
45  @Override
46  Optional<PipelineModule<AnalysisResultIngestTask>> acceptModuleTemplate(IngestModuleTemplate template) {
47  Optional<IngestPipeline.PipelineModule<AnalysisResultIngestTask>> module = Optional.empty();
48  if (template.isAnalysisResultIngestModuleTemplate()) {
49  AnalysisResultIngestModule ingestModule = template.createAnalysisResultIngestModule();
50  module = Optional.of(new AnalysisResultIngestPipelineModule(ingestModule, template.getModuleName()));
51  }
52  return module;
53  }
54 
55  @Override
56  void prepareForTask(AnalysisResultIngestTask task) throws IngestPipelineException {
57  }
58 
59  @Override
60  void cleanUpAfterTask(AnalysisResultIngestTask task) throws IngestPipelineException {
61  IngestManager.getInstance().setIngestTaskProgressCompleted(task);
62  }
63 
68  static final class AnalysisResultIngestPipelineModule extends IngestPipeline.PipelineModule<AnalysisResultIngestTask> {
69 
70  private final AnalysisResultIngestModule module;
71 
79  AnalysisResultIngestPipelineModule(AnalysisResultIngestModule module, String displayName) {
80  super(module, displayName);
81  this.module = module;
82  }
83 
84  @Override
85  void process(IngestJobExecutor ingestJobExecutor, AnalysisResultIngestTask task) throws IngestModule.IngestModuleException {
86  AnalysisResult result = task.getAnalysisResult();
87  IngestManager.getInstance().setIngestTaskProgress(task, getDisplayName());
88  module.process(result);
89  }
90 
91  }
92 
93 }
static synchronized IngestManager getInstance()
ProcessResult process(AnalysisResult result)

Copyright © 2012-2022 Basis Technology. Generated on: Tue Aug 1 2023
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.