mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-06 21:00:22 +00:00
Merge remote-tracking branch 'upstream/develop' into 7673-postartifacts-feeds-pipeline-other-apis
This commit is contained in:
commit
554586a1d0
@ -25,6 +25,7 @@ import java.util.Collections;
|
|||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import javax.annotation.concurrent.GuardedBy;
|
||||||
import org.sleuthkit.autopsy.events.AutopsyEvent;
|
import org.sleuthkit.autopsy.events.AutopsyEvent;
|
||||||
import org.sleuthkit.autopsy.ingest.IngestJobSettings;
|
import org.sleuthkit.autopsy.ingest.IngestJobSettings;
|
||||||
import org.sleuthkit.autopsy.ingest.IngestJobStartResult;
|
import org.sleuthkit.autopsy.ingest.IngestJobStartResult;
|
||||||
@ -53,7 +54,7 @@ public final class IngestJobRunner {
|
|||||||
*/
|
*/
|
||||||
public static List<IngestModuleError> runIngestJob(Collection<Content> dataSources, IngestJobSettings settings) throws InterruptedException {
|
public static List<IngestModuleError> runIngestJob(Collection<Content> dataSources, IngestJobSettings settings) throws InterruptedException {
|
||||||
Object ingestMonitor = new Object();
|
Object ingestMonitor = new Object();
|
||||||
IngestJobCompletiontListener completiontListener = new IngestJobCompletiontListener(ingestMonitor);
|
IngestJobCompletionListener completiontListener = new IngestJobCompletionListener(ingestMonitor, dataSources.size());
|
||||||
IngestManager ingestManager = IngestManager.getInstance();
|
IngestManager ingestManager = IngestManager.getInstance();
|
||||||
ingestManager.addIngestJobEventListener(INGEST_JOB_EVENTS_OF_INTEREST, completiontListener);
|
ingestManager.addIngestJobEventListener(INGEST_JOB_EVENTS_OF_INTEREST, completiontListener);
|
||||||
try {
|
try {
|
||||||
@ -81,9 +82,12 @@ public final class IngestJobRunner {
|
|||||||
* An ingest job event listener that allows IngestRunner.runIngestJob to
|
* An ingest job event listener that allows IngestRunner.runIngestJob to
|
||||||
* block until the specified ingest job is completed.
|
* block until the specified ingest job is completed.
|
||||||
*/
|
*/
|
||||||
private static final class IngestJobCompletiontListener implements PropertyChangeListener {
|
private static final class IngestJobCompletionListener implements PropertyChangeListener {
|
||||||
|
|
||||||
private final Object ingestMonitor;
|
private final Object ingestMonitor;
|
||||||
|
|
||||||
|
@GuardedBy("ingestMonitor")
|
||||||
|
private int remainingJobsCount;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs an ingest job event listener that allows
|
* Constructs an ingest job event listener that allows
|
||||||
@ -92,9 +96,11 @@ public final class IngestJobRunner {
|
|||||||
*
|
*
|
||||||
* @param ingestMonitor A Java object to notify when the ingest job is
|
* @param ingestMonitor A Java object to notify when the ingest job is
|
||||||
* omcpleted.
|
* omcpleted.
|
||||||
|
* @param jobsCount The number of jobs to listen for before notifying monitor.
|
||||||
*/
|
*/
|
||||||
IngestJobCompletiontListener(Object ingestMonitor) {
|
IngestJobCompletionListener(Object ingestMonitor, int jobsCount) {
|
||||||
this.ingestMonitor = ingestMonitor;
|
this.ingestMonitor = ingestMonitor;
|
||||||
|
this.remainingJobsCount = jobsCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -109,7 +115,10 @@ public final class IngestJobRunner {
|
|||||||
String eventType = event.getPropertyName();
|
String eventType = event.getPropertyName();
|
||||||
if (eventType.equals(IngestManager.IngestJobEvent.COMPLETED.toString()) || eventType.equals(IngestManager.IngestJobEvent.CANCELLED.toString())) {
|
if (eventType.equals(IngestManager.IngestJobEvent.COMPLETED.toString()) || eventType.equals(IngestManager.IngestJobEvent.CANCELLED.toString())) {
|
||||||
synchronized (ingestMonitor) {
|
synchronized (ingestMonitor) {
|
||||||
ingestMonitor.notify();
|
this.remainingJobsCount--;
|
||||||
|
if (this.remainingJobsCount <= 0) {
|
||||||
|
ingestMonitor.notify();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -82,13 +82,6 @@ public class IngestedWithHashAndFileTypeIntraCaseTest extends NbTestCase {
|
|||||||
Exceptions.printStackTrace(ex);
|
Exceptions.printStackTrace(ex);
|
||||||
Assert.fail(ex.getMessage());
|
Assert.fail(ex.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
// wait 10 seconds for all processes to finish before beginning tests
|
|
||||||
try {
|
|
||||||
Thread.sleep(10_000);
|
|
||||||
} catch (InterruptedException ex) {
|
|
||||||
Exceptions.printStackTrace(ex);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
x
Reference in New Issue
Block a user