From 69f8b060ea1994520b22bf90b6284d2cd0754639 Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Wed, 19 Dec 2018 17:46:42 -0500 Subject: [PATCH 01/16] 4328 make refreshing occur at 30 second interval instead of in response to events --- .../autoingest/AutoIngestDashboard.java | 32 +++++++++---------- .../autoingest/AutoIngestMonitor.java | 3 +- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestDashboard.java b/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestDashboard.java index 8d993f4dc9..25736d5563 100644 --- a/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestDashboard.java +++ b/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestDashboard.java @@ -18,9 +18,8 @@ */ package org.sleuthkit.autopsy.experimental.autoingest; +import com.google.common.util.concurrent.ThreadFactoryBuilder; import java.awt.Cursor; -import java.util.Observable; -import java.util.Observer; import java.util.logging.Level; import java.awt.Color; import java.awt.EventQueue; @@ -31,6 +30,8 @@ import java.nio.file.Paths; import java.util.HashSet; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ScheduledThreadPoolExecutor; +import java.util.concurrent.TimeUnit; import javax.swing.JPanel; import javax.swing.SwingWorker; import javax.swing.UIManager; @@ -45,17 +46,20 @@ import org.sleuthkit.autopsy.experimental.autoingest.AutoIngestNodeRefreshEvents * A dashboard for monitoring an automated ingest cluster. */ @SuppressWarnings("PMD.SingularField") // UI widgets cause lots of false positives -final class AutoIngestDashboard extends JPanel implements Observer { - +final class AutoIngestDashboard extends JPanel { + private final static String ADMIN_ACCESS_FILE_NAME = "_aiaa"; // NON-NLS private final static String ADMIN_ACCESS_FILE_PATH = Paths.get(PlatformUtil.getUserConfigDirectory(), ADMIN_ACCESS_FILE_NAME).toString(); + private final static String AID_REFRESH_THREAD_NAME = "AID-refresh-jobs-%d"; + private final static int AID_REFRESH_INTERVAL_SECS = 30; + private final static int AID_DELAY_BEFORE_FIRST_REFRESH = 0; private static final long serialVersionUID = 1L; private static final Logger LOGGER = Logger.getLogger(AutoIngestDashboard.class.getName()); private AutoIngestMonitor autoIngestMonitor; private AutoIngestJobsPanel pendingJobsPanel; private AutoIngestJobsPanel runningJobsPanel; private AutoIngestJobsPanel completedJobsPanel; - + private final ScheduledThreadPoolExecutor scheduledRefreshThreadPoolExecutor; /** * Maintain a mapping of each service to it's last status update. */ @@ -88,7 +92,7 @@ final class AutoIngestDashboard extends JPanel implements Observer { private AutoIngestDashboard() { this.statusByService = new ConcurrentHashMap<>(); - + scheduledRefreshThreadPoolExecutor = new ScheduledThreadPoolExecutor(1, new ThreadFactoryBuilder().setNameFormat(AID_REFRESH_THREAD_NAME).build()); initComponents(); statusByService.put(ServicesMonitor.Service.REMOTE_CASE_DATABASE.toString(), NbBundle.getMessage(AutoIngestDashboard.class, "AutoIngestDashboard.tbServicesStatusMessage.Message.Down")); statusByService.put(ServicesMonitor.Service.REMOTE_KEYWORD_SEARCH.toString(), NbBundle.getMessage(AutoIngestDashboard.class, "AutoIngestDashboard.tbServicesStatusMessage.Message.Down")); @@ -236,7 +240,12 @@ final class AutoIngestDashboard extends JPanel implements Observer { ServicesMonitor.getInstance().addSubscriber(servicesList, propChangeListener); autoIngestMonitor = new AutoIngestMonitor(); - autoIngestMonitor.addObserver(this); + + scheduledRefreshThreadPoolExecutor.scheduleWithFixedDelay(() -> { + EventQueue.invokeLater(() -> { + refreshTables(); + }); + }, AID_DELAY_BEFORE_FIRST_REFRESH, AID_REFRESH_INTERVAL_SECS, TimeUnit.SECONDS); new Thread(() -> { try { autoIngestMonitor.startUp(); @@ -255,15 +264,6 @@ final class AutoIngestDashboard extends JPanel implements Observer { } } - @Override - public void update(Observable observable, Object arg) { - if (arg == null ) { - EventQueue.invokeLater(() -> { - refreshTables(); - }); - } - } - /** * Reloads the table models using a jobs snapshot and refreshes the JTables * that use the models. diff --git a/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestMonitor.java b/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestMonitor.java index 84eaa5fcdf..8f7a9c0696 100644 --- a/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestMonitor.java +++ b/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestMonitor.java @@ -198,6 +198,7 @@ final class AutoIngestMonitor extends Observable implements PropertyChangeListen runningJob.setModuleRuntimesSnapshot(job.getModuleRunTimes()); runningJob.setProcessingStage(job.getProcessingStage(), job.getProcessingStageStartDate()); runningJob.setProcessingStatus(job.getProcessingStatus()); + break; } } setChanged(); @@ -734,7 +735,7 @@ final class AutoIngestMonitor extends Observable implements PropertyChangeListen stopWatch.start(); eventPublisher.publishRemotely(new AutoIngestCaseDeletedEvent(caseName, LOCAL_HOST_NAME, AutoIngestManager.getSystemUserNameProperty())); stopWatch.stop(); - LOGGER.log(Level.INFO, String.format("Used %d s to publish job deletion event for case %s at %s", stopWatch.getElapsedTimeSecs(), caseName,caseDirectoryPath)); + LOGGER.log(Level.INFO, String.format("Used %d s to publish job deletion event for case %s at %s", stopWatch.getElapsedTimeSecs(), caseName, caseDirectoryPath)); } return CaseDeletionResult.FULLY_DELETED; From 48d47d93befbf4beb608ab39d485ca710f022293 Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Thu, 20 Dec 2018 11:23:49 -0500 Subject: [PATCH 02/16] 4328 give AutoIngestMonitor a chance to start before first refresh --- .../experimental/autoingest/AutoIngestDashboard.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestDashboard.java b/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestDashboard.java index 25736d5563..dddb387cdb 100644 --- a/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestDashboard.java +++ b/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestDashboard.java @@ -52,7 +52,7 @@ final class AutoIngestDashboard extends JPanel { private final static String ADMIN_ACCESS_FILE_PATH = Paths.get(PlatformUtil.getUserConfigDirectory(), ADMIN_ACCESS_FILE_NAME).toString(); private final static String AID_REFRESH_THREAD_NAME = "AID-refresh-jobs-%d"; private final static int AID_REFRESH_INTERVAL_SECS = 30; - private final static int AID_DELAY_BEFORE_FIRST_REFRESH = 0; + private final static int AID_DELAY_BEFORE_FIRST_REFRESH = 1; private static final long serialVersionUID = 1L; private static final Logger LOGGER = Logger.getLogger(AutoIngestDashboard.class.getName()); private AutoIngestMonitor autoIngestMonitor; @@ -241,11 +241,6 @@ final class AutoIngestDashboard extends JPanel { autoIngestMonitor = new AutoIngestMonitor(); - scheduledRefreshThreadPoolExecutor.scheduleWithFixedDelay(() -> { - EventQueue.invokeLater(() -> { - refreshTables(); - }); - }, AID_DELAY_BEFORE_FIRST_REFRESH, AID_REFRESH_INTERVAL_SECS, TimeUnit.SECONDS); new Thread(() -> { try { autoIngestMonitor.startUp(); @@ -253,6 +248,11 @@ final class AutoIngestDashboard extends JPanel { LOGGER.log(Level.SEVERE, "Unable to start up Auto Ingest Monitor", ex); } }).start(); + scheduledRefreshThreadPoolExecutor.scheduleWithFixedDelay(() -> { + EventQueue.invokeLater(() -> { + refreshTables(); + }); + }, AID_DELAY_BEFORE_FIRST_REFRESH, AID_REFRESH_INTERVAL_SECS, TimeUnit.SECONDS); } /** From 003990972036d11fa09c84240067c463ac39c6c6 Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Thu, 20 Dec 2018 11:30:42 -0500 Subject: [PATCH 03/16] 4328 make node list refresh at set interval as well --- .../autoingest/AinStatusDashboard.java | 27 ++++++++++--------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AinStatusDashboard.java b/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AinStatusDashboard.java index 3cfe48da5d..62d4e4bca0 100644 --- a/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AinStatusDashboard.java +++ b/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AinStatusDashboard.java @@ -18,27 +18,32 @@ */ package org.sleuthkit.autopsy.experimental.autoingest; +import com.google.common.util.concurrent.ThreadFactoryBuilder; import java.awt.Cursor; import java.awt.EventQueue; -import java.util.Observable; -import java.util.Observer; -import org.sleuthkit.autopsy.experimental.autoingest.AutoIngestMonitor.AutoIngestNodeState; +import java.util.concurrent.ScheduledThreadPoolExecutor; +import java.util.concurrent.TimeUnit; import org.sleuthkit.autopsy.healthmonitor.HealthMonitorDashboard; /** * A dashboard for monitoring the existing AutoIngestNodes and their status. */ @SuppressWarnings("PMD.SingularField") // UI widgets cause lots of false positives -final class AinStatusDashboard extends javax.swing.JPanel implements Observer { +final class AinStatusDashboard extends javax.swing.JPanel { private final AutoIngestMonitor autoIngestMonitor; private final AinStatusPanel nodesPanel; + private final static String AIN_REFRESH_THREAD_NAME = "AID-refresh-jobs-%d"; + private final static int AIN_REFRESH_INTERVAL_SECS = 30; + private final static int AIN_DELAY_BEFORE_FIRST_REFRESH = 1; + private final ScheduledThreadPoolExecutor scheduledRefreshThreadPoolExecutor; /** * Creates new form AutoIngestNodeStatus */ AinStatusDashboard(AutoIngestMonitor monitor) { initComponents(); + scheduledRefreshThreadPoolExecutor = new ScheduledThreadPoolExecutor(1, new ThreadFactoryBuilder().setNameFormat(AIN_REFRESH_THREAD_NAME).build()); autoIngestMonitor = monitor; nodesPanel = new AinStatusPanel(); nodesPanel.setSize(nodesPanel.getSize()); @@ -51,7 +56,11 @@ final class AinStatusDashboard extends javax.swing.JPanel implements Observer { * Adds this panel as an observer of AutoIngestMonitor. */ void startUp() { - autoIngestMonitor.addObserver(this); + scheduledRefreshThreadPoolExecutor.scheduleWithFixedDelay(() -> { + EventQueue.invokeLater(() -> { + refreshTables(); + }); + }, AIN_DELAY_BEFORE_FIRST_REFRESH, AIN_REFRESH_INTERVAL_SECS, TimeUnit.SECONDS); } AutoIngestMonitor getMonitor() { @@ -170,12 +179,4 @@ final class AinStatusDashboard extends javax.swing.JPanel implements Observer { private javax.swing.JButton refreshButton; // End of variables declaration//GEN-END:variables - @Override - public void update(Observable o, Object arg) { - if (arg instanceof AutoIngestNodeState) { - EventQueue.invokeLater(() -> { - refreshTables(); - }); - } - } } From fc7a7624c6f592df320fa6e4bfc34cc434e4e002 Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Thu, 20 Dec 2018 12:59:11 -0500 Subject: [PATCH 04/16] 4328 remove extension of Observable from AutoIngestMonitor --- .../autoingest/AutoIngestDashboard.java | 13 ++++++------- .../autoingest/AutoIngestMonitor.java | 18 ++---------------- 2 files changed, 8 insertions(+), 23 deletions(-) diff --git a/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestDashboard.java b/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestDashboard.java index dddb387cdb..bb71d008f6 100644 --- a/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestDashboard.java +++ b/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestDashboard.java @@ -52,7 +52,7 @@ final class AutoIngestDashboard extends JPanel { private final static String ADMIN_ACCESS_FILE_PATH = Paths.get(PlatformUtil.getUserConfigDirectory(), ADMIN_ACCESS_FILE_NAME).toString(); private final static String AID_REFRESH_THREAD_NAME = "AID-refresh-jobs-%d"; private final static int AID_REFRESH_INTERVAL_SECS = 30; - private final static int AID_DELAY_BEFORE_FIRST_REFRESH = 1; + private final static int AID_DELAY_BEFORE_FIRST_REFRESH = 0; private static final long serialVersionUID = 1L; private static final Logger LOGGER = Logger.getLogger(AutoIngestDashboard.class.getName()); private AutoIngestMonitor autoIngestMonitor; @@ -240,19 +240,18 @@ final class AutoIngestDashboard extends JPanel { ServicesMonitor.getInstance().addSubscriber(servicesList, propChangeListener); autoIngestMonitor = new AutoIngestMonitor(); - new Thread(() -> { try { autoIngestMonitor.startUp(); + scheduledRefreshThreadPoolExecutor.scheduleWithFixedDelay(() -> { + EventQueue.invokeLater(() -> { + refreshTables(); + }); + }, AID_DELAY_BEFORE_FIRST_REFRESH, AID_REFRESH_INTERVAL_SECS, TimeUnit.SECONDS); } catch (AutoIngestMonitor.AutoIngestMonitorException ex) { LOGGER.log(Level.SEVERE, "Unable to start up Auto Ingest Monitor", ex); } }).start(); - scheduledRefreshThreadPoolExecutor.scheduleWithFixedDelay(() -> { - EventQueue.invokeLater(() -> { - refreshTables(); - }); - }, AID_DELAY_BEFORE_FIRST_REFRESH, AID_REFRESH_INTERVAL_SECS, TimeUnit.SECONDS); } /** diff --git a/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestMonitor.java b/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestMonitor.java index 8f7a9c0696..4e0de76bad 100644 --- a/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestMonitor.java +++ b/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestMonitor.java @@ -30,7 +30,6 @@ import java.util.Date; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Observable; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ScheduledThreadPoolExecutor; @@ -59,7 +58,7 @@ import org.sleuthkit.autopsy.experimental.autoingest.AutoIngestNodeControlEvent. * An auto ingest monitor responsible for monitoring and reporting the * processing of auto ingest jobs. */ -final class AutoIngestMonitor extends Observable implements PropertyChangeListener { +final class AutoIngestMonitor implements PropertyChangeListener { private static final Logger LOGGER = Logger.getLogger(AutoIngestMonitor.class.getName()); private static final int DEFAULT_PRIORITY = 0; @@ -172,8 +171,6 @@ final class AutoIngestMonitor extends Observable implements PropertyChangeListen synchronized (jobsLock) { jobsSnapshot.removePendingJob(event.getJob()); jobsSnapshot.addOrReplaceRunningJob(event.getJob()); - setChanged(); - notifyObservers(); } } @@ -201,8 +198,6 @@ final class AutoIngestMonitor extends Observable implements PropertyChangeListen break; } } - setChanged(); - notifyObservers(); } } @@ -217,8 +212,6 @@ final class AutoIngestMonitor extends Observable implements PropertyChangeListen jobsSnapshot.removePendingJob(job); jobsSnapshot.removeRunningJob(job); jobsSnapshot.addOrReplaceCompletedJob(job); - setChanged(); - notifyObservers(); } } @@ -246,18 +239,14 @@ final class AutoIngestMonitor extends Observable implements PropertyChangeListen * @param event A node state change event. */ private void handleAutoIngestNodeStateEvent(AutoIngestNodeStateEvent event) { - AutoIngestNodeState oldNodeState = null; if (event.getEventType() == AutoIngestManager.Event.SHUTDOWN) { // Remove node from collection. - oldNodeState = nodeStates.remove(event.getNodeName()); + nodeStates.remove(event.getNodeName()); } else { // Otherwise either create an entry for the given node name or update // an existing entry in the map. nodeStates.put(event.getNodeName(), new AutoIngestNodeState(event.getNodeName(), event.getEventType())); } - setChanged(); - // Trigger a dashboard refresh. - notifyObservers(oldNodeState == null ? nodeStates.get(event.getNodeName()) : oldNodeState); } /** @@ -797,9 +786,6 @@ final class AutoIngestMonitor extends Observable implements PropertyChangeListen // Ask running auto ingest nodes to report their status. refreshNodeState(); - - setChanged(); - notifyObservers(); } } From 8de438ced15042ac4302d6cfef431bf22b024a30 Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Thu, 20 Dec 2018 14:00:31 -0500 Subject: [PATCH 05/16] 4328 add back observer / observable to AutoIngestDashboard with executor --- .../autoingest/AinStatusDashboard.java | 24 ++++++++++++------ .../autoingest/AutoIngestDashboard.java | 25 ++++++++++++++----- .../autoingest/AutoIngestMonitor.java | 18 +++++++++++-- 3 files changed, 52 insertions(+), 15 deletions(-) diff --git a/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AinStatusDashboard.java b/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AinStatusDashboard.java index 62d4e4bca0..270b3c3dc8 100644 --- a/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AinStatusDashboard.java +++ b/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AinStatusDashboard.java @@ -21,22 +21,26 @@ package org.sleuthkit.autopsy.experimental.autoingest; import com.google.common.util.concurrent.ThreadFactoryBuilder; import java.awt.Cursor; import java.awt.EventQueue; +import java.util.Observable; +import java.util.Observer; import java.util.concurrent.ScheduledThreadPoolExecutor; import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicBoolean; import org.sleuthkit.autopsy.healthmonitor.HealthMonitorDashboard; /** * A dashboard for monitoring the existing AutoIngestNodes and their status. */ @SuppressWarnings("PMD.SingularField") // UI widgets cause lots of false positives -final class AinStatusDashboard extends javax.swing.JPanel { +final class AinStatusDashboard extends javax.swing.JPanel implements Observer { private final AutoIngestMonitor autoIngestMonitor; private final AinStatusPanel nodesPanel; private final static String AIN_REFRESH_THREAD_NAME = "AID-refresh-jobs-%d"; private final static int AIN_REFRESH_INTERVAL_SECS = 30; - private final static int AIN_DELAY_BEFORE_FIRST_REFRESH = 1; + private final static int AIN_DELAY_BEFORE_FIRST_REFRESH = 0; private final ScheduledThreadPoolExecutor scheduledRefreshThreadPoolExecutor; + private AtomicBoolean scheduledRefreshStarted = new AtomicBoolean(false); /** * Creates new form AutoIngestNodeStatus @@ -56,11 +60,7 @@ final class AinStatusDashboard extends javax.swing.JPanel { * Adds this panel as an observer of AutoIngestMonitor. */ void startUp() { - scheduledRefreshThreadPoolExecutor.scheduleWithFixedDelay(() -> { - EventQueue.invokeLater(() -> { - refreshTables(); - }); - }, AIN_DELAY_BEFORE_FIRST_REFRESH, AIN_REFRESH_INTERVAL_SECS, TimeUnit.SECONDS); + autoIngestMonitor.addObserver(this); } AutoIngestMonitor getMonitor() { @@ -179,4 +179,14 @@ final class AinStatusDashboard extends javax.swing.JPanel { private javax.swing.JButton refreshButton; // End of variables declaration//GEN-END:variables + @Override + public void update(Observable o, Object arg) { + if (!scheduledRefreshStarted.getAndSet(true)) { + scheduledRefreshThreadPoolExecutor.scheduleWithFixedDelay(() -> { + EventQueue.invokeLater(() -> { + refreshTables(); + }); + }, AIN_DELAY_BEFORE_FIRST_REFRESH, AIN_REFRESH_INTERVAL_SECS, TimeUnit.SECONDS); + } + } } diff --git a/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestDashboard.java b/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestDashboard.java index bb71d008f6..9743592ba3 100644 --- a/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestDashboard.java +++ b/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestDashboard.java @@ -28,10 +28,13 @@ import java.beans.PropertyChangeListener; import java.io.File; import java.nio.file.Paths; import java.util.HashSet; +import java.util.Observable; +import java.util.Observer; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ScheduledThreadPoolExecutor; import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicBoolean; import javax.swing.JPanel; import javax.swing.SwingWorker; import javax.swing.UIManager; @@ -46,7 +49,7 @@ import org.sleuthkit.autopsy.experimental.autoingest.AutoIngestNodeRefreshEvents * A dashboard for monitoring an automated ingest cluster. */ @SuppressWarnings("PMD.SingularField") // UI widgets cause lots of false positives -final class AutoIngestDashboard extends JPanel { +final class AutoIngestDashboard extends JPanel implements Observer { private final static String ADMIN_ACCESS_FILE_NAME = "_aiaa"; // NON-NLS private final static String ADMIN_ACCESS_FILE_PATH = Paths.get(PlatformUtil.getUserConfigDirectory(), ADMIN_ACCESS_FILE_NAME).toString(); @@ -60,6 +63,8 @@ final class AutoIngestDashboard extends JPanel { private AutoIngestJobsPanel runningJobsPanel; private AutoIngestJobsPanel completedJobsPanel; private final ScheduledThreadPoolExecutor scheduledRefreshThreadPoolExecutor; + private AtomicBoolean scheduledRefreshStarted = new AtomicBoolean(false); + /** * Maintain a mapping of each service to it's last status update. */ @@ -240,14 +245,11 @@ final class AutoIngestDashboard extends JPanel { ServicesMonitor.getInstance().addSubscriber(servicesList, propChangeListener); autoIngestMonitor = new AutoIngestMonitor(); + autoIngestMonitor.addObserver(this); new Thread(() -> { try { autoIngestMonitor.startUp(); - scheduledRefreshThreadPoolExecutor.scheduleWithFixedDelay(() -> { - EventQueue.invokeLater(() -> { - refreshTables(); - }); - }, AID_DELAY_BEFORE_FIRST_REFRESH, AID_REFRESH_INTERVAL_SECS, TimeUnit.SECONDS); + } catch (AutoIngestMonitor.AutoIngestMonitorException ex) { LOGGER.log(Level.SEVERE, "Unable to start up Auto Ingest Monitor", ex); } @@ -263,6 +265,17 @@ final class AutoIngestDashboard extends JPanel { } } + @Override + public void update(Observable observable, Object arg) { + if (!scheduledRefreshStarted.getAndSet(true)) { + scheduledRefreshThreadPoolExecutor.scheduleWithFixedDelay(() -> { + EventQueue.invokeLater(() -> { + refreshTables(); + }); + }, AID_DELAY_BEFORE_FIRST_REFRESH, AID_REFRESH_INTERVAL_SECS, TimeUnit.SECONDS); + } + } + /** * Reloads the table models using a jobs snapshot and refreshes the JTables * that use the models. diff --git a/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestMonitor.java b/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestMonitor.java index 4e0de76bad..8f7a9c0696 100644 --- a/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestMonitor.java +++ b/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestMonitor.java @@ -30,6 +30,7 @@ import java.util.Date; import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.Observable; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ScheduledThreadPoolExecutor; @@ -58,7 +59,7 @@ import org.sleuthkit.autopsy.experimental.autoingest.AutoIngestNodeControlEvent. * An auto ingest monitor responsible for monitoring and reporting the * processing of auto ingest jobs. */ -final class AutoIngestMonitor implements PropertyChangeListener { +final class AutoIngestMonitor extends Observable implements PropertyChangeListener { private static final Logger LOGGER = Logger.getLogger(AutoIngestMonitor.class.getName()); private static final int DEFAULT_PRIORITY = 0; @@ -171,6 +172,8 @@ final class AutoIngestMonitor implements PropertyChangeListener { synchronized (jobsLock) { jobsSnapshot.removePendingJob(event.getJob()); jobsSnapshot.addOrReplaceRunningJob(event.getJob()); + setChanged(); + notifyObservers(); } } @@ -198,6 +201,8 @@ final class AutoIngestMonitor implements PropertyChangeListener { break; } } + setChanged(); + notifyObservers(); } } @@ -212,6 +217,8 @@ final class AutoIngestMonitor implements PropertyChangeListener { jobsSnapshot.removePendingJob(job); jobsSnapshot.removeRunningJob(job); jobsSnapshot.addOrReplaceCompletedJob(job); + setChanged(); + notifyObservers(); } } @@ -239,14 +246,18 @@ final class AutoIngestMonitor implements PropertyChangeListener { * @param event A node state change event. */ private void handleAutoIngestNodeStateEvent(AutoIngestNodeStateEvent event) { + AutoIngestNodeState oldNodeState = null; if (event.getEventType() == AutoIngestManager.Event.SHUTDOWN) { // Remove node from collection. - nodeStates.remove(event.getNodeName()); + oldNodeState = nodeStates.remove(event.getNodeName()); } else { // Otherwise either create an entry for the given node name or update // an existing entry in the map. nodeStates.put(event.getNodeName(), new AutoIngestNodeState(event.getNodeName(), event.getEventType())); } + setChanged(); + // Trigger a dashboard refresh. + notifyObservers(oldNodeState == null ? nodeStates.get(event.getNodeName()) : oldNodeState); } /** @@ -786,6 +797,9 @@ final class AutoIngestMonitor implements PropertyChangeListener { // Ask running auto ingest nodes to report their status. refreshNodeState(); + + setChanged(); + notifyObservers(); } } From 77b8bf863ea2f7928314a794fe64735cbf938517 Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Thu, 20 Dec 2018 14:04:43 -0500 Subject: [PATCH 06/16] 4328 fix errors with comments regarding arguements --- .../autopsy/experimental/autoingest/AutoIngestDashboard.java | 3 +-- .../autopsy/experimental/autoingest/AutoIngestJobsPanel.java | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestDashboard.java b/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestDashboard.java index 9743592ba3..754a9c3ad7 100644 --- a/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestDashboard.java +++ b/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestDashboard.java @@ -277,10 +277,9 @@ final class AutoIngestDashboard extends JPanel implements Observer { } /** - * Reloads the table models using a jobs snapshot and refreshes the JTables + * Reloads the table models using a RefreshChildrenEvent and refreshes the JTables * that use the models. * - * @param nodeStateSnapshot The jobs snapshot. */ void refreshTables() { pendingJobsPanel.refresh(new RefreshChildrenEvent(autoIngestMonitor)); diff --git a/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestJobsPanel.java b/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestJobsPanel.java index 18fb8171b2..6962057541 100644 --- a/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestJobsPanel.java +++ b/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestJobsPanel.java @@ -164,7 +164,7 @@ final class AutoIngestJobsPanel extends javax.swing.JPanel implements ExplorerMa * Update the contents of this AutoIngestJobsPanel while retaining currently * selected node. * - * @param jobsSnapshot - the JobsSnapshot which will provide the new + * @param refreshEvent - the AutoIngestRefreshEvent which will provide the new * contents */ void refresh(AutoIngestRefreshEvent refreshEvent) { From e99d2e36159204a587dab048b80b447ad03cab08 Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Thu, 20 Dec 2018 16:37:05 -0500 Subject: [PATCH 07/16] 4556 fix bug in upgrade population of CR data source obj id --- .../centralrepository/datamodel/DataSourceUpdateService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/DataSourceUpdateService.java b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/DataSourceUpdateService.java index 16cc5b58c7..46696bad94 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/DataSourceUpdateService.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/DataSourceUpdateService.java @@ -51,7 +51,7 @@ public class DataSourceUpdateService implements AutopsyService { //ResultSet.getLong has a value of 0 when the value is null if (correlationDataSource.getCaseID() == correlationCase.getID() && correlationDataSource.getDataSourceObjectID() == 0) { for (Content dataSource : context.getCase().getDataSources()) { - if (((DataSource) dataSource).getDeviceId().equals(correlationDataSource.getDeviceID())) { + if (((DataSource) dataSource).getDeviceId().equals(correlationDataSource.getDeviceID()) && dataSource.getName().equals(correlationDataSource.getName())) { centralRepository.addDataSourceObjectId(correlationDataSource.getID(), dataSource.getId()); break; } From 04f33b722b0835557013aea7472b9cf40103d5a6 Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Fri, 21 Dec 2018 13:19:09 -0500 Subject: [PATCH 08/16] 4556 add check for CR compatability of major version --- ...CentralRepoContextMenuActionsProvider.java | 3 ++- .../DataContentViewerOtherCases.java | 2 +- .../datamodel/AbstractSqlEamDb.java | 21 ++++++++++++------- .../datamodel/CorrelationDataSource.java | 2 +- .../datamodel/EamDbUtil.java | 12 +++++++---- .../datamodel/PostgresEamDbSettings.java | 10 ++++----- .../datamodel/SqliteEamDbSettings.java | 10 ++++----- .../communications/RelationshipNode.java | 5 +++-- .../corecomponents/ViewPreferencesPanel.java | 5 +++-- .../datamodel/AbstractAbstractFileNode.java | 2 +- .../datamodel/BlackboardArtifactNode.java | 2 +- 11 files changed, 44 insertions(+), 30 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/CentralRepoContextMenuActionsProvider.java b/Core/src/org/sleuthkit/autopsy/centralrepository/CentralRepoContextMenuActionsProvider.java index 65a980558c..ab9bed4632 100755 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/CentralRepoContextMenuActionsProvider.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/CentralRepoContextMenuActionsProvider.java @@ -25,6 +25,7 @@ import javax.swing.Action; import org.openide.util.Utilities; import org.openide.util.lookup.ServiceProvider; import org.sleuthkit.autopsy.centralrepository.datamodel.EamArtifactUtil; +import org.sleuthkit.autopsy.centralrepository.datamodel.EamDb; import org.sleuthkit.autopsy.centralrepository.datamodel.EamDbUtil; import org.sleuthkit.autopsy.corecomponentinterfaces.ContextMenuActionsProvider; import org.sleuthkit.datamodel.AbstractFile; @@ -46,7 +47,7 @@ public class CentralRepoContextMenuActionsProvider implements ContextMenuActions } for (AbstractFile file : selectedFiles) { - if (EamDbUtil.useCentralRepo() && EamArtifactUtil.isSupportedAbstractFileType(file) && file.isFile()) { + if (EamDb.isEnabled() && EamArtifactUtil.isSupportedAbstractFileType(file) && file.isFile()) { AddEditCentralRepoCommentAction action = new AddEditCentralRepoCommentAction(file); if (action.getCorrelationAttribute() == null) { action.setEnabled(false); diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/contentviewer/DataContentViewerOtherCases.java b/Core/src/org/sleuthkit/autopsy/centralrepository/contentviewer/DataContentViewerOtherCases.java index 191d1c3bc6..ee0f5c6769 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/contentviewer/DataContentViewerOtherCases.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/contentviewer/DataContentViewerOtherCases.java @@ -891,7 +891,7 @@ public class DataContentViewerOtherCases extends JPanel implements DataContentVi private void rightClickPopupMenuPopupMenuWillBecomeVisible(javax.swing.event.PopupMenuEvent evt) {//GEN-FIRST:event_rightClickPopupMenuPopupMenuWillBecomeVisible boolean enableCentralRepoActions = false; - if (EamDbUtil.useCentralRepo() && otherCasesTable.getSelectedRowCount() == 1) { + if (EamDb.isEnabled() && otherCasesTable.getSelectedRowCount() == 1) { int rowIndex = otherCasesTable.getSelectedRow(); OtherOccurrenceNodeData selectedNode = (OtherOccurrenceNodeData) tableModel.getRow(rowIndex); if (selectedNode instanceof OtherOccurrenceNodeInstanceData) { diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/AbstractSqlEamDb.java b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/AbstractSqlEamDb.java index 27c6407b5d..76b9d54381 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/AbstractSqlEamDb.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/AbstractSqlEamDb.java @@ -60,7 +60,7 @@ abstract class AbstractSqlEamDb implements EamDb { static final String SCHEMA_MINOR_VERSION_KEY = "SCHEMA_MINOR_VERSION"; static final String CREATION_SCHEMA_MAJOR_VERSION_KEY = "CREATION_SCHEMA_MAJOR_VERSION"; static final String CREATION_SCHEMA_MINOR_VERSION_KEY = "CREATION_SCHEMA_MINOR_VERSION"; - static final CaseDbSchemaVersionNumber CURRENT_DB_SCHEMA_VERSION = new CaseDbSchemaVersionNumber(1, 2); + static final CaseDbSchemaVersionNumber SOFTWARE_CR_DB_SCHEMA_VERSION = new CaseDbSchemaVersionNumber(1, 2); protected final List defaultCorrelationTypes; @@ -3220,11 +3220,18 @@ abstract class AbstractSqlEamDb implements EamDb { * schema updates that may already have been done once. */ CaseDbSchemaVersionNumber dbSchemaVersion = new CaseDbSchemaVersionNumber(majorVersion, minorVersion); - if (dbSchemaVersion.equals(CURRENT_DB_SCHEMA_VERSION)) { + + //compare the major versions for compatability + //we can not use the CaseDbSchemaVersionNumber.isCompatible method + //because it is specific to case db schema versions only supporting major versions greater than 1 + if (SOFTWARE_CR_DB_SCHEMA_VERSION.getMajor() < dbSchemaVersion.getMajor()) { + throw new EamDbException("The selected Central Repository is not compatable with the current version of the application, please upgrade the application if you wish to use this Central Repository"); + } + if (dbSchemaVersion.equals(SOFTWARE_CR_DB_SCHEMA_VERSION)) { logger.log(Level.INFO, "Central Repository is up to date"); return; } - if (dbSchemaVersion.compareTo(CURRENT_DB_SCHEMA_VERSION) > 0) { + if (dbSchemaVersion.compareTo(SOFTWARE_CR_DB_SCHEMA_VERSION) > 0) { logger.log(Level.INFO, "Central Repository is of newer version than software creates"); return; } @@ -3386,8 +3393,8 @@ abstract class AbstractSqlEamDb implements EamDb { * column having a UNIQUE constraint. The name column could now * be used as the primary key, but the essentially useless id * column is retained for the sake of backwards compatibility. - * Note that the creation schema version number is set to 0.0 - * to indicate that it is unknown. + * Note that the creation schema version number is set to 0.0 to + * indicate that it is unknown. */ String creationMajorVer; resultSet = statement.executeQuery("SELECT value FROM db_info WHERE name = '" + AbstractSqlEamDb.CREATION_SCHEMA_MAJOR_VERSION_KEY + "'"); @@ -3417,7 +3424,7 @@ abstract class AbstractSqlEamDb implements EamDb { updateSchemaVersion(conn); conn.commit(); - logger.log(Level.INFO, String.format("Central Repository schema updated to version %s", CURRENT_DB_SCHEMA_VERSION)); + logger.log(Level.INFO, String.format("Central Repository schema updated to version %s", SOFTWARE_CR_DB_SCHEMA_VERSION)); } catch (SQLException | EamDbException ex) { try { @@ -3425,7 +3432,7 @@ abstract class AbstractSqlEamDb implements EamDb { conn.rollback(); } } catch (SQLException ex2) { - logger.log(Level.SEVERE, String.format("Central Repository rollback of failed schema update to %s failed", CURRENT_DB_SCHEMA_VERSION), ex2); + logger.log(Level.SEVERE, String.format("Central Repository rollback of failed schema update to %s failed", SOFTWARE_CR_DB_SCHEMA_VERSION), ex2); } throw ex; } finally { diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/CorrelationDataSource.java b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/CorrelationDataSource.java index b1d48d07b2..5b38c8a39e 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/CorrelationDataSource.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/CorrelationDataSource.java @@ -98,7 +98,7 @@ public class CorrelationDataSource implements Serializable { } CorrelationDataSource correlationDataSource = null; - boolean useCR = EamDbUtil.useCentralRepo(); + boolean useCR = EamDb.isEnabled(); if (useCR) { correlationDataSource = EamDb.getInstance().getDataSource(correlationCase, dataSource.getId()); } diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/EamDbUtil.java b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/EamDbUtil.java index 6e629b52e2..8f409fb558 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/EamDbUtil.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/EamDbUtil.java @@ -25,11 +25,11 @@ import java.sql.SQLException; import java.sql.Statement; import java.util.List; import java.util.logging.Level; -import static org.sleuthkit.autopsy.centralrepository.datamodel.AbstractSqlEamDb.CURRENT_DB_SCHEMA_VERSION; import org.sleuthkit.autopsy.coordinationservice.CoordinationService; import org.sleuthkit.autopsy.coordinationservice.CoordinationService.CoordinationServiceException; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.ModuleSettings; +import static org.sleuthkit.autopsy.centralrepository.datamodel.AbstractSqlEamDb.SOFTWARE_CR_DB_SCHEMA_VERSION; /** * @@ -134,8 +134,8 @@ public class EamDbUtil { */ static void updateSchemaVersion(Connection conn) throws SQLException { try (Statement statement = conn.createStatement()) { - statement.execute("UPDATE db_info SET value = '" + CURRENT_DB_SCHEMA_VERSION.getMajor() + "' WHERE name = '" + AbstractSqlEamDb.SCHEMA_MAJOR_VERSION_KEY + "'"); - statement.execute("UPDATE db_info SET value = '" + CURRENT_DB_SCHEMA_VERSION.getMinor() + "' WHERE name = '" + AbstractSqlEamDb.SCHEMA_MINOR_VERSION_KEY + "'"); + statement.execute("UPDATE db_info SET value = '" + SOFTWARE_CR_DB_SCHEMA_VERSION.getMajor() + "' WHERE name = '" + AbstractSqlEamDb.SCHEMA_MAJOR_VERSION_KEY + "'"); + statement.execute("UPDATE db_info SET value = '" + SOFTWARE_CR_DB_SCHEMA_VERSION.getMinor() + "' WHERE name = '" + AbstractSqlEamDb.SCHEMA_MINOR_VERSION_KEY + "'"); } } @@ -200,6 +200,7 @@ public class EamDbUtil { LOGGER.log(Level.SEVERE, "Error shutting down central repo connection pool", ex); } setUseCentralRepo(false); + EamDbPlatformEnum.setSelectedPlatform(EamDbPlatformEnum.DISABLED.name()); EamDbPlatformEnum.saveSelectedPlatform(); @@ -268,12 +269,15 @@ public class EamDbUtil { } /** - * If the Central Repos use has been enabled. + * If the option to use a central repository has been selected, does not + * indicate the central repository is configured for use. * * @return true if the Central Repo may be configured, false if it should * not be able to be */ public static boolean useCentralRepo() { + //In almost all situations EamDb.isEnabled() should be used instead of this method + //as will call this as well as checking that the selected type of central repository is not DISABLED return Boolean.parseBoolean(ModuleSettings.getConfigSetting(CENTRAL_REPO_NAME, CENTRAL_REPO_USE_KEY)); } diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/PostgresEamDbSettings.java b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/PostgresEamDbSettings.java index 14a5719f52..9a431f8011 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/PostgresEamDbSettings.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/PostgresEamDbSettings.java @@ -28,11 +28,11 @@ import java.util.List; import java.util.Properties; import java.util.logging.Level; import java.util.regex.Pattern; -import static org.sleuthkit.autopsy.centralrepository.datamodel.AbstractSqlEamDb.CURRENT_DB_SCHEMA_VERSION; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.ModuleSettings; import org.sleuthkit.autopsy.coreutils.TextConverter; import org.sleuthkit.autopsy.coreutils.TextConverterException; +import static org.sleuthkit.autopsy.centralrepository.datamodel.AbstractSqlEamDb.SOFTWARE_CR_DB_SCHEMA_VERSION; /** * Settings for the Postgres implementation of the Central Repository database @@ -437,10 +437,10 @@ public final class PostgresEamDbSettings { * name column could be the primary key. */ stmt.execute("CREATE TABLE db_info (id SERIAL, name TEXT UNIQUE NOT NULL, value TEXT NOT NULL)"); - stmt.execute("INSERT INTO db_info (name, value) VALUES ('" + AbstractSqlEamDb.SCHEMA_MAJOR_VERSION_KEY + "', '" + CURRENT_DB_SCHEMA_VERSION.getMajor() + "')"); - stmt.execute("INSERT INTO db_info (name, value) VALUES ('" + AbstractSqlEamDb.SCHEMA_MINOR_VERSION_KEY + "', '" + CURRENT_DB_SCHEMA_VERSION.getMinor() + "')"); - stmt.execute("INSERT INTO db_info (name, value) VALUES ('" + AbstractSqlEamDb.CREATION_SCHEMA_MAJOR_VERSION_KEY + "', '" + CURRENT_DB_SCHEMA_VERSION.getMajor() + "')"); - stmt.execute("INSERT INTO db_info (name, value) VALUES ('" + AbstractSqlEamDb.CREATION_SCHEMA_MINOR_VERSION_KEY + "', '" + CURRENT_DB_SCHEMA_VERSION.getMinor() + "')"); + stmt.execute("INSERT INTO db_info (name, value) VALUES ('" + AbstractSqlEamDb.SCHEMA_MAJOR_VERSION_KEY + "', '" + SOFTWARE_CR_DB_SCHEMA_VERSION.getMajor() + "')"); + stmt.execute("INSERT INTO db_info (name, value) VALUES ('" + AbstractSqlEamDb.SCHEMA_MINOR_VERSION_KEY + "', '" + SOFTWARE_CR_DB_SCHEMA_VERSION.getMinor() + "')"); + stmt.execute("INSERT INTO db_info (name, value) VALUES ('" + AbstractSqlEamDb.CREATION_SCHEMA_MAJOR_VERSION_KEY + "', '" + SOFTWARE_CR_DB_SCHEMA_VERSION.getMajor() + "')"); + stmt.execute("INSERT INTO db_info (name, value) VALUES ('" + AbstractSqlEamDb.CREATION_SCHEMA_MINOR_VERSION_KEY + "', '" + SOFTWARE_CR_DB_SCHEMA_VERSION.getMinor() + "')"); // Create a separate instance and reference table for each correlation type List DEFAULT_CORRELATION_TYPES = CorrelationAttributeInstance.getDefaultCorrelationTypes(); diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/SqliteEamDbSettings.java b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/SqliteEamDbSettings.java index 4851e51b51..4baa423a04 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/SqliteEamDbSettings.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/SqliteEamDbSettings.java @@ -29,10 +29,10 @@ import java.sql.Statement; import java.util.List; import java.util.logging.Level; import java.util.regex.Pattern; -import static org.sleuthkit.autopsy.centralrepository.datamodel.AbstractSqlEamDb.CURRENT_DB_SCHEMA_VERSION; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.ModuleSettings; import org.sleuthkit.autopsy.coreutils.PlatformUtil; +import static org.sleuthkit.autopsy.centralrepository.datamodel.AbstractSqlEamDb.SOFTWARE_CR_DB_SCHEMA_VERSION; /** * Settings for the sqlite implementation of the Central Repository database @@ -386,10 +386,10 @@ public final class SqliteEamDbSettings { * name column could be the primary key. */ stmt.execute("CREATE TABLE db_info (id INTEGER PRIMARY KEY, name TEXT UNIQUE NOT NULL, value TEXT NOT NULL)"); - stmt.execute("INSERT INTO db_info (name, value) VALUES ('" + AbstractSqlEamDb.SCHEMA_MAJOR_VERSION_KEY + "', '" + CURRENT_DB_SCHEMA_VERSION.getMajor() + "')"); - stmt.execute("INSERT INTO db_info (name, value) VALUES ('" + AbstractSqlEamDb.SCHEMA_MINOR_VERSION_KEY + "', '" + CURRENT_DB_SCHEMA_VERSION.getMinor() + "')"); - stmt.execute("INSERT INTO db_info (name, value) VALUES ('" + AbstractSqlEamDb.CREATION_SCHEMA_MAJOR_VERSION_KEY + "', '" + CURRENT_DB_SCHEMA_VERSION.getMajor() + "')"); - stmt.execute("INSERT INTO db_info (name, value) VALUES ('" + AbstractSqlEamDb.CREATION_SCHEMA_MINOR_VERSION_KEY + "', '" + CURRENT_DB_SCHEMA_VERSION.getMinor() + "')"); + stmt.execute("INSERT INTO db_info (name, value) VALUES ('" + AbstractSqlEamDb.SCHEMA_MAJOR_VERSION_KEY + "', '" + SOFTWARE_CR_DB_SCHEMA_VERSION.getMajor() + "')"); + stmt.execute("INSERT INTO db_info (name, value) VALUES ('" + AbstractSqlEamDb.SCHEMA_MINOR_VERSION_KEY + "', '" + SOFTWARE_CR_DB_SCHEMA_VERSION.getMinor() + "')"); + stmt.execute("INSERT INTO db_info (name, value) VALUES ('" + AbstractSqlEamDb.CREATION_SCHEMA_MAJOR_VERSION_KEY + "', '" + SOFTWARE_CR_DB_SCHEMA_VERSION.getMajor() + "')"); + stmt.execute("INSERT INTO db_info (name, value) VALUES ('" + AbstractSqlEamDb.CREATION_SCHEMA_MINOR_VERSION_KEY + "', '" + SOFTWARE_CR_DB_SCHEMA_VERSION.getMinor() + "')"); // Create a separate instance and reference table for each artifact type List DEFAULT_CORRELATION_TYPES = CorrelationAttributeInstance.getDefaultCorrelationTypes(); diff --git a/Core/src/org/sleuthkit/autopsy/communications/RelationshipNode.java b/Core/src/org/sleuthkit/autopsy/communications/RelationshipNode.java index 9cee18d5f9..9b2ab71ca2 100644 --- a/Core/src/org/sleuthkit/autopsy/communications/RelationshipNode.java +++ b/Core/src/org/sleuthkit/autopsy/communications/RelationshipNode.java @@ -24,6 +24,7 @@ import java.util.logging.Level; import org.apache.commons.lang3.StringUtils; import org.openide.nodes.Sheet; import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttributeInstance; +import org.sleuthkit.autopsy.centralrepository.datamodel.EamDb; import org.sleuthkit.autopsy.centralrepository.datamodel.EamDbUtil; import org.sleuthkit.autopsy.core.UserPreferences; import org.sleuthkit.autopsy.coreutils.Logger; @@ -74,12 +75,12 @@ final class RelationshipNode extends BlackboardArtifactNode { addScoreProperty(sheetSet, tags); CorrelationAttributeInstance correlationAttribute = null; - if (EamDbUtil.useCentralRepo() && UserPreferences.hideCentralRepoCommentsAndOccurrences()== false) { + if (UserPreferences.hideCentralRepoCommentsAndOccurrences()== false) { correlationAttribute = getCorrelationAttributeInstance(); } addCommentProperty(sheetSet, tags, correlationAttribute); - if (EamDbUtil.useCentralRepo() && UserPreferences.hideCentralRepoCommentsAndOccurrences()== false) { + if (UserPreferences.hideCentralRepoCommentsAndOccurrences()== false) { addCountProperty(sheetSet, correlationAttribute); } final BlackboardArtifact artifact = getArtifact(); diff --git a/Core/src/org/sleuthkit/autopsy/corecomponents/ViewPreferencesPanel.java b/Core/src/org/sleuthkit/autopsy/corecomponents/ViewPreferencesPanel.java index cdea98caf6..833a850aac 100755 --- a/Core/src/org/sleuthkit/autopsy/corecomponents/ViewPreferencesPanel.java +++ b/Core/src/org/sleuthkit/autopsy/corecomponents/ViewPreferencesPanel.java @@ -26,6 +26,7 @@ import javax.swing.JPanel; import org.netbeans.spi.options.OptionsPanelController; import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.casemodule.CasePreferences; +import org.sleuthkit.autopsy.centralrepository.datamodel.EamDb; import org.sleuthkit.autopsy.centralrepository.datamodel.EamDbUtil; import org.sleuthkit.autopsy.core.UserPreferences; import org.sleuthkit.autopsy.coreutils.TimeZoneUtils; @@ -75,8 +76,8 @@ public class ViewPreferencesPanel extends JPanel implements OptionsPanel { dataSourcesHideSlackCheckbox.setSelected(UserPreferences.hideSlackFilesInDataSourcesTree()); viewsHideSlackCheckbox.setSelected(UserPreferences.hideSlackFilesInViewsTree()); - commentsOccurencesColumnsCheckbox.setEnabled(EamDbUtil.useCentralRepo()); - commentsOccurencesColumnWrapAroundText.setEnabled(EamDbUtil.useCentralRepo()); + commentsOccurencesColumnsCheckbox.setEnabled(EamDb.isEnabled()); + commentsOccurencesColumnWrapAroundText.setEnabled(EamDb.isEnabled()); commentsOccurencesColumnsCheckbox.setSelected(UserPreferences.hideCentralRepoCommentsAndOccurrences()); hideOtherUsersTagsCheckbox.setSelected(UserPreferences.showOnlyCurrentUserTags()); diff --git a/Core/src/org/sleuthkit/autopsy/datamodel/AbstractAbstractFileNode.java b/Core/src/org/sleuthkit/autopsy/datamodel/AbstractAbstractFileNode.java index ce00c55433..3e7a6802dc 100644 --- a/Core/src/org/sleuthkit/autopsy/datamodel/AbstractAbstractFileNode.java +++ b/Core/src/org/sleuthkit/autopsy/datamodel/AbstractAbstractFileNode.java @@ -572,7 +572,7 @@ public abstract class AbstractAbstractFileNode extends A CorrelationAttributeInstance getCorrelationAttributeInstance() { CorrelationAttributeInstance attribute = null; - if (EamDbUtil.useCentralRepo() && !UserPreferences.hideCentralRepoCommentsAndOccurrences()) { + if (EamDb.isEnabled() && !UserPreferences.hideCentralRepoCommentsAndOccurrences()) { attribute = EamArtifactUtil.getInstanceFromContent(content); } return attribute; diff --git a/Core/src/org/sleuthkit/autopsy/datamodel/BlackboardArtifactNode.java b/Core/src/org/sleuthkit/autopsy/datamodel/BlackboardArtifactNode.java index 17e36ff5a3..9906255a25 100644 --- a/Core/src/org/sleuthkit/autopsy/datamodel/BlackboardArtifactNode.java +++ b/Core/src/org/sleuthkit/autopsy/datamodel/BlackboardArtifactNode.java @@ -572,7 +572,7 @@ public class BlackboardArtifactNode extends AbstractContentNode Date: Fri, 21 Dec 2018 13:34:11 -0500 Subject: [PATCH 09/16] 4556 rename EamDbUtil.useCentralRepo to make it's limited purpose more clear --- .../autopsy/centralrepository/datamodel/EamDb.java | 4 ++-- .../autopsy/centralrepository/datamodel/EamDbUtil.java | 7 ++++--- .../optionspanel/GlobalSettingsPanel.java | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/EamDb.java b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/EamDb.java index 0793a8f696..7a54ee656c 100755 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/EamDb.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/EamDb.java @@ -41,7 +41,7 @@ public interface EamDb { static EamDb getInstance() throws EamDbException { EamDbPlatformEnum selectedPlatform = EamDbPlatformEnum.DISABLED; - if (EamDbUtil.useCentralRepo()) { + if (EamDbUtil.allowUseOfCentralRepository()) { selectedPlatform = EamDbPlatformEnum.getSelectedPlatform(); } switch (selectedPlatform) { @@ -92,7 +92,7 @@ public interface EamDb { * @return Is the database enabled */ static boolean isEnabled() { - return EamDbUtil.useCentralRepo() + return EamDbUtil.allowUseOfCentralRepository() && EamDbPlatformEnum.getSelectedPlatform() != EamDbPlatformEnum.DISABLED; } diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/EamDbUtil.java b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/EamDbUtil.java index 8f409fb558..d1edcc15c3 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/EamDbUtil.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/EamDbUtil.java @@ -270,14 +270,15 @@ public class EamDbUtil { /** * If the option to use a central repository has been selected, does not - * indicate the central repository is configured for use. + * indicate the central repository is configured for use simply that the + * checkbox allowing configuration is checked on the options panel. * * @return true if the Central Repo may be configured, false if it should * not be able to be */ - public static boolean useCentralRepo() { + public static boolean allowUseOfCentralRepository() { //In almost all situations EamDb.isEnabled() should be used instead of this method - //as will call this as well as checking that the selected type of central repository is not DISABLED + //as EamDb.isEnabled() will call this method as well as checking that the selected type of central repository is not DISABLED return Boolean.parseBoolean(ModuleSettings.getConfigSetting(CENTRAL_REPO_NAME, CENTRAL_REPO_USE_KEY)); } diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/GlobalSettingsPanel.java b/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/GlobalSettingsPanel.java index b51e751930..0c680f4912 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/GlobalSettingsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/GlobalSettingsPanel.java @@ -458,7 +458,7 @@ public final class GlobalSettingsPanel extends IngestModuleGlobalSettingsPanel i tbOops.setText(""); enableButtonSubComponents(false); EamDbPlatformEnum selectedPlatform = EamDbPlatformEnum.getSelectedPlatform(); - cbUseCentralRepo.setSelected(EamDbUtil.useCentralRepo()); // NON-NLS + cbUseCentralRepo.setSelected(EamDbUtil.ableToConfigureCentralRepo()); // NON-NLS switch (selectedPlatform) { case POSTGRESQL: PostgresEamDbSettings dbSettingsPg = new PostgresEamDbSettings(); From 4cd970f257c81f0c7cc949744b477b6bba77e0ac Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Fri, 21 Dec 2018 14:27:13 -0500 Subject: [PATCH 10/16] 4556 change event listener for CR options panel on use CR setting, remove unused imports --- ...CentralRepoContextMenuActionsProvider.java | 1 - .../DataContentViewerOtherCases.java | 1 - .../optionspanel/EamDbSettingsDialog.java | 33 ++++++++++--------- .../optionspanel/GlobalSettingsPanel.form | 2 +- .../optionspanel/GlobalSettingsPanel.java | 26 +++++++-------- .../communications/RelationshipNode.java | 2 -- .../contentviewers/MessageContentViewer.java | 5 --- .../corecomponents/ViewPreferencesPanel.java | 1 - .../datamodel/AbstractAbstractFileNode.java | 1 - .../datamodel/BlackboardArtifactNode.java | 1 - 10 files changed, 32 insertions(+), 41 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/CentralRepoContextMenuActionsProvider.java b/Core/src/org/sleuthkit/autopsy/centralrepository/CentralRepoContextMenuActionsProvider.java index ab9bed4632..bfeae53ca6 100755 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/CentralRepoContextMenuActionsProvider.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/CentralRepoContextMenuActionsProvider.java @@ -26,7 +26,6 @@ import org.openide.util.Utilities; import org.openide.util.lookup.ServiceProvider; import org.sleuthkit.autopsy.centralrepository.datamodel.EamArtifactUtil; import org.sleuthkit.autopsy.centralrepository.datamodel.EamDb; -import org.sleuthkit.autopsy.centralrepository.datamodel.EamDbUtil; import org.sleuthkit.autopsy.corecomponentinterfaces.ContextMenuActionsProvider; import org.sleuthkit.datamodel.AbstractFile; diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/contentviewer/DataContentViewerOtherCases.java b/Core/src/org/sleuthkit/autopsy/centralrepository/contentviewer/DataContentViewerOtherCases.java index ee0f5c6769..6082dce81b 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/contentviewer/DataContentViewerOtherCases.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/contentviewer/DataContentViewerOtherCases.java @@ -71,7 +71,6 @@ import org.sleuthkit.datamodel.ContentTag; import org.sleuthkit.datamodel.TskCoreException; import org.sleuthkit.datamodel.TskException; import org.sleuthkit.autopsy.centralrepository.datamodel.EamDb; -import org.sleuthkit.autopsy.centralrepository.datamodel.EamDbUtil; import org.sleuthkit.datamodel.SleuthkitCase; import org.sleuthkit.datamodel.TskData; diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/EamDbSettingsDialog.java b/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/EamDbSettingsDialog.java index 826e66ecbc..19b1c4c8e5 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/EamDbSettingsDialog.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/EamDbSettingsDialog.java @@ -90,7 +90,7 @@ public class EamDbSettingsDialog extends JDialog { initComponents(); fcDatabasePath.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); fcDatabasePath.setAcceptAllFileFilterUsed(false); - fcDatabasePath.setDialogTitle(Bundle.EamDbSettingsDialog_fcDatabasePath_title()); + fcDatabasePath.setDialogTitle(Bundle.EamDbSettingsDialog_fcDatabasePath_title()); fcDatabasePath.setFileFilter(new FileFilter() { @Override public boolean accept(File pathname) { @@ -369,7 +369,7 @@ public class EamDbSettingsDialog extends JDialog { case POSTGRESQL: if (dbSettingsPostgres.verifyConnection()) { if (dbSettingsPostgres.verifyDatabaseExists()) { - if( dbSettingsPostgres.verifyDatabaseSchema()) { + if (dbSettingsPostgres.verifyDatabaseSchema()) { testingStatus = DatabaseTestResult.TESTEDOK; } else { testingStatus = DatabaseTestResult.SCHEMA_INVALID; @@ -382,8 +382,8 @@ public class EamDbSettingsDialog extends JDialog { } break; case SQLITE: - if (dbSettingsSqlite.dbFileExists()){ - if(dbSettingsSqlite.verifyConnection()) { + if (dbSettingsSqlite.dbFileExists()) { + if (dbSettingsSqlite.verifyConnection()) { if (dbSettingsSqlite.verifyDatabaseSchema()) { testingStatus = DatabaseTestResult.TESTEDOK; } else { @@ -418,10 +418,10 @@ public class EamDbSettingsDialog extends JDialog { } if (!result) { // Remove the incomplete database - if(dbCreated){ + if (dbCreated) { dbSettingsPostgres.deleteDatabase(); } - + JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(), Bundle.EamDbSettingsDialog_okButton_createPostgresDbError_message(), Bundle.EamDbSettingsDialog_okButton_createDbError_title(), @@ -439,10 +439,10 @@ public class EamDbSettingsDialog extends JDialog { && dbSettingsSqlite.insertDefaultDatabaseContent(); } if (!result) { - if(dbCreated){ + if (dbCreated) { dbSettingsSqlite.deleteDatabase(); } - + JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(), Bundle.EamDbSettingsDialog_okButton_createSQLiteDbError_message(), Bundle.EamDbSettingsDialog_okButton_createDbError_title(), @@ -455,10 +455,13 @@ public class EamDbSettingsDialog extends JDialog { testingStatus = DatabaseTestResult.TESTEDOK; valid(); } + /** - * Returns if changes to the central repository configuration were successfully applied - * - * @return true if the database configuration was successfully changed false if it was not + * Returns if changes to the central repository configuration were + * successfully applied + * + * @return true if the database configuration was successfully changed false + * if it was not */ boolean wasConfigurationChanged() { return configurationChanged; @@ -481,12 +484,12 @@ public class EamDbSettingsDialog extends JDialog { Bundle.EamDbSettingsDialog_okButton_databaseConnectionFailed_message(), Bundle.EamDbSettingsDialog_okButton_databaseConnectionFailed_title(), JOptionPane.WARNING_MESSAGE); - } else if (testingStatus == DatabaseTestResult.SCHEMA_INVALID){ + } else if (testingStatus == DatabaseTestResult.SCHEMA_INVALID) { // There's an existing database or file, but it's not in our format. JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(), Bundle.EamDbSettingsDialog_okButton_corruptDatabaseExists_message(), Bundle.EamDbSettingsDialog_okButton_corruptDatabaseExists_title(), - JOptionPane.WARNING_MESSAGE); + JOptionPane.WARNING_MESSAGE); } else if (testingStatus == DatabaseTestResult.DB_DOES_NOT_EXIST) { //database doesn't exist do you want to create if (JOptionPane.YES_OPTION == JOptionPane.showConfirmDialog(WindowManager.getDefault().getMainWindow(), @@ -580,10 +583,10 @@ public class EamDbSettingsDialog extends JDialog { customizeComponents(); }//GEN-LAST:event_cbDatabaseTypeActionPerformed - private void updateFullDbPath(){ + private void updateFullDbPath() { lbFullDbPath.setText(tfDatabasePath.getText() + File.separator + CENTRAL_REPO_DB_NAME + CENTRAL_REPO_SQLITE_EXT); } - + private void displayDatabaseSettings(boolean isPostgres) { lbDatabasePath.setVisible(!isPostgres); tfDatabasePath.setVisible(!isPostgres); diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/GlobalSettingsPanel.form b/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/GlobalSettingsPanel.form index 13ba7876cd..b876b9f8bd 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/GlobalSettingsPanel.form +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/GlobalSettingsPanel.form @@ -117,7 +117,7 @@ - + diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/GlobalSettingsPanel.java b/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/GlobalSettingsPanel.java index 0c680f4912..14137ba950 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/GlobalSettingsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/GlobalSettingsPanel.java @@ -149,9 +149,9 @@ public final class GlobalSettingsPanel extends IngestModuleGlobalSettingsPanel i org.openide.awt.Mnemonics.setLocalizedText(lbCentralRepository, org.openide.util.NbBundle.getMessage(GlobalSettingsPanel.class, "GlobalSettingsPanel.lbCentralRepository.text")); // NOI18N org.openide.awt.Mnemonics.setLocalizedText(cbUseCentralRepo, org.openide.util.NbBundle.getMessage(GlobalSettingsPanel.class, "GlobalSettingsPanel.cbUseCentralRepo.text")); // NOI18N - cbUseCentralRepo.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - cbUseCentralRepoActionPerformed(evt); + cbUseCentralRepo.addPropertyChangeListener(new java.beans.PropertyChangeListener() { + public void propertyChange(java.beans.PropertyChangeEvent evt) { + useCentralRepoPropertyChange(evt); } }); @@ -433,15 +433,6 @@ public final class GlobalSettingsPanel extends IngestModuleGlobalSettingsPanel i } }//GEN-LAST:event_bnDbConfigureActionPerformed - private void cbUseCentralRepoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbUseCentralRepoActionPerformed - //if saved setting is disabled checkbox should be disabled already - store(); - updateDatabase(); - load(); - this.ingestStateUpdated(Case.isCaseOpen()); - firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null); - }//GEN-LAST:event_cbUseCentralRepoActionPerformed - private void manageOrganizationButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_manageOrganizationButtonActionPerformed store(); ManageOrganizationsDialog manageOrganizationsDialog = new ManageOrganizationsDialog(); @@ -452,13 +443,22 @@ public final class GlobalSettingsPanel extends IngestModuleGlobalSettingsPanel i ManageCasesDialog.displayManageCasesDialog(); }//GEN-LAST:event_showCasesButtonActionPerformed + private void useCentralRepoPropertyChange(java.beans.PropertyChangeEvent evt) {//GEN-FIRST:event_useCentralRepoPropertyChange + //if saved setting is disabled checkbox should be disabled already + store(); + updateDatabase(); + load(); + this.ingestStateUpdated(Case.isCaseOpen()); + firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null); + }//GEN-LAST:event_useCentralRepoPropertyChange + @Override @Messages({"GlobalSettingsPanel.validationerrMsg.mustConfigure=Configure the database to enable this module."}) public void load() { tbOops.setText(""); enableButtonSubComponents(false); EamDbPlatformEnum selectedPlatform = EamDbPlatformEnum.getSelectedPlatform(); - cbUseCentralRepo.setSelected(EamDbUtil.ableToConfigureCentralRepo()); // NON-NLS + cbUseCentralRepo.setSelected(EamDbUtil.allowUseOfCentralRepository()); // NON-NLS switch (selectedPlatform) { case POSTGRESQL: PostgresEamDbSettings dbSettingsPg = new PostgresEamDbSettings(); diff --git a/Core/src/org/sleuthkit/autopsy/communications/RelationshipNode.java b/Core/src/org/sleuthkit/autopsy/communications/RelationshipNode.java index 9b2ab71ca2..3fc7e36e4e 100644 --- a/Core/src/org/sleuthkit/autopsy/communications/RelationshipNode.java +++ b/Core/src/org/sleuthkit/autopsy/communications/RelationshipNode.java @@ -24,8 +24,6 @@ import java.util.logging.Level; import org.apache.commons.lang3.StringUtils; import org.openide.nodes.Sheet; import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttributeInstance; -import org.sleuthkit.autopsy.centralrepository.datamodel.EamDb; -import org.sleuthkit.autopsy.centralrepository.datamodel.EamDbUtil; import org.sleuthkit.autopsy.core.UserPreferences; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.datamodel.BlackboardArtifactNode; diff --git a/Core/src/org/sleuthkit/autopsy/contentviewers/MessageContentViewer.java b/Core/src/org/sleuthkit/autopsy/contentviewers/MessageContentViewer.java index cf2695dc2e..ef631eeb02 100644 --- a/Core/src/org/sleuthkit/autopsy/contentviewers/MessageContentViewer.java +++ b/Core/src/org/sleuthkit/autopsy/contentviewers/MessageContentViewer.java @@ -38,16 +38,12 @@ import org.openide.nodes.Node; import org.openide.nodes.Sheet; import org.openide.util.NbBundle; import org.openide.util.lookup.ServiceProvider; -import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttributeInstance; -import org.sleuthkit.autopsy.centralrepository.datamodel.EamDbUtil; -import org.sleuthkit.autopsy.core.UserPreferences; import org.sleuthkit.autopsy.corecomponentinterfaces.DataContentViewer; import org.sleuthkit.autopsy.corecomponents.DataResultPanel; import org.sleuthkit.autopsy.corecomponents.TableFilterNode; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.datamodel.AbstractAbstractFileNode; import org.sleuthkit.autopsy.datamodel.FileNode; -import org.sleuthkit.autopsy.datamodel.NodeProperty; import org.sleuthkit.autopsy.directorytree.DataResultFilterNode; import org.sleuthkit.autopsy.directorytree.NewWindowViewAction; import org.sleuthkit.datamodel.AbstractFile; @@ -71,7 +67,6 @@ import static org.sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PHO import static org.sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PHONE_NUMBER_TO; import static org.sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE.TSK_SUBJECT; import static org.sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE.TSK_TEXT; -import org.sleuthkit.datamodel.ContentTag; import org.sleuthkit.datamodel.TskCoreException; /** diff --git a/Core/src/org/sleuthkit/autopsy/corecomponents/ViewPreferencesPanel.java b/Core/src/org/sleuthkit/autopsy/corecomponents/ViewPreferencesPanel.java index 833a850aac..e65373ab76 100755 --- a/Core/src/org/sleuthkit/autopsy/corecomponents/ViewPreferencesPanel.java +++ b/Core/src/org/sleuthkit/autopsy/corecomponents/ViewPreferencesPanel.java @@ -27,7 +27,6 @@ import org.netbeans.spi.options.OptionsPanelController; import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.casemodule.CasePreferences; import org.sleuthkit.autopsy.centralrepository.datamodel.EamDb; -import org.sleuthkit.autopsy.centralrepository.datamodel.EamDbUtil; import org.sleuthkit.autopsy.core.UserPreferences; import org.sleuthkit.autopsy.coreutils.TimeZoneUtils; import org.sleuthkit.autopsy.directorytree.DirectoryTreeTopComponent; diff --git a/Core/src/org/sleuthkit/autopsy/datamodel/AbstractAbstractFileNode.java b/Core/src/org/sleuthkit/autopsy/datamodel/AbstractAbstractFileNode.java index 3e7a6802dc..76113cb76b 100644 --- a/Core/src/org/sleuthkit/autopsy/datamodel/AbstractAbstractFileNode.java +++ b/Core/src/org/sleuthkit/autopsy/datamodel/AbstractAbstractFileNode.java @@ -48,7 +48,6 @@ import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttributeNor import org.sleuthkit.autopsy.centralrepository.datamodel.EamArtifactUtil; import org.sleuthkit.autopsy.centralrepository.datamodel.EamDb; import org.sleuthkit.autopsy.centralrepository.datamodel.EamDbException; -import org.sleuthkit.autopsy.centralrepository.datamodel.EamDbUtil; import org.sleuthkit.autopsy.core.UserPreferences; import org.sleuthkit.autopsy.corecomponents.DataResultViewerTable; import org.sleuthkit.autopsy.corecomponents.DataResultViewerTable.HasCommentStatus; diff --git a/Core/src/org/sleuthkit/autopsy/datamodel/BlackboardArtifactNode.java b/Core/src/org/sleuthkit/autopsy/datamodel/BlackboardArtifactNode.java index 9906255a25..55e81acd17 100644 --- a/Core/src/org/sleuthkit/autopsy/datamodel/BlackboardArtifactNode.java +++ b/Core/src/org/sleuthkit/autopsy/datamodel/BlackboardArtifactNode.java @@ -54,7 +54,6 @@ import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttributeNor import org.sleuthkit.autopsy.centralrepository.datamodel.EamArtifactUtil; import org.sleuthkit.autopsy.centralrepository.datamodel.EamDb; import org.sleuthkit.autopsy.centralrepository.datamodel.EamDbException; -import org.sleuthkit.autopsy.centralrepository.datamodel.EamDbUtil; import org.sleuthkit.autopsy.core.UserPreferences; import org.sleuthkit.autopsy.corecomponents.DataResultViewerTable.Score; import org.sleuthkit.autopsy.coreutils.Logger; From f0f3505dd2f905f877f2acbd2c8d5f26e05a8059 Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Fri, 21 Dec 2018 14:48:52 -0500 Subject: [PATCH 11/16] 4556 change propertychange listener to state change listener to avoid stack overflow --- .../optionspanel/GlobalSettingsPanel.form | 2 +- .../optionspanel/GlobalSettingsPanel.java | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/GlobalSettingsPanel.form b/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/GlobalSettingsPanel.form index b876b9f8bd..b83c9782a1 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/GlobalSettingsPanel.form +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/GlobalSettingsPanel.form @@ -117,7 +117,7 @@ - + diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/GlobalSettingsPanel.java b/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/GlobalSettingsPanel.java index 14137ba950..7c24da62c4 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/GlobalSettingsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/GlobalSettingsPanel.java @@ -149,9 +149,9 @@ public final class GlobalSettingsPanel extends IngestModuleGlobalSettingsPanel i org.openide.awt.Mnemonics.setLocalizedText(lbCentralRepository, org.openide.util.NbBundle.getMessage(GlobalSettingsPanel.class, "GlobalSettingsPanel.lbCentralRepository.text")); // NOI18N org.openide.awt.Mnemonics.setLocalizedText(cbUseCentralRepo, org.openide.util.NbBundle.getMessage(GlobalSettingsPanel.class, "GlobalSettingsPanel.cbUseCentralRepo.text")); // NOI18N - cbUseCentralRepo.addPropertyChangeListener(new java.beans.PropertyChangeListener() { - public void propertyChange(java.beans.PropertyChangeEvent evt) { - useCentralRepoPropertyChange(evt); + cbUseCentralRepo.addChangeListener(new javax.swing.event.ChangeListener() { + public void stateChanged(javax.swing.event.ChangeEvent evt) { + useCentralRepoStateChanged(evt); } }); @@ -443,14 +443,14 @@ public final class GlobalSettingsPanel extends IngestModuleGlobalSettingsPanel i ManageCasesDialog.displayManageCasesDialog(); }//GEN-LAST:event_showCasesButtonActionPerformed - private void useCentralRepoPropertyChange(java.beans.PropertyChangeEvent evt) {//GEN-FIRST:event_useCentralRepoPropertyChange + private void useCentralRepoStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_useCentralRepoStateChanged //if saved setting is disabled checkbox should be disabled already store(); updateDatabase(); load(); this.ingestStateUpdated(Case.isCaseOpen()); firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null); - }//GEN-LAST:event_useCentralRepoPropertyChange + }//GEN-LAST:event_useCentralRepoStateChanged @Override @Messages({"GlobalSettingsPanel.validationerrMsg.mustConfigure=Configure the database to enable this module."}) From b0a80f0260d88aa3a5d70e646e1ad6debeabeb87 Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Fri, 21 Dec 2018 15:37:53 -0500 Subject: [PATCH 12/16] 4556 allow upgrade failure message to indicate that CR is incompatable --- .../datamodel/AbstractSqlEamDb.java | 4 +- .../centralrepository/datamodel/EamDb.java | 2 +- .../datamodel/EamDbUtil.java | 18 ++++--- .../IncompatibleCentralRepoException.java | 53 +++++++++++++++++++ .../datamodel/SqliteEamDb.java | 2 +- .../eventlisteners/Installer.java | 12 ++--- .../optionspanel/GlobalSettingsPanel.java | 22 ++++---- 7 files changed, 84 insertions(+), 29 deletions(-) create mode 100644 Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/IncompatibleCentralRepoException.java diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/AbstractSqlEamDb.java b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/AbstractSqlEamDb.java index 76b9d54381..3f66069e98 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/AbstractSqlEamDb.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/AbstractSqlEamDb.java @@ -3171,7 +3171,7 @@ abstract class AbstractSqlEamDb implements EamDb { * @throws EamDbException */ @Override - public void upgradeSchema() throws EamDbException, SQLException { + public void upgradeSchema() throws EamDbException, SQLException, IncompatibleCentralRepoException { ResultSet resultSet = null; Statement statement = null; @@ -3225,7 +3225,7 @@ abstract class AbstractSqlEamDb implements EamDb { //we can not use the CaseDbSchemaVersionNumber.isCompatible method //because it is specific to case db schema versions only supporting major versions greater than 1 if (SOFTWARE_CR_DB_SCHEMA_VERSION.getMajor() < dbSchemaVersion.getMajor()) { - throw new EamDbException("The selected Central Repository is not compatable with the current version of the application, please upgrade the application if you wish to use this Central Repository"); + throw new IncompatibleCentralRepoException("The selected Central Repository is not compatable with the current version of the application, please upgrade the application if you wish to use this Central Repository"); } if (dbSchemaVersion.equals(SOFTWARE_CR_DB_SCHEMA_VERSION)) { logger.log(Level.INFO, "Central Repository is up to date"); diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/EamDb.java b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/EamDb.java index 7a54ee656c..c633dc5adc 100755 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/EamDb.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/EamDb.java @@ -710,7 +710,7 @@ public interface EamDb { * * @throws EamDbException */ - public void upgradeSchema() throws EamDbException, SQLException; + public void upgradeSchema() throws EamDbException, SQLException, IncompatibleCentralRepoException; /** * Gets an exclusive lock (if applicable). Will return the lock if diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/EamDbUtil.java b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/EamDbUtil.java index d1edcc15c3..300b44a015 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/EamDbUtil.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/EamDbUtil.java @@ -25,6 +25,7 @@ import java.sql.SQLException; import java.sql.Statement; import java.util.List; import java.util.logging.Level; +import org.openide.util.NbBundle.Messages; import org.sleuthkit.autopsy.coordinationservice.CoordinationService; import org.sleuthkit.autopsy.coordinationservice.CoordinationService.CoordinationServiceException; import org.sleuthkit.autopsy.coreutils.Logger; @@ -172,9 +173,10 @@ public class EamDbUtil { * * @return true if the upgrade succeeds, false otherwise. */ - public static boolean upgradeDatabase() { + @Messages({"EamDbUtil.centralRepoUpgradeFailed.message=Failed to upgrade central repository. It has been disabled."}) + public static void upgradeDatabase() throws EamDbException { if (!EamDb.isEnabled()) { - return true; + return; } CoordinationService.Lock lock = null; @@ -188,7 +190,7 @@ public class EamDbUtil { db.upgradeSchema(); - } catch (EamDbException | SQLException ex) { + } catch (EamDbException | SQLException | IncompatibleCentralRepoException ex) { LOGGER.log(Level.SEVERE, "Error updating central repository", ex); // Disable the central repo and clear the current settings. @@ -196,15 +198,18 @@ public class EamDbUtil { if (null != EamDb.getInstance()) { EamDb.getInstance().shutdownConnections(); } - } catch (EamDbException ex2) { + } catch (EamDbException ignored) { LOGGER.log(Level.SEVERE, "Error shutting down central repo connection pool", ex); } setUseCentralRepo(false); EamDbPlatformEnum.setSelectedPlatform(EamDbPlatformEnum.DISABLED.name()); EamDbPlatformEnum.saveSelectedPlatform(); - - return false; + String messageForDialog = Bundle.EamDbUtil_centralRepoUpgradeFailed_message(); + if (ex instanceof IncompatibleCentralRepoException) { + messageForDialog = ex.getMessage() + "\n\n" + messageForDialog; + } + throw new EamDbException(messageForDialog); } finally { if (lock != null) { try { @@ -214,7 +219,6 @@ public class EamDbUtil { } } } - return true; } /** diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/IncompatibleCentralRepoException.java b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/IncompatibleCentralRepoException.java new file mode 100644 index 0000000000..3d96189ea8 --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/IncompatibleCentralRepoException.java @@ -0,0 +1,53 @@ +/* + * + * Autopsy Forensic Browser + * + * Copyright 2018 Basis Technology Corp. + * Contact: carrier sleuthkit org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.sleuthkit.autopsy.centralrepository.datamodel; + +/** + * Exception to denote that the Central Repo is not compatable with the current version of the software. + */ +public class IncompatibleCentralRepoException extends Exception { + + private static final long serialVersionUID = 1L; + + /** + * Construct an exception with the given message. + * @param message error message + */ + public IncompatibleCentralRepoException(String message){ + super(message); + } + + /** + * Construct an exception with the given message and inner exception. + * @param message error message + * @param cause inner exception + */ + public IncompatibleCentralRepoException(String message, Throwable cause){ + super(message, cause); + } + + /** + * Construct an exception with the given inner exception. + * @param cause inner exception + */ + public IncompatibleCentralRepoException(Throwable cause){ + super(cause); + } +} diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/SqliteEamDb.java b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/SqliteEamDb.java index 36484d2f2d..69826a3355 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/SqliteEamDb.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/SqliteEamDb.java @@ -1118,7 +1118,7 @@ final class SqliteEamDb extends AbstractSqlEamDb { * @throws EamDbException */ @Override - public void upgradeSchema() throws EamDbException, SQLException { + public void upgradeSchema() throws EamDbException, SQLException, IncompatibleCentralRepoException { try { acquireExclusiveLock(); super.upgradeSchema(); diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/eventlisteners/Installer.java b/Core/src/org/sleuthkit/autopsy/centralrepository/eventlisteners/Installer.java index 7ca97535d9..b887dea359 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/eventlisteners/Installer.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/eventlisteners/Installer.java @@ -23,6 +23,7 @@ import org.openide.modules.ModuleInstall; import org.openide.util.NbBundle; import org.openide.windows.WindowManager; import org.sleuthkit.autopsy.casemodule.Case; +import org.sleuthkit.autopsy.centralrepository.datamodel.EamDbException; import org.sleuthkit.autopsy.centralrepository.datamodel.EamDbUtil; import org.sleuthkit.autopsy.core.RuntimeProperties; import org.sleuthkit.autopsy.coreutils.Logger; @@ -50,21 +51,20 @@ public class Installer extends ModuleInstall { super(); } - @NbBundle.Messages({"Installer.centralRepoUpgradeFailed.title=Central repository upgrade failed", - "Installer.centralRepoUpgradeFailed.message=Failed to upgrade central repository. It has been disabled." - }) + @NbBundle.Messages({"Installer.centralRepoUpgradeFailed.title=Central repository upgrade failed"}) @Override public void restored() { Case.addPropertyChangeListener(pcl); ieListener.installListeners(); // Perform the database upgrade and inform the user if it fails - if (!EamDbUtil.upgradeDatabase()) { + try { + EamDbUtil.upgradeDatabase(); + } catch (EamDbException ex) { if (RuntimeProperties.runningWithGUI()) { WindowManager.getDefault().invokeWhenUIReady(() -> { JOptionPane.showMessageDialog(null, - NbBundle.getMessage(this.getClass(), - "Installer.centralRepoUpgradeFailed.message"), + ex.getMessage(), NbBundle.getMessage(this.getClass(), "Installer.centralRepoUpgradeFailed.title"), JOptionPane.ERROR_MESSAGE); diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/GlobalSettingsPanel.java b/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/GlobalSettingsPanel.java index 7c24da62c4..dec84dfb51 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/GlobalSettingsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/GlobalSettingsPanel.java @@ -30,6 +30,7 @@ import org.netbeans.spi.options.OptionsPanelController; import org.openide.util.NbBundle; import org.openide.util.NbBundle.Messages; import org.sleuthkit.autopsy.casemodule.Case; +import org.sleuthkit.autopsy.centralrepository.datamodel.EamDbException; import org.sleuthkit.autopsy.corecomponents.OptionsPanel; import org.sleuthkit.autopsy.events.AutopsyEvent; import org.sleuthkit.autopsy.ingest.IngestManager; @@ -75,9 +76,7 @@ public final class GlobalSettingsPanel extends IngestModuleGlobalSettingsPanel i ingestStateUpdated(Case.isCaseOpen()); } - @Messages({"GlobalSettingsPanel.updateFailed.title=Update failed", - "GlobalSettingsPanel.updateFailed.message=Failed to update database. Central repository has been disabled." - }) + @Messages({"GlobalSettingsPanel.updateFailed.title=Central repository upgrade failed"}) private void updateDatabase() { if (EamDbPlatformEnum.getSelectedPlatform().equals(DISABLED)) { @@ -86,16 +85,15 @@ public final class GlobalSettingsPanel extends IngestModuleGlobalSettingsPanel i setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); try { - boolean result = EamDbUtil.upgradeDatabase(); + EamDbUtil.upgradeDatabase(); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); - if (!result) { - JOptionPane.showMessageDialog(this, - NbBundle.getMessage(this.getClass(), - "GlobalSettingsPanel.updateFailed.message"), - NbBundle.getMessage(this.getClass(), - "GlobalSettingsPanel.updateFailed.title"), - JOptionPane.WARNING_MESSAGE); - } + } catch (EamDbException ex) { + setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); + JOptionPane.showMessageDialog(this, + ex.getMessage(), + NbBundle.getMessage(this.getClass(), + "GlobalSettingsPanel.updateFailed.title"), + JOptionPane.WARNING_MESSAGE); } finally { setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } From 1eda9a2ca3901360dad75ee2de774ed73da00ea2 Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Fri, 21 Dec 2018 15:43:09 -0500 Subject: [PATCH 13/16] 4556 change message regarding incompatible cr to be bundle message --- .../autopsy/centralrepository/datamodel/AbstractSqlEamDb.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/AbstractSqlEamDb.java b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/AbstractSqlEamDb.java index 3f66069e98..35e1e44537 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/AbstractSqlEamDb.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/AbstractSqlEamDb.java @@ -40,6 +40,7 @@ import java.util.Set; import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeUnit; import java.util.logging.Level; +import org.openide.util.NbBundle.Messages; import org.sleuthkit.autopsy.casemodule.Case; import static org.sleuthkit.autopsy.centralrepository.datamodel.EamDbUtil.updateSchemaVersion; import org.sleuthkit.autopsy.coreutils.Logger; @@ -3170,6 +3171,7 @@ abstract class AbstractSqlEamDb implements EamDb { * * @throws EamDbException */ + @Messages({"AbstractSqlEamDb.upgradeSchema.incompatible=The selected Central Repository is not compatable with the current version of the application, please upgrade the application if you wish to use this Central Repository"}) @Override public void upgradeSchema() throws EamDbException, SQLException, IncompatibleCentralRepoException { @@ -3225,7 +3227,7 @@ abstract class AbstractSqlEamDb implements EamDb { //we can not use the CaseDbSchemaVersionNumber.isCompatible method //because it is specific to case db schema versions only supporting major versions greater than 1 if (SOFTWARE_CR_DB_SCHEMA_VERSION.getMajor() < dbSchemaVersion.getMajor()) { - throw new IncompatibleCentralRepoException("The selected Central Repository is not compatable with the current version of the application, please upgrade the application if you wish to use this Central Repository"); + throw new IncompatibleCentralRepoException(Bundle.AbstractSqlEamDb_upgradeSchema_incompatible()); } if (dbSchemaVersion.equals(SOFTWARE_CR_DB_SCHEMA_VERSION)) { logger.log(Level.INFO, "Central Repository is up to date"); From eea6bd119c902c84f57f701cdea4ae8341121383 Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Fri, 21 Dec 2018 15:49:06 -0500 Subject: [PATCH 14/16] 4556 fix typo in word compatible --- .../autopsy/centralrepository/datamodel/AbstractSqlEamDb.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/AbstractSqlEamDb.java b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/AbstractSqlEamDb.java index 35e1e44537..b1d4ba3cd6 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/AbstractSqlEamDb.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/AbstractSqlEamDb.java @@ -3171,7 +3171,7 @@ abstract class AbstractSqlEamDb implements EamDb { * * @throws EamDbException */ - @Messages({"AbstractSqlEamDb.upgradeSchema.incompatible=The selected Central Repository is not compatable with the current version of the application, please upgrade the application if you wish to use this Central Repository"}) + @Messages({"AbstractSqlEamDb.upgradeSchema.incompatible=The selected Central Repository is not compatible with the current version of the application, please upgrade the application if you wish to use this Central Repository"}) @Override public void upgradeSchema() throws EamDbException, SQLException, IncompatibleCentralRepoException { From 12ced95857271c683130c2f842205acd3b4a6dca Mon Sep 17 00:00:00 2001 From: Richard Cordovano Date: Fri, 21 Dec 2018 17:27:59 -0500 Subject: [PATCH 15/16] Logging fix --- .../autopsy/centralrepository/datamodel/EamDbUtil.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/EamDbUtil.java b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/EamDbUtil.java index 300b44a015..d7e611ae3c 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/EamDbUtil.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/EamDbUtil.java @@ -198,8 +198,8 @@ public class EamDbUtil { if (null != EamDb.getInstance()) { EamDb.getInstance().shutdownConnections(); } - } catch (EamDbException ignored) { - LOGGER.log(Level.SEVERE, "Error shutting down central repo connection pool", ex); + } catch (EamDbException ex2) { + LOGGER.log(Level.SEVERE, "Error shutting down central repo connection pool", ex2); } setUseCentralRepo(false); From 00537c809f1b913c48249f237ba501f9677dd630 Mon Sep 17 00:00:00 2001 From: Richard Cordovano Date: Fri, 21 Dec 2018 17:46:35 -0500 Subject: [PATCH 16/16] Added punctuation to CR upgrade error message. --- .../autopsy/centralrepository/datamodel/AbstractSqlEamDb.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/AbstractSqlEamDb.java b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/AbstractSqlEamDb.java index b1d4ba3cd6..2f090edfc0 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/AbstractSqlEamDb.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/AbstractSqlEamDb.java @@ -3171,7 +3171,7 @@ abstract class AbstractSqlEamDb implements EamDb { * * @throws EamDbException */ - @Messages({"AbstractSqlEamDb.upgradeSchema.incompatible=The selected Central Repository is not compatible with the current version of the application, please upgrade the application if you wish to use this Central Repository"}) + @Messages({"AbstractSqlEamDb.upgradeSchema.incompatible=The selected Central Repository is not compatible with the current version of the application, please upgrade the application if you wish to use this Central Repository."}) @Override public void upgradeSchema() throws EamDbException, SQLException, IncompatibleCentralRepoException {