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() {
CaseUtils.closeCurrentCase(testSucceeded);
}
/**
* 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));
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,

View File

@ -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()));
}
/**

View File

@ -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<AutoIngestJob> {
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);
}

View File

@ -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);

View File

@ -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;
}
}
}

View File

@ -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());
}
}
}