mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-12 07:56:16 +00:00
Resolved conflicts.
This commit is contained in:
commit
24c24624d5
@ -47,7 +47,7 @@ import org.sleuthkit.autopsy.ingest.IngestScheduler.FileIngestScheduler.FileInge
|
|||||||
*/
|
*/
|
||||||
public class IngestManager {
|
public class IngestManager {
|
||||||
|
|
||||||
private static final String NUMBER_OF_FILE_INGEST_THREADS_KEY = "NumberOfFileingestThreads"; //NON-NLS
|
private static final String NUMBER_OF_FILE_INGEST_THREADS_KEY = "NumberOfFileingestThreads";
|
||||||
private static final int MIN_NUMBER_OF_FILE_INGEST_THREADS = 1;
|
private static final int MIN_NUMBER_OF_FILE_INGEST_THREADS = 1;
|
||||||
private static final int MAX_NUMBER_OF_FILE_INGEST_THREADS = 4;
|
private static final int MAX_NUMBER_OF_FILE_INGEST_THREADS = 4;
|
||||||
private static final int DEFAULT_NUMBER_OF_FILE_INGEST_THREADS = 2;
|
private static final int DEFAULT_NUMBER_OF_FILE_INGEST_THREADS = 2;
|
||||||
@ -198,7 +198,7 @@ public class IngestManager {
|
|||||||
try {
|
try {
|
||||||
pcs.firePropertyChange(eventType, jobId, null);
|
pcs.firePropertyChange(eventType, jobId, null);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.log(Level.SEVERE, "Ingest manager listener threw exception", e); //NON-NLS
|
logger.log(Level.SEVERE, "Ingest manager listener threw exception", e);
|
||||||
MessageNotifyUtil.Notify.show(NbBundle.getMessage(IngestManager.class, "IngestManager.moduleErr"),
|
MessageNotifyUtil.Notify.show(NbBundle.getMessage(IngestManager.class, "IngestManager.moduleErr"),
|
||||||
NbBundle.getMessage(IngestManager.class, "IngestManager.moduleErr.errListenToUpdates.msg"),
|
NbBundle.getMessage(IngestManager.class, "IngestManager.moduleErr.errListenToUpdates.msg"),
|
||||||
MessageNotifyUtil.MessageType.ERROR);
|
MessageNotifyUtil.MessageType.ERROR);
|
||||||
@ -214,7 +214,7 @@ public class IngestManager {
|
|||||||
try {
|
try {
|
||||||
pcs.firePropertyChange(IngestEvent.FILE_DONE.toString(), fileId, null);
|
pcs.firePropertyChange(IngestEvent.FILE_DONE.toString(), fileId, null);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.log(Level.SEVERE, "Ingest manager listener threw exception", e); //NON-NLS
|
logger.log(Level.SEVERE, "Ingest manager listener threw exception", e);
|
||||||
MessageNotifyUtil.Notify.show(NbBundle.getMessage(IngestManager.class, "IngestManager.moduleErr"),
|
MessageNotifyUtil.Notify.show(NbBundle.getMessage(IngestManager.class, "IngestManager.moduleErr"),
|
||||||
NbBundle.getMessage(IngestManager.class, "IngestManager.moduleErr.errListenToUpdates.msg"),
|
NbBundle.getMessage(IngestManager.class, "IngestManager.moduleErr.errListenToUpdates.msg"),
|
||||||
MessageNotifyUtil.MessageType.ERROR);
|
MessageNotifyUtil.MessageType.ERROR);
|
||||||
@ -231,7 +231,7 @@ public class IngestManager {
|
|||||||
try {
|
try {
|
||||||
pcs.firePropertyChange(IngestEvent.DATA.toString(), moduleDataEvent, null);
|
pcs.firePropertyChange(IngestEvent.DATA.toString(), moduleDataEvent, null);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.log(Level.SEVERE, "Ingest manager listener threw exception", e); //NON-NLS
|
logger.log(Level.SEVERE, "Ingest manager listener threw exception", e);
|
||||||
MessageNotifyUtil.Notify.show(NbBundle.getMessage(IngestManager.class, "IngestManager.moduleErr"),
|
MessageNotifyUtil.Notify.show(NbBundle.getMessage(IngestManager.class, "IngestManager.moduleErr"),
|
||||||
NbBundle.getMessage(IngestManager.class, "IngestManager.moduleErr.errListenToUpdates.msg"),
|
NbBundle.getMessage(IngestManager.class, "IngestManager.moduleErr.errListenToUpdates.msg"),
|
||||||
MessageNotifyUtil.MessageType.ERROR);
|
MessageNotifyUtil.MessageType.ERROR);
|
||||||
@ -248,7 +248,7 @@ public class IngestManager {
|
|||||||
try {
|
try {
|
||||||
pcs.firePropertyChange(IngestEvent.CONTENT_CHANGED.toString(), moduleContentEvent, null);
|
pcs.firePropertyChange(IngestEvent.CONTENT_CHANGED.toString(), moduleContentEvent, null);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.log(Level.SEVERE, "Ingest manager listener threw exception", e); //NON-NLS
|
logger.log(Level.SEVERE, "Ingest manager listener threw exception", e);
|
||||||
MessageNotifyUtil.Notify.show(NbBundle.getMessage(IngestManager.class, "IngestManager.moduleErr"),
|
MessageNotifyUtil.Notify.show(NbBundle.getMessage(IngestManager.class, "IngestManager.moduleErr"),
|
||||||
NbBundle.getMessage(IngestManager.class, "IngestManager.moduleErr.errListenToUpdates.msg"),
|
NbBundle.getMessage(IngestManager.class, "IngestManager.moduleErr.errListenToUpdates.msg"),
|
||||||
MessageNotifyUtil.MessageType.ERROR);
|
MessageNotifyUtil.MessageType.ERROR);
|
||||||
@ -360,14 +360,14 @@ public class IngestManager {
|
|||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
final String displayName = NbBundle.getMessage(this.getClass(),
|
final String displayName = NbBundle.getMessage(this.getClass(),
|
||||||
"IngestManager.StartIngestJobsTask.run.displayName");
|
"IngestManager.StartIngestJobsTask.run.displayName");
|
||||||
progress = ProgressHandleFactory.createHandle(displayName, new Cancellable() {
|
progress = ProgressHandleFactory.createHandle(displayName, new Cancellable() {
|
||||||
@Override
|
@Override
|
||||||
public boolean cancel() {
|
public boolean cancel() {
|
||||||
if (progress != null) {
|
if (progress != null) {
|
||||||
progress.setDisplayName(NbBundle.getMessage(this.getClass(),
|
progress.setDisplayName(NbBundle.getMessage(this.getClass(),
|
||||||
"IngestManager.StartIngestJobsTask.run.cancelling",
|
"IngestManager.StartIngestJobsTask.run.cancelling",
|
||||||
displayName));
|
displayName));
|
||||||
}
|
}
|
||||||
IngestManager.getInstance().cancelIngestJobs();
|
IngestManager.getInstance().cancelIngestJobs();
|
||||||
return true;
|
return true;
|
||||||
@ -381,37 +381,53 @@ public class IngestManager {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Create an ingest job.
|
||||||
IngestJob ingestJob = new IngestJob(IngestManager.this.ingestJobId.incrementAndGet(), dataSource, moduleTemplates, processUnallocatedSpace);
|
IngestJob ingestJob = new IngestJob(IngestManager.this.ingestJobId.incrementAndGet(), dataSource, moduleTemplates, processUnallocatedSpace);
|
||||||
List<IngestModuleError> errors = ingestJob.startUpIngestPipelines();
|
|
||||||
if (!errors.isEmpty()) {
|
|
||||||
StringBuilder failedModules = 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()); //NON-NLS
|
|
||||||
failedModules.append(moduleName);
|
|
||||||
if ((errors.size() > 1) && (i != (errors.size() - 1))) {
|
|
||||||
failedModules.append(",");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
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" //NON-NLS
|
|
||||||
+ "No ingest modules will be run. Please disable the module " //NON-NLS NON-NLS
|
|
||||||
+ "or fix the error and restart ingest by right clicking on " //NON-NLS
|
|
||||||
+ "the data source and selecting Run Ingest Modules.\n\n" //NON-NLS
|
|
||||||
+ "Error: " + errors.get(0).getModuleError().getMessage()); //NON-NLS
|
|
||||||
ingestJob.cancel();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Save the ingest job for later cleanup of pipelines.
|
|
||||||
synchronized (IngestManager.this) {
|
synchronized (IngestManager.this) {
|
||||||
ingestJobs.put(ingestJob.getId(), ingestJob);
|
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
|
||||||
|
// cannot be started up.
|
||||||
|
List<IngestModuleError> 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");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
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());
|
||||||
|
|
||||||
|
// 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.
|
// Queue the data source ingest tasks for the ingest job.
|
||||||
final String inputName = dataSource.getName();
|
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);
|
scheduler.getDataSourceIngestScheduler().queueForIngest(ingestJob);
|
||||||
progress.progress("Data source ingest tasks for " + inputName, ++workUnitsCompleted);
|
progress.progress("Data source ingest tasks for " + inputName, ++workUnitsCompleted);
|
||||||
|
|
||||||
@ -426,7 +442,7 @@ public class IngestManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
String message = String.format("StartIngestJobsTask (id=%d) caught exception", id); //NON-NLS
|
String message = String.format("StartIngestJobsTask (id=%d) caught exception", id);
|
||||||
logger.log(Level.SEVERE, message, ex);
|
logger.log(Level.SEVERE, message, ex);
|
||||||
MessageNotifyUtil.Message.error(
|
MessageNotifyUtil.Message.error(
|
||||||
NbBundle.getMessage(this.getClass(), "IngestManager.StartIngestJobsTask.run.catchException.msg"));
|
NbBundle.getMessage(this.getClass(), "IngestManager.StartIngestJobsTask.run.catchException.msg"));
|
||||||
@ -458,7 +474,7 @@ public class IngestManager {
|
|||||||
job = scheduler.getNextTask();
|
job = scheduler.getNextTask();
|
||||||
}
|
}
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
String message = String.format("RunDataSourceIngestModulesTask (id=%d) caught exception", id); //NON-NLS
|
String message = String.format("RunDataSourceIngestModulesTask (id=%d) caught exception", id);
|
||||||
logger.log(Level.SEVERE, message, ex);
|
logger.log(Level.SEVERE, message, ex);
|
||||||
} finally {
|
} finally {
|
||||||
reportRunIngestModulesTaskDone(id);
|
reportRunIngestModulesTaskDone(id);
|
||||||
@ -489,7 +505,7 @@ public class IngestManager {
|
|||||||
task = fileScheduler.getNextTask();
|
task = fileScheduler.getNextTask();
|
||||||
}
|
}
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
String message = String.format("RunFileSourceIngestModulesTask (id=%d) caught exception", id); //NON-NLS
|
String message = String.format("RunFileSourceIngestModulesTask (id=%d) caught exception", id);
|
||||||
logger.log(Level.SEVERE, message, ex);
|
logger.log(Level.SEVERE, message, ex);
|
||||||
} finally {
|
} finally {
|
||||||
reportRunIngestModulesTaskDone(id);
|
reportRunIngestModulesTaskDone(id);
|
||||||
@ -511,7 +527,7 @@ public class IngestManager {
|
|||||||
super.get();
|
super.get();
|
||||||
} catch (CancellationException | InterruptedException ex) {
|
} catch (CancellationException | InterruptedException ex) {
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
logger.log(Level.SEVERE, "Error while cancelling ingest jobs", ex); //NON-NLS
|
logger.log(Level.SEVERE, "Error while cancelling ingest jobs", ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user