Autopsy  4.21.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
DataArtifactIngestPipeline.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.DataArtifact;
24 
29 final class DataArtifactIngestPipeline extends IngestPipeline<DataArtifactIngestTask> {
30 
41  DataArtifactIngestPipeline(IngestJobExecutor ingestJobExecutor, List<IngestModuleTemplate> moduleTemplates) {
42  super(ingestJobExecutor, moduleTemplates);
43  }
44 
45  @Override
46  Optional<PipelineModule<DataArtifactIngestTask>> acceptModuleTemplate(IngestModuleTemplate template) {
47  Optional<IngestPipeline.PipelineModule<DataArtifactIngestTask>> module = Optional.empty();
48  if (template.isDataArtifactIngestModuleTemplate()) {
49  DataArtifactIngestModule ingestModule = template.createDataArtifactIngestModule();
50  module = Optional.of(new DataArtifactIngestPipelineModule(ingestModule, template.getModuleName()));
51  }
52  return module;
53  }
54 
55  @Override
56  void prepareForTask(DataArtifactIngestTask task) throws IngestPipelineException {
57  }
58 
59  @Override
60  void cleanUpAfterTask(DataArtifactIngestTask task) throws IngestPipelineException {
61  IngestManager.getInstance().setIngestTaskProgressCompleted(task);
62  }
63 
68  static final class DataArtifactIngestPipelineModule extends IngestPipeline.PipelineModule<DataArtifactIngestTask> {
69 
70  private final DataArtifactIngestModule module;
71 
79  DataArtifactIngestPipelineModule(DataArtifactIngestModule module, String displayName) {
80  super(module, displayName);
81  this.module = module;
82  }
83 
84  @Override
85  void process(IngestJobExecutor ingestJobExecutor, DataArtifactIngestTask task) throws IngestModuleException {
86  DataArtifact artifact = task.getDataArtifact();
87  IngestManager.getInstance().setIngestTaskProgress(task, getDisplayName());
88  module.process(artifact);
89  }
90 
91  }
92 
93 }

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