diff --git a/Core/test/qa-functional/src/org/sleuthkit/autopsy/modules/encryptiondetection/EncryptionDetectionTest.java b/Core/test/qa-functional/src/org/sleuthkit/autopsy/modules/encryptiondetection/EncryptionDetectionTest.java index e0027dbd71..ef639bec5f 100755 --- a/Core/test/qa-functional/src/org/sleuthkit/autopsy/modules/encryptiondetection/EncryptionDetectionTest.java +++ b/Core/test/qa-functional/src/org/sleuthkit/autopsy/modules/encryptiondetection/EncryptionDetectionTest.java @@ -81,7 +81,7 @@ public class EncryptionDetectionTest extends NbTestCase { public void tearDown() { CaseUtils.closeCurrentCase(testSucceeded); } - + /** * Test the Encryption Detection module's volume encryption detection. */ diff --git a/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestAdminActions.java b/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestAdminActions.java index f17372f055..87c805fa12 100644 --- a/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestAdminActions.java +++ b/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestAdminActions.java @@ -338,7 +338,7 @@ final class AutoIngestAdminActions { dashboard.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); 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)); if (AutoIngestManager.CaseDeletionResult.FAILED == result) { JOptionPane.showMessageDialog(dashboard, diff --git a/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestDashboard.java b/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestDashboard.java index fc486dcfa2..f191823dc2 100644 --- a/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestDashboard.java +++ b/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestDashboard.java @@ -271,9 +271,9 @@ final class AutoIngestDashboard extends JPanel implements Observer { * @param nodeStateSnapshot The jobs snapshot. */ void refreshTables() { - pendingJobsPanel.refresh(autoIngestMonitor.getJobsSnapshot(), new RefreshChildrenEvent()); - runningJobsPanel.refresh(autoIngestMonitor.getJobsSnapshot(), new RefreshChildrenEvent()); - completedJobsPanel.refresh(autoIngestMonitor.getJobsSnapshot(), new RefreshChildrenEvent()); + pendingJobsPanel.refresh(new RefreshChildrenEvent(autoIngestMonitor.getJobsSnapshot())); + runningJobsPanel.refresh(new RefreshChildrenEvent(autoIngestMonitor.getJobsSnapshot())); + completedJobsPanel.refresh(new RefreshChildrenEvent(autoIngestMonitor.getJobsSnapshot())); } /** diff --git a/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestJobsNode.java b/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestJobsNode.java index 55837299ae..15913dfba7 100644 --- a/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestJobsNode.java +++ b/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestJobsNode.java @@ -60,8 +60,8 @@ final class AutoIngestJobsNode extends AbstractNode { /** * Construct a new AutoIngestJobsNode. */ - AutoIngestJobsNode(JobsSnapshot jobsSnapshot, AutoIngestJobStatus status, EventBus eventBus) { - super(Children.create(new AutoIngestNodeChildren(jobsSnapshot, status, eventBus), false)); + AutoIngestJobsNode(AutoIngestJobStatus status, EventBus eventBus) { + super(Children.create(new AutoIngestNodeChildren(status, eventBus), false)); refreshChildrenEventBus = eventBus; } @@ -78,7 +78,7 @@ final class AutoIngestJobsNode extends AbstractNode { static final class AutoIngestNodeChildren extends ChildFactory { private final AutoIngestJobStatus autoIngestJobStatus; - private final JobsSnapshot jobsSnapshot; + private JobsSnapshot jobsSnapshot; private final RefreshChildrenSubscriber refreshChildrenSubscriber = new RefreshChildrenSubscriber(); private final EventBus refreshEventBus; @@ -89,8 +89,8 @@ final class AutoIngestJobsNode extends AbstractNode { * @param snapshot the snapshot which contains the AutoIngestJobs * @param status the status of the jobs being displayed */ - AutoIngestNodeChildren(JobsSnapshot snapshot, AutoIngestJobStatus status, EventBus eventBus) { - jobsSnapshot = snapshot; + AutoIngestNodeChildren(AutoIngestJobStatus status, EventBus eventBus) { + jobsSnapshot = new JobsSnapshot(); autoIngestJobStatus = status; refreshEventBus = eventBus; 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 //RefreshChildrenEvents can change which children are present however //RefreshJobEvents and RefreshCaseEvents can still change the order we want to display them in + jobsSnapshot = refreshEvent.getJobsSnapshot(); refresh(true); } diff --git a/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestJobsPanel.java b/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestJobsPanel.java index 561864df59..7818dd8d68 100644 --- a/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestJobsPanel.java +++ b/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestJobsPanel.java @@ -164,14 +164,14 @@ final class AutoIngestJobsPanel extends javax.swing.JPanel implements ExplorerMa * @param jobsSnapshot - the JobsSnapshot which will provide the new * contents */ - void refresh(JobsSnapshot jobsSnapshot, AutoIngestRefreshEvent refreshEvent) { + void refresh(AutoIngestRefreshEvent refreshEvent) { synchronized (this) { outline.setRowSelectionAllowed(false); if (explorerManager.getRootContext() instanceof AutoIngestJobsNode) { ((AutoIngestJobsNode) explorerManager.getRootContext()).refresh(refreshEvent); } else { //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.setFocusable(true); diff --git a/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestNodeRefreshEvents.java b/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestNodeRefreshEvents.java index c01158f44a..2c554bf00f 100644 --- a/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestNodeRefreshEvents.java +++ b/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestNodeRefreshEvents.java @@ -18,6 +18,8 @@ */ 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 * AutoIngestJobsNode @@ -25,23 +27,37 @@ package org.sleuthkit.autopsy.experimental.autoingest; 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 * refreshed but no specific nodes need their properties refreshed. */ - static final class RefreshChildrenEvent implements AutoIngestRefreshEvent { + static final class RefreshChildrenEvent extends AutoIngestRefreshEvent { /** * 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 * the specified case should be refreshed. */ - static final class RefreshCaseEvent implements AutoIngestRefreshEvent { + static final class RefreshCaseEvent extends AutoIngestRefreshEvent { 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; } @@ -76,19 +96,23 @@ class AutoIngestNodeRefreshEvents { /** * 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; /** * 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; } /** - * 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 * refreshed @@ -97,5 +121,4 @@ class AutoIngestNodeRefreshEvents { return autoIngestJob; } } - } diff --git a/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/PrioritizationAction.java b/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/PrioritizationAction.java index 371fe71ad3..3d57057bff 100644 --- a/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/PrioritizationAction.java +++ b/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/PrioritizationAction.java @@ -27,7 +27,6 @@ import org.openide.util.NbBundle.Messages; import org.openide.windows.WindowManager; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil; -import org.sleuthkit.autopsy.experimental.autoingest.AutoIngestNodeRefreshEvents; /** * Abstract actions which are for the modification of AutoIngestJob or Case @@ -90,7 +89,7 @@ abstract class PrioritizationAction extends AbstractAction { EventQueue.invokeLater(() -> { try { modifyPriority(dashboard.getMonitor()); - dashboard.getPendingJobsPanel().refresh(dashboard.getMonitor().getJobsSnapshot(), getRefreshEvent()); + dashboard.getPendingJobsPanel().refresh(getRefreshEvent(dashboard.getMonitor())); } catch (AutoIngestMonitor.AutoIngestMonitorException ex) { String errorMessage = getErrorMessage(); 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. } - abstract AutoIngestNodeRefreshEvents.AutoIngestRefreshEvent getRefreshEvent(); + abstract AutoIngestNodeRefreshEvents.AutoIngestRefreshEvent getRefreshEvent(AutoIngestMonitor monitor); /** * Action to prioritize the specified AutoIngestJob @@ -145,8 +144,8 @@ abstract class PrioritizationAction extends AbstractAction { } @Override - AutoIngestNodeRefreshEvents.AutoIngestRefreshEvent getRefreshEvent() { - return new AutoIngestNodeRefreshEvents.RefreshJobEvent(getJob()); + AutoIngestNodeRefreshEvents.AutoIngestRefreshEvent getRefreshEvent(AutoIngestMonitor monitor) { + return new AutoIngestNodeRefreshEvents.RefreshJobEvent(monitor.getJobsSnapshot(), getJob()); } } @@ -184,8 +183,8 @@ abstract class PrioritizationAction extends AbstractAction { } @Override - AutoIngestNodeRefreshEvents.AutoIngestRefreshEvent getRefreshEvent() { - return new AutoIngestNodeRefreshEvents.RefreshJobEvent(getJob()); + AutoIngestNodeRefreshEvents.AutoIngestRefreshEvent getRefreshEvent(AutoIngestMonitor monitor) { + return new AutoIngestNodeRefreshEvents.RefreshJobEvent(monitor.getJobsSnapshot(), getJob()); } } @@ -225,8 +224,8 @@ abstract class PrioritizationAction extends AbstractAction { } @Override - AutoIngestNodeRefreshEvents.AutoIngestRefreshEvent getRefreshEvent() { - return new AutoIngestNodeRefreshEvents.RefreshCaseEvent(getJob().getManifest().getCaseName()); + AutoIngestNodeRefreshEvents.AutoIngestRefreshEvent getRefreshEvent(AutoIngestMonitor monitor) { + return new AutoIngestNodeRefreshEvents.RefreshCaseEvent(monitor.getJobsSnapshot(), getJob().getManifest().getCaseName()); } } @@ -266,8 +265,8 @@ abstract class PrioritizationAction extends AbstractAction { } @Override - AutoIngestNodeRefreshEvents.AutoIngestRefreshEvent getRefreshEvent() { - return new AutoIngestNodeRefreshEvents.RefreshCaseEvent(getJob().getManifest().getCaseName()); + AutoIngestNodeRefreshEvents.AutoIngestRefreshEvent getRefreshEvent(AutoIngestMonitor monitor) { + return new AutoIngestNodeRefreshEvents.RefreshCaseEvent(monitor.getJobsSnapshot(), getJob().getManifest().getCaseName()); } } }