19 package org.sleuthkit.autopsy.ingest;
 
   21 import java.util.ArrayList;
 
   22 import java.util.Date;
 
   23 import java.util.List;
 
   25 import org.openide.util.NbBundle;
 
   36 final class FileIngestPipeline {
 
   38     private static final IngestManager ingestManager = IngestManager.getInstance();
 
   39     private final DataSourceIngestJob job;
 
   40     private final List<PipelineModule> modules = 
new ArrayList<>();
 
   41     private Date startTime;
 
   42     private volatile boolean running;
 
   53     FileIngestPipeline(DataSourceIngestJob job, List<IngestModuleTemplate> moduleTemplates) {
 
   55         for (IngestModuleTemplate 
template : moduleTemplates) {
 
   56             if (
template.isFileIngestModuleTemplate()) {
 
   57                 PipelineModule module = 
new PipelineModule(
template.createFileIngestModule(), 
template.getModuleName());
 
   69         return this.modules.isEmpty();
 
   88         return this.startTime;
 
   96     synchronized List<IngestModuleError> startUp() {
 
   97         this.startTime = 
new Date();
 
   99         List<IngestModuleError> errors = 
new ArrayList<>();
 
  100         for (PipelineModule module : this.modules) {
 
  102                 module.startUp(
new IngestJobContext(this.job));
 
  103             } 
catch (Throwable ex) { 
 
  104                 errors.add(
new IngestModuleError(module.getDisplayName(), ex));
 
  117     synchronized List<IngestModuleError> process(FileIngestTask task) {
 
  118         List<IngestModuleError> errors = 
new ArrayList<>();
 
  119         if (!this.job.isCancelled()) {
 
  120             AbstractFile file = task.getFile();
 
  121             for (PipelineModule module : this.modules) {
 
  123                     FileIngestPipeline.ingestManager.setIngestTaskProgress(task, module.getDisplayName());
 
  124                     this.job.setCurrentFileIngestModule(module.getDisplayName(), task.getFile().getName());
 
  125                     module.process(file);
 
  126                 } 
catch (Throwable ex) { 
 
  127                     errors.add(
new IngestModuleError(module.getDisplayName(), ex));
 
  128                     String msg = ex.getMessage();
 
  133                     MessageNotifyUtil.Notify.error(NbBundle.getMessage(
this.getClass(), 
"FileIngestPipeline.moduleError.title.text", module.getDisplayName()), msg);
 
  135                 if (this.job.isCancelled()) {
 
  140             if (!this.job.isCancelled()) {
 
  141                 IngestManager.getInstance().fireFileIngestDone(file);
 
  144         FileIngestPipeline.ingestManager.setIngestTaskProgressCompleted(task);
 
  153     synchronized List<IngestModuleError> shutDown() {
 
  154         List<IngestModuleError> errors = 
new ArrayList<>();
 
  155         if (this.running == 
true) { 
 
  156             for (PipelineModule module : this.modules) {
 
  159                 } 
catch (Throwable ex) { 
 
  160                     errors.add(
new IngestModuleError(module.getDisplayName(), ex));
 
  161                     String msg = ex.getMessage();
 
  166                     MessageNotifyUtil.Notify.error(NbBundle.getMessage(
this.getClass(), 
"FileIngestPipeline.moduleError.title.text", module.getDisplayName()), msg);
 
  170         this.running = 
false;
 
  199         String getClassName() {
 
  200             return module.getClass().getCanonicalName();
 
  208         String getDisplayName() {
 
ProcessResult process(AbstractFile file)
void startUp(IngestJobContext context)
IngestModule.ProcessResult process(AbstractFile file)
void startUp(IngestJobContext context)
final FileIngestModule module