From 44d5454f8d7a29e64628e16862e55c3355a1dbbf Mon Sep 17 00:00:00 2001 From: Richard Cordovano Date: Mon, 21 Apr 2014 16:22:27 -0400 Subject: [PATCH 1/3] Add ingest job to IngestManager collection sooner --- .../autopsy/ingest/IngestManager.java | 48 ++++++++++++------- 1 file changed, 32 insertions(+), 16 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/ingest/IngestManager.java b/Core/src/org/sleuthkit/autopsy/ingest/IngestManager.java index c5fa91a01a..3810cad10c 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/IngestManager.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/IngestManager.java @@ -360,14 +360,14 @@ public class IngestManager { public void run() { try { final String displayName = NbBundle.getMessage(this.getClass(), - "IngestManager.StartIngestJobsTask.run.displayName"); + "IngestManager.StartIngestJobsTask.run.displayName"); progress = ProgressHandleFactory.createHandle(displayName, new Cancellable() { @Override public boolean cancel() { if (progress != null) { progress.setDisplayName(NbBundle.getMessage(this.getClass(), - "IngestManager.StartIngestJobsTask.run.cancelling", - displayName)); + "IngestManager.StartIngestJobsTask.run.cancelling", + displayName)); } IngestManager.getInstance().cancelIngestJobs(); return true; @@ -381,37 +381,53 @@ public class IngestManager { break; } + // Create an ingest job. IngestJob ingestJob = new IngestJob(IngestManager.this.ingestJobId.incrementAndGet(), dataSource, moduleTemplates, processUnallocatedSpace); + synchronized (IngestManager.this) { + ingestJobs.put(ingestJob.getId(), ingestJob); + } + + // Start at least one instance of each kind of ingest + // pipeline for this ingest job. This allows for an early out + // if the full ingest module lineup specified by the user is + // cannot be started up. List errors = ingestJob.startUpIngestPipelines(); if (!errors.isEmpty()) { + // Report the error to the user. StringBuilder failedModules = new StringBuilder(); + StringBuilder errorMessages = new StringBuilder(); for (int i = 0; i < errors.size(); ++i) { IngestModuleError error = errors.get(i); String moduleName = error.getModuleDisplayName(); logger.log(Level.SEVERE, "The " + moduleName + " module failed to start up", error.getModuleError()); failedModules.append(moduleName); + errorMessages.append(error.getModuleError().getMessage()); if ((errors.size() > 1) && (i != (errors.size() - 1))) { failedModules.append(","); + errorMessages.append("\n\n"); } } - MessageNotifyUtil.Message.error( // RJCTODO: Fix this to show all errors, probably should specify data source name - "Failed to start the following ingest modules: " + failedModules.toString() + " .\n\n" - + "No ingest modules will be run. Please disable the module " - + "or fix the error and restart ingest by right clicking on " - + "the data source and selecting Run Ingest Modules.\n\n" - + "Error: " + errors.get(0).getModuleError().getMessage()); - ingestJob.cancel(); - break; - } + StringBuilder notifyMessage = new StringBuilder(); + notifyMessage.append("Failed to start the following ingest modules: "); + notifyMessage.append(failedModules.toString()); + notifyMessage.append(" .\n\nNo ingest modules will be run. Please disable the failed modules "); + notifyMessage.append("or fix the error and restart ingest by right clicking on "); + notifyMessage.append("the data source and selecting Run Ingest Modules.\n\n"); + notifyMessage.append("Errors\n\n: "); + notifyMessage.append(errorMessages.toString()); + MessageNotifyUtil.Message.error(notifyMessage.toString()); - // Save the ingest job for later cleanup of pipelines. - synchronized (IngestManager.this) { - ingestJobs.put(ingestJob.getId(), ingestJob); + // Jettison the ingest job and move on to the next one. + synchronized (IngestManager.this) { + ingestJob.cancel(); + ingestJobs.remove(ingestJob.getId()); + } + break; } // Queue the data source ingest tasks for the ingest job. final String inputName = dataSource.getName(); - progress.progress("Data source ingest tasks for " + inputName, workUnitsCompleted); // RJCTODO: Improve + progress.progress("Data source ingest tasks for " + inputName, workUnitsCompleted); scheduler.getDataSourceIngestScheduler().queueForIngest(ingestJob); progress.progress("Data source ingest tasks for " + inputName, ++workUnitsCompleted); From 52796daaba12ba8ea882f6b0a4fc7ab3b3db4c66 Mon Sep 17 00:00:00 2001 From: Richard Cordovano Date: Mon, 21 Apr 2014 16:25:41 -0400 Subject: [PATCH 2/3] mend --- Core/src/org/sleuthkit/autopsy/ingest/IngestManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/src/org/sleuthkit/autopsy/ingest/IngestManager.java b/Core/src/org/sleuthkit/autopsy/ingest/IngestManager.java index 3810cad10c..5180a12453 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/IngestManager.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/IngestManager.java @@ -389,7 +389,7 @@ public class IngestManager { // Start at least one instance of each kind of ingest // pipeline for this ingest job. This allows for an early out - // if the full ingest module lineup specified by the user is + // if the full ingest module lineup specified by the user // cannot be started up. List errors = ingestJob.startUpIngestPipelines(); if (!errors.isEmpty()) { From 81090f8273ac3803feb6e446bce0d057cfeac4f7 Mon Sep 17 00:00:00 2001 From: Richard Cordovano Date: Mon, 21 Apr 2014 16:27:33 -0400 Subject: [PATCH 3/3] mend --- Core/src/org/sleuthkit/autopsy/ingest/IngestManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/src/org/sleuthkit/autopsy/ingest/IngestManager.java b/Core/src/org/sleuthkit/autopsy/ingest/IngestManager.java index 5180a12453..cc6d3ed050 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/IngestManager.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/IngestManager.java @@ -410,7 +410,7 @@ public class IngestManager { StringBuilder notifyMessage = new StringBuilder(); notifyMessage.append("Failed to start the following ingest modules: "); notifyMessage.append(failedModules.toString()); - notifyMessage.append(" .\n\nNo ingest modules will be run. Please disable the failed modules "); + notifyMessage.append(".\n\nNo ingest modules will be run. Please disable the failed modules "); notifyMessage.append("or fix the error and restart ingest by right clicking on "); notifyMessage.append("the data source and selecting Run Ingest Modules.\n\n"); notifyMessage.append("Errors\n\n: ");