Merge pull request #3803 from wschaeferB/MergeInMayRelease

Merge in may release
This commit is contained in:
Richard Cordovano 2018-05-23 12:32:10 -04:00 committed by GitHub
commit 26468595a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 58 additions and 35 deletions

View File

@ -81,7 +81,7 @@ public class EncryptionDetectionTest extends NbTestCase {
public void tearDown() { public void tearDown() {
CaseUtils.closeCurrentCase(testSucceeded); CaseUtils.closeCurrentCase(testSucceeded);
} }
/** /**
* Test the Encryption Detection module's volume encryption detection. * Test the Encryption Detection module's volume encryption detection.
*/ */

View File

@ -338,7 +338,7 @@ final class AutoIngestAdminActions {
dashboard.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); dashboard.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
AutoIngestManager.CaseDeletionResult result = dashboard.getMonitor().deleteCase(job); AutoIngestManager.CaseDeletionResult result = dashboard.getMonitor().deleteCase(job);
dashboard.getCompletedJobsPanel().refresh(dashboard.getMonitor().getJobsSnapshot(), new AutoIngestNodeRefreshEvents.RefreshChildrenEvent()); dashboard.getCompletedJobsPanel().refresh(new AutoIngestNodeRefreshEvents.RefreshChildrenEvent(dashboard.getMonitor().getJobsSnapshot()));
dashboard.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); dashboard.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
if (AutoIngestManager.CaseDeletionResult.FAILED == result) { if (AutoIngestManager.CaseDeletionResult.FAILED == result) {
JOptionPane.showMessageDialog(dashboard, JOptionPane.showMessageDialog(dashboard,

View File

@ -271,9 +271,9 @@ final class AutoIngestDashboard extends JPanel implements Observer {
* @param nodeStateSnapshot The jobs snapshot. * @param nodeStateSnapshot The jobs snapshot.
*/ */
void refreshTables() { void refreshTables() {
pendingJobsPanel.refresh(autoIngestMonitor.getJobsSnapshot(), new RefreshChildrenEvent()); pendingJobsPanel.refresh(new RefreshChildrenEvent(autoIngestMonitor.getJobsSnapshot()));
runningJobsPanel.refresh(autoIngestMonitor.getJobsSnapshot(), new RefreshChildrenEvent()); runningJobsPanel.refresh(new RefreshChildrenEvent(autoIngestMonitor.getJobsSnapshot()));
completedJobsPanel.refresh(autoIngestMonitor.getJobsSnapshot(), new RefreshChildrenEvent()); completedJobsPanel.refresh(new RefreshChildrenEvent(autoIngestMonitor.getJobsSnapshot()));
} }
/** /**

View File

@ -60,8 +60,8 @@ final class AutoIngestJobsNode extends AbstractNode {
/** /**
* Construct a new AutoIngestJobsNode. * Construct a new AutoIngestJobsNode.
*/ */
AutoIngestJobsNode(JobsSnapshot jobsSnapshot, AutoIngestJobStatus status, EventBus eventBus) { AutoIngestJobsNode(AutoIngestJobStatus status, EventBus eventBus) {
super(Children.create(new AutoIngestNodeChildren(jobsSnapshot, status, eventBus), false)); super(Children.create(new AutoIngestNodeChildren(status, eventBus), false));
refreshChildrenEventBus = eventBus; refreshChildrenEventBus = eventBus;
} }
@ -78,7 +78,7 @@ final class AutoIngestJobsNode extends AbstractNode {
static final class AutoIngestNodeChildren extends ChildFactory<AutoIngestJob> { static final class AutoIngestNodeChildren extends ChildFactory<AutoIngestJob> {
private final AutoIngestJobStatus autoIngestJobStatus; private final AutoIngestJobStatus autoIngestJobStatus;
private final JobsSnapshot jobsSnapshot; private JobsSnapshot jobsSnapshot;
private final RefreshChildrenSubscriber refreshChildrenSubscriber = new RefreshChildrenSubscriber(); private final RefreshChildrenSubscriber refreshChildrenSubscriber = new RefreshChildrenSubscriber();
private final EventBus refreshEventBus; private final EventBus refreshEventBus;
@ -89,8 +89,8 @@ final class AutoIngestJobsNode extends AbstractNode {
* @param snapshot the snapshot which contains the AutoIngestJobs * @param snapshot the snapshot which contains the AutoIngestJobs
* @param status the status of the jobs being displayed * @param status the status of the jobs being displayed
*/ */
AutoIngestNodeChildren(JobsSnapshot snapshot, AutoIngestJobStatus status, EventBus eventBus) { AutoIngestNodeChildren(AutoIngestJobStatus status, EventBus eventBus) {
jobsSnapshot = snapshot; jobsSnapshot = new JobsSnapshot();
autoIngestJobStatus = status; autoIngestJobStatus = status;
refreshEventBus = eventBus; refreshEventBus = eventBus;
refreshChildrenSubscriber.register(refreshEventBus); refreshChildrenSubscriber.register(refreshEventBus);
@ -159,6 +159,7 @@ final class AutoIngestJobsNode extends AbstractNode {
//Ignore netbeans suggesting this isn't being used, it is used behind the scenes by the EventBus //Ignore netbeans suggesting this isn't being used, it is used behind the scenes by the EventBus
//RefreshChildrenEvents can change which children are present however //RefreshChildrenEvents can change which children are present however
//RefreshJobEvents and RefreshCaseEvents can still change the order we want to display them in //RefreshJobEvents and RefreshCaseEvents can still change the order we want to display them in
jobsSnapshot = refreshEvent.getJobsSnapshot();
refresh(true); refresh(true);
} }

View File

@ -164,14 +164,14 @@ final class AutoIngestJobsPanel extends javax.swing.JPanel implements ExplorerMa
* @param jobsSnapshot - the JobsSnapshot which will provide the new * @param jobsSnapshot - the JobsSnapshot which will provide the new
* contents * contents
*/ */
void refresh(JobsSnapshot jobsSnapshot, AutoIngestRefreshEvent refreshEvent) { void refresh(AutoIngestRefreshEvent refreshEvent) {
synchronized (this) { synchronized (this) {
outline.setRowSelectionAllowed(false); outline.setRowSelectionAllowed(false);
if (explorerManager.getRootContext() instanceof AutoIngestJobsNode) { if (explorerManager.getRootContext() instanceof AutoIngestJobsNode) {
((AutoIngestJobsNode) explorerManager.getRootContext()).refresh(refreshEvent); ((AutoIngestJobsNode) explorerManager.getRootContext()).refresh(refreshEvent);
} else { } else {
//Make a new AutoIngestJobsNode with it's own EventBus and set it as the root context //Make a new AutoIngestJobsNode with it's own EventBus and set it as the root context
explorerManager.setRootContext(new AutoIngestJobsNode(jobsSnapshot, status, new EventBus("AutoIngestJobsNodeEventBus"))); explorerManager.setRootContext(new AutoIngestJobsNode(status, new EventBus("AutoIngestJobsNodeEventBus")));
} }
outline.setRowSelectionAllowed(true); outline.setRowSelectionAllowed(true);
outline.setFocusable(true); outline.setFocusable(true);

View File

@ -18,6 +18,8 @@
*/ */
package org.sleuthkit.autopsy.experimental.autoingest; package org.sleuthkit.autopsy.experimental.autoingest;
import org.sleuthkit.autopsy.experimental.autoingest.AutoIngestMonitor.JobsSnapshot;
/** /**
* Class which contains events to identify what should be refreshed in the * Class which contains events to identify what should be refreshed in the
* AutoIngestJobsNode * AutoIngestJobsNode
@ -25,23 +27,37 @@ package org.sleuthkit.autopsy.experimental.autoingest;
class AutoIngestNodeRefreshEvents { class AutoIngestNodeRefreshEvents {
/** /**
* An empty interface for all refresh events to implement. * The base class for all refresh events.
*/ */
interface AutoIngestRefreshEvent { static class AutoIngestRefreshEvent {
private final JobsSnapshot jobsSnapshot;
AutoIngestRefreshEvent(JobsSnapshot jobs) {
this.jobsSnapshot = jobs;
}
/**
* Get the state of the jobs lists when the event was fired.
*
* @return
*/
JobsSnapshot getJobsSnapshot() {
return this.jobsSnapshot;
}
} }
/** /**
* An event to denote that the children of the AutoIngestJobsNode should be * An event to denote that the children of the AutoIngestJobsNode should be
* refreshed but no specific nodes need their properties refreshed. * refreshed but no specific nodes need their properties refreshed.
*/ */
static final class RefreshChildrenEvent implements AutoIngestRefreshEvent { static final class RefreshChildrenEvent extends AutoIngestRefreshEvent {
/** /**
* Constructs a RefreshChildrenEvent. * Constructs a RefreshChildrenEvent.
*/ */
RefreshChildrenEvent() { RefreshChildrenEvent(JobsSnapshot jobs) {
super(jobs);
} }
} }
@ -49,14 +65,18 @@ class AutoIngestNodeRefreshEvents {
* An event to denote that all nodes which represent jobs which are part of * An event to denote that all nodes which represent jobs which are part of
* the specified case should be refreshed. * the specified case should be refreshed.
*/ */
static final class RefreshCaseEvent implements AutoIngestRefreshEvent { static final class RefreshCaseEvent extends AutoIngestRefreshEvent {
private final String caseName; private final String caseName;
/** /**
* Constructs a RefreshCaseEvent. * Contructs a RefreshCaseEvent
*
* @param jobs The current state of the jobs lists.
* @param name The name of the case whose nodes should be refreshed.
*/ */
RefreshCaseEvent(String name) { RefreshCaseEvent(JobsSnapshot jobs, String name) {
super(jobs);
caseName = name; caseName = name;
} }
@ -76,19 +96,23 @@ class AutoIngestNodeRefreshEvents {
/** /**
* An event to denote that a node for a specific job should be refreshed. * An event to denote that a node for a specific job should be refreshed.
*/ */
static final class RefreshJobEvent implements AutoIngestRefreshEvent { static final class RefreshJobEvent extends AutoIngestRefreshEvent {
private final AutoIngestJob autoIngestJob; private final AutoIngestJob autoIngestJob;
/** /**
* Constructs a RefreshJobEvent. * Constructs a RefreshJobEvent.
*
* @param jobs The curent state of the jobs lists.
* @param job The job which should be refreshed.
*/ */
RefreshJobEvent(AutoIngestJob job) { RefreshJobEvent(JobsSnapshot jobs, AutoIngestJob job) {
super(jobs);
autoIngestJob = job; autoIngestJob = job;
} }
/** /**
* Get the AutoIngestJob which should have it's node refresheds. * Get the AutoIngestJob which should have it's node refreshed.
* *
* @return autoIngestJob - the AutoIngestJob which should have it's node * @return autoIngestJob - the AutoIngestJob which should have it's node
* refreshed * refreshed
@ -97,5 +121,4 @@ class AutoIngestNodeRefreshEvents {
return autoIngestJob; return autoIngestJob;
} }
} }
} }

View File

@ -27,7 +27,6 @@ import org.openide.util.NbBundle.Messages;
import org.openide.windows.WindowManager; import org.openide.windows.WindowManager;
import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil; import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil;
import org.sleuthkit.autopsy.experimental.autoingest.AutoIngestNodeRefreshEvents;
/** /**
* Abstract actions which are for the modification of AutoIngestJob or Case * Abstract actions which are for the modification of AutoIngestJob or Case
@ -90,7 +89,7 @@ abstract class PrioritizationAction extends AbstractAction {
EventQueue.invokeLater(() -> { EventQueue.invokeLater(() -> {
try { try {
modifyPriority(dashboard.getMonitor()); modifyPriority(dashboard.getMonitor());
dashboard.getPendingJobsPanel().refresh(dashboard.getMonitor().getJobsSnapshot(), getRefreshEvent()); dashboard.getPendingJobsPanel().refresh(getRefreshEvent(dashboard.getMonitor()));
} catch (AutoIngestMonitor.AutoIngestMonitorException ex) { } catch (AutoIngestMonitor.AutoIngestMonitorException ex) {
String errorMessage = getErrorMessage(); String errorMessage = getErrorMessage();
logger.log(Level.SEVERE, errorMessage, ex); logger.log(Level.SEVERE, errorMessage, ex);
@ -109,7 +108,7 @@ abstract class PrioritizationAction extends AbstractAction {
return super.clone(); //To change body of generated methods, choose Tools | Templates. return super.clone(); //To change body of generated methods, choose Tools | Templates.
} }
abstract AutoIngestNodeRefreshEvents.AutoIngestRefreshEvent getRefreshEvent(); abstract AutoIngestNodeRefreshEvents.AutoIngestRefreshEvent getRefreshEvent(AutoIngestMonitor monitor);
/** /**
* Action to prioritize the specified AutoIngestJob * Action to prioritize the specified AutoIngestJob
@ -145,8 +144,8 @@ abstract class PrioritizationAction extends AbstractAction {
} }
@Override @Override
AutoIngestNodeRefreshEvents.AutoIngestRefreshEvent getRefreshEvent() { AutoIngestNodeRefreshEvents.AutoIngestRefreshEvent getRefreshEvent(AutoIngestMonitor monitor) {
return new AutoIngestNodeRefreshEvents.RefreshJobEvent(getJob()); return new AutoIngestNodeRefreshEvents.RefreshJobEvent(monitor.getJobsSnapshot(), getJob());
} }
} }
@ -184,8 +183,8 @@ abstract class PrioritizationAction extends AbstractAction {
} }
@Override @Override
AutoIngestNodeRefreshEvents.AutoIngestRefreshEvent getRefreshEvent() { AutoIngestNodeRefreshEvents.AutoIngestRefreshEvent getRefreshEvent(AutoIngestMonitor monitor) {
return new AutoIngestNodeRefreshEvents.RefreshJobEvent(getJob()); return new AutoIngestNodeRefreshEvents.RefreshJobEvent(monitor.getJobsSnapshot(), getJob());
} }
} }
@ -225,8 +224,8 @@ abstract class PrioritizationAction extends AbstractAction {
} }
@Override @Override
AutoIngestNodeRefreshEvents.AutoIngestRefreshEvent getRefreshEvent() { AutoIngestNodeRefreshEvents.AutoIngestRefreshEvent getRefreshEvent(AutoIngestMonitor monitor) {
return new AutoIngestNodeRefreshEvents.RefreshCaseEvent(getJob().getManifest().getCaseName()); return new AutoIngestNodeRefreshEvents.RefreshCaseEvent(monitor.getJobsSnapshot(), getJob().getManifest().getCaseName());
} }
} }
@ -266,8 +265,8 @@ abstract class PrioritizationAction extends AbstractAction {
} }
@Override @Override
AutoIngestNodeRefreshEvents.AutoIngestRefreshEvent getRefreshEvent() { AutoIngestNodeRefreshEvents.AutoIngestRefreshEvent getRefreshEvent(AutoIngestMonitor monitor) {
return new AutoIngestNodeRefreshEvents.RefreshCaseEvent(getJob().getManifest().getCaseName()); return new AutoIngestNodeRefreshEvents.RefreshCaseEvent(monitor.getJobsSnapshot(), getJob().getManifest().getCaseName());
} }
} }
} }