diff --git a/BootstrapIvy.xml b/BootstrapIvy.xml index 031c1f2cf3..c668d480ba 100644 --- a/BootstrapIvy.xml +++ b/BootstrapIvy.xml @@ -15,7 +15,7 @@ - diff --git a/Core/build.xml b/Core/build.xml index 0e5c90ef04..5d91ade7e1 100644 --- a/Core/build.xml +++ b/Core/build.xml @@ -74,6 +74,7 @@ + diff --git a/Core/ivysettings.xml b/Core/ivysettings.xml index 7a4d38c65e..c27e095ddb 100644 --- a/Core/ivysettings.xml +++ b/Core/ivysettings.xml @@ -2,7 +2,7 @@ - + diff --git a/Core/nbproject/project.properties b/Core/nbproject/project.properties index c01abc4855..94dffdeb9b 100644 --- a/Core/nbproject/project.properties +++ b/Core/nbproject/project.properties @@ -120,6 +120,7 @@ file.reference.okhttp-2.7.5-javadoc.jar=release/modules/ext/okhttp-2.7.5-javadoc file.reference.okhttp-2.7.5-sources.jar=release/modules/ext/okhttp-2.7.5-sources.jar file.reference.okhttp-2.7.5.jar=release/modules/ext/okhttp-2.7.5.jar file.reference.okio-1.6.0.jar=release/modules/ext/okio-1.6.0.jar +file.reference.datcon.jar=release/modules/ext/DatCon.jar javac.source=1.8 javac.compilerargs=-Xlint -Xlint:-serial license.file=../LICENSE-2.0.txt diff --git a/Core/nbproject/project.xml b/Core/nbproject/project.xml index b2e17a7e32..ceb0d9c3e7 100644 --- a/Core/nbproject/project.xml +++ b/Core/nbproject/project.xml @@ -309,6 +309,8 @@ net.sf.sevenzipjbinding.impl net.sf.sevenzipjbinding.simple net.sf.sevenzipjbinding.simple.impl + org.apache.tika + org.apache.tika.io org.sleuthkit.autopsy.actions org.sleuthkit.autopsy.appservices org.sleuthkit.autopsy.casemodule @@ -346,6 +348,7 @@ org.sleuthkit.autopsy.texttranslation org.sleuthkit.datamodel org.sleuthkit.datamodel.blackboardutils + org.sleuthkit.datamodel.blackboardutils.attributes ext/commons-lang3-3.8.1.jar @@ -802,6 +805,10 @@ ext/jutf7-1.0.0.jar release/modules/ext/jutf7-1.0.0.jar + + + ext/DatCon.jar + release/modules/ext/DatCon.jar diff --git a/Core/src/org/sleuthkit/autopsy/allcasessearch/AllCasesSearchAction.java b/Core/src/org/sleuthkit/autopsy/allcasessearch/AllCasesSearchAction.java index f04eebabdc..676a565de2 100755 --- a/Core/src/org/sleuthkit/autopsy/allcasessearch/AllCasesSearchAction.java +++ b/Core/src/org/sleuthkit/autopsy/allcasessearch/AllCasesSearchAction.java @@ -26,7 +26,7 @@ import org.openide.util.HelpCtx; import org.openide.util.NbBundle; import org.openide.util.actions.CallableSystemAction; import org.sleuthkit.autopsy.casemodule.Case; -import org.sleuthkit.autopsy.centralrepository.datamodel.EamDb; +import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepository; /** * Action for accessing the Search Other Cases dialog. @@ -39,7 +39,7 @@ public class AllCasesSearchAction extends CallableSystemAction { @Override public boolean isEnabled() { - return EamDb.isEnabled() && Case.isCaseOpen(); + return CentralRepository.isEnabled() && Case.isCaseOpen(); } @Override diff --git a/Core/src/org/sleuthkit/autopsy/allcasessearch/AllCasesSearchDialog.java b/Core/src/org/sleuthkit/autopsy/allcasessearch/AllCasesSearchDialog.java index 814b696ce3..d8c82dc40b 100755 --- a/Core/src/org/sleuthkit/autopsy/allcasessearch/AllCasesSearchDialog.java +++ b/Core/src/org/sleuthkit/autopsy/allcasessearch/AllCasesSearchDialog.java @@ -37,8 +37,7 @@ import org.openide.windows.WindowManager; import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttributeInstance; import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttributeNormalizationException; import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttributeNormalizer; -import org.sleuthkit.autopsy.centralrepository.datamodel.EamDb; -import org.sleuthkit.autopsy.centralrepository.datamodel.EamDbException; +import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoException; import org.sleuthkit.autopsy.corecomponentinterfaces.DataResultViewer; import org.sleuthkit.autopsy.corecomponents.DataResultTopComponent; import org.sleuthkit.autopsy.corecomponents.DataResultViewerTable; @@ -46,6 +45,7 @@ import org.sleuthkit.autopsy.corecomponents.TableFilterNode; import org.sleuthkit.autopsy.corecomponents.TextPrompt; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.datamodel.EmptyNode; +import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepository; @Messages({ "AllCasesSearchDialog.dialogTitle.text=Search All Cases", @@ -103,8 +103,8 @@ final class AllCasesSearchDialog extends javax.swing.JDialog { List correlationInstances = new ArrayList<>(); try { - correlationInstances = EamDb.getInstance().getArtifactInstancesByTypeValue(type, value); - } catch (EamDbException ex) { + correlationInstances = CentralRepository.getInstance().getArtifactInstancesByTypeValue(type, value); + } catch (CentralRepoException ex) { logger.log(Level.SEVERE, "Unable to connect to the Central Repository database.", ex); } catch (CorrelationAttributeNormalizationException ex) { logger.log(Level.SEVERE, "Unable to retrieve data from the Central Repository.", ex); @@ -336,12 +336,12 @@ final class AllCasesSearchDialog extends javax.swing.JDialog { * Add correlation types to the combo-box. */ try { - EamDb dbManager = EamDb.getInstance(); + CentralRepository dbManager = CentralRepository.getInstance(); correlationTypes.clear(); correlationTypes.addAll(dbManager.getDefinedCorrelationTypes()); int numberOfCases = dbManager.getCases().size(); casesLabel.setText(Bundle.AllCasesSearchDialog_caseLabel_text(numberOfCases)); - } catch (EamDbException ex) { + } catch (CentralRepoException ex) { logger.log(Level.SEVERE, "Unable to connect to the Central Repository database.", ex); } diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/CaseDetailsPanel.java b/Core/src/org/sleuthkit/autopsy/casemodule/CaseDetailsPanel.java index d5b8dbdfa7..c5ca31f65e 100644 --- a/Core/src/org/sleuthkit/autopsy/casemodule/CaseDetailsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/CaseDetailsPanel.java @@ -22,10 +22,10 @@ import java.nio.file.Paths; import java.util.logging.Level; import org.openide.util.NbBundle.Messages; import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationCase; -import org.sleuthkit.autopsy.centralrepository.datamodel.EamDb; -import org.sleuthkit.autopsy.centralrepository.datamodel.EamDbException; -import org.sleuthkit.autopsy.centralrepository.datamodel.EamOrganization; +import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoException; +import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoOrganization; import org.sleuthkit.autopsy.coreutils.Logger; +import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepository; /** * A panel that allows the user to view various details of a case and change @@ -69,7 +69,7 @@ final class CaseDetailsPanel extends javax.swing.JPanel { } else { dbNameField.setText(theCase.getMetadata().getCaseDatabaseName()); } - boolean cREnabled = EamDb.isEnabled(); + boolean cREnabled = CentralRepository.isEnabled(); lbOrganizationNameLabel.setEnabled(cREnabled); lbOrganizationNameText.setEnabled(cREnabled); lbPointOfContactEmailLabel.setEnabled(cREnabled); @@ -79,15 +79,15 @@ final class CaseDetailsPanel extends javax.swing.JPanel { lbPointOfContactPhoneLabel.setEnabled(cREnabled); lbPointOfContactPhoneText.setEnabled(cREnabled); pnOrganization.setEnabled(cREnabled); - EamOrganization currentOrg = null; + CentralRepoOrganization currentOrg = null; if (cREnabled) { try { - EamDb dbManager = EamDb.getInstance(); + CentralRepository dbManager = CentralRepository.getInstance(); if (dbManager != null) { CorrelationCase correlationCase = dbManager.getCase(theCase); currentOrg = correlationCase.getOrg(); } - } catch (EamDbException ex) { + } catch (CentralRepoException ex) { logger.log(Level.SEVERE, "Unable to access Correlation Case when Central Repo is enabled", ex); } } diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/NewCaseWizardAction.java b/Core/src/org/sleuthkit/autopsy/casemodule/NewCaseWizardAction.java index c5e6ece78d..92f83ba26c 100644 --- a/Core/src/org/sleuthkit/autopsy/casemodule/NewCaseWizardAction.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/NewCaseWizardAction.java @@ -38,10 +38,10 @@ import org.openide.windows.WindowManager; import org.sleuthkit.autopsy.actions.IngestRunningCheck; import org.sleuthkit.autopsy.casemodule.Case.CaseType; import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationCase; -import org.sleuthkit.autopsy.centralrepository.datamodel.EamDb; -import org.sleuthkit.autopsy.centralrepository.datamodel.EamOrganization; +import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoOrganization; import org.sleuthkit.autopsy.coreutils.FileUtil; import org.sleuthkit.autopsy.coreutils.Logger; +import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepository; /** * The action associated with the Case/New Case menu item, t toolbar button, and @@ -89,15 +89,15 @@ final class NewCaseWizardAction extends CallableSystemAction { String createdDirectory = (String) wizardDescriptor.getProperty("createdDirectory"); //NON-NLS CaseType caseType = CaseType.values()[(int) wizardDescriptor.getProperty("caseType")]; //NON-NLS Case.createAsCurrentCase(caseType, createdDirectory, new CaseDetails(caseName, caseNumber, examinerName, examinerPhone, examinerEmail, caseNotes)); - if (EamDb.isEnabled()) { //if the eam is enabled we need to save the case organization information now - EamDb dbManager = EamDb.getInstance(); + if (CentralRepository.isEnabled()) { //if the eam is enabled we need to save the case organization information now + CentralRepository dbManager = CentralRepository.getInstance(); if (dbManager != null) { CorrelationCase cRCase = dbManager.getCase(Case.getCurrentCaseThrows()); if (cRCase == null) { cRCase = dbManager.newCase(Case.getCurrentCaseThrows()); } if (!organizationName.isEmpty()) { - for (EamOrganization org : dbManager.getOrganizations()) { + for (CentralRepoOrganization org : dbManager.getOrganizations()) { if (org.getName().equals(organizationName)) { cRCase.setOrg(org); dbManager.updateCase(cRCase); diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/NewCaseWizardPanel2.java b/Core/src/org/sleuthkit/autopsy/casemodule/NewCaseWizardPanel2.java index aa9b6643d8..b5119dc389 100644 --- a/Core/src/org/sleuthkit/autopsy/casemodule/NewCaseWizardPanel2.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/NewCaseWizardPanel2.java @@ -29,9 +29,9 @@ import org.openide.util.HelpCtx; import org.openide.windows.WindowManager; import java.awt.Cursor; import java.util.logging.Level; -import org.sleuthkit.autopsy.centralrepository.datamodel.EamDb; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.ModuleSettings; +import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepository; /** * The second panel of the New Case wizard. @@ -145,7 +145,7 @@ class NewCaseWizardPanel2 implements WizardDescriptor.ValidatingPanel orgs = null; + private CentralRepoOrganization selectedOrg = null; + private java.util.List orgs = null; /** * Creates new form OptionalCasePropertiesPanel @@ -92,14 +92,14 @@ final class OptionalCasePropertiesPanel extends javax.swing.JPanel { } private void setUpOrganizationData() { - if (EamDb.isEnabled()) { + if (CentralRepository.isEnabled()) { try { Case currentCase = Case.getCurrentCaseThrows(); if (currentCase != null) { - EamDb dbManager = EamDb.getInstance(); + CentralRepository dbManager = CentralRepository.getInstance(); selectedOrg = dbManager.getCase(currentCase).getOrg(); } - } catch (EamDbException ex) { + } catch (CentralRepoException ex) { logger.log(Level.SEVERE, "Unable to get Organization associated with the case from Central Repo", ex); } catch (NoCurrentCaseException ex) { logger.log(Level.SEVERE, "Exception while getting open case.", ex); @@ -109,13 +109,13 @@ final class OptionalCasePropertiesPanel extends javax.swing.JPanel { setCurrentlySelectedOrganization(selectedOrg.getName()); } else { - setCurrentlySelectedOrganization(EamDbUtil.getDefaultOrgName()); + setCurrentlySelectedOrganization(CentralRepoDbUtil.getDefaultOrgName()); } } } void setUpCaseDetailsFields() { - boolean cREnabled = EamDb.isEnabled(); + boolean cREnabled = CentralRepository.isEnabled(); comboBoxOrgName.setEnabled(cREnabled); bnNewOrganization.setEnabled(cREnabled); lbPointOfContactNameText.setEnabled(cREnabled); @@ -138,13 +138,13 @@ final class OptionalCasePropertiesPanel extends javax.swing.JPanel { Object selectedBeforeLoad = comboBoxOrgName.getSelectedItem(); comboBoxOrgName.removeAllItems(); try { - EamDb dbManager = EamDb.getInstance(); + CentralRepository dbManager = CentralRepository.getInstance(); orgs = dbManager.getOrganizations(); orgs.forEach((org) -> { comboBoxOrgName.addItem(org.getName()); }); comboBoxOrgName.setSelectedItem(selectedBeforeLoad); - } catch (EamDbException ex) { + } catch (CentralRepoException ex) { logger.log(Level.WARNING, "Unable to populate list of Organizations from Central Repo", ex); } } @@ -180,7 +180,7 @@ final class OptionalCasePropertiesPanel extends javax.swing.JPanel { if (selectedOrg != null) { return selectedOrg.getName(); } else { - return EamDbUtil.getDefaultOrgName(); + return CentralRepoDbUtil.getDefaultOrgName(); } } @@ -514,7 +514,7 @@ final class OptionalCasePropertiesPanel extends javax.swing.JPanel { clearOrganization(); return; } - for (EamOrganization org : orgs) { + for (CentralRepoOrganization org : orgs) { if (org.getName().equals(orgName)) { selectedOrg = org; lbPointOfContactNameText.setText(selectedOrg.getPocName()); @@ -538,7 +538,7 @@ final class OptionalCasePropertiesPanel extends javax.swing.JPanel { }//GEN-LAST:event_bnNewOrganizationActionPerformed void setCurrentlySelectedOrganization(String orgName) { - comboBoxOrgName.setSelectedItem(orgName == null ? EamDbUtil.getDefaultOrgName() : orgName); + comboBoxOrgName.setSelectedItem(orgName == null ? CentralRepoDbUtil.getDefaultOrgName() : orgName); } @Messages({ @@ -583,9 +583,9 @@ final class OptionalCasePropertiesPanel extends javax.swing.JPanel { */ private void updateCorrelationCase() { setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); - if (EamDb.isEnabled()) { + if (CentralRepository.isEnabled()) { try { - EamDb dbManager = EamDb.getInstance(); + CentralRepository dbManager = CentralRepository.getInstance(); CorrelationCase correlationCase = dbManager.getCase(Case.getCurrentCaseThrows()); if (caseDisplayNameTextField.isVisible()) { correlationCase.setDisplayName(caseDisplayNameTextField.getText()); @@ -597,7 +597,7 @@ final class OptionalCasePropertiesPanel extends javax.swing.JPanel { correlationCase.setExaminerPhone(tfExaminerPhoneText.getText()); correlationCase.setNotes(taNotesText.getText()); dbManager.updateCase(correlationCase); - } catch (EamDbException ex) { + } catch (CentralRepoException ex) { logger.log(Level.SEVERE, "Error connecting to central repository database", ex); // NON-NLS } catch (NoCurrentCaseException ex) { logger.log(Level.SEVERE, "Exception while getting open case.", ex); // NON-NLS diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/AddEditCentralRepoCommentAction.java b/Core/src/org/sleuthkit/autopsy/centralrepository/AddEditCentralRepoCommentAction.java index e9e9c4270a..dae8bbe312 100755 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/AddEditCentralRepoCommentAction.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/AddEditCentralRepoCommentAction.java @@ -29,11 +29,11 @@ import org.openide.util.NbBundle.Messages; import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttributeInstance; -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.CorrelationAttributeUtil; +import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoException; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.datamodel.AbstractFile; +import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepository; /** * An AbstractAction to manage adding and modifying a Central Repository file @@ -61,10 +61,10 @@ public final class AddEditCentralRepoCommentAction extends AbstractAction { */ public AddEditCentralRepoCommentAction(AbstractFile file) { fileId = file.getId(); - correlationAttributeInstance = EamArtifactUtil.getInstanceFromContent(file); + correlationAttributeInstance = CorrelationAttributeUtil.getInstanceFromContent(file); if (correlationAttributeInstance == null) { addToDatabase = true; - correlationAttributeInstance = EamArtifactUtil.makeInstanceFromContent(file); + correlationAttributeInstance = CorrelationAttributeUtil.makeInstanceFromContent(file); } if (file.getSize() == 0) { putValue(Action.NAME, Bundle.AddEditCentralRepoCommentAction_menuItemText_addEditCentralRepoCommentEmptyFile()); @@ -94,10 +94,10 @@ public final class AddEditCentralRepoCommentAction extends AbstractAction { comment = null; if (centralRepoCommentDialog.isCommentUpdated()) { - EamDb dbManager; + CentralRepository dbManager; try { - dbManager = EamDb.getInstance(); + dbManager = CentralRepository.getInstance(); if (addToDatabase) { dbManager.addArtifactInstance(correlationAttributeInstance); @@ -111,7 +111,7 @@ public final class AddEditCentralRepoCommentAction extends AbstractAction { } catch (NoCurrentCaseException ex) { logger.log(Level.WARNING, "Case not open after changing central repository comment", ex); } - } catch (EamDbException ex) { + } catch (CentralRepoException ex) { logger.log(Level.SEVERE, "Error adding comment", ex); NotifyDescriptor notifyDescriptor = new NotifyDescriptor.Message( "An error occurred while trying to save the comment to the central repository.", diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/CentralRepoContextMenuActionsProvider.java b/Core/src/org/sleuthkit/autopsy/centralrepository/CentralRepoContextMenuActionsProvider.java index bfeae53ca6..0540fb2a81 100755 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/CentralRepoContextMenuActionsProvider.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/CentralRepoContextMenuActionsProvider.java @@ -24,10 +24,10 @@ import java.util.List; 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.CorrelationAttributeUtil; import org.sleuthkit.autopsy.corecomponentinterfaces.ContextMenuActionsProvider; import org.sleuthkit.datamodel.AbstractFile; +import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepository; /** * This creates a single context menu item for adding or editing a Central @@ -46,7 +46,7 @@ public class CentralRepoContextMenuActionsProvider implements ContextMenuActions } for (AbstractFile file : selectedFiles) { - if (EamDb.isEnabled() && EamArtifactUtil.isSupportedAbstractFileType(file) && file.isFile()) { + if (CentralRepository.isEnabled() && CorrelationAttributeUtil.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 9713a5b47a..a28a013220 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/contentviewer/DataContentViewerOtherCases.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/contentviewer/DataContentViewerOtherCases.java @@ -62,10 +62,10 @@ import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttributeNormalizationException; import org.sleuthkit.autopsy.corecomponentinterfaces.DataContentViewer; import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttributeInstance; -import org.sleuthkit.autopsy.centralrepository.datamodel.EamArtifactUtil; +import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttributeUtil; import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationCase; import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationDataSource; -import org.sleuthkit.autopsy.centralrepository.datamodel.EamDbException; +import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoException; import org.sleuthkit.datamodel.AbstractFile; import org.sleuthkit.datamodel.BlackboardArtifact; import org.sleuthkit.datamodel.BlackboardArtifactTag; @@ -73,9 +73,9 @@ import org.sleuthkit.datamodel.Content; 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.datamodel.SleuthkitCase; import org.sleuthkit.datamodel.TskData; +import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepository; /** * View correlation results from other cases @@ -206,7 +206,7 @@ public class DataContentViewerOtherCases extends JPanel implements DataContentVi StringBuilder msg = new StringBuilder(correlationAttributes.size()); int percentage; try { - EamDb dbManager = EamDb.getInstance(); + CentralRepository dbManager = CentralRepository.getInstance(); for (CorrelationAttributeInstance eamArtifact : correlationAttributes) { try { percentage = dbManager.getFrequencyPercentage(eamArtifact); @@ -221,7 +221,7 @@ public class DataContentViewerOtherCases extends JPanel implements DataContentVi msg.toString(), Bundle.DataContentViewerOtherCases_correlatedArtifacts_title(), DEFAULT_OPTION, PLAIN_MESSAGE); - } catch (EamDbException ex) { + } catch (CentralRepoException ex) { LOGGER.log(Level.SEVERE, "Error getting commonality details.", ex); JOptionPane.showConfirmDialog(showCommonalityMenuItem, Bundle.DataContentViewerOtherCases_correlatedArtifacts_failed(), @@ -241,7 +241,7 @@ public class DataContentViewerOtherCases extends JPanel implements DataContentVi String details = Bundle.DataContentViewerOtherCases_caseDetailsDialog_noDetails(); try { if (-1 != selectedRowViewIdx) { - EamDb dbManager = EamDb.getInstance(); + CentralRepository dbManager = CentralRepository.getInstance(); int selectedRowModelIdx = filesTable.convertRowIndexToModel(selectedRowViewIdx); List rowList = filesTableModel.getListOfNodesForFile(selectedRowModelIdx); if (!rowList.isEmpty()) { @@ -262,7 +262,7 @@ public class DataContentViewerOtherCases extends JPanel implements DataContentVi details = Bundle.DataContentViewerOtherCases_caseDetailsDialog_noDetailsReference(); } } - } catch (EamDbException ex) { + } catch (CentralRepoException ex) { LOGGER.log(Level.SEVERE, "Error loading case details", ex); } finally { JOptionPane.showConfirmDialog(showCaseDetailsMenuItem, @@ -463,20 +463,20 @@ public class DataContentViewerOtherCases extends JPanel implements DataContentVi // correlate on blackboard artifact attributes if they exist and supported BlackboardArtifact bbArtifact = getBlackboardArtifactFromNode(node); - if (bbArtifact != null && EamDb.isEnabled()) { - ret.addAll(EamArtifactUtil.makeInstancesFromBlackboardArtifact(bbArtifact, false)); + if (bbArtifact != null && CentralRepository.isEnabled()) { + ret.addAll(CorrelationAttributeUtil.makeInstancesFromBlackboardArtifact(bbArtifact, false)); } // we can correlate based on the MD5 if it is enabled - if (this.file != null && EamDb.isEnabled() && this.file.getSize() > 0) { + if (this.file != null && CentralRepository.isEnabled() && this.file.getSize() > 0) { try { - List artifactTypes = EamDb.getInstance().getDefinedCorrelationTypes(); + List artifactTypes = CentralRepository.getInstance().getDefinedCorrelationTypes(); String md5 = this.file.getMd5Hash(); if (md5 != null && !md5.isEmpty() && null != artifactTypes && !artifactTypes.isEmpty()) { for (CorrelationAttributeInstance.Type aType : artifactTypes) { if (aType.getId() == CorrelationAttributeInstance.FILES_TYPE_ID) { - CorrelationCase corCase = EamDb.getInstance().getCase(Case.getCurrentCase()); + CorrelationCase corCase = CentralRepository.getInstance().getCase(Case.getCurrentCase()); try { ret.add(new CorrelationAttributeInstance( aType, @@ -494,7 +494,7 @@ public class DataContentViewerOtherCases extends JPanel implements DataContentVi } } } - } catch (EamDbException | TskCoreException ex) { + } catch (CentralRepoException | TskCoreException ex) { LOGGER.log(Level.SEVERE, "Error connecting to DB", ex); // NON-NLS } // If EamDb not enabled, get the Files default correlation type to allow Other Occurances to be enabled. @@ -510,7 +510,7 @@ public class DataContentViewerOtherCases extends JPanel implements DataContentVi .get(); //The Central Repository is not enabled ret.add(new CorrelationAttributeInstance(fileAttributeType, md5, null, null, "", "", TskData.FileKnown.UNKNOWN, this.file.getId())); - } catch (EamDbException ex) { + } catch (CentralRepoException ex) { LOGGER.log(Level.SEVERE, "Error connecting to DB", ex); // NON-NLS } catch (CorrelationAttributeNormalizationException ex) { LOGGER.log(Level.INFO, String.format("Unable to create CorrelationAttributeInstance for value %s", md5), ex); // NON-NLS @@ -529,11 +529,11 @@ public class DataContentViewerOtherCases extends JPanel implements DataContentVi private void setEarliestCaseDate() { String dateStringDisplay = Bundle.DataContentViewerOtherCases_earliestCaseNotAvailable(); - if (EamDb.isEnabled()) { + if (CentralRepository.isEnabled()) { LocalDateTime earliestDate = LocalDateTime.now(DateTimeZone.UTC); DateFormat datetimeFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss", Locale.US); try { - EamDb dbManager = EamDb.getInstance(); + CentralRepository dbManager = CentralRepository.getInstance(); List cases = dbManager.getCases(); for (CorrelationCase aCase : cases) { LocalDateTime caseDate = LocalDateTime.fromDateFields(datetimeFormat.parse(aCase.getCreationDate())); @@ -545,7 +545,7 @@ public class DataContentViewerOtherCases extends JPanel implements DataContentVi } - } catch (EamDbException ex) { + } catch (CentralRepoException ex) { LOGGER.log(Level.SEVERE, "Error getting list of cases from database.", ex); // NON-NLS } catch (ParseException ex) { LOGGER.log(Level.SEVERE, "Error parsing date of cases from database.", ex); // NON-NLS @@ -574,8 +574,8 @@ public class DataContentViewerOtherCases extends JPanel implements DataContentVi String caseUUID = openCase.getName(); HashMap nodeDataMap = new HashMap<>(); - if (EamDb.isEnabled()) { - List instances = EamDb.getInstance().getArtifactInstancesByTypeValue(corAttr.getCorrelationType(), corAttr.getCorrelationValue()); + if (CentralRepository.isEnabled()) { + List instances = CentralRepository.getInstance().getArtifactInstancesByTypeValue(corAttr.getCorrelationType(), corAttr.getCorrelationValue()); for (CorrelationAttributeInstance artifactInstance : instances) { @@ -604,7 +604,7 @@ public class DataContentViewerOtherCases extends JPanel implements DataContentVi } } return nodeDataMap; - } catch (EamDbException ex) { + } catch (CentralRepoException ex) { LOGGER.log(Level.SEVERE, "Error getting artifact instances from database.", ex); // NON-NLS } catch (CorrelationAttributeNormalizationException ex) { LOGGER.log(Level.INFO, "Error getting artifact instances from database.", ex); // NON-NLS @@ -630,9 +630,9 @@ public class DataContentViewerOtherCases extends JPanel implements DataContentVi * * @throws NoCurrentCaseException * @throws TskCoreException - * @throws EamDbException + * @throws CentralRepoException */ - private List getCaseDbMatches(CorrelationAttributeInstance corAttr, Case openCase) throws NoCurrentCaseException, TskCoreException, EamDbException { + private List getCaseDbMatches(CorrelationAttributeInstance corAttr, Case openCase) throws NoCurrentCaseException, TskCoreException, CentralRepoException { String md5 = corAttr.getCorrelationValue(); SleuthkitCase tsk = openCase.getSleuthkitCase(); List matches = tsk.findAllFilesWhere(String.format("md5 = '%s'", new Object[]{md5})); @@ -656,9 +656,9 @@ public class DataContentViewerOtherCases extends JPanel implements DataContentVi * @param newFile * * @throws TskCoreException - * @throws EamDbException + * @throws CentralRepoException */ - private void addOrUpdateNodeData(final Case autopsyCase, Map nodeDataMap, AbstractFile newFile) throws TskCoreException, EamDbException { + private void addOrUpdateNodeData(final Case autopsyCase, Map nodeDataMap, AbstractFile newFile) throws TskCoreException, CentralRepoException { OtherOccurrenceNodeInstanceData newNode = new OtherOccurrenceNodeInstanceData(newFile, autopsyCase); @@ -699,7 +699,7 @@ public class DataContentViewerOtherCases extends JPanel implements DataContentVi // (either through the MD5 hash of the associated file or through a BlackboardArtifact) // - The central repo is disabled and the backing file has a valid MD5 hash this.file = this.getAbstractFileFromNode(node); - if (EamDb.isEnabled()) { + if (CentralRepository.isEnabled()) { return !getCorrelationAttributesFromNode(node).isEmpty(); } else { return this.file != null @@ -758,7 +758,7 @@ public class DataContentViewerOtherCases extends JPanel implements DataContentVi try { dataSources.add(makeDataSourceString(nodeData.getCorrelationAttributeInstance().getCorrelationCase().getCaseUUID(), nodeData.getDeviceID(), nodeData.getDataSourceName())); caseNames.put(nodeData.getCorrelationAttributeInstance().getCorrelationCase().getCaseUUID(), nodeData.getCorrelationAttributeInstance().getCorrelationCase()); - } catch (EamDbException ex) { + } catch (CentralRepoException ex) { LOGGER.log(Level.WARNING, "Unable to get correlation case for displaying other occurrence for case: " + nodeData.getCaseName(), ex); } } else { @@ -833,7 +833,7 @@ public class DataContentViewerOtherCases extends JPanel implements DataContentVi } else if (currentCaseName != null && (casesTableModel.getCorrelationCase(casesTable.convertRowIndexToModel(selectedRow)).getCaseUUID().equals(currentCaseName))) { dataSourcesTableModel.addNodeData(nodeData); } - } catch (EamDbException ex) { + } catch (CentralRepoException ex) { LOGGER.log(Level.WARNING, "Unable to get correlation attribute instance from OtherOccurrenceNodeInstanceData for case " + nodeData.getCaseName(), ex); } } @@ -870,7 +870,7 @@ public class DataContentViewerOtherCases extends JPanel implements DataContentVi filesTableModel.addNodeData(nodeData); } } - } catch (EamDbException ex) { + } catch (CentralRepoException ex) { LOGGER.log(Level.WARNING, "Unable to get correlation attribute instance from OtherOccurrenceNodeInstanceData for case " + nodeData.getCaseName(), ex); } } @@ -934,17 +934,17 @@ public class DataContentViewerOtherCases extends JPanel implements DataContentVi */ private String getCaseCreatedDate(int caseTableRowIdx) { try { - if (EamDb.isEnabled()) { + if (CentralRepository.isEnabled()) { CorrelationCase partialCase; partialCase = casesTableModel.getCorrelationCase(casesTable.convertRowIndexToModel(caseTableRowIdx)); if (partialCase == null) { return ""; } - return EamDb.getInstance().getCaseByUUID(partialCase.getCaseUUID()).getCreationDate(); + return CentralRepository.getInstance().getCaseByUUID(partialCase.getCaseUUID()).getCreationDate(); } else { return Case.getCurrentCase().getCreatedDate(); } - } catch (EamDbException ex) { + } catch (CentralRepoException ex) { LOGGER.log(Level.WARNING, "Error getting case created date for row: " + caseTableRowIdx, ex); } return ""; @@ -1102,7 +1102,7 @@ public class DataContentViewerOtherCases extends JPanel implements DataContentVi private void rightClickPopupMenuPopupMenuWillBecomeVisible(javax.swing.event.PopupMenuEvent evt) {//GEN-FIRST:event_rightClickPopupMenuPopupMenuWillBecomeVisible boolean enableCentralRepoActions = false; - if (EamDb.isEnabled() && filesTable.getSelectedRowCount() == 1) { + if (CentralRepository.isEnabled() && filesTable.getSelectedRowCount() == 1) { int rowIndex = filesTable.getSelectedRow(); List selectedFile = filesTableModel.getListOfNodesForFile(rowIndex); if (!selectedFile.isEmpty() && selectedFile.get(0) instanceof OtherOccurrenceNodeInstanceData) { @@ -1159,7 +1159,7 @@ public class DataContentViewerOtherCases extends JPanel implements DataContentVi String tempCaseUUID; try { tempCaseUUID = nodeData.getCorrelationAttributeInstance().getCorrelationCase().getCaseUUID(); - } catch (EamDbException ignored) { + } catch (CentralRepoException ignored) { //non central repo nodeData won't have a correlation case try { tempCaseUUID = Case.getCurrentCaseThrows().getName(); diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/contentviewer/OccurrencePanel.java b/Core/src/org/sleuthkit/autopsy/centralrepository/contentviewer/OccurrencePanel.java index 36877a124d..c66d4ce085 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/contentviewer/OccurrencePanel.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/contentviewer/OccurrencePanel.java @@ -30,10 +30,10 @@ import java.util.logging.Level; import org.openide.util.NbBundle.Messages; import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationCase; -import org.sleuthkit.autopsy.centralrepository.datamodel.EamDb; -import org.sleuthkit.autopsy.centralrepository.datamodel.EamDbException; +import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoException; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.datamodel.TskData; +import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepository; /** * Panel for displaying other occurrence details. @@ -203,14 +203,14 @@ final class OccurrencePanel extends javax.swing.JPanel { try { OtherOccurrenceNodeInstanceData nodeData = ((OtherOccurrenceNodeInstanceData) occurrence); if (nodeData.isCentralRepoNode()) { - if (EamDb.isEnabled()) { + if (CentralRepository.isEnabled()) { CorrelationCase partialCase = nodeData.getCorrelationAttributeInstance().getCorrelationCase(); - caseDate = EamDb.getInstance().getCaseByUUID(partialCase.getCaseUUID()).getCreationDate(); + caseDate = CentralRepository.getInstance().getCaseByUUID(partialCase.getCaseUUID()).getCreationDate(); } } else { caseDate = Case.getCurrentCase().getCreatedDate(); } - } catch (EamDbException ex) { + } catch (CentralRepoException ex) { LOGGER.log(Level.WARNING, "Error getting case created date for other occurrence content viewer", ex); } //Collect the data that is necessary for the other sections diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/contentviewer/OtherOccurrenceNodeInstanceData.java b/Core/src/org/sleuthkit/autopsy/centralrepository/contentviewer/OtherOccurrenceNodeInstanceData.java index 7703e19e62..92ebc821f8 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/contentviewer/OtherOccurrenceNodeInstanceData.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/contentviewer/OtherOccurrenceNodeInstanceData.java @@ -20,7 +20,7 @@ package org.sleuthkit.autopsy.centralrepository.contentviewer; import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttributeInstance; -import org.sleuthkit.autopsy.centralrepository.datamodel.EamDbException; +import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoException; import org.sleuthkit.datamodel.AbstractFile; import org.sleuthkit.datamodel.DataSource; import org.sleuthkit.datamodel.TskCoreException; @@ -75,16 +75,16 @@ class OtherOccurrenceNodeInstanceData implements OtherOccurrenceNodeData { * @param newFile The abstract file * @param autopsyCase The current case * - * @throws EamDbException + * @throws CentralRepoException */ - OtherOccurrenceNodeInstanceData(AbstractFile newFile, Case autopsyCase) throws EamDbException { + OtherOccurrenceNodeInstanceData(AbstractFile newFile, Case autopsyCase) throws CentralRepoException { caseName = autopsyCase.getDisplayName(); try { DataSource dataSource = autopsyCase.getSleuthkitCase().getDataSource(newFile.getDataSource().getId()); deviceID = dataSource.getDeviceId(); dataSourceName = dataSource.getName(); } catch (TskDataException | TskCoreException ex) { - throw new EamDbException("Error loading data source for abstract file ID " + newFile.getId(), ex); + throw new CentralRepoException("Error loading data source for abstract file ID " + newFile.getId(), ex); } filePath = newFile.getParentPath() + newFile.getName(); @@ -211,9 +211,9 @@ class OtherOccurrenceNodeInstanceData implements OtherOccurrenceNodeData { * * @return the original abstract file */ - AbstractFile getAbstractFile() throws EamDbException { + AbstractFile getAbstractFile() throws CentralRepoException { if (originalAbstractFile == null) { - throw new EamDbException("AbstractFile is null"); + throw new CentralRepoException("AbstractFile is null"); } return originalAbstractFile; } @@ -224,11 +224,11 @@ class OtherOccurrenceNodeInstanceData implements OtherOccurrenceNodeData { * * @return the original CorrelationAttributeInstance * - * @throws EamDbException + * @throws CentralRepoException */ - CorrelationAttributeInstance getCorrelationAttributeInstance() throws EamDbException { + CorrelationAttributeInstance getCorrelationAttributeInstance() throws CentralRepoException { if (originalCorrelationInstance == null) { - throw new EamDbException("CorrelationAttributeInstance is null"); + throw new CentralRepoException("CorrelationAttributeInstance is null"); } return originalCorrelationInstance; } diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/contentviewer/OtherOccurrencesDataSourcesTableModel.java b/Core/src/org/sleuthkit/autopsy/centralrepository/contentviewer/OtherOccurrencesDataSourcesTableModel.java index 76871d074d..89d2a599ec 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/contentviewer/OtherOccurrencesDataSourcesTableModel.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/contentviewer/OtherOccurrencesDataSourcesTableModel.java @@ -26,7 +26,7 @@ import javax.swing.table.AbstractTableModel; import org.openide.util.NbBundle; import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; -import org.sleuthkit.autopsy.centralrepository.datamodel.EamDbException; +import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoException; import org.sleuthkit.autopsy.coreutils.Logger; /** @@ -144,7 +144,7 @@ final class OtherOccurrencesDataSourcesTableModel extends AbstractTableModel { String caseUUID; try { caseUUID = nodeData.getCorrelationAttributeInstance().getCorrelationCase().getCaseUUID(); - } catch (EamDbException ignored) { + } catch (CentralRepoException ignored) { //non central repo nodeData won't have a correlation case try { caseUUID = Case.getCurrentCaseThrows().getName(); diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/contentviewer/OtherOccurrencesFilesTableModel.java b/Core/src/org/sleuthkit/autopsy/centralrepository/contentviewer/OtherOccurrencesFilesTableModel.java index 3344951857..8f78d66ee8 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/contentviewer/OtherOccurrencesFilesTableModel.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/contentviewer/OtherOccurrencesFilesTableModel.java @@ -28,7 +28,7 @@ import org.openide.util.NbBundle.Messages; import org.apache.commons.io.FilenameUtils; import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; -import org.sleuthkit.autopsy.centralrepository.datamodel.EamDbException; +import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoException; import org.sleuthkit.autopsy.coreutils.Logger; /** @@ -123,7 +123,7 @@ public class OtherOccurrencesFilesTableModel extends AbstractTableModel { String caseUUID; try { caseUUID = nodeData.getCorrelationAttributeInstance().getCorrelationCase().getCaseUUID(); - } catch (EamDbException ignored) { + } catch (CentralRepoException ignored) { //non central repo nodeData won't have a correlation case try { caseUUID = Case.getCurrentCaseThrows().getName(); diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/EamDbUtil.java b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/CentralRepoDbUtil.java similarity index 80% rename from Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/EamDbUtil.java rename to Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/CentralRepoDbUtil.java index c287990d79..4ba8ac579e 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/EamDbUtil.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/CentralRepoDbUtil.java @@ -1,7 +1,7 @@ /* * Central Repository * - * Copyright 2015-2017 Basis Technology Corp. + * Copyright 2015-2020 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -30,14 +30,14 @@ 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; +import static org.sleuthkit.autopsy.centralrepository.datamodel.RdbmsCentralRepo.SOFTWARE_CR_DB_SCHEMA_VERSION; /** * */ -public class EamDbUtil { +public class CentralRepoDbUtil { - private final static Logger LOGGER = Logger.getLogger(EamDbUtil.class.getName()); + private final static Logger LOGGER = Logger.getLogger(CentralRepoDbUtil.class.getName()); private static final String CENTRAL_REPO_NAME = "CentralRepository"; private static final String CENTRAL_REPO_USE_KEY = "db.useCentralRepo"; private static final String DEFAULT_ORG_NAME = "Not Specified"; @@ -47,7 +47,7 @@ public class EamDbUtil { * * @param statement The statement to be closed. * - * @throws EamDbException + * @throws CentralRepoException */ public static void closeStatement(Statement statement) { if (null != statement) { @@ -64,7 +64,7 @@ public class EamDbUtil { * * @param resultSet * - * @throws EamDbException + * @throws CentralRepoException */ public static void closeResultSet(ResultSet resultSet) { if (null != resultSet) { @@ -81,7 +81,7 @@ public class EamDbUtil { * * @param conn An open connection * - * @throws EamDbException + * @throws CentralRepoException */ public static void closeConnection(Connection conn) { if (null != conn) { @@ -117,11 +117,11 @@ public class EamDbUtil { preparedStatement.addBatch(); } preparedStatement.executeBatch(); - } catch (EamDbException | SQLException ex) { + } catch (CentralRepoException | SQLException ex) { LOGGER.log(Level.SEVERE, "Error inserting default correlation types.", ex); // NON-NLS return false; } finally { - EamDbUtil.closePreparedStatement(preparedStatement); + CentralRepoDbUtil.closePreparedStatement(preparedStatement); } return true; } @@ -135,8 +135,8 @@ public class EamDbUtil { */ static void updateSchemaVersion(Connection conn) throws SQLException { try (Statement statement = conn.createStatement()) { - 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 + "'"); + statement.execute("UPDATE db_info SET value = '" + SOFTWARE_CR_DB_SCHEMA_VERSION.getMajor() + "' WHERE name = '" + RdbmsCentralRepo.SCHEMA_MAJOR_VERSION_KEY + "'"); + statement.execute("UPDATE db_info SET value = '" + SOFTWARE_CR_DB_SCHEMA_VERSION.getMinor() + "' WHERE name = '" + RdbmsCentralRepo.SCHEMA_MINOR_VERSION_KEY + "'"); } } @@ -161,7 +161,7 @@ public class EamDbUtil { } catch (SQLException ex) { return false; } finally { - EamDbUtil.closeResultSet(resultSet); + CentralRepoDbUtil.closeResultSet(resultSet); } return true; } @@ -175,20 +175,20 @@ public class EamDbUtil { "EamDbUtil.centralRepoUpgradeFailed.message=Failed to upgrade Central Repository.", "EamDbUtil.centralRepoConnectionFailed.message=Unable to connect to Central Repository.", "EamDbUtil.exclusiveLockAquisitionFailure.message=Unable to acquire exclusive lock for Central Repository."}) - public static void upgradeDatabase() throws EamDbException { - if (!EamDb.isEnabled()) { + public static void upgradeDatabase() throws CentralRepoException { + if (!CentralRepository.isEnabled()) { return; } - EamDb db = null; + CentralRepository db = null; CoordinationService.Lock lock = null; //get connection try { try { - db = EamDb.getInstance(); - } catch (EamDbException ex) { + db = CentralRepository.getInstance(); + } catch (CentralRepoException ex) { LOGGER.log(Level.SEVERE, "Error updating central repository, unable to make connection", ex); - throw new EamDbException("Error updating central repository, unable to make connection", Bundle.EamDbUtil_centralRepoConnectionFailed_message() + Bundle.EamDbUtil_centralRepoDisabled_message(), ex); + throw new CentralRepoException("Error updating central repository, unable to make connection", Bundle.EamDbUtil_centralRepoConnectionFailed_message() + Bundle.EamDbUtil_centralRepoDisabled_message(), ex); } //get lock necessary for upgrade if (db != null) { @@ -198,22 +198,22 @@ public class EamDbUtil { // (meaning the database is in use by another user) lock = db.getExclusiveMultiUserDbLock(); //perform upgrade - } catch (EamDbException ex) { + } catch (CentralRepoException ex) { LOGGER.log(Level.SEVERE, "Error updating central repository, unable to acquire exclusive lock", ex); - throw new EamDbException("Error updating central repository, unable to acquire exclusive lock", Bundle.EamDbUtil_exclusiveLockAquisitionFailure_message() + Bundle.EamDbUtil_centralRepoDisabled_message(), ex); + throw new CentralRepoException("Error updating central repository, unable to acquire exclusive lock", Bundle.EamDbUtil_exclusiveLockAquisitionFailure_message() + Bundle.EamDbUtil_centralRepoDisabled_message(), ex); } try { db.upgradeSchema(); - } catch (EamDbException ex) { + } catch (CentralRepoException ex) { LOGGER.log(Level.SEVERE, "Error updating central repository", ex); - throw new EamDbException("Error updating central repository", ex.getUserMessage() + Bundle.EamDbUtil_centralRepoDisabled_message(), ex); + throw new CentralRepoException("Error updating central repository", ex.getUserMessage() + Bundle.EamDbUtil_centralRepoDisabled_message(), ex); } catch (SQLException ex) { LOGGER.log(Level.SEVERE, "Error updating central repository", ex); - throw new EamDbException("Error updating central repository", Bundle.EamDbUtil_centralRepoUpgradeFailed_message() + Bundle.EamDbUtil_centralRepoDisabled_message(), ex); + throw new CentralRepoException("Error updating central repository", Bundle.EamDbUtil_centralRepoUpgradeFailed_message() + Bundle.EamDbUtil_centralRepoDisabled_message(), ex); } catch (IncompatibleCentralRepoException ex) { LOGGER.log(Level.SEVERE, "Error updating central repository", ex); - throw new EamDbException("Error updating central repository", ex.getMessage() + "\n\n" + Bundle.EamDbUtil_centralRepoUpgradeFailed_message() + Bundle.EamDbUtil_centralRepoDisabled_message(), ex); + throw new CentralRepoException("Error updating central repository", ex.getMessage() + "\n\n" + Bundle.EamDbUtil_centralRepoUpgradeFailed_message() + Bundle.EamDbUtil_centralRepoDisabled_message(), ex); } finally { if (lock != null) { try { @@ -224,19 +224,19 @@ public class EamDbUtil { } } } else { - throw new EamDbException("Unable to connect to database", Bundle.EamDbUtil_centralRepoConnectionFailed_message() + Bundle.EamDbUtil_centralRepoDisabled_message()); + throw new CentralRepoException("Unable to connect to database", Bundle.EamDbUtil_centralRepoConnectionFailed_message() + Bundle.EamDbUtil_centralRepoDisabled_message()); } - } catch (EamDbException ex) { + } catch (CentralRepoException ex) { // Disable the central repo and clear the current settings. try { - if (null != EamDb.getInstance()) { - EamDb.getInstance().shutdownConnections(); + if (null != CentralRepository.getInstance()) { + CentralRepository.getInstance().shutdownConnections(); } - } catch (EamDbException ex2) { + } catch (CentralRepoException ex2) { LOGGER.log(Level.SEVERE, "Error shutting down central repo connection pool", ex2); } - EamDbPlatformEnum.setSelectedPlatform(EamDbPlatformEnum.DISABLED.name()); - EamDbPlatformEnum.saveSelectedPlatform(); + CentralRepoPlatforms.setSelectedPlatform(CentralRepoPlatforms.DISABLED.name()); + CentralRepoPlatforms.saveSelectedPlatform(); throw ex; } } @@ -257,7 +257,7 @@ public class EamDbUtil { * * @return true if it is the default org, false otherwise */ - public static boolean isDefaultOrg(EamOrganization org) { + public static boolean isDefaultOrg(CentralRepoOrganization org) { return DEFAULT_ORG_NAME.equals(org.getName()); } @@ -286,7 +286,7 @@ public class EamDbUtil { LOGGER.log(Level.SEVERE, "Error adding default organization", ex); return false; } finally { - EamDbUtil.closePreparedStatement(preparedStatement); + CentralRepoDbUtil.closePreparedStatement(preparedStatement); } return true; @@ -338,7 +338,7 @@ public class EamDbUtil { } catch (SQLException ex) { return false; } finally { - EamDbUtil.closeResultSet(resultSet); + CentralRepoDbUtil.closeResultSet(resultSet); } return false; @@ -373,7 +373,7 @@ public class EamDbUtil { * * @deprecated Use closeStatement() instead. * - * @throws EamDbException + * @throws CentralRepoException */ @Deprecated public static void closePreparedStatement(PreparedStatement preparedStatement) { diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/EamDbException.java b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/CentralRepoException.java similarity index 83% rename from Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/EamDbException.java rename to Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/CentralRepoException.java index 262b550f5c..24ede0803d 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/EamDbException.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/CentralRepoException.java @@ -1,7 +1,7 @@ /* * Central Repository * - * Copyright 2015-2019 Basis Technology Corp. + * Copyright 2015-2020 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -23,7 +23,7 @@ import org.sleuthkit.autopsy.exceptions.AutopsyException; /** * An exception to be thrown by an artifact manager. */ -public class EamDbException extends AutopsyException { +public class CentralRepoException extends AutopsyException { private static final long serialVersionUID = 1L; @@ -32,7 +32,7 @@ public class EamDbException extends AutopsyException { * * @param message The exception message. */ - public EamDbException(String message) { + public CentralRepoException(String message) { super(message); } @@ -42,7 +42,7 @@ public class EamDbException extends AutopsyException { * @param message Exception message. * @param userMessage the user friendly message to include in this exception */ - public EamDbException(String message, String userMessage) { + public CentralRepoException(String message, String userMessage) { super(message, userMessage); } @@ -54,7 +54,7 @@ public class EamDbException extends AutopsyException { * @param userMessage the user friendly message to include in this exception * @param cause Exception cause. */ - public EamDbException(String message, String userMessage, Throwable cause) { + public CentralRepoException(String message, String userMessage, Throwable cause) { super(message, userMessage, cause); } @@ -64,7 +64,7 @@ public class EamDbException extends AutopsyException { * @param message The exception message. * @param cause The exception cause. */ - public EamDbException(String message, Throwable cause) { + public CentralRepoException(String message, Throwable cause) { super(message, cause); } } diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/EamGlobalFileInstance.java b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/CentralRepoFileInstance.java similarity index 87% rename from Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/EamGlobalFileInstance.java rename to Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/CentralRepoFileInstance.java index 9f51752251..bd243f812a 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/EamGlobalFileInstance.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/CentralRepoFileInstance.java @@ -1,7 +1,7 @@ /* * Central Repository * - * Copyright 2015-2017 Basis Technology Corp. + * Copyright 2015-2020 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -24,7 +24,7 @@ import org.sleuthkit.datamodel.TskData; /** * Global file hash instance */ -public class EamGlobalFileInstance { +public class CentralRepoFileInstance { private int instanceID; private int globalSetID; @@ -32,23 +32,23 @@ public class EamGlobalFileInstance { private TskData.FileKnown knownStatus; private String comment; - public EamGlobalFileInstance( + public CentralRepoFileInstance( int globalSetID, String MD5Hash, TskData.FileKnown knownStatus, - String comment) throws EamDbException, CorrelationAttributeNormalizationException { + String comment) throws CentralRepoException, CorrelationAttributeNormalizationException { this(-1, globalSetID, MD5Hash, knownStatus, comment); } - public EamGlobalFileInstance( + public CentralRepoFileInstance( int instanceID, int globalSetID, String MD5Hash, TskData.FileKnown knownStatus, - String comment) throws EamDbException, CorrelationAttributeNormalizationException { + String comment) throws CentralRepoException, CorrelationAttributeNormalizationException { if(knownStatus == null){ - throw new EamDbException("null known status"); + throw new CentralRepoException("null known status"); } this.instanceID = instanceID; this.globalSetID = globalSetID; @@ -61,7 +61,7 @@ public class EamGlobalFileInstance { public boolean equals(Object otherInstance) { if (this == otherInstance) { return true; - } else if (!(otherInstance instanceof EamGlobalFileInstance)) { + } else if (!(otherInstance instanceof CentralRepoFileInstance)) { return false; } else { return (this.hashCode() == otherInstance.hashCode()); diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/EamGlobalSet.java b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/CentralRepoFileSet.java similarity index 96% rename from Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/EamGlobalSet.java rename to Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/CentralRepoFileSet.java index e9a230740c..1288efcd56 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/EamGlobalSet.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/CentralRepoFileSet.java @@ -1,7 +1,7 @@ /* * Central Repository * - * Copyright 2015-2017 Basis Technology Corp. + * Copyright 2015-2020 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -24,7 +24,7 @@ import org.sleuthkit.datamodel.TskData; /** * A global set in the Central Repository database */ -public class EamGlobalSet { +public class CentralRepoFileSet { private int globalSetID; private int orgID; @@ -35,7 +35,7 @@ public class EamGlobalSet { private CorrelationAttributeInstance.Type type; private LocalDate importDate; - public EamGlobalSet( + public CentralRepoFileSet( int globalSetID, int orgID, String setName, @@ -54,7 +54,7 @@ public class EamGlobalSet { this.importDate = importDate; } - public EamGlobalSet( + public CentralRepoFileSet( int orgID, String setName, String version, @@ -77,7 +77,7 @@ public class EamGlobalSet { * @param isReadOnly * @param type */ - public EamGlobalSet( + public CentralRepoFileSet( int orgID, String setName, String version, diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/EamOrganization.java b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/CentralRepoOrganization.java similarity index 94% rename from Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/EamOrganization.java rename to Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/CentralRepoOrganization.java index ba88798128..753c9e24d5 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/EamOrganization.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/CentralRepoOrganization.java @@ -21,7 +21,7 @@ package org.sleuthkit.autopsy.centralrepository.datamodel; /** * An organization in the Central Repository database */ -public class EamOrganization { +public class CentralRepoOrganization { private int orgID; private String name; @@ -29,7 +29,7 @@ public class EamOrganization { private String pocEmail; private String pocPhone; - EamOrganization( + CentralRepoOrganization( int orgID, String name, String pocName, @@ -42,7 +42,7 @@ public class EamOrganization { this.pocPhone = pocPhone; } - public EamOrganization( + public CentralRepoOrganization( String name, String pocName, String pocEmail, @@ -50,12 +50,12 @@ public class EamOrganization { this(-1, name, pocName, pocEmail, pocPhone); } - public EamOrganization( + public CentralRepoOrganization( String name) { this(-1, name, "", "", ""); } - public static EamOrganization getDefault() { + public static CentralRepoOrganization getDefault() { // TODO: when we allow the user to configure/specify the default organization // this will return it. return null; diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/EamDbPlatformEnum.java b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/CentralRepoPlatforms.java similarity index 80% rename from Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/EamDbPlatformEnum.java rename to Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/CentralRepoPlatforms.java index 6210d5d528..bcdf009ca3 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/EamDbPlatformEnum.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/CentralRepoPlatforms.java @@ -1,7 +1,7 @@ /* * Central Repository * - * Copyright 2015-2017 Basis Technology Corp. + * Copyright 2015-2020 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -23,7 +23,7 @@ import org.sleuthkit.autopsy.coreutils.ModuleSettings; /** * */ -public enum EamDbPlatformEnum { +public enum CentralRepoPlatforms { DISABLED("Disabled", true), SQLITE("SQLite", false), POSTGRESQL("PostgreSQL", false); @@ -31,7 +31,7 @@ public enum EamDbPlatformEnum { private final String platformName; private Boolean selected; - EamDbPlatformEnum(String name, Boolean selected) { + CentralRepoPlatforms(String name, Boolean selected) { this.platformName = name; this.selected = selected; loadSettings(); @@ -63,12 +63,12 @@ public enum EamDbPlatformEnum { return selected; } - public static EamDbPlatformEnum fromString(String pName) { + public static CentralRepoPlatforms fromString(String pName) { if (null == pName) { return DISABLED; } - for (EamDbPlatformEnum p : EamDbPlatformEnum.values()) { + for (CentralRepoPlatforms p : CentralRepoPlatforms.values()) { if (p.toString().equalsIgnoreCase(pName)) { return p; } @@ -80,8 +80,8 @@ public enum EamDbPlatformEnum { * Save the selected platform to the config file. */ public static void saveSelectedPlatform() { - EamDbPlatformEnum selectedPlatform = DISABLED; - for (EamDbPlatformEnum p : EamDbPlatformEnum.values()) { + CentralRepoPlatforms selectedPlatform = DISABLED; + for (CentralRepoPlatforms p : CentralRepoPlatforms.values()) { if (p.isSelected()) { selectedPlatform = p; } @@ -96,8 +96,8 @@ public enum EamDbPlatformEnum { * @param platformString The name of the selected platform. */ public static void setSelectedPlatform(String platformString) { - EamDbPlatformEnum pSelected = EamDbPlatformEnum.fromString(platformString); - for (EamDbPlatformEnum p : EamDbPlatformEnum.values()) { + CentralRepoPlatforms pSelected = CentralRepoPlatforms.fromString(platformString); + for (CentralRepoPlatforms p : CentralRepoPlatforms.values()) { p.setSelected(p == pSelected); } } @@ -108,8 +108,8 @@ public enum EamDbPlatformEnum { * @return The selected platform, or if not platform is selected, default to * DISABLED. */ - public static EamDbPlatformEnum getSelectedPlatform() { - for (EamDbPlatformEnum p : EamDbPlatformEnum.values()) { + public static CentralRepoPlatforms getSelectedPlatform() { + for (CentralRepoPlatforms p : CentralRepoPlatforms.values()) { if (p.isSelected()) { return p; } diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/EamDb.java b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/CentralRepository.java similarity index 74% rename from Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/EamDb.java rename to Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/CentralRepository.java index c28c0537f7..3e7ac158a9 100755 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/EamDb.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/CentralRepository.java @@ -1,7 +1,7 @@ /* * Central Repository * - * Copyright 2015-2019 Basis Technology Corp. + * Copyright 2015-2020 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -28,27 +28,27 @@ import org.sleuthkit.autopsy.coordinationservice.CoordinationService; /** * Main interface for interacting with the database */ -public interface EamDb { +public interface CentralRepository { /** * Get the instance * * @return The EamDb instance or null if one is not configured. * - * @throws EamDbException + * @throws CentralRepoException */ - static EamDb getInstance() throws EamDbException { + static CentralRepository getInstance() throws CentralRepoException { - EamDbPlatformEnum selectedPlatform = EamDbPlatformEnum.DISABLED; - if (EamDbUtil.allowUseOfCentralRepository()) { - selectedPlatform = EamDbPlatformEnum.getSelectedPlatform(); + CentralRepoPlatforms selectedPlatform = CentralRepoPlatforms.DISABLED; + if (CentralRepoDbUtil.allowUseOfCentralRepository()) { + selectedPlatform = CentralRepoPlatforms.getSelectedPlatform(); } switch (selectedPlatform) { case POSTGRESQL: - return PostgresEamDb.getInstance(); + return PostgresCentralRepo.getInstance(); case SQLITE: - return SqliteEamDb.getInstance(); + return SqliteCentralRepo.getInstance(); default: return null; } @@ -61,9 +61,9 @@ public interface EamDb { * It will not close active/in-use connections. Thus, it is vital that there * are no in-use connections when you call this method. * - * @throws EamDbException if there is a problem closing the connection pool. + * @throws CentralRepoException if there is a problem closing the connection pool. */ - void shutdownConnections() throws EamDbException; + void shutdownConnections() throws CentralRepoException; /** * Update settings @@ -83,7 +83,7 @@ public interface EamDb { /** * Reset the database (testing method) */ - void reset() throws EamDbException; + void reset() throws CentralRepoException; /** * Is the database enabled? @@ -91,8 +91,8 @@ public interface EamDb { * @return Is the database enabled */ static boolean isEnabled() { - return EamDbUtil.allowUseOfCentralRepository() - && EamDbPlatformEnum.getSelectedPlatform() != EamDbPlatformEnum.DISABLED; + return CentralRepoDbUtil.allowUseOfCentralRepository() + && CentralRepoPlatforms.getSelectedPlatform() != CentralRepoPlatforms.DISABLED; } /** @@ -101,9 +101,9 @@ public interface EamDb { * @param name Key to set * @param value Value to set * - * @throws EamDbException + * @throws CentralRepoException */ - public void newDbInfo(String name, String value) throws EamDbException; + public void newDbInfo(String name, String value) throws CentralRepoException; /** * Set the data source object id for a specific entry in the data_sources @@ -113,7 +113,7 @@ public interface EamDb { * @param dataSourceObjectId - the object id for the data source from the * caseDb */ - void addDataSourceObjectId(int rowId, long dataSourceObjectId) throws EamDbException; + void addDataSourceObjectId(int rowId, long dataSourceObjectId) throws CentralRepoException; /** * Get the value for the given name from the name/value db_info table. @@ -122,9 +122,9 @@ public interface EamDb { * * @return value associated with name. * - * @throws EamDbException + * @throws CentralRepoException */ - public String getDbInfo(String name) throws EamDbException; + public String getDbInfo(String name) throws CentralRepoException; /** * Update the value for a name in the name/value db_info table. @@ -132,9 +132,9 @@ public interface EamDb { * @param name Name to find * @param value Value to assign to name. * - * @throws EamDbException + * @throws CentralRepoException */ - public void updateDbInfo(String name, String value) throws EamDbException; + public void updateDbInfo(String name, String value) throws CentralRepoException; /** * Creates new Case in the database @@ -143,21 +143,21 @@ public interface EamDb { * * @param eamCase The case to add */ - CorrelationCase newCase(CorrelationCase eamCase) throws EamDbException; + CorrelationCase newCase(CorrelationCase eamCase) throws CentralRepoException; /** * Creates new Case in the database from the given case * * @param autopsyCase The case to add */ - CorrelationCase newCase(Case autopsyCase) throws EamDbException; + CorrelationCase newCase(Case autopsyCase) throws CentralRepoException; /** * Updates an existing Case in the database * * @param eamCase The case to update */ - void updateCase(CorrelationCase eamCase) throws EamDbException; + void updateCase(CorrelationCase eamCase) throws CentralRepoException; /** * Retrieves Central Repo case based on an Autopsy Case @@ -166,9 +166,9 @@ public interface EamDb { * * @return CR Case * - * @throws EamDbException + * @throws CentralRepoException */ - CorrelationCase getCase(Case autopsyCase) throws EamDbException; + CorrelationCase getCase(Case autopsyCase) throws CentralRepoException; /** * Retrieves Case details based on Case UUID @@ -177,7 +177,7 @@ public interface EamDb { * * @return The retrieved case */ - CorrelationCase getCaseByUUID(String caseUUID) throws EamDbException; + CorrelationCase getCaseByUUID(String caseUUID) throws CentralRepoException; /** * Retrieves Case details based on Case ID @@ -186,14 +186,14 @@ public interface EamDb { * * @return The retrieved case */ - CorrelationCase getCaseById(int caseId) throws EamDbException; + CorrelationCase getCaseById(int caseId) throws CentralRepoException; /** * Retrieves cases that are in DB. * * @return List of cases */ - List getCases() throws EamDbException; + List getCases() throws CentralRepoException; /** * Creates new Data Source in the database @@ -203,21 +203,21 @@ public interface EamDb { * @return - A CorrelationDataSource object with data source's central * repository id */ - CorrelationDataSource newDataSource(CorrelationDataSource eamDataSource) throws EamDbException; + CorrelationDataSource newDataSource(CorrelationDataSource eamDataSource) throws CentralRepoException; /** * Updates the MD5 hash value in an existing data source in the database. * * @param eamDataSource The data source to update */ - void updateDataSourceMd5Hash(CorrelationDataSource eamDataSource) throws EamDbException; + void updateDataSourceMd5Hash(CorrelationDataSource eamDataSource) throws CentralRepoException; /** * Updates the SHA-1 hash value in an existing data source in the database. * * @param eamDataSource The data source to update */ - void updateDataSourceSha1Hash(CorrelationDataSource eamDataSource) throws EamDbException; + void updateDataSourceSha1Hash(CorrelationDataSource eamDataSource) throws CentralRepoException; /** * Updates the SHA-256 hash value in an existing data source in the @@ -225,7 +225,7 @@ public interface EamDb { * * @param eamDataSource The data source to update */ - void updateDataSourceSha256Hash(CorrelationDataSource eamDataSource) throws EamDbException; + void updateDataSourceSha256Hash(CorrelationDataSource eamDataSource) throws CentralRepoException; /** * Retrieves Data Source details based on data source device ID @@ -236,7 +236,7 @@ public interface EamDb { * * @return The data source */ - CorrelationDataSource getDataSource(CorrelationCase correlationCase, Long caseDbDataSourceId) throws EamDbException; + CorrelationDataSource getDataSource(CorrelationCase correlationCase, Long caseDbDataSourceId) throws CentralRepoException; /** * Retrieves Data Source details based on data source ID @@ -247,14 +247,14 @@ public interface EamDb { * * @return The data source */ - CorrelationDataSource getDataSourceById(CorrelationCase correlationCase, int dataSourceId) throws EamDbException; + CorrelationDataSource getDataSourceById(CorrelationCase correlationCase, int dataSourceId) throws CentralRepoException; /** * Retrieves data sources that are in DB * * @return List of data sources */ - List getDataSources() throws EamDbException; + List getDataSources() throws CentralRepoException; /** * Changes the name of a data source in the DB @@ -262,9 +262,9 @@ public interface EamDb { * @param eamDataSource The data source * @param newName The new name * - * @throws EamDbException + * @throws CentralRepoException */ - void updateDataSourceName(CorrelationDataSource eamDataSource, String newName) throws EamDbException; + void updateDataSourceName(CorrelationDataSource eamDataSource, String newName) throws CentralRepoException; /** * Inserts new Artifact(s) into the database. Should add associated Case and @@ -272,7 +272,7 @@ public interface EamDb { * * @param eamArtifact The artifact to add */ - void addArtifactInstance(CorrelationAttributeInstance eamArtifact) throws EamDbException; + void addArtifactInstance(CorrelationAttributeInstance eamArtifact) throws CentralRepoException; /** * Retrieves eamArtifact instances from the database that are associated @@ -286,9 +286,9 @@ public interface EamDb { * values * * @throws CorrelationAttributeNormalizationException - * @throws EamDbException + * @throws CentralRepoException */ - List getArtifactInstancesByTypeValues(CorrelationAttributeInstance.Type aType, List values) throws EamDbException, CorrelationAttributeNormalizationException; + List getArtifactInstancesByTypeValues(CorrelationAttributeInstance.Type aType, List values) throws CentralRepoException, CorrelationAttributeNormalizationException; /** * Retrieves eamArtifact instances from the database that are associated @@ -300,9 +300,9 @@ public interface EamDb { * @return List of artifact instances for a given type/value * * @throws CorrelationAttributeNormalizationException - * @throws EamDbException + * @throws CentralRepoException */ - List getArtifactInstancesByTypeValue(CorrelationAttributeInstance.Type aType, String value) throws EamDbException, CorrelationAttributeNormalizationException; + List getArtifactInstancesByTypeValue(CorrelationAttributeInstance.Type aType, String value) throws CentralRepoException, CorrelationAttributeNormalizationException; /** * Retrieves eamArtifact instances from the database that are associated @@ -319,9 +319,9 @@ public interface EamDb { * values for the specified cases * * @throws CorrelationAttributeNormalizationException - * @throws EamDbException + * @throws CentralRepoException */ - List getArtifactInstancesByTypeValuesAndCases(CorrelationAttributeInstance.Type aType, List values, List caseIds) throws EamDbException, CorrelationAttributeNormalizationException; + List getArtifactInstancesByTypeValuesAndCases(CorrelationAttributeInstance.Type aType, List values, List caseIds) throws CentralRepoException, CorrelationAttributeNormalizationException; /** * Retrieves number of artifact instances in the database that are @@ -333,7 +333,7 @@ public interface EamDb { * @return Number of artifact instances having ArtifactType and * ArtifactValue. */ - Long getCountArtifactInstancesByTypeValue(CorrelationAttributeInstance.Type aType, String value) throws EamDbException, CorrelationAttributeNormalizationException; + Long getCountArtifactInstancesByTypeValue(CorrelationAttributeInstance.Type aType, String value) throws CentralRepoException, CorrelationAttributeNormalizationException; /** * Calculate the percentage of data sources that have this attribute value. @@ -342,7 +342,7 @@ public interface EamDb { * * @return Int between 0 and 100 */ - int getFrequencyPercentage(CorrelationAttributeInstance corAttr) throws EamDbException, CorrelationAttributeNormalizationException; + int getFrequencyPercentage(CorrelationAttributeInstance corAttr) throws CentralRepoException, CorrelationAttributeNormalizationException; /** * Retrieves number of unique caseDisplayName / dataSource tuples in the @@ -354,14 +354,14 @@ public interface EamDb { * * @return Number of unique tuples */ - Long getCountUniqueCaseDataSourceTuplesHavingTypeValue(CorrelationAttributeInstance.Type aType, String value) throws EamDbException, CorrelationAttributeNormalizationException; + Long getCountUniqueCaseDataSourceTuplesHavingTypeValue(CorrelationAttributeInstance.Type aType, String value) throws CentralRepoException, CorrelationAttributeNormalizationException; /** * Retrieves number of data sources in the database. * * @return Number of unique data sources */ - Long getCountUniqueDataSources() throws EamDbException; + Long getCountUniqueDataSources() throws CentralRepoException; /** * Retrieves number of eamArtifact instances in the database that are @@ -372,7 +372,7 @@ public interface EamDb { * @return Number of artifact instances having caseDisplayName and * dataSource */ - Long getCountArtifactInstancesByCaseDataSource(CorrelationDataSource correlationDataSource) throws EamDbException; + Long getCountArtifactInstancesByCaseDataSource(CorrelationDataSource correlationDataSource) throws CentralRepoException; /** * Adds an eamArtifact to an internal list to be later added to DB. Artifact @@ -381,18 +381,18 @@ public interface EamDb { * * @param eamArtifact The artifact to add */ - void addAttributeInstanceBulk(CorrelationAttributeInstance eamArtifact) throws EamDbException; + void addAttributeInstanceBulk(CorrelationAttributeInstance eamArtifact) throws CentralRepoException; /** * Executes a bulk insert of the eamArtifacts added from the * addAttributeInstanceBulk() method */ - void commitAttributeInstancesBulk() throws EamDbException; + void commitAttributeInstancesBulk() throws CentralRepoException; /** * Executes a bulk insert of the cases */ - void bulkInsertCases(List cases) throws EamDbException; + void bulkInsertCases(List cases) throws CentralRepoException; /** * Update a correlation attribute instance comment in the database with that @@ -401,9 +401,9 @@ public interface EamDb { * @param eamArtifact The correlation attribute whose database instance will * be updated. * - * @throws EamDbException + * @throws CentralRepoException */ - void updateAttributeInstanceComment(CorrelationAttributeInstance eamArtifact) throws EamDbException; + void updateAttributeInstanceComment(CorrelationAttributeInstance eamArtifact) throws CentralRepoException; /** * Find a correlation attribute in the Central Repository database given the @@ -420,10 +420,10 @@ public interface EamDb { * * @return The correlation attribute if it exists; otherwise null. * - * @throws EamDbException + * @throws CentralRepoException */ CorrelationAttributeInstance getCorrelationAttributeInstance(CorrelationAttributeInstance.Type type, CorrelationCase correlationCase, - CorrelationDataSource correlationDataSource, String value, String filePath) throws EamDbException, CorrelationAttributeNormalizationException; + CorrelationDataSource correlationDataSource, String value, String filePath) throws CentralRepoException, CorrelationAttributeNormalizationException; /** * Find a correlation attribute in the Central Repository database given the @@ -437,10 +437,10 @@ public interface EamDb { * * @return The correlation attribute if it exists; otherwise null. * - * @throws EamDbException + * @throws CentralRepoException */ CorrelationAttributeInstance getCorrelationAttributeInstance(CorrelationAttributeInstance.Type type, CorrelationCase correlationCase, - CorrelationDataSource correlationDataSource, long objectID) throws EamDbException, CorrelationAttributeNormalizationException; + CorrelationDataSource correlationDataSource, long objectID) throws CentralRepoException, CorrelationAttributeNormalizationException; /** * Sets an eamArtifact instance to the given known status. If eamArtifact @@ -449,7 +449,7 @@ public interface EamDb { * @param eamArtifact Artifact containing exactly one (1) ArtifactInstance. * @param knownStatus The status to change the artifact to */ - void setAttributeInstanceKnownStatus(CorrelationAttributeInstance eamArtifact, TskData.FileKnown knownStatus) throws EamDbException; + void setAttributeInstanceKnownStatus(CorrelationAttributeInstance eamArtifact, TskData.FileKnown knownStatus) throws CentralRepoException; /** * Count matching eamArtifacts instances that have knownStatus = "Bad". @@ -459,7 +459,7 @@ public interface EamDb { * * @return Number of matching eamArtifacts */ - Long getCountArtifactInstancesKnownBad(CorrelationAttributeInstance.Type aType, String value) throws EamDbException, CorrelationAttributeNormalizationException; + Long getCountArtifactInstancesKnownBad(CorrelationAttributeInstance.Type aType, String value) throws CentralRepoException, CorrelationAttributeNormalizationException; /** * Gets list of distinct case display names, where each case has 1+ Artifact @@ -471,9 +471,9 @@ public interface EamDb { * @return List of cases containing this artifact with instances marked as * bad * - * @throws EamDbException + * @throws CentralRepoException */ - List getListCasesHavingArtifactInstancesKnownBad(CorrelationAttributeInstance.Type aType, String value) throws EamDbException, CorrelationAttributeNormalizationException; + List getListCasesHavingArtifactInstancesKnownBad(CorrelationAttributeInstance.Type aType, String value) throws CentralRepoException, CorrelationAttributeNormalizationException; /** * Gets list of distinct case display names, where each case has 1+ Artifact @@ -485,18 +485,18 @@ public interface EamDb { * @return List of cases containing this artifact with instances marked as * bad * - * @throws EamDbException + * @throws CentralRepoException */ - List getListCasesHavingArtifactInstances(CorrelationAttributeInstance.Type aType, String value) throws EamDbException, CorrelationAttributeNormalizationException; + List getListCasesHavingArtifactInstances(CorrelationAttributeInstance.Type aType, String value) throws CentralRepoException, CorrelationAttributeNormalizationException; /** * Remove a reference set and all values contained in it. * * @param referenceSetID * - * @throws EamDbException + * @throws CentralRepoException */ - public void deleteReferenceSet(int referenceSetID) throws EamDbException; + public void deleteReferenceSet(int referenceSetID) throws CentralRepoException; /** * Check whether a reference set with the given parameters exists in the @@ -509,9 +509,9 @@ public interface EamDb { * * @return true if a matching entry exists in the central repository * - * @throws EamDbException + * @throws CentralRepoException */ - public boolean referenceSetIsValid(int referenceSetID, String referenceSetName, String version) throws EamDbException; + public boolean referenceSetIsValid(int referenceSetID, String referenceSetName, String version) throws CentralRepoException; /** * Check whether a reference set with the given name/version is in the @@ -523,9 +523,9 @@ public interface EamDb { * * @return true if a matching set is found * - * @throws EamDbException + * @throws CentralRepoException */ - public boolean referenceSetExists(String referenceSetName, String version) throws EamDbException; + public boolean referenceSetExists(String referenceSetName, String version) throws CentralRepoException; /** * Check if the given file hash is in this reference set. Only searches the @@ -536,9 +536,9 @@ public interface EamDb { * * @return true if the hash is found in the reference set * - * @throws EamDbException + * @throws CentralRepoException */ - public boolean isFileHashInReferenceSet(String hash, int referenceSetID) throws EamDbException, CorrelationAttributeNormalizationException; + public boolean isFileHashInReferenceSet(String hash, int referenceSetID) throws CentralRepoException, CorrelationAttributeNormalizationException; /** * Check if the given value is in a specific reference set @@ -549,7 +549,7 @@ public interface EamDb { * * @return true if the hash is found in the reference set */ - public boolean isValueInReferenceSet(String value, int referenceSetID, int correlationTypeID) throws EamDbException, CorrelationAttributeNormalizationException; + public boolean isValueInReferenceSet(String value, int referenceSetID, int correlationTypeID) throws CentralRepoException, CorrelationAttributeNormalizationException; /** * Is the artifact known as bad according to the reference entries? @@ -559,7 +559,7 @@ public interface EamDb { * * @return Global known status of the artifact */ - boolean isArtifactKnownBadByReference(CorrelationAttributeInstance.Type aType, String value) throws EamDbException, CorrelationAttributeNormalizationException; + boolean isArtifactKnownBadByReference(CorrelationAttributeInstance.Type aType, String value) throws CentralRepoException, CorrelationAttributeNormalizationException; /** * Add a new organization @@ -568,18 +568,18 @@ public interface EamDb { * * @return The organization with the org ID set. * - * @throws EamDbException + * @throws CentralRepoException */ - EamOrganization newOrganization(EamOrganization eamOrg) throws EamDbException; + CentralRepoOrganization newOrganization(CentralRepoOrganization eamOrg) throws CentralRepoException; /** * Get all organizations * * @return A list of all organizations * - * @throws EamDbException + * @throws CentralRepoException */ - List getOrganizations() throws EamDbException; + List getOrganizations() throws CentralRepoException; /** * Get an organization having the given ID @@ -588,9 +588,9 @@ public interface EamDb { * * @return The organization with the given ID * - * @throws EamDbException + * @throws CentralRepoException */ - EamOrganization getOrganizationByID(int orgID) throws EamDbException; + CentralRepoOrganization getOrganizationByID(int orgID) throws CentralRepoException; /** * Get the organization associated with the given reference set. @@ -599,9 +599,9 @@ public interface EamDb { * * @return The organization object * - * @throws EamDbException + * @throws CentralRepoException */ - EamOrganization getReferenceSetOrganization(int referenceSetID) throws EamDbException; + CentralRepoOrganization getReferenceSetOrganization(int referenceSetID) throws CentralRepoException; /** * Update an existing organization. @@ -609,18 +609,18 @@ public interface EamDb { * @param updatedOrganization the values the Organization with the same ID * will be updated to in the database. * - * @throws EamDbException + * @throws CentralRepoException */ - void updateOrganization(EamOrganization updatedOrganization) throws EamDbException; + void updateOrganization(CentralRepoOrganization updatedOrganization) throws CentralRepoException; /** * Delete an organization if it is not being used by any case. * * @param organizationToDelete the organization to be deleted * - * @throws EamDbException + * @throws CentralRepoException */ - void deleteOrganization(EamOrganization organizationToDelete) throws EamDbException; + void deleteOrganization(CentralRepoOrganization organizationToDelete) throws CentralRepoException; /** * Add a new Global Set @@ -629,9 +629,9 @@ public interface EamDb { * * @return The ID of the new global set * - * @throws EamDbException + * @throws CentralRepoException */ - int newReferenceSet(EamGlobalSet eamGlobalSet) throws EamDbException; + int newReferenceSet(CentralRepoFileSet eamGlobalSet) throws CentralRepoException; /** * Get a global set by ID @@ -640,9 +640,9 @@ public interface EamDb { * * @return The global set associated with the ID * - * @throws EamDbException + * @throws CentralRepoException */ - EamGlobalSet getReferenceSetByID(int globalSetID) throws EamDbException; + CentralRepoFileSet getReferenceSetByID(int globalSetID) throws CentralRepoException; /** * Get all reference sets @@ -651,9 +651,9 @@ public interface EamDb { * * @return List of all reference sets in the central repository * - * @throws EamDbException + * @throws CentralRepoException */ - List getAllReferenceSets(CorrelationAttributeInstance.Type correlationType) throws EamDbException; + List getAllReferenceSets(CorrelationAttributeInstance.Type correlationType) throws CentralRepoException; /** * Add a new reference instance @@ -662,9 +662,9 @@ public interface EamDb { * @param correlationType Correlation Type that this Reference * Instance is * - * @throws EamDbException + * @throws CentralRepoException */ - void addReferenceInstance(EamGlobalFileInstance eamGlobalFileInstance, CorrelationAttributeInstance.Type correlationType) throws EamDbException; + void addReferenceInstance(CentralRepoFileInstance eamGlobalFileInstance, CorrelationAttributeInstance.Type correlationType) throws CentralRepoException; /** * Insert the bulk collection of Global File Instances @@ -673,9 +673,9 @@ public interface EamDb { * db. * @param contentType the Type of the global instances * - * @throws EamDbException + * @throws CentralRepoException */ - void bulkInsertReferenceTypeEntries(Set globalInstances, CorrelationAttributeInstance.Type contentType) throws EamDbException; + void bulkInsertReferenceTypeEntries(Set globalInstances, CorrelationAttributeInstance.Type contentType) throws CentralRepoException; /** * Get all reference entries having a given correlation type and value @@ -685,9 +685,9 @@ public interface EamDb { * * @return List of all global file instances with a type and value * - * @throws EamDbException + * @throws CentralRepoException */ - List getReferenceInstancesByTypeValue(CorrelationAttributeInstance.Type aType, String aValue) throws EamDbException, CorrelationAttributeNormalizationException; + List getReferenceInstancesByTypeValue(CorrelationAttributeInstance.Type aType, String aValue) throws CentralRepoException, CorrelationAttributeNormalizationException; /** * Add a new EamArtifact.Type to the db. @@ -696,9 +696,9 @@ public interface EamDb { * * @return Type.ID for newType * - * @throws EamDbException + * @throws CentralRepoException */ - int newCorrelationType(CorrelationAttributeInstance.Type newType) throws EamDbException; + int newCorrelationType(CorrelationAttributeInstance.Type newType) throws CentralRepoException; /** * Get the list of EamArtifact.Type's that are defined in the DB and can be @@ -707,9 +707,9 @@ public interface EamDb { * @return List of EamArtifact.Type's. If none are defined in the database, * the default list will be returned. * - * @throws EamDbException + * @throws CentralRepoException */ - List getDefinedCorrelationTypes() throws EamDbException; + List getDefinedCorrelationTypes() throws CentralRepoException; /** * Get the list of enabled EamArtifact.Type's that will be used to correlate @@ -718,9 +718,9 @@ public interface EamDb { * @return List of enabled EamArtifact.Type's. If none are defined in the * database, the default list will be returned. * - * @throws EamDbException + * @throws CentralRepoException */ - List getEnabledCorrelationTypes() throws EamDbException; + List getEnabledCorrelationTypes() throws CentralRepoException; /** * Get the list of supported EamArtifact.Type's that can be used to @@ -729,18 +729,18 @@ public interface EamDb { * @return List of supported EamArtifact.Type's. If none are defined in the * database, the default list will be returned. * - * @throws EamDbException + * @throws CentralRepoException */ - List getSupportedCorrelationTypes() throws EamDbException; + List getSupportedCorrelationTypes() throws CentralRepoException; /** * Update a EamArtifact.Type. * * @param aType EamArtifact.Type to update. * - * @throws EamDbException + * @throws CentralRepoException */ - void updateCorrelationType(CorrelationAttributeInstance.Type aType) throws EamDbException; + void updateCorrelationType(CorrelationAttributeInstance.Type aType) throws CentralRepoException; /** * Get the EamArtifact.Type that has the given Type.Id. @@ -749,16 +749,16 @@ public interface EamDb { * * @return EamArtifact.Type or null if it doesn't exist. * - * @throws EamDbException + * @throws CentralRepoException */ - CorrelationAttributeInstance.Type getCorrelationTypeById(int typeId) throws EamDbException; + CorrelationAttributeInstance.Type getCorrelationTypeById(int typeId) throws CentralRepoException; /** * Upgrade the schema of the database (if needed) * - * @throws EamDbException + * @throws CentralRepoException */ - public void upgradeSchema() throws EamDbException, SQLException, IncompatibleCentralRepoException; + public void upgradeSchema() throws CentralRepoException, SQLException, IncompatibleCentralRepoException; /** * Gets an exclusive lock (if applicable). Will return the lock if @@ -768,10 +768,10 @@ public interface EamDb { * * @return the lock, or null if locking is not supported * - * @throws EamDbException if the coordination service is running but we fail + * @throws CentralRepoException if the coordination service is running but we fail * to get the lock */ - public CoordinationService.Lock getExclusiveMultiUserDbLock() throws EamDbException; + public CoordinationService.Lock getExclusiveMultiUserDbLock() throws CentralRepoException; /** * Process the Artifact instance in the EamDb @@ -779,9 +779,9 @@ public interface EamDb { * @param type EamArtifact.Type to search for * @param instanceTableCallback callback to process the instance * - * @throws EamDbException + * @throws CentralRepoException */ - void processInstanceTable(CorrelationAttributeInstance.Type type, InstanceTableCallback instanceTableCallback) throws EamDbException; + void processInstanceTable(CorrelationAttributeInstance.Type type, InstanceTableCallback instanceTableCallback) throws CentralRepoException; /** * Process the Artifact instance in the EamDb @@ -790,9 +790,9 @@ public interface EamDb { * @param instanceTableCallback callback to process the instance * @param whereClause query string to execute * - * @throws EamDbException + * @throws CentralRepoException */ - void processInstanceTableWhere(CorrelationAttributeInstance.Type type, String whereClause, InstanceTableCallback instanceTableCallback) throws EamDbException; + void processInstanceTableWhere(CorrelationAttributeInstance.Type type, String whereClause, InstanceTableCallback instanceTableCallback) throws CentralRepoException; /** * Process a SELECT query @@ -800,7 +800,7 @@ public interface EamDb { * @param selectClause query string to execute * @param instanceTableCallback callback to process the instance * - * @throws EamDbException + * @throws CentralRepoException */ - public void processSelectClause(String selectClause, InstanceTableCallback instanceTableCallback) throws EamDbException; + public void processSelectClause(String selectClause, InstanceTableCallback instanceTableCallback) throws CentralRepoException; } diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/CorrelationAttributeInstance.java b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/CorrelationAttributeInstance.java index 727b5ecb0b..f13b27787d 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/CorrelationAttributeInstance.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/CorrelationAttributeInstance.java @@ -58,7 +58,7 @@ public class CorrelationAttributeInstance implements Serializable { String filePath, String comment, TskData.FileKnown knownStatus, - long fileObjectId) throws EamDbException, CorrelationAttributeNormalizationException { + long fileObjectId) throws CentralRepoException, CorrelationAttributeNormalizationException { this(correlationType, correlationValue, -1, eamCase, eamDataSource, filePath, comment, knownStatus, fileObjectId); } @@ -72,9 +72,9 @@ public class CorrelationAttributeInstance implements Serializable { String comment, TskData.FileKnown knownStatus, Long fileObjectId - ) throws EamDbException, CorrelationAttributeNormalizationException { + ) throws CentralRepoException, CorrelationAttributeNormalizationException { if (filePath == null) { - throw new EamDbException("file path is null"); + throw new CentralRepoException("file path is null"); } this.correlationType = type; @@ -224,7 +224,7 @@ public class CorrelationAttributeInstance implements Serializable { /** * Load the default correlation types * - * @throws EamDbException if the Type's dbTableName has invalid + * @throws CentralRepoException if the Type's dbTableName has invalid * characters/format */ @Messages({"CorrelationType.FILES.displayName=Files", @@ -237,7 +237,7 @@ public class CorrelationAttributeInstance implements Serializable { "CorrelationType.IMEI.displayName=IMEI Number", "CorrelationType.IMSI.displayName=IMSI Number", "CorrelationType.ICCID.displayName=ICCID Number"}) - public static List getDefaultCorrelationTypes() throws EamDbException { + public static List getDefaultCorrelationTypes() throws CentralRepoException { List DEFAULT_CORRELATION_TYPES = new ArrayList<>(); DEFAULT_CORRELATION_TYPES.add(new CorrelationAttributeInstance.Type(FILES_TYPE_ID, Bundle.CorrelationType_FILES_displayName(), "file", true, true)); // NON-NLS DEFAULT_CORRELATION_TYPES.add(new CorrelationAttributeInstance.Type(DOMAIN_TYPE_ID, Bundle.CorrelationType_DOMAIN_displayName(), "domain", true, true)); // NON-NLS @@ -278,9 +278,9 @@ public class CorrelationAttributeInstance implements Serializable { */ @Messages({"CorrelationAttributeInstance.nullName.message=Database name is null.", "CorrelationAttributeInstance.invalidName.message=Invalid database table name. Name must start with a lowercase letter and can only contain lowercase letters, numbers, and '_'."}) - public Type(int typeId, String displayName, String dbTableName, Boolean supported, Boolean enabled) throws EamDbException { + public Type(int typeId, String displayName, String dbTableName, Boolean supported, Boolean enabled) throws CentralRepoException { if (dbTableName == null) { - throw new EamDbException("dbTableName is null", Bundle.CorrelationAttributeInstance_nullName_message()); + throw new CentralRepoException("dbTableName is null", Bundle.CorrelationAttributeInstance_nullName_message()); } this.typeId = typeId; this.displayName = displayName; @@ -288,7 +288,7 @@ public class CorrelationAttributeInstance implements Serializable { this.supported = supported; this.enabled = enabled; if (!Pattern.matches(DB_NAMES_REGEX, dbTableName)) { - throw new EamDbException("Invalid database table name. Name must start with a lowercase letter and can only contain lowercase letters, numbers, and '_'.", Bundle.CorrelationAttributeInstance_invalidName_message()); // NON-NLS + throw new CentralRepoException("Invalid database table name. Name must start with a lowercase letter and can only contain lowercase letters, numbers, and '_'.", Bundle.CorrelationAttributeInstance_invalidName_message()); // NON-NLS } } @@ -305,7 +305,7 @@ public class CorrelationAttributeInstance implements Serializable { * @param supported Is this Type currently supported * @param enabled Is this Type currently enabled. */ - public Type(String displayName, String dbTableName, Boolean supported, Boolean enabled) throws EamDbException { + public Type(String displayName, String dbTableName, Boolean supported, Boolean enabled) throws CentralRepoException { this(-1, displayName, dbTableName, supported, enabled); } @@ -468,11 +468,11 @@ public class CorrelationAttributeInstance implements Serializable { * letter and can only contain lowercase letters, * numbers, and '_' characters. * - * @throws EamDbException if dbTableName contains invalid characters + * @throws CentralRepoException if dbTableName contains invalid characters */ - public void setDbTableName(String dbTableName) throws EamDbException { + public void setDbTableName(String dbTableName) throws CentralRepoException { if (!Pattern.matches(DB_NAMES_REGEX, dbTableName)) { - throw new EamDbException("Invalid database table name. Name must start with a lowercase letter and can only contain lowercase letters, numbers, and '_'."); // NON-NLS + throw new CentralRepoException("Invalid database table name. Name must start with a lowercase letter and can only contain lowercase letters, numbers, and '_'."); // NON-NLS } this.dbTableName = dbTableName; } diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/CorrelationAttributeNormalizer.java b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/CorrelationAttributeNormalizer.java index 08ed088cf1..4e5811a0c8 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/CorrelationAttributeNormalizer.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/CorrelationAttributeNormalizer.java @@ -103,7 +103,7 @@ final public class CorrelationAttributeNormalizer { } else { throw new CorrelationAttributeNormalizationException(String.format("Given attributeTypeId did not correspond to any known Attribute: %s", attributeTypeId)); } - } catch (EamDbException ex) { + } catch (CentralRepoException ex) { throw new CorrelationAttributeNormalizationException(ex); } } diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/EamArtifactUtil.java b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/CorrelationAttributeUtil.java similarity index 89% rename from Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/EamArtifactUtil.java rename to Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/CorrelationAttributeUtil.java index 18a21d0ab6..07eb454ac5 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/EamArtifactUtil.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/CorrelationAttributeUtil.java @@ -1,7 +1,7 @@ /* * Central Repository * - * Copyright 2015-2019 Basis Technology Corp. + * Copyright 2015-2020 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -38,9 +38,9 @@ import org.sleuthkit.datamodel.TskData; /** * Utility class for correlation attributes in the central repository */ -public class EamArtifactUtil { +public class CorrelationAttributeUtil { - private static final Logger logger = Logger.getLogger(EamArtifactUtil.class.getName()); + private static final Logger logger = Logger.getLogger(CorrelationAttributeUtil.class.getName()); @Messages({"EamArtifactUtil.emailaddresses.text=Email Addresses"}) public static String getEmailAddressAttrString() { @@ -78,7 +78,7 @@ public class EamArtifactUtil { if (artifactTypeID == ARTIFACT_TYPE.TSK_KEYWORD_HIT.getTypeID()) { BlackboardAttribute setNameAttr = artifactForInstance.getAttribute(new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_SET_NAME)); if (setNameAttr != null - && EamArtifactUtil.getEmailAddressAttrString().equals(setNameAttr.getValueString())) { + && CorrelationAttributeUtil.getEmailAddressAttrString().equals(setNameAttr.getValueString())) { addCorrelationAttributeToList(eamArtifacts, artifactForInstance, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_KEYWORD, CorrelationAttributeInstance.EMAIL_TYPE_ID); } } else if (artifactTypeID == ARTIFACT_TYPE.TSK_WEB_BOOKMARK.getTypeID() @@ -108,7 +108,7 @@ public class EamArtifactUtil { // Only add the correlation attribute if the resulting phone number large enough to be of use // (these 3-5 digit numbers can be valid, but are not useful for correlation) if (value.length() > 5) { - CorrelationAttributeInstance inst = makeCorrelationAttributeInstanceUsingTypeValue(artifactForInstance, EamDb.getInstance().getCorrelationTypeById(CorrelationAttributeInstance.PHONE_TYPE_ID), value); + CorrelationAttributeInstance inst = makeCorrelationAttributeInstanceUsingTypeValue(artifactForInstance, CentralRepository.getInstance().getCorrelationTypeById(CorrelationAttributeInstance.PHONE_TYPE_ID), value); if (inst != null) { eamArtifacts.add(inst); } @@ -135,7 +135,7 @@ public class EamArtifactUtil { addCorrelationAttributeToList(eamArtifacts, artifactForInstance, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_EMAIL, CorrelationAttributeInstance.EMAIL_TYPE_ID); } } - } catch (EamDbException ex) { + } catch (CentralRepoException ex) { logger.log(Level.SEVERE, "Error getting defined correlation types.", ex); // NON-NLS return eamArtifacts; } catch (TskCoreException ex) { @@ -163,15 +163,15 @@ public class EamArtifactUtil { * @param typeId the integer type id of the * CorrelationAttributeInstance type * - * @throws EamDbException + * @throws CentralRepoException * @throws TskCoreException */ - private static void addCorrelationAttributeToList(List eamArtifacts, BlackboardArtifact artifact, ATTRIBUTE_TYPE bbAttributeType, int typeId) throws EamDbException, TskCoreException { + private static void addCorrelationAttributeToList(List eamArtifacts, BlackboardArtifact artifact, ATTRIBUTE_TYPE bbAttributeType, int typeId) throws CentralRepoException, TskCoreException { BlackboardAttribute attribute = artifact.getAttribute(new BlackboardAttribute.Type(bbAttributeType)); if (attribute != null) { String value = attribute.getValueString(); if ((null != value) && (value.isEmpty() == false)) { - CorrelationAttributeInstance inst = makeCorrelationAttributeInstanceUsingTypeValue(artifact, EamDb.getInstance().getCorrelationTypeById(typeId), value); + CorrelationAttributeInstance inst = makeCorrelationAttributeInstanceUsingTypeValue(artifact, CentralRepository.getInstance().getCorrelationTypeById(typeId), value); if (inst != null) { eamArtifacts.add(inst); } @@ -200,7 +200,7 @@ public class EamArtifactUtil { } // make an instance for the BB source file - CorrelationCase correlationCase = EamDb.getInstance().getCase(Case.getCurrentCaseThrows()); + CorrelationCase correlationCase = CentralRepository.getInstance().getCase(Case.getCurrentCaseThrows()); return new CorrelationAttributeInstance( correlationType, value, @@ -214,7 +214,7 @@ public class EamArtifactUtil { } catch (TskCoreException ex) { logger.log(Level.SEVERE, "Error getting AbstractFile for artifact: " + bbArtifact.toString(), ex); // NON-NLS return null; - } catch (EamDbException | CorrelationAttributeNormalizationException ex) { + } catch (CentralRepoException | CorrelationAttributeNormalizationException ex) { logger.log(Level.WARNING, "Error creating artifact instance for artifact: " + bbArtifact.toString(), ex); // NON-NLS return null; } catch (NoCurrentCaseException ex) { @@ -247,14 +247,14 @@ public class EamArtifactUtil { CorrelationDataSource correlationDataSource; try { - type = EamDb.getInstance().getCorrelationTypeById(CorrelationAttributeInstance.FILES_TYPE_ID); - correlationCase = EamDb.getInstance().getCase(Case.getCurrentCaseThrows()); + type = CentralRepository.getInstance().getCorrelationTypeById(CorrelationAttributeInstance.FILES_TYPE_ID); + correlationCase = CentralRepository.getInstance().getCase(Case.getCurrentCaseThrows()); if (null == correlationCase) { //if the correlationCase is not in the Central repo then attributes generated in relation to it will not be return null; } correlationDataSource = CorrelationDataSource.fromTSKDataSource(correlationCase, file.getDataSource()); - } catch (TskCoreException | EamDbException ex) { + } catch (TskCoreException | CentralRepoException ex) { logger.log(Level.SEVERE, "Error retrieving correlation attribute.", ex); return null; } catch (NoCurrentCaseException ex) { @@ -264,8 +264,8 @@ public class EamArtifactUtil { CorrelationAttributeInstance correlationAttributeInstance; try { - correlationAttributeInstance = EamDb.getInstance().getCorrelationAttributeInstance(type, correlationCase, correlationDataSource, file.getId()); - } catch (EamDbException | CorrelationAttributeNormalizationException ex) { + correlationAttributeInstance = CentralRepository.getInstance().getCorrelationAttributeInstance(type, correlationCase, correlationDataSource, file.getId()); + } catch (CentralRepoException | CorrelationAttributeNormalizationException ex) { logger.log(Level.WARNING, String.format( "Correlation attribute could not be retrieved for '%s' (id=%d): ", content.getName(), content.getId()), ex); @@ -275,8 +275,8 @@ public class EamArtifactUtil { if (correlationAttributeInstance == null && file.getMd5Hash() != null) { String filePath = (file.getParentPath() + file.getName()).toLowerCase(); try { - correlationAttributeInstance = EamDb.getInstance().getCorrelationAttributeInstance(type, correlationCase, correlationDataSource, file.getMd5Hash(), filePath); - } catch (EamDbException | CorrelationAttributeNormalizationException ex) { + correlationAttributeInstance = CentralRepository.getInstance().getCorrelationAttributeInstance(type, correlationCase, correlationDataSource, file.getMd5Hash(), filePath); + } catch (CentralRepoException | CorrelationAttributeNormalizationException ex) { logger.log(Level.WARNING, String.format( "Correlation attribute could not be retrieved for '%s' (id=%d): ", content.getName(), content.getId()), ex); @@ -319,9 +319,9 @@ public class EamArtifactUtil { } try { - CorrelationAttributeInstance.Type filesType = EamDb.getInstance().getCorrelationTypeById(CorrelationAttributeInstance.FILES_TYPE_ID); + CorrelationAttributeInstance.Type filesType = CentralRepository.getInstance().getCorrelationTypeById(CorrelationAttributeInstance.FILES_TYPE_ID); - CorrelationCase correlationCase = EamDb.getInstance().getCase(Case.getCurrentCaseThrows()); + CorrelationCase correlationCase = CentralRepository.getInstance().getCase(Case.getCurrentCaseThrows()); return new CorrelationAttributeInstance( filesType, af.getMd5Hash(), @@ -332,7 +332,7 @@ public class EamArtifactUtil { TskData.FileKnown.UNKNOWN, af.getId()); - } catch (TskCoreException | EamDbException | CorrelationAttributeNormalizationException ex) { + } catch (TskCoreException | CentralRepoException | CorrelationAttributeNormalizationException ex) { logger.log(Level.SEVERE, "Error making correlation attribute.", ex); return null; } catch (NoCurrentCaseException ex) { @@ -377,7 +377,7 @@ public class EamArtifactUtil { /** * Constructs a new EamArtifactUtil */ - private EamArtifactUtil() { + private CorrelationAttributeUtil() { //empty constructor } } diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/CorrelationCase.java b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/CorrelationCase.java index 284b351c68..3d843e0c77 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/CorrelationCase.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/CorrelationCase.java @@ -36,7 +36,7 @@ public class CorrelationCase implements Serializable { private int databaseId; private String caseUUID; // globally unique - private EamOrganization org; + private CentralRepoOrganization org; private String displayName; private String creationDate; private String caseNumber; @@ -56,7 +56,7 @@ public class CorrelationCase implements Serializable { CorrelationCase(int ID, String caseUUID, - EamOrganization org, + CentralRepoOrganization org, String displayName, String creationDate, String caseNumber, @@ -172,14 +172,14 @@ public class CorrelationCase implements Serializable { /** * @return the org */ - public EamOrganization getOrg() { + public CentralRepoOrganization getOrg() { return org; } /** * @param org the org to set */ - public void setOrg(EamOrganization org) { + public void setOrg(CentralRepoOrganization org) { this.org = org; } diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/CorrelationDataSource.java b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/CorrelationDataSource.java index 8b8ed63699..ac17a1e962 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/CorrelationDataSource.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/CorrelationDataSource.java @@ -108,20 +108,20 @@ public class CorrelationDataSource implements Serializable { * * @return * - * @throws EamDbException + * @throws CentralRepoException */ - public static CorrelationDataSource fromTSKDataSource(CorrelationCase correlationCase, Content dataSource) throws EamDbException { + public static CorrelationDataSource fromTSKDataSource(CorrelationCase correlationCase, Content dataSource) throws CentralRepoException { Case curCase; try { curCase = Case.getCurrentCaseThrows(); } catch (NoCurrentCaseException ex) { - throw new EamDbException("Autopsy case is closed"); + throw new CentralRepoException("Autopsy case is closed"); } CorrelationDataSource correlationDataSource = null; - boolean useCR = EamDb.isEnabled(); + boolean useCR = CentralRepository.isEnabled(); if (useCR) { - correlationDataSource = EamDb.getInstance().getDataSource(correlationCase, dataSource.getId()); + correlationDataSource = CentralRepository.getInstance().getDataSource(correlationCase, dataSource.getId()); } if (correlationDataSource == null) { @@ -139,13 +139,13 @@ public class CorrelationDataSource implements Serializable { sha256 = image.getSha256(); } } catch (TskDataException | TskCoreException ex) { - throw new EamDbException("Error getting data source info: " + ex.getMessage()); + throw new CentralRepoException("Error getting data source info: " + ex.getMessage()); } correlationDataSource = new CorrelationDataSource(correlationCase, deviceId, dataSource.getName(), dataSource.getId(), md5, sha1, sha256); if (useCR) { //add the correlation data source to the central repository and fill in the Central repository data source id in the object - correlationDataSource = EamDb.getInstance().newDataSource(correlationDataSource); + correlationDataSource = CentralRepository.getInstance().newDataSource(correlationDataSource); } } return correlationDataSource; @@ -217,15 +217,14 @@ public class CorrelationDataSource implements Serializable { * Set the MD5 hash value and persist to the Central Repository if available. * * @param md5Hash The MD5 hash value. - * - * @exception EamDbException If there's an issue updating the Central - * Repository. + * @throws CentralRepoException If there's an issue updating the Central + Repository. */ - public void setMd5(String md5Hash) throws EamDbException { + public void setMd5(String md5Hash) throws CentralRepoException { this.md5Hash = md5Hash; if (dataSourceObjectID != -1) { - EamDb.getInstance().updateDataSourceMd5Hash(this); + CentralRepository.getInstance().updateDataSourceMd5Hash(this); } } @@ -242,11 +241,11 @@ public class CorrelationDataSource implements Serializable { * * @param sha1Hash The SHA-1 hash value. */ - public void setSha1(String sha1Hash) throws EamDbException { + public void setSha1(String sha1Hash) throws CentralRepoException { this.sha1Hash = sha1Hash; if (dataSourceObjectID != -1) { - EamDb.getInstance().updateDataSourceSha1Hash(this); + CentralRepository.getInstance().updateDataSourceSha1Hash(this); } } @@ -263,11 +262,11 @@ public class CorrelationDataSource implements Serializable { * * @param sha256Hash The SHA-256 hash value. */ - public void setSha256(String sha256Hash) throws EamDbException { + public void setSha256(String sha256Hash) throws CentralRepoException { this.sha256Hash = sha256Hash; if (dataSourceObjectID != -1) { - EamDb.getInstance().updateDataSourceSha256Hash(this); + CentralRepository.getInstance().updateDataSourceSha256Hash(this); } } } diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/DataSourceUpdateService.java b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/DataSourceUpdateService.java index f1e52b03e4..2450ca3440 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/DataSourceUpdateService.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/DataSourceUpdateService.java @@ -41,9 +41,9 @@ public class DataSourceUpdateService implements AutopsyService { @Override public void openCaseResources(CaseContext context) throws AutopsyServiceException { - if (EamDb.isEnabled()) { + if (CentralRepository.isEnabled()) { try { - EamDb centralRepository = EamDb.getInstance(); + CentralRepository centralRepository = CentralRepository.getInstance(); CorrelationCase correlationCase = centralRepository.getCase(context.getCase()); //if the case isn't in the central repository yet there won't be data sources in it to update if (correlationCase != null) { @@ -59,7 +59,7 @@ public class DataSourceUpdateService implements AutopsyService { } } } - } catch (EamDbException | TskCoreException ex) { + } catch (CentralRepoException | TskCoreException ex) { throw new AutopsyServiceException("Unabe to update datasources in central repository", ex); } } diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/PostgresEamDb.java b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/PostgresCentralRepo.java similarity index 80% rename from Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/PostgresEamDb.java rename to Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/PostgresCentralRepo.java index dabfeba7a1..42772a9bd3 100755 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/PostgresEamDb.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/PostgresCentralRepo.java @@ -33,30 +33,30 @@ import org.sleuthkit.autopsy.coreutils.Logger; /** * Central Repository database implementation using Postgres as a backend */ -final class PostgresEamDb extends AbstractSqlEamDb { +final class PostgresCentralRepo extends RdbmsCentralRepo { - private final static Logger LOGGER = Logger.getLogger(PostgresEamDb.class.getName()); + private final static Logger LOGGER = Logger.getLogger(PostgresCentralRepo.class.getName()); private final static String CONFLICT_CLAUSE = "ON CONFLICT DO NOTHING"; - private static PostgresEamDb instance; + private static PostgresCentralRepo instance; private static final int CONN_POOL_SIZE = 10; private BasicDataSource connectionPool = null; - private final PostgresEamDbSettings dbSettings; + private final PostgresCentralRepoSettings dbSettings; /** * Get the singleton instance of PostgresEamDb * * @return the singleton instance of PostgresEamDb * - * @throws EamDbException if one or more default correlation type(s) have an + * @throws CentralRepoException if one or more default correlation type(s) have an * invalid db table name. */ - public synchronized static PostgresEamDb getInstance() throws EamDbException { + public synchronized static PostgresCentralRepo getInstance() throws CentralRepoException { if (instance == null) { - instance = new PostgresEamDb(); + instance = new PostgresCentralRepo(); } return instance; @@ -64,17 +64,17 @@ final class PostgresEamDb extends AbstractSqlEamDb { /** * - * @throws EamDbException if the AbstractSqlEamDb class has one or more + * @throws CentralRepoException if the AbstractSqlEamDb class has one or more * default correlation type(s) having an invalid db * table name. */ - private PostgresEamDb() throws EamDbException { - dbSettings = new PostgresEamDbSettings(); + private PostgresCentralRepo() throws CentralRepoException { + dbSettings = new PostgresCentralRepoSettings(); bulkArtifactsThreshold = dbSettings.getBulkThreshold(); } @Override - public void shutdownConnections() throws EamDbException { + public void shutdownConnections() throws CentralRepoException { try { synchronized (this) { if (connectionPool != null) { @@ -84,7 +84,7 @@ final class PostgresEamDb extends AbstractSqlEamDb { clearCaches(); } } catch (SQLException ex) { - throw new EamDbException("Failed to close existing database connections.", ex); // NON-NLS + throw new CentralRepoException("Failed to close existing database connections.", ex); // NON-NLS } } @@ -104,7 +104,7 @@ final class PostgresEamDb extends AbstractSqlEamDb { } @Override - public void reset() throws EamDbException { + public void reset() throws CentralRepoException { Connection conn = connect(); try { @@ -128,7 +128,7 @@ final class PostgresEamDb extends AbstractSqlEamDb { } catch (SQLException ex) { LOGGER.log(Level.WARNING, "Failed to reset database.", ex); } finally { - EamDbUtil.closeConnection(conn); + CentralRepoDbUtil.closeConnection(conn); } dbSettings.insertDefaultDatabaseContent(); @@ -138,7 +138,7 @@ final class PostgresEamDb extends AbstractSqlEamDb { * Setup a connection pool for db connections. * */ - private void setupConnectionPool() throws EamDbException { + private void setupConnectionPool() throws CentralRepoException { connectionPool = new BasicDataSource(); connectionPool.setUsername(dbSettings.getUserName()); connectionPool.setPassword(dbSettings.getPassword()); @@ -169,10 +169,10 @@ final class PostgresEamDb extends AbstractSqlEamDb { * * @return A connection from the connection pool. * - * @throws EamDbException + * @throws CentralRepoException */ @Override - protected Connection connect(boolean foreignKeys) throws EamDbException { + protected Connection connect(boolean foreignKeys) throws CentralRepoException { //foreignKeys boolean is ignored for postgres return connect(); } @@ -182,15 +182,15 @@ final class PostgresEamDb extends AbstractSqlEamDb { * * @return A connection from the connection pool. * - * @throws EamDbException + * @throws CentralRepoException */ @Messages({"PostgresEamDb.centralRepoDisabled.message=Central Repository module is not enabled.", "PostgresEamDb.connectionFailed.message=Error getting connection to database."}) @Override - protected Connection connect() throws EamDbException { + protected Connection connect() throws CentralRepoException { synchronized (this) { - if (!EamDb.isEnabled()) { - throw new EamDbException("Central Repository module is not enabled", Bundle.PostgresEamDb_centralRepoDisabled_message()); // NON-NLS + if (!CentralRepository.isEnabled()) { + throw new CentralRepoException("Central Repository module is not enabled", Bundle.PostgresEamDb_centralRepoDisabled_message()); // NON-NLS } if (connectionPool == null) { @@ -200,7 +200,7 @@ final class PostgresEamDb extends AbstractSqlEamDb { try { return connectionPool.getConnection(); } catch (SQLException ex) { - throw new EamDbException("Error getting connection from connection pool.", Bundle.PostgresEamDb_connectionFailed_message(), ex); // NON-NLS + throw new CentralRepoException("Error getting connection from connection pool.", Bundle.PostgresEamDb_connectionFailed_message(), ex); // NON-NLS } } @@ -217,12 +217,12 @@ final class PostgresEamDb extends AbstractSqlEamDb { * * @return the lock, or null if locking is not supported * - * @throws EamDbException if the coordination service is running but we fail + * @throws CentralRepoException if the coordination service is running but we fail * to get the lock */ @Override @Messages({"PostgresEamDb.multiUserLockError.message=Error acquiring database lock"}) - public CoordinationService.Lock getExclusiveMultiUserDbLock() throws EamDbException { + public CoordinationService.Lock getExclusiveMultiUserDbLock() throws CentralRepoException { try { // First check if multi user mode is enabled - if not there's no point trying to get a lock if (!UserPreferences.getIsMultiUserModeEnabled()) { @@ -235,9 +235,9 @@ final class PostgresEamDb extends AbstractSqlEamDb { if (lock != null) { return lock; } - throw new EamDbException("Error acquiring database lock", Bundle.PostgresEamDb_multiUserLockError_message()); + throw new CentralRepoException("Error acquiring database lock", Bundle.PostgresEamDb_multiUserLockError_message()); } catch (InterruptedException ex) { - throw new EamDbException("Error acquiring database lock", Bundle.PostgresEamDb_multiUserLockError_message(), ex); + throw new CentralRepoException("Error acquiring database lock", Bundle.PostgresEamDb_multiUserLockError_message(), ex); } catch (CoordinationService.CoordinationServiceException ex) { // This likely just means the coordination service isn't running, which is ok return null; @@ -257,8 +257,8 @@ final class PostgresEamDb extends AbstractSqlEamDb { columnExists = resultSet.getBoolean(1); } } finally { - EamDbUtil.closeResultSet(resultSet); - EamDbUtil.closeStatement(statement); + CentralRepoDbUtil.closeResultSet(resultSet); + CentralRepoDbUtil.closeStatement(statement); } return columnExists; } diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/PostgresEamDbSettings.java b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/PostgresCentralRepoSettings.java similarity index 90% rename from Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/PostgresEamDbSettings.java rename to Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/PostgresCentralRepoSettings.java index a4ab17906b..9b5b013540 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/PostgresEamDbSettings.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/PostgresCentralRepoSettings.java @@ -32,7 +32,7 @@ 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; +import static org.sleuthkit.autopsy.centralrepository.datamodel.RdbmsCentralRepo.SOFTWARE_CR_DB_SCHEMA_VERSION; /** * Settings for the Postgres implementation of the Central Repository database @@ -40,9 +40,9 @@ import static org.sleuthkit.autopsy.centralrepository.datamodel.AbstractSqlEamDb * NOTE: This is public scope because the options panel calls it directly to * set/get */ -public final class PostgresEamDbSettings { +public final class PostgresCentralRepoSettings { - private final static Logger LOGGER = Logger.getLogger(PostgresEamDbSettings.class.getName()); + private final static Logger LOGGER = Logger.getLogger(PostgresCentralRepoSettings.class.getName()); private final static String DEFAULT_HOST = ""; // NON-NLS private final static int DEFAULT_PORT = 5432; private final static String DEFAULT_DBNAME = "central_repository"; // NON-NLS @@ -60,7 +60,7 @@ public final class PostgresEamDbSettings { private String userName; private String password; - public PostgresEamDbSettings() { + public PostgresCentralRepoSettings() { loadSettings(); } @@ -92,15 +92,15 @@ public final class PostgresEamDbSettings { try { String bulkThresholdString = ModuleSettings.getConfigSetting("CentralRepository", "db.postgresql.bulkThreshold"); // NON-NLS if (bulkThresholdString == null || bulkThresholdString.isEmpty()) { - this.bulkThreshold = AbstractSqlEamDb.DEFAULT_BULK_THRESHHOLD; + this.bulkThreshold = RdbmsCentralRepo.DEFAULT_BULK_THRESHHOLD; } else { this.bulkThreshold = Integer.parseInt(bulkThresholdString); if (getBulkThreshold() <= 0) { - this.bulkThreshold = AbstractSqlEamDb.DEFAULT_BULK_THRESHHOLD; + this.bulkThreshold = RdbmsCentralRepo.DEFAULT_BULK_THRESHHOLD; } } } catch (NumberFormatException ex) { - this.bulkThreshold = AbstractSqlEamDb.DEFAULT_BULK_THRESHHOLD; + this.bulkThreshold = RdbmsCentralRepo.DEFAULT_BULK_THRESHHOLD; } userName = ModuleSettings.getConfigSetting("CentralRepository", "db.postgresql.user"); // NON-NLS @@ -193,8 +193,8 @@ public final class PostgresEamDbSettings { return false; } - boolean result = EamDbUtil.executeValidationQuery(conn, VALIDATION_QUERY); - EamDbUtil.closeConnection(conn); + boolean result = CentralRepoDbUtil.executeValidationQuery(conn, VALIDATION_QUERY); + CentralRepoDbUtil.closeConnection(conn); return result; } @@ -223,9 +223,9 @@ public final class PostgresEamDbSettings { LOGGER.log(Level.SEVERE, "Failed to execute database existance query.", ex); // NON-NLS return false; } finally { - EamDbUtil.closeStatement(ps); - EamDbUtil.closeResultSet(rs); - EamDbUtil.closeConnection(conn); + CentralRepoDbUtil.closeStatement(ps); + CentralRepoDbUtil.closeResultSet(rs); + CentralRepoDbUtil.closeConnection(conn); } return false; } @@ -242,9 +242,9 @@ public final class PostgresEamDbSettings { return false; } - boolean result = EamDbUtil.schemaVersionIsSet(conn); + boolean result = CentralRepoDbUtil.schemaVersionIsSet(conn); - EamDbUtil.closeConnection(conn); + CentralRepoDbUtil.closeConnection(conn); return result; } @@ -263,7 +263,7 @@ public final class PostgresEamDbSettings { LOGGER.log(Level.SEVERE, "Failed to execute create database statement.", ex); // NON-NLS return false; } finally { - EamDbUtil.closeConnection(conn); + CentralRepoDbUtil.closeConnection(conn); } return true; @@ -284,7 +284,7 @@ public final class PostgresEamDbSettings { LOGGER.log(Level.SEVERE, "Failed to execute drop database statement.", ex); // NON-NLS return false; } finally { - EamDbUtil.closeConnection(conn); + CentralRepoDbUtil.closeConnection(conn); } return true; @@ -420,10 +420,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 + "', '" + 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() + "')"); + stmt.execute("INSERT INTO db_info (name, value) VALUES ('" + RdbmsCentralRepo.SCHEMA_MAJOR_VERSION_KEY + "', '" + SOFTWARE_CR_DB_SCHEMA_VERSION.getMajor() + "')"); + stmt.execute("INSERT INTO db_info (name, value) VALUES ('" + RdbmsCentralRepo.SCHEMA_MINOR_VERSION_KEY + "', '" + SOFTWARE_CR_DB_SCHEMA_VERSION.getMinor() + "')"); + stmt.execute("INSERT INTO db_info (name, value) VALUES ('" + RdbmsCentralRepo.CREATION_SCHEMA_MAJOR_VERSION_KEY + "', '" + SOFTWARE_CR_DB_SCHEMA_VERSION.getMajor() + "')"); + stmt.execute("INSERT INTO db_info (name, value) VALUES ('" + RdbmsCentralRepo.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(); @@ -431,8 +431,8 @@ public final class PostgresEamDbSettings { String reference_type_dbname; String instance_type_dbname; for (CorrelationAttributeInstance.Type type : DEFAULT_CORRELATION_TYPES) { - reference_type_dbname = EamDbUtil.correlationTypeToReferenceTableName(type); - instance_type_dbname = EamDbUtil.correlationTypeToInstanceTableName(type); + reference_type_dbname = CentralRepoDbUtil.correlationTypeToReferenceTableName(type); + instance_type_dbname = CentralRepoDbUtil.correlationTypeToInstanceTableName(type); stmt.execute(String.format(createArtifactInstancesTableTemplate, instance_type_dbname, instance_type_dbname)); stmt.execute(String.format(instancesCaseIdIdx, instance_type_dbname, instance_type_dbname)); @@ -452,11 +452,11 @@ public final class PostgresEamDbSettings { } catch (SQLException ex) { LOGGER.log(Level.SEVERE, "Error initializing db schema.", ex); // NON-NLS return false; - } catch (EamDbException ex) { + } catch (CentralRepoException ex) { LOGGER.log(Level.SEVERE, "Error getting default correlation types. Likely due to one or more Type's with an invalid db table name."); // NON-NLS return false; } finally { - EamDbUtil.closeConnection(conn); + CentralRepoDbUtil.closeConnection(conn); } return true; } @@ -587,8 +587,8 @@ public final class PostgresEamDbSettings { return false; } - boolean result = EamDbUtil.insertDefaultCorrelationTypes(conn) && EamDbUtil.insertDefaultOrganization(conn); - EamDbUtil.closeConnection(conn); + boolean result = CentralRepoDbUtil.insertDefaultCorrelationTypes(conn) && CentralRepoDbUtil.insertDefaultOrganization(conn); + CentralRepoDbUtil.closeConnection(conn); return result; } @@ -616,11 +616,11 @@ public final class PostgresEamDbSettings { /** * @param host the host to set */ - public void setHost(String host) throws EamDbException { + public void setHost(String host) throws CentralRepoException { if (null != host && !host.isEmpty()) { this.host = host; } else { - throw new EamDbException("Invalid host name. Cannot be empty."); // NON-NLS + throw new CentralRepoException("Invalid host name. Cannot be empty."); // NON-NLS } } @@ -634,11 +634,11 @@ public final class PostgresEamDbSettings { /** * @param port the port to set */ - public void setPort(int port) throws EamDbException { + public void setPort(int port) throws CentralRepoException { if (port > 0 && port < 65535) { this.port = port; } else { - throw new EamDbException("Invalid port. Must be a number greater than 0."); // NON-NLS + throw new CentralRepoException("Invalid port. Must be a number greater than 0."); // NON-NLS } } @@ -655,11 +655,11 @@ public final class PostgresEamDbSettings { /** * @param dbName the dbName to set */ - public void setDbName(String dbName) throws EamDbException { + public void setDbName(String dbName) throws CentralRepoException { if (dbName == null || dbName.isEmpty()) { - throw new EamDbException("Invalid database name. Cannot be empty."); // NON-NLS + throw new CentralRepoException("Invalid database name. Cannot be empty."); // NON-NLS } else if (!Pattern.matches(DB_NAMES_REGEX, dbName)) { - throw new EamDbException("Invalid database name. Name must start with a lowercase letter and can only contain lowercase letters, numbers, and '_'."); // NON-NLS + throw new CentralRepoException("Invalid database name. Name must start with a lowercase letter and can only contain lowercase letters, numbers, and '_'."); // NON-NLS } this.dbName = dbName.toLowerCase(); @@ -675,11 +675,11 @@ public final class PostgresEamDbSettings { /** * @param bulkThreshold the bulkThreshold to set */ - public void setBulkThreshold(int bulkThreshold) throws EamDbException { + public void setBulkThreshold(int bulkThreshold) throws CentralRepoException { if (bulkThreshold > 0) { this.bulkThreshold = bulkThreshold; } else { - throw new EamDbException("Invalid bulk threshold."); // NON-NLS + throw new CentralRepoException("Invalid bulk threshold."); // NON-NLS } } @@ -693,11 +693,11 @@ public final class PostgresEamDbSettings { /** * @param userName the userName to set */ - public void setUserName(String userName) throws EamDbException { + public void setUserName(String userName) throws CentralRepoException { if (userName == null || userName.isEmpty()) { - throw new EamDbException("Invalid user name. Cannot be empty."); // NON-NLS + throw new CentralRepoException("Invalid user name. Cannot be empty."); // NON-NLS } else if (!Pattern.matches(DB_USER_NAMES_REGEX, userName)) { - throw new EamDbException("Invalid user name. Name must start with a letter and can only contain letters, numbers, and '_'."); // NON-NLS + throw new CentralRepoException("Invalid user name. Name must start with a letter and can only contain letters, numbers, and '_'."); // NON-NLS } this.userName = userName; } @@ -712,9 +712,9 @@ public final class PostgresEamDbSettings { /** * @param password the password to set */ - public void setPassword(String password) throws EamDbException { + public void setPassword(String password) throws CentralRepoException { if (password == null || password.isEmpty()) { - throw new EamDbException("Invalid user password. Cannot be empty."); // NON-NLS + throw new CentralRepoException("Invalid user password. Cannot be empty."); // NON-NLS } this.password = password; } diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/AbstractSqlEamDb.java b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/RdbmsCentralRepo.java similarity index 77% rename from Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/AbstractSqlEamDb.java rename to Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/RdbmsCentralRepo.java index fee297880c..1a641c5a28 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/AbstractSqlEamDb.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/RdbmsCentralRepo.java @@ -1,7 +1,7 @@ /* * Central Repository * - * Copyright 2015-2019 Basis Technology Corp. + * Copyright 2015-2020 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -43,7 +43,7 @@ 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 static org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoDbUtil.updateSchemaVersion; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.healthmonitor.HealthMonitor; import org.sleuthkit.autopsy.healthmonitor.TimingMetric; @@ -55,9 +55,9 @@ import org.sleuthkit.datamodel.TskData; * Generic JDBC methods * */ -abstract class AbstractSqlEamDb implements EamDb { +abstract class RdbmsCentralRepo implements CentralRepository { - private final static Logger logger = Logger.getLogger(AbstractSqlEamDb.class.getName()); + private final static Logger logger = Logger.getLogger(RdbmsCentralRepo.class.getName()); static final String SCHEMA_MAJOR_VERSION_KEY = "SCHEMA_VERSION"; static final String SCHEMA_MINOR_VERSION_KEY = "SCHEMA_MINOR_VERSION"; static final String CREATION_SCHEMA_MAJOR_VERSION_KEY = "CREATION_SCHEMA_MAJOR_VERSION"; @@ -96,25 +96,25 @@ abstract class AbstractSqlEamDb implements EamDb { * * @throws UnknownHostException, EamDbException */ - protected AbstractSqlEamDb() throws EamDbException { + protected RdbmsCentralRepo() throws CentralRepoException { bulkArtifactsCount = 0; bulkArtifacts = new HashMap<>(); defaultCorrelationTypes = CorrelationAttributeInstance.getDefaultCorrelationTypes(); defaultCorrelationTypes.forEach((type) -> { - bulkArtifacts.put(EamDbUtil.correlationTypeToInstanceTableName(type), new ArrayList<>()); + bulkArtifacts.put(CentralRepoDbUtil.correlationTypeToInstanceTableName(type), new ArrayList<>()); }); } /** * Setup and create a connection to the selected database implementation */ - protected abstract Connection connect(boolean foreignKeys) throws EamDbException; + protected abstract Connection connect(boolean foreignKeys) throws CentralRepoException; /** * Setup and create a connection to the selected database implementation */ - protected abstract Connection connect() throws EamDbException; + protected abstract Connection connect() throws CentralRepoException; /** * Add a new name/value pair in the db_info table. @@ -122,10 +122,10 @@ abstract class AbstractSqlEamDb implements EamDb { * @param name Key to set * @param value Value to set * - * @throws EamDbException + * @throws CentralRepoException */ @Override - public void newDbInfo(String name, String value) throws EamDbException { + public void newDbInfo(String name, String value) throws CentralRepoException { Connection conn = connect(); PreparedStatement preparedStatement = null; @@ -137,16 +137,16 @@ abstract class AbstractSqlEamDb implements EamDb { preparedStatement.setString(2, value); preparedStatement.executeUpdate(); } catch (SQLException ex) { - throw new EamDbException("Error adding new name/value pair to db_info.", ex); + throw new CentralRepoException("Error adding new name/value pair to db_info.", ex); } finally { - EamDbUtil.closeStatement(preparedStatement); - EamDbUtil.closeConnection(conn); + CentralRepoDbUtil.closeStatement(preparedStatement); + CentralRepoDbUtil.closeConnection(conn); } } @Override - public void addDataSourceObjectId(int rowId, long dataSourceObjectId) throws EamDbException { + public void addDataSourceObjectId(int rowId, long dataSourceObjectId) throws CentralRepoException { Connection conn = connect(); PreparedStatement preparedStatement = null; String sql = "UPDATE data_sources SET datasource_obj_id=? WHERE id=?"; @@ -156,10 +156,10 @@ abstract class AbstractSqlEamDb implements EamDb { preparedStatement.setInt(2, rowId); preparedStatement.executeUpdate(); } catch (SQLException ex) { - throw new EamDbException("Error updating data source object id for data_sources row " + rowId, ex); + throw new CentralRepoException("Error updating data source object id for data_sources row " + rowId, ex); } finally { - EamDbUtil.closeStatement(preparedStatement); - EamDbUtil.closeConnection(conn); + CentralRepoDbUtil.closeStatement(preparedStatement); + CentralRepoDbUtil.closeConnection(conn); } } @@ -170,10 +170,10 @@ abstract class AbstractSqlEamDb implements EamDb { * * @return value associated with name. * - * @throws EamDbException + * @throws CentralRepoException */ @Override - public String getDbInfo(String name) throws EamDbException { + public String getDbInfo(String name) throws CentralRepoException { Connection conn = connect(); PreparedStatement preparedStatement = null; @@ -188,11 +188,11 @@ abstract class AbstractSqlEamDb implements EamDb { value = resultSet.getString("value"); } } catch (SQLException ex) { - throw new EamDbException("Error getting value for name.", ex); + throw new CentralRepoException("Error getting value for name.", ex); } finally { - EamDbUtil.closeStatement(preparedStatement); - EamDbUtil.closeResultSet(resultSet); - EamDbUtil.closeConnection(conn); + CentralRepoDbUtil.closeStatement(preparedStatement); + CentralRepoDbUtil.closeResultSet(resultSet); + CentralRepoDbUtil.closeConnection(conn); } return value; @@ -215,10 +215,10 @@ abstract class AbstractSqlEamDb implements EamDb { * @param name Name to find * @param value Value to assign to name. * - * @throws EamDbException + * @throws CentralRepoException */ @Override - public void updateDbInfo(String name, String value) throws EamDbException { + public void updateDbInfo(String name, String value) throws CentralRepoException { Connection conn = connect(); PreparedStatement preparedStatement = null; @@ -229,10 +229,10 @@ abstract class AbstractSqlEamDb implements EamDb { preparedStatement.setString(2, name); preparedStatement.executeUpdate(); } catch (SQLException ex) { - throw new EamDbException("Error updating value for name.", ex); + throw new CentralRepoException("Error updating value for name.", ex); } finally { - EamDbUtil.closeStatement(preparedStatement); - EamDbUtil.closeConnection(conn); + CentralRepoDbUtil.closeStatement(preparedStatement); + CentralRepoDbUtil.closeConnection(conn); } } @@ -246,10 +246,10 @@ abstract class AbstractSqlEamDb implements EamDb { * @returns New Case class with populated database ID */ @Override - public synchronized CorrelationCase newCase(CorrelationCase eamCase) throws EamDbException { + public synchronized CorrelationCase newCase(CorrelationCase eamCase) throws CentralRepoException { if (eamCase.getCaseUUID() == null) { - throw new EamDbException("Case UUID is null"); + throw new CentralRepoException("Case UUID is null"); } // check if there is already an existing CorrelationCase for this Case @@ -307,7 +307,7 @@ abstract class AbstractSqlEamDb implements EamDb { //update the case in the caches resultSet = preparedStatement.getGeneratedKeys(); if (!resultSet.next()) { - throw new EamDbException(String.format("Failed to INSERT case %s in central repo", eamCase.getCaseUUID())); + throw new CentralRepoException(String.format("Failed to INSERT case %s in central repo", eamCase.getCaseUUID())); } int caseID = resultSet.getInt(1); //last_insert_rowid() CorrelationCase correlationCase = new CorrelationCase(caseID, eamCase.getCaseUUID(), eamCase.getOrg(), @@ -316,11 +316,11 @@ abstract class AbstractSqlEamDb implements EamDb { caseCacheByUUID.put(eamCase.getCaseUUID(), correlationCase); caseCacheById.put(caseID, correlationCase); } catch (SQLException ex) { - throw new EamDbException("Error inserting new case.", ex); // NON-NLS + throw new CentralRepoException("Error inserting new case.", ex); // NON-NLS } finally { - EamDbUtil.closeResultSet(resultSet); - EamDbUtil.closeStatement(preparedStatement); - EamDbUtil.closeConnection(conn); + CentralRepoDbUtil.closeResultSet(resultSet); + CentralRepoDbUtil.closeStatement(preparedStatement); + CentralRepoDbUtil.closeConnection(conn); } // get a new version with the updated ID @@ -333,15 +333,15 @@ abstract class AbstractSqlEamDb implements EamDb { * @param autopsyCase The case to add */ @Override - public CorrelationCase newCase(Case autopsyCase) throws EamDbException { + public CorrelationCase newCase(Case autopsyCase) throws CentralRepoException { if (autopsyCase == null) { - throw new EamDbException("Case is null"); + throw new CentralRepoException("Case is null"); } CorrelationCase curCeCase = new CorrelationCase( -1, autopsyCase.getName(), // unique case ID - EamOrganization.getDefault(), + CentralRepoOrganization.getDefault(), autopsyCase.getDisplayName(), autopsyCase.getCreatedDate(), autopsyCase.getNumber(), @@ -353,7 +353,7 @@ abstract class AbstractSqlEamDb implements EamDb { } @Override - public CorrelationCase getCase(Case autopsyCase) throws EamDbException { + public CorrelationCase getCase(Case autopsyCase) throws CentralRepoException { return getCaseByUUID(autopsyCase.getName()); } @@ -363,9 +363,9 @@ abstract class AbstractSqlEamDb implements EamDb { * @param eamCase The case to update */ @Override - public void updateCase(CorrelationCase eamCase) throws EamDbException { + public void updateCase(CorrelationCase eamCase) throws CentralRepoException { if (eamCase == null) { - throw new EamDbException("Correlation case is null"); + throw new CentralRepoException("Correlation case is null"); } Connection conn = connect(); @@ -419,10 +419,10 @@ abstract class AbstractSqlEamDb implements EamDb { caseCacheById.put(eamCase.getID(), eamCase); caseCacheByUUID.put(eamCase.getCaseUUID(), eamCase); } catch (SQLException ex) { - throw new EamDbException("Error updating case.", ex); // NON-NLS + throw new CentralRepoException("Error updating case.", ex); // NON-NLS } finally { - EamDbUtil.closeStatement(preparedStatement); - EamDbUtil.closeConnection(conn); + CentralRepoDbUtil.closeStatement(preparedStatement); + CentralRepoDbUtil.closeConnection(conn); } } @@ -434,14 +434,14 @@ abstract class AbstractSqlEamDb implements EamDb { * @return The retrieved case */ @Override - public CorrelationCase getCaseByUUID(String caseUUID) throws EamDbException { + public CorrelationCase getCaseByUUID(String caseUUID) throws CentralRepoException { try { return caseCacheByUUID.get(caseUUID, () -> getCaseByUUIDFromCr(caseUUID)); } catch (CacheLoader.InvalidCacheLoadException ignored) { //lambda valueloader returned a null value and cache can not store null values this is normal if the case does not exist in the central repo yet return null; } catch (ExecutionException ex) { - throw new EamDbException("Error getting autopsy case from Central repo", ex); + throw new CentralRepoException("Error getting autopsy case from Central repo", ex); } } @@ -452,7 +452,7 @@ abstract class AbstractSqlEamDb implements EamDb { * * @return The retrieved case */ - private CorrelationCase getCaseByUUIDFromCr(String caseUUID) throws EamDbException { + private CorrelationCase getCaseByUUIDFromCr(String caseUUID) throws CentralRepoException { Connection conn = connect(); CorrelationCase eamCaseResult = null; @@ -477,11 +477,11 @@ abstract class AbstractSqlEamDb implements EamDb { caseCacheById.put(eamCaseResult.getID(), eamCaseResult); } } catch (SQLException ex) { - throw new EamDbException("Error getting case details.", ex); // NON-NLS + throw new CentralRepoException("Error getting case details.", ex); // NON-NLS } finally { - EamDbUtil.closeStatement(preparedStatement); - EamDbUtil.closeResultSet(resultSet); - EamDbUtil.closeConnection(conn); + CentralRepoDbUtil.closeStatement(preparedStatement); + CentralRepoDbUtil.closeResultSet(resultSet); + CentralRepoDbUtil.closeConnection(conn); } return eamCaseResult; @@ -495,14 +495,14 @@ abstract class AbstractSqlEamDb implements EamDb { * @return The retrieved case */ @Override - public CorrelationCase getCaseById(int caseId) throws EamDbException { + public CorrelationCase getCaseById(int caseId) throws CentralRepoException { try { return caseCacheById.get(caseId, () -> getCaseByIdFromCr(caseId)); } catch (CacheLoader.InvalidCacheLoadException ignored) { //lambda valueloader returned a null value and cache can not store null values this is normal if the case does not exist in the central repo yet return null; } catch (ExecutionException ex) { - throw new EamDbException("Error getting autopsy case from Central repo", ex); + throw new CentralRepoException("Error getting autopsy case from Central repo", ex); } } @@ -513,7 +513,7 @@ abstract class AbstractSqlEamDb implements EamDb { * * @return The retrieved case */ - private CorrelationCase getCaseByIdFromCr(int caseId) throws EamDbException { + private CorrelationCase getCaseByIdFromCr(int caseId) throws CentralRepoException { Connection conn = connect(); CorrelationCase eamCaseResult = null; @@ -537,11 +537,11 @@ abstract class AbstractSqlEamDb implements EamDb { caseCacheByUUID.put(eamCaseResult.getCaseUUID(), eamCaseResult); } } catch (SQLException ex) { - throw new EamDbException("Error getting case details.", ex); // NON-NLS + throw new CentralRepoException("Error getting case details.", ex); // NON-NLS } finally { - EamDbUtil.closeStatement(preparedStatement); - EamDbUtil.closeResultSet(resultSet); - EamDbUtil.closeConnection(conn); + CentralRepoDbUtil.closeStatement(preparedStatement); + CentralRepoDbUtil.closeResultSet(resultSet); + CentralRepoDbUtil.closeConnection(conn); } return eamCaseResult; @@ -553,7 +553,7 @@ abstract class AbstractSqlEamDb implements EamDb { * @return List of cases */ @Override - public List getCases() throws EamDbException { + public List getCases() throws CentralRepoException { Connection conn = connect(); List cases = new ArrayList<>(); @@ -574,11 +574,11 @@ abstract class AbstractSqlEamDb implements EamDb { cases.add(eamCaseResult); } } catch (SQLException ex) { - throw new EamDbException("Error getting all cases.", ex); // NON-NLS + throw new CentralRepoException("Error getting all cases.", ex); // NON-NLS } finally { - EamDbUtil.closeStatement(preparedStatement); - EamDbUtil.closeResultSet(resultSet); - EamDbUtil.closeConnection(conn); + CentralRepoDbUtil.closeStatement(preparedStatement); + CentralRepoDbUtil.closeResultSet(resultSet); + CentralRepoDbUtil.closeConnection(conn); } return cases; @@ -617,15 +617,15 @@ abstract class AbstractSqlEamDb implements EamDb { * @param eamDataSource the data source to add */ @Override - public CorrelationDataSource newDataSource(CorrelationDataSource eamDataSource) throws EamDbException { + public CorrelationDataSource newDataSource(CorrelationDataSource eamDataSource) throws CentralRepoException { if (eamDataSource.getCaseID() == -1) { - throw new EamDbException("Case ID is -1"); + throw new CentralRepoException("Case ID is -1"); } if (eamDataSource.getDeviceID() == null) { - throw new EamDbException("Device ID is null"); + throw new CentralRepoException("Device ID is null"); } if (eamDataSource.getName() == null) { - throw new EamDbException("Name is null"); + throw new CentralRepoException("Name is null"); } if (eamDataSource.getID() != -1) { // This data source is already in the central repo @@ -665,7 +665,7 @@ abstract class AbstractSqlEamDb implements EamDb { eamDataSource.getCaseID(), eamDataSource.getDataSourceObjectID()), () -> getDataSourceFromCr(eamDataSource.getCaseID(), eamDataSource.getDataSourceObjectID())); } catch (CacheLoader.InvalidCacheLoadException | ExecutionException getException) { - throw new EamDbException(String.format("Unable to to INSERT or get data source %s in central repo:", eamDataSource.getName()), getException); + throw new CentralRepoException(String.format("Unable to to INSERT or get data source %s in central repo:", eamDataSource.getName()), getException); } } else { //if a new data source was added to the central repository update the caches to include it and return it @@ -690,12 +690,12 @@ abstract class AbstractSqlEamDb implements EamDb { eamDataSource.getCaseID(), eamDataSource.getDataSourceObjectID()), () -> getDataSourceFromCr(eamDataSource.getCaseID(), eamDataSource.getDataSourceObjectID())); } catch (CacheLoader.InvalidCacheLoadException | ExecutionException getException) { - throw new EamDbException(String.format("Unable to to INSERT or get data source %s in central repo, insert failed due to Exception: %s", eamDataSource.getName(), insertException.getMessage()), getException); + throw new CentralRepoException(String.format("Unable to to INSERT or get data source %s in central repo, insert failed due to Exception: %s", eamDataSource.getName(), insertException.getMessage()), getException); } } finally { - EamDbUtil.closeResultSet(resultSet); - EamDbUtil.closeStatement(preparedStatement); - EamDbUtil.closeConnection(conn); + CentralRepoDbUtil.closeResultSet(resultSet); + CentralRepoDbUtil.closeStatement(preparedStatement); + CentralRepoDbUtil.closeConnection(conn); } } @@ -708,13 +708,13 @@ abstract class AbstractSqlEamDb implements EamDb { * * @return The data source * - * @throws EamDbException + * @throws CentralRepoException */ @Override - public CorrelationDataSource getDataSource(CorrelationCase correlationCase, Long dataSourceObjectId) throws EamDbException { + public CorrelationDataSource getDataSource(CorrelationCase correlationCase, Long dataSourceObjectId) throws CentralRepoException { if (correlationCase == null) { - throw new EamDbException("Correlation case is null"); + throw new CentralRepoException("Correlation case is null"); } try { return dataSourceCacheByDsObjectId.get(getDataSourceByDSObjectIdCacheKey(correlationCase.getID(), dataSourceObjectId), () -> getDataSourceFromCr(correlationCase.getID(), dataSourceObjectId)); @@ -722,7 +722,7 @@ abstract class AbstractSqlEamDb implements EamDb { //lambda valueloader returned a null value and cache can not store null values this is normal if the dataSource does not exist in the central repo yet return null; } catch (ExecutionException ex) { - throw new EamDbException("Error getting data source from central repository", ex); + throw new CentralRepoException("Error getting data source from central repository", ex); } } @@ -736,9 +736,9 @@ abstract class AbstractSqlEamDb implements EamDb { * * @return The data source * - * @throws EamDbException + * @throws CentralRepoException */ - private CorrelationDataSource getDataSourceFromCr(int correlationCaseId, Long dataSourceObjectId) throws EamDbException { + private CorrelationDataSource getDataSourceFromCr(int correlationCaseId, Long dataSourceObjectId) throws CentralRepoException { Connection conn = connect(); CorrelationDataSource eamDataSourceResult = null; @@ -759,11 +759,11 @@ abstract class AbstractSqlEamDb implements EamDb { dataSourceCacheById.put(getDataSourceByIdCacheKey(correlationCaseId, eamDataSourceResult.getID()), eamDataSourceResult); } } catch (SQLException ex) { - throw new EamDbException("Error getting data source.", ex); // NON-NLS + throw new CentralRepoException("Error getting data source.", ex); // NON-NLS } finally { - EamDbUtil.closeStatement(preparedStatement); - EamDbUtil.closeResultSet(resultSet); - EamDbUtil.closeConnection(conn); + CentralRepoDbUtil.closeStatement(preparedStatement); + CentralRepoDbUtil.closeResultSet(resultSet); + CentralRepoDbUtil.closeConnection(conn); } return eamDataSourceResult; @@ -779,9 +779,9 @@ abstract class AbstractSqlEamDb implements EamDb { * @return The data source */ @Override - public CorrelationDataSource getDataSourceById(CorrelationCase correlationCase, int dataSourceId) throws EamDbException { + public CorrelationDataSource getDataSourceById(CorrelationCase correlationCase, int dataSourceId) throws CentralRepoException { if (correlationCase == null) { - throw new EamDbException("Correlation case is null"); + throw new CentralRepoException("Correlation case is null"); } try { return dataSourceCacheById.get(getDataSourceByIdCacheKey(correlationCase.getID(), dataSourceId), () -> getDataSourceByIdFromCr(correlationCase, dataSourceId)); @@ -789,7 +789,7 @@ abstract class AbstractSqlEamDb implements EamDb { //lambda valueloader returned a null value and cache can not store null values this is normal if the dataSource does not exist in the central repo yet return null; } catch (ExecutionException ex) { - throw new EamDbException("Error getting data source from central repository", ex); + throw new CentralRepoException("Error getting data source from central repository", ex); } } @@ -802,7 +802,7 @@ abstract class AbstractSqlEamDb implements EamDb { * * @return The data source */ - private CorrelationDataSource getDataSourceByIdFromCr(CorrelationCase correlationCase, int dataSourceId) throws EamDbException { + private CorrelationDataSource getDataSourceByIdFromCr(CorrelationCase correlationCase, int dataSourceId) throws CentralRepoException { Connection conn = connect(); CorrelationDataSource eamDataSourceResult = null; @@ -823,11 +823,11 @@ abstract class AbstractSqlEamDb implements EamDb { dataSourceCacheByDsObjectId.put(getDataSourceByDSObjectIdCacheKey(correlationCase.getID(), eamDataSourceResult.getDataSourceObjectID()), eamDataSourceResult); } } catch (SQLException ex) { - throw new EamDbException("Error getting data source.", ex); // NON-NLS + throw new CentralRepoException("Error getting data source.", ex); // NON-NLS } finally { - EamDbUtil.closeStatement(preparedStatement); - EamDbUtil.closeResultSet(resultSet); - EamDbUtil.closeConnection(conn); + CentralRepoDbUtil.closeStatement(preparedStatement); + CentralRepoDbUtil.closeResultSet(resultSet); + CentralRepoDbUtil.closeConnection(conn); } return eamDataSourceResult; @@ -839,7 +839,7 @@ abstract class AbstractSqlEamDb implements EamDb { * @return list of data sources in the DB */ @Override - public List getDataSources() throws EamDbException { + public List getDataSources() throws CentralRepoException { Connection conn = connect(); List dataSources = new ArrayList<>(); @@ -857,11 +857,11 @@ abstract class AbstractSqlEamDb implements EamDb { dataSources.add(eamDataSourceResult); } } catch (SQLException ex) { - throw new EamDbException("Error getting all data sources.", ex); // NON-NLS + throw new CentralRepoException("Error getting all data sources.", ex); // NON-NLS } finally { - EamDbUtil.closeStatement(preparedStatement); - EamDbUtil.closeResultSet(resultSet); - EamDbUtil.closeConnection(conn); + CentralRepoDbUtil.closeStatement(preparedStatement); + CentralRepoDbUtil.closeResultSet(resultSet); + CentralRepoDbUtil.closeConnection(conn); } return dataSources; @@ -873,7 +873,7 @@ abstract class AbstractSqlEamDb implements EamDb { * @param eamDataSource The data source to update */ @Override - public void updateDataSourceMd5Hash(CorrelationDataSource eamDataSource) throws EamDbException { + public void updateDataSourceMd5Hash(CorrelationDataSource eamDataSource) throws CentralRepoException { updateDataSourceStringValue(eamDataSource, "md5", eamDataSource.getMd5()); } @@ -883,7 +883,7 @@ abstract class AbstractSqlEamDb implements EamDb { * @param eamDataSource The data source to update */ @Override - public void updateDataSourceSha1Hash(CorrelationDataSource eamDataSource) throws EamDbException { + public void updateDataSourceSha1Hash(CorrelationDataSource eamDataSource) throws CentralRepoException { updateDataSourceStringValue(eamDataSource, "sha1", eamDataSource.getSha1()); } @@ -894,7 +894,7 @@ abstract class AbstractSqlEamDb implements EamDb { * @param eamDataSource The data source to update */ @Override - public void updateDataSourceSha256Hash(CorrelationDataSource eamDataSource) throws EamDbException { + public void updateDataSourceSha256Hash(CorrelationDataSource eamDataSource) throws CentralRepoException { updateDataSourceStringValue(eamDataSource, "sha256", eamDataSource.getSha256()); } @@ -905,9 +905,9 @@ abstract class AbstractSqlEamDb implements EamDb { * @param column The name of the column to be updated * @param value The value to assign to the specified column */ - private void updateDataSourceStringValue(CorrelationDataSource eamDataSource, String column, String value) throws EamDbException { + private void updateDataSourceStringValue(CorrelationDataSource eamDataSource, String column, String value) throws CentralRepoException { if (eamDataSource == null) { - throw new EamDbException("Correlation data source is null"); + throw new CentralRepoException("Correlation data source is null"); } Connection conn = connect(); @@ -928,10 +928,10 @@ abstract class AbstractSqlEamDb implements EamDb { dataSourceCacheByDsObjectId.put(getDataSourceByDSObjectIdCacheKey(eamDataSource.getCaseID(), eamDataSource.getDataSourceObjectID()), eamDataSource); dataSourceCacheById.put(getDataSourceByIdCacheKey(eamDataSource.getCaseID(), eamDataSource.getID()), eamDataSource); } catch (SQLException ex) { - throw new EamDbException(String.format("Error updating data source (obj_id=%d).", eamDataSource.getDataSourceObjectID()), ex); // NON-NLS + throw new CentralRepoException(String.format("Error updating data source (obj_id=%d).", eamDataSource.getDataSourceObjectID()), ex); // NON-NLS } finally { - EamDbUtil.closeStatement(preparedStatement); - EamDbUtil.closeConnection(conn); + CentralRepoDbUtil.closeStatement(preparedStatement); + CentralRepoDbUtil.closeConnection(conn); } } @@ -941,10 +941,10 @@ abstract class AbstractSqlEamDb implements EamDb { * @param eamDataSource The data source * @param newName The new name * - * @throws EamDbException + * @throws CentralRepoException */ @Override - public void updateDataSourceName(CorrelationDataSource eamDataSource, String newName) throws EamDbException { + public void updateDataSourceName(CorrelationDataSource eamDataSource, String newName) throws CentralRepoException { Connection conn = connect(); @@ -971,11 +971,11 @@ abstract class AbstractSqlEamDb implements EamDb { dataSourceCacheByDsObjectId.put(getDataSourceByDSObjectIdCacheKey(updatedDataSource.getCaseID(), updatedDataSource.getDataSourceObjectID()), updatedDataSource); dataSourceCacheById.put(getDataSourceByIdCacheKey(updatedDataSource.getCaseID(), updatedDataSource.getID()), updatedDataSource); } catch (SQLException ex) { - throw new EamDbException("Error updating name of data source with ID " + eamDataSource.getDataSourceObjectID() + throw new CentralRepoException("Error updating name of data source with ID " + eamDataSource.getDataSourceObjectID() + " to " + newName, ex); // NON-NLS } finally { - EamDbUtil.closeStatement(preparedStatement); - EamDbUtil.closeConnection(conn); + CentralRepoDbUtil.closeStatement(preparedStatement); + CentralRepoDbUtil.closeConnection(conn); } } @@ -986,7 +986,7 @@ abstract class AbstractSqlEamDb implements EamDb { * @param eamArtifact The artifact to add */ @Override - public void addArtifactInstance(CorrelationAttributeInstance eamArtifact) throws EamDbException { + public void addArtifactInstance(CorrelationAttributeInstance eamArtifact) throws CentralRepoException { checkAddArtifactInstanceNulls(eamArtifact); Connection conn = connect(); @@ -994,7 +994,7 @@ abstract class AbstractSqlEamDb implements EamDb { PreparedStatement preparedStatement = null; // @@@ We should cache the case and data source IDs in memory - String tableName = EamDbUtil.correlationTypeToInstanceTableName(eamArtifact.getCorrelationType()); + String tableName = CentralRepoDbUtil.correlationTypeToInstanceTableName(eamArtifact.getCorrelationType()); String sql = "INSERT INTO " + tableName @@ -1023,43 +1023,43 @@ abstract class AbstractSqlEamDb implements EamDb { } } catch (SQLException ex) { - throw new EamDbException("Error inserting new artifact into artifacts table.", ex); // NON-NLS + throw new CentralRepoException("Error inserting new artifact into artifacts table.", ex); // NON-NLS } finally { - EamDbUtil.closeStatement(preparedStatement); - EamDbUtil.closeConnection(conn); + CentralRepoDbUtil.closeStatement(preparedStatement); + CentralRepoDbUtil.closeConnection(conn); } } - private void checkAddArtifactInstanceNulls(CorrelationAttributeInstance eamArtifact) throws EamDbException { + private void checkAddArtifactInstanceNulls(CorrelationAttributeInstance eamArtifact) throws CentralRepoException { if (eamArtifact == null) { - throw new EamDbException("CorrelationAttribute is null"); + throw new CentralRepoException("CorrelationAttribute is null"); } if (eamArtifact.getCorrelationType() == null) { - throw new EamDbException("Correlation type is null"); + throw new CentralRepoException("Correlation type is null"); } if (eamArtifact.getCorrelationValue() == null) { - throw new EamDbException("Correlation value is null"); + throw new CentralRepoException("Correlation value is null"); } if (eamArtifact.getCorrelationValue().length() >= MAX_VALUE_LENGTH) { - throw new EamDbException("Artifact value too long for central repository." + throw new CentralRepoException("Artifact value too long for central repository." + "\nCorrelationArtifact ID: " + eamArtifact.getID() + "\nCorrelationArtifact Type: " + eamArtifact.getCorrelationType().getDisplayName() + "\nCorrelationArtifact Value: " + eamArtifact.getCorrelationValue()); } if (eamArtifact.getCorrelationCase() == null) { - throw new EamDbException("CorrelationAttributeInstance case is null"); + throw new CentralRepoException("CorrelationAttributeInstance case is null"); } if (eamArtifact.getCorrelationDataSource() == null) { - throw new EamDbException("CorrelationAttributeInstance data source is null"); + throw new CentralRepoException("CorrelationAttributeInstance data source is null"); } if (eamArtifact.getKnownStatus() == null) { - throw new EamDbException("CorrelationAttributeInstance known status is null"); + throw new CentralRepoException("CorrelationAttributeInstance known status is null"); } } @Override - public List getArtifactInstancesByTypeValue(CorrelationAttributeInstance.Type aType, String value) throws EamDbException, CorrelationAttributeNormalizationException { + public List getArtifactInstancesByTypeValue(CorrelationAttributeInstance.Type aType, String value) throws CentralRepoException, CorrelationAttributeNormalizationException { if (value == null) { throw new CorrelationAttributeNormalizationException("Cannot get artifact instances for null value"); } @@ -1067,7 +1067,7 @@ abstract class AbstractSqlEamDb implements EamDb { } @Override - public List getArtifactInstancesByTypeValues(CorrelationAttributeInstance.Type aType, List values) throws EamDbException, CorrelationAttributeNormalizationException { + public List getArtifactInstancesByTypeValues(CorrelationAttributeInstance.Type aType, List values) throws CentralRepoException, CorrelationAttributeNormalizationException { if (aType == null) { throw new CorrelationAttributeNormalizationException("Cannot get artifact instances for null type"); } @@ -1078,7 +1078,7 @@ abstract class AbstractSqlEamDb implements EamDb { } @Override - public List getArtifactInstancesByTypeValuesAndCases(CorrelationAttributeInstance.Type aType, List values, List caseIds) throws EamDbException, CorrelationAttributeNormalizationException { + public List getArtifactInstancesByTypeValuesAndCases(CorrelationAttributeInstance.Type aType, List values, List caseIds) throws CentralRepoException, CorrelationAttributeNormalizationException { if (aType == null) { throw new CorrelationAttributeNormalizationException("Cannot get artifact instances for null type"); } @@ -1088,7 +1088,7 @@ abstract class AbstractSqlEamDb implements EamDb { if (caseIds == null || caseIds.isEmpty()) { throw new CorrelationAttributeNormalizationException("Cannot get artifact instances without specified cases"); } - String tableName = EamDbUtil.correlationTypeToInstanceTableName(aType); + String tableName = CentralRepoDbUtil.correlationTypeToInstanceTableName(aType); String sql = " and " + tableName @@ -1113,7 +1113,7 @@ abstract class AbstractSqlEamDb implements EamDb { * @throws CorrelationAttributeNormalizationException */ private String prepareGetInstancesSql(CorrelationAttributeInstance.Type aType, List values) throws CorrelationAttributeNormalizationException { - String tableName = EamDbUtil.correlationTypeToInstanceTableName(aType); + String tableName = CentralRepoDbUtil.correlationTypeToInstanceTableName(aType); String sql = "SELECT " + tableName @@ -1157,9 +1157,9 @@ abstract class AbstractSqlEamDb implements EamDb { * values * * @throws CorrelationAttributeNormalizationException - * @throws EamDbException + * @throws CentralRepoException */ - private List getArtifactInstances(String sql, CorrelationAttributeInstance.Type aType) throws CorrelationAttributeNormalizationException, EamDbException { + private List getArtifactInstances(String sql, CorrelationAttributeInstance.Type aType) throws CorrelationAttributeNormalizationException, CentralRepoException { Connection conn = connect(); List artifactInstances = new ArrayList<>(); CorrelationAttributeInstance artifactInstance; @@ -1173,11 +1173,11 @@ abstract class AbstractSqlEamDb implements EamDb { artifactInstances.add(artifactInstance); } } catch (SQLException ex) { - throw new EamDbException("Error getting artifact instances by artifactType and artifactValue.", ex); // NON-NLS + throw new CentralRepoException("Error getting artifact instances by artifactType and artifactValue.", ex); // NON-NLS } finally { - EamDbUtil.closeStatement(preparedStatement); - EamDbUtil.closeResultSet(resultSet); - EamDbUtil.closeConnection(conn); + CentralRepoDbUtil.closeStatement(preparedStatement); + CentralRepoDbUtil.closeResultSet(resultSet); + CentralRepoDbUtil.closeConnection(conn); } return artifactInstances; } @@ -1193,7 +1193,7 @@ abstract class AbstractSqlEamDb implements EamDb { * ArtifactValue. */ @Override - public Long getCountArtifactInstancesByTypeValue(CorrelationAttributeInstance.Type aType, String value) throws EamDbException, CorrelationAttributeNormalizationException { + public Long getCountArtifactInstancesByTypeValue(CorrelationAttributeInstance.Type aType, String value) throws CentralRepoException, CorrelationAttributeNormalizationException { String normalizedValue = CorrelationAttributeNormalizer.normalize(aType, value); Connection conn = connect(); @@ -1202,7 +1202,7 @@ abstract class AbstractSqlEamDb implements EamDb { PreparedStatement preparedStatement = null; ResultSet resultSet = null; - String tableName = EamDbUtil.correlationTypeToInstanceTableName(aType); + String tableName = CentralRepoDbUtil.correlationTypeToInstanceTableName(aType); String sql = "SELECT count(*) FROM " + tableName @@ -1215,20 +1215,20 @@ abstract class AbstractSqlEamDb implements EamDb { resultSet.next(); instanceCount = resultSet.getLong(1); } catch (SQLException ex) { - throw new EamDbException("Error getting count of artifact instances by artifactType and artifactValue.", ex); // NON-NLS + throw new CentralRepoException("Error getting count of artifact instances by artifactType and artifactValue.", ex); // NON-NLS } finally { - EamDbUtil.closeStatement(preparedStatement); - EamDbUtil.closeResultSet(resultSet); - EamDbUtil.closeConnection(conn); + CentralRepoDbUtil.closeStatement(preparedStatement); + CentralRepoDbUtil.closeResultSet(resultSet); + CentralRepoDbUtil.closeConnection(conn); } return instanceCount; } @Override - public int getFrequencyPercentage(CorrelationAttributeInstance corAttr) throws EamDbException, CorrelationAttributeNormalizationException { + public int getFrequencyPercentage(CorrelationAttributeInstance corAttr) throws CentralRepoException, CorrelationAttributeNormalizationException { if (corAttr == null) { - throw new EamDbException("CorrelationAttribute is null"); + throw new CentralRepoException("CorrelationAttribute is null"); } Double uniqueTypeValueTuples = getCountUniqueCaseDataSourceTuplesHavingTypeValue(corAttr.getCorrelationType(), corAttr.getCorrelationValue()).doubleValue(); Double uniqueCaseDataSourceTuples = getCountUniqueDataSources().doubleValue(); @@ -1247,7 +1247,7 @@ abstract class AbstractSqlEamDb implements EamDb { * @return Number of unique tuples */ @Override - public Long getCountUniqueCaseDataSourceTuplesHavingTypeValue(CorrelationAttributeInstance.Type aType, String value) throws EamDbException, CorrelationAttributeNormalizationException { + public Long getCountUniqueCaseDataSourceTuplesHavingTypeValue(CorrelationAttributeInstance.Type aType, String value) throws CentralRepoException, CorrelationAttributeNormalizationException { String normalizedValue = CorrelationAttributeNormalizer.normalize(aType, value); Connection conn = connect(); @@ -1256,7 +1256,7 @@ abstract class AbstractSqlEamDb implements EamDb { PreparedStatement preparedStatement = null; ResultSet resultSet = null; - String tableName = EamDbUtil.correlationTypeToInstanceTableName(aType); + String tableName = CentralRepoDbUtil.correlationTypeToInstanceTableName(aType); String sql = "SELECT count(*) FROM (SELECT DISTINCT case_id, data_source_id FROM " + tableName @@ -1271,18 +1271,18 @@ abstract class AbstractSqlEamDb implements EamDb { resultSet.next(); instanceCount = resultSet.getLong(1); } catch (SQLException ex) { - throw new EamDbException("Error counting unique caseDisplayName/dataSource tuples having artifactType and artifactValue.", ex); // NON-NLS + throw new CentralRepoException("Error counting unique caseDisplayName/dataSource tuples having artifactType and artifactValue.", ex); // NON-NLS } finally { - EamDbUtil.closeStatement(preparedStatement); - EamDbUtil.closeResultSet(resultSet); - EamDbUtil.closeConnection(conn); + CentralRepoDbUtil.closeStatement(preparedStatement); + CentralRepoDbUtil.closeResultSet(resultSet); + CentralRepoDbUtil.closeConnection(conn); } return instanceCount; } @Override - public Long getCountUniqueDataSources() throws EamDbException { + public Long getCountUniqueDataSources() throws CentralRepoException { Connection conn = connect(); Long instanceCount = 0L; @@ -1297,11 +1297,11 @@ abstract class AbstractSqlEamDb implements EamDb { resultSet.next(); instanceCount = resultSet.getLong(1); } catch (SQLException ex) { - throw new EamDbException("Error counting data sources.", ex); // NON-NLS + throw new CentralRepoException("Error counting data sources.", ex); // NON-NLS } finally { - EamDbUtil.closeStatement(preparedStatement); - EamDbUtil.closeResultSet(resultSet); - EamDbUtil.closeConnection(conn); + CentralRepoDbUtil.closeStatement(preparedStatement); + CentralRepoDbUtil.closeResultSet(resultSet); + CentralRepoDbUtil.closeConnection(conn); } return instanceCount; @@ -1319,7 +1319,7 @@ abstract class AbstractSqlEamDb implements EamDb { * dataSource */ @Override - public Long getCountArtifactInstancesByCaseDataSource(CorrelationDataSource correlationDataSource) throws EamDbException { + public Long getCountArtifactInstancesByCaseDataSource(CorrelationDataSource correlationDataSource) throws CentralRepoException { Connection conn = connect(); Long instanceCount = 0L; @@ -1331,7 +1331,7 @@ abstract class AbstractSqlEamDb implements EamDb { String sql = "SELECT 0 "; for (CorrelationAttributeInstance.Type type : artifactTypes) { - String table_name = EamDbUtil.correlationTypeToInstanceTableName(type); + String table_name = CentralRepoDbUtil.correlationTypeToInstanceTableName(type); sql += "+ (SELECT count(*) FROM " + table_name @@ -1344,11 +1344,11 @@ abstract class AbstractSqlEamDb implements EamDb { resultSet.next(); instanceCount = resultSet.getLong(1); } catch (SQLException ex) { - throw new EamDbException("Error counting artifact instances by caseName/dataSource.", ex); // NON-NLS + throw new CentralRepoException("Error counting artifact instances by caseName/dataSource.", ex); // NON-NLS } finally { - EamDbUtil.closeStatement(preparedStatement); - EamDbUtil.closeResultSet(resultSet); - EamDbUtil.closeConnection(conn); + CentralRepoDbUtil.closeStatement(preparedStatement); + CentralRepoDbUtil.closeResultSet(resultSet); + CentralRepoDbUtil.closeConnection(conn); } return instanceCount; @@ -1362,14 +1362,14 @@ abstract class AbstractSqlEamDb implements EamDb { * @param eamArtifact The artifact to add */ @Override - public void addAttributeInstanceBulk(CorrelationAttributeInstance eamArtifact) throws EamDbException { + public void addAttributeInstanceBulk(CorrelationAttributeInstance eamArtifact) throws CentralRepoException { if (eamArtifact.getCorrelationType() == null) { - throw new EamDbException("Correlation type is null"); + throw new CentralRepoException("Correlation type is null"); } synchronized (bulkArtifacts) { - bulkArtifacts.get(EamDbUtil.correlationTypeToInstanceTableName(eamArtifact.getCorrelationType())).add(eamArtifact); + bulkArtifacts.get(CentralRepoDbUtil.correlationTypeToInstanceTableName(eamArtifact.getCorrelationType())).add(eamArtifact); bulkArtifactsCount++; if (bulkArtifactsCount >= bulkArtifactsThreshold) { @@ -1390,7 +1390,7 @@ abstract class AbstractSqlEamDb implements EamDb { * addAttributeInstanceBulk() method */ @Override - public void commitAttributeInstancesBulk() throws EamDbException { + public void commitAttributeInstancesBulk() throws CentralRepoException { List artifactTypes = getDefinedCorrelationTypes(); Connection conn = connect(); @@ -1420,19 +1420,19 @@ abstract class AbstractSqlEamDb implements EamDb { if (!eamArtifact.getCorrelationValue().isEmpty()) { if (eamArtifact.getCorrelationCase() == null) { - throw new EamDbException("CorrelationAttributeInstance case is null for: " + throw new CentralRepoException("CorrelationAttributeInstance case is null for: " + "\n\tCorrelationArtifact ID: " + eamArtifact.getID() + "\n\tCorrelationArtifact Type: " + eamArtifact.getCorrelationType().getDisplayName() + "\n\tCorrelationArtifact Value: " + eamArtifact.getCorrelationValue()); } if (eamArtifact.getCorrelationDataSource() == null) { - throw new EamDbException("CorrelationAttributeInstance data source is null for: " + throw new CentralRepoException("CorrelationAttributeInstance data source is null for: " + "\n\tCorrelationArtifact ID: " + eamArtifact.getID() + "\n\tCorrelationArtifact Type: " + eamArtifact.getCorrelationType().getDisplayName() + "\n\tCorrelationArtifact Value: " + eamArtifact.getCorrelationValue()); } if (eamArtifact.getKnownStatus() == null) { - throw new EamDbException("CorrelationAttributeInstance known status is null for: " + throw new CentralRepoException("CorrelationAttributeInstance known status is null for: " + "\n\tCorrelationArtifact ID: " + eamArtifact.getID() + "\n\tCorrelationArtifact Type: " + eamArtifact.getCorrelationType().getDisplayName() + "\n\tCorrelationArtifact Value: " + eamArtifact.getCorrelationValue() @@ -1480,10 +1480,10 @@ abstract class AbstractSqlEamDb implements EamDb { bulkArtifactsCount = 0; } } catch (SQLException ex) { - throw new EamDbException("Error inserting bulk artifacts.", ex); // NON-NLS + throw new CentralRepoException("Error inserting bulk artifacts.", ex); // NON-NLS } finally { - EamDbUtil.closeStatement(bulkPs); - EamDbUtil.closeConnection(conn); + CentralRepoDbUtil.closeStatement(bulkPs); + CentralRepoDbUtil.closeConnection(conn); } } @@ -1491,9 +1491,9 @@ abstract class AbstractSqlEamDb implements EamDb { * Executes a bulk insert of the cases */ @Override - public void bulkInsertCases(List cases) throws EamDbException { + public void bulkInsertCases(List cases) throws CentralRepoException { if (cases == null) { - throw new EamDbException("cases argument is null"); + throw new CentralRepoException("cases argument is null"); } if (cases.isEmpty()) { @@ -1560,10 +1560,10 @@ abstract class AbstractSqlEamDb implements EamDb { // send the remaining batch records bulkPs.executeBatch(); } catch (SQLException ex) { - throw new EamDbException("Error inserting bulk cases.", ex); // NON-NLS + throw new CentralRepoException("Error inserting bulk cases.", ex); // NON-NLS } finally { - EamDbUtil.closeStatement(bulkPs); - EamDbUtil.closeConnection(conn); + CentralRepoDbUtil.closeStatement(bulkPs); + CentralRepoDbUtil.closeConnection(conn); } } @@ -1574,23 +1574,23 @@ abstract class AbstractSqlEamDb implements EamDb { * @param eamArtifact The correlation attribute whose database instance will * be updated. * - * @throws EamDbException + * @throws CentralRepoException */ @Override - public void updateAttributeInstanceComment(CorrelationAttributeInstance eamArtifact) throws EamDbException { + public void updateAttributeInstanceComment(CorrelationAttributeInstance eamArtifact) throws CentralRepoException { if (eamArtifact == null) { - throw new EamDbException("CorrelationAttributeInstance is null"); + throw new CentralRepoException("CorrelationAttributeInstance is null"); } if (eamArtifact.getCorrelationCase() == null) { - throw new EamDbException("Correlation case is null"); + throw new CentralRepoException("Correlation case is null"); } if (eamArtifact.getCorrelationDataSource() == null) { - throw new EamDbException("Correlation data source is null"); + throw new CentralRepoException("Correlation data source is null"); } Connection conn = connect(); PreparedStatement preparedQuery = null; - String tableName = EamDbUtil.correlationTypeToInstanceTableName(eamArtifact.getCorrelationType()); + String tableName = CentralRepoDbUtil.correlationTypeToInstanceTableName(eamArtifact.getCorrelationType()); String sqlUpdate = "UPDATE " + tableName @@ -1609,10 +1609,10 @@ abstract class AbstractSqlEamDb implements EamDb { preparedQuery.setString(5, eamArtifact.getFilePath().toLowerCase()); preparedQuery.executeUpdate(); } catch (SQLException ex) { - throw new EamDbException("Error getting/setting artifact instance comment=" + eamArtifact.getComment(), ex); // NON-NLS + throw new CentralRepoException("Error getting/setting artifact instance comment=" + eamArtifact.getComment(), ex); // NON-NLS } finally { - EamDbUtil.closeStatement(preparedQuery); - EamDbUtil.closeConnection(conn); + CentralRepoDbUtil.closeStatement(preparedQuery); + CentralRepoDbUtil.closeConnection(conn); } } @@ -1628,14 +1628,14 @@ abstract class AbstractSqlEamDb implements EamDb { * * @return The correlation attribute if it exists; otherwise null. * - * @throws EamDbException + * @throws CentralRepoException */ @Override public CorrelationAttributeInstance getCorrelationAttributeInstance(CorrelationAttributeInstance.Type type, CorrelationCase correlationCase, - CorrelationDataSource correlationDataSource, long objectID) throws EamDbException, CorrelationAttributeNormalizationException { + CorrelationDataSource correlationDataSource, long objectID) throws CentralRepoException, CorrelationAttributeNormalizationException { if (correlationCase == null) { - throw new EamDbException("Correlation case is null"); + throw new CentralRepoException("Correlation case is null"); } Connection conn = connect(); @@ -1646,7 +1646,7 @@ abstract class AbstractSqlEamDb implements EamDb { try { - String tableName = EamDbUtil.correlationTypeToInstanceTableName(type); + String tableName = CentralRepoDbUtil.correlationTypeToInstanceTableName(type); String sql = "SELECT id, value, file_path, known_status, comment FROM " + tableName @@ -1668,11 +1668,11 @@ abstract class AbstractSqlEamDb implements EamDb { instanceId, correlationCase, correlationDataSource, filePath, comment, TskData.FileKnown.valueOf((byte) knownStatus), objectID); } } catch (SQLException ex) { - throw new EamDbException("Error getting notable artifact instances.", ex); // NON-NLS + throw new CentralRepoException("Error getting notable artifact instances.", ex); // NON-NLS } finally { - EamDbUtil.closeStatement(preparedStatement); - EamDbUtil.closeResultSet(resultSet); - EamDbUtil.closeConnection(conn); + CentralRepoDbUtil.closeStatement(preparedStatement); + CentralRepoDbUtil.closeResultSet(resultSet); + CentralRepoDbUtil.closeConnection(conn); } return correlationAttributeInstance; @@ -1690,20 +1690,20 @@ abstract class AbstractSqlEamDb implements EamDb { * * @return The correlation attribute if it exists; otherwise null. * - * @throws EamDbException + * @throws CentralRepoException */ @Override public CorrelationAttributeInstance getCorrelationAttributeInstance(CorrelationAttributeInstance.Type type, CorrelationCase correlationCase, - CorrelationDataSource correlationDataSource, String value, String filePath) throws EamDbException, CorrelationAttributeNormalizationException { + CorrelationDataSource correlationDataSource, String value, String filePath) throws CentralRepoException, CorrelationAttributeNormalizationException { if (correlationCase == null) { - throw new EamDbException("Correlation case is null"); + throw new CentralRepoException("Correlation case is null"); } if (correlationDataSource == null) { - throw new EamDbException("Correlation data source is null"); + throw new CentralRepoException("Correlation data source is null"); } if (filePath == null) { - throw new EamDbException("Correlation file path is null"); + throw new CentralRepoException("Correlation file path is null"); } Connection conn = connect(); @@ -1715,7 +1715,7 @@ abstract class AbstractSqlEamDb implements EamDb { try { String normalizedValue = CorrelationAttributeNormalizer.normalize(type, value); - String tableName = EamDbUtil.correlationTypeToInstanceTableName(type); + String tableName = CentralRepoDbUtil.correlationTypeToInstanceTableName(type); String sql = "SELECT id, known_status, comment FROM " + tableName @@ -1739,11 +1739,11 @@ abstract class AbstractSqlEamDb implements EamDb { instanceId, correlationCase, correlationDataSource, filePath, comment, TskData.FileKnown.valueOf((byte) knownStatus), null); } } catch (SQLException ex) { - throw new EamDbException("Error getting notable artifact instances.", ex); // NON-NLS + throw new CentralRepoException("Error getting notable artifact instances.", ex); // NON-NLS } finally { - EamDbUtil.closeStatement(preparedStatement); - EamDbUtil.closeResultSet(resultSet); - EamDbUtil.closeConnection(conn); + CentralRepoDbUtil.closeStatement(preparedStatement); + CentralRepoDbUtil.closeResultSet(resultSet); + CentralRepoDbUtil.closeConnection(conn); } return correlationAttributeInstance; @@ -1760,19 +1760,19 @@ abstract class AbstractSqlEamDb implements EamDb { * KNOWN */ @Override - public void setAttributeInstanceKnownStatus(CorrelationAttributeInstance eamArtifact, TskData.FileKnown knownStatus) throws EamDbException { + public void setAttributeInstanceKnownStatus(CorrelationAttributeInstance eamArtifact, TskData.FileKnown knownStatus) throws CentralRepoException { if (eamArtifact == null) { - throw new EamDbException("CorrelationAttribute is null"); + throw new CentralRepoException("CorrelationAttribute is null"); } if (knownStatus == null) { - throw new EamDbException("Known status is null"); + throw new CentralRepoException("Known status is null"); } if (eamArtifact.getCorrelationCase() == null) { - throw new EamDbException("Correlation case is null"); + throw new CentralRepoException("Correlation case is null"); } if (eamArtifact.getCorrelationDataSource() == null) { - throw new EamDbException("Correlation data source is null"); + throw new CentralRepoException("Correlation data source is null"); } Connection conn = connect(); @@ -1781,7 +1781,7 @@ abstract class AbstractSqlEamDb implements EamDb { PreparedStatement preparedQuery = null; ResultSet resultSet = null; - String tableName = EamDbUtil.correlationTypeToInstanceTableName(eamArtifact.getCorrelationType()); + String tableName = CentralRepoDbUtil.correlationTypeToInstanceTableName(eamArtifact.getCorrelationType()); String sqlQuery = "SELECT id FROM " @@ -1835,12 +1835,12 @@ abstract class AbstractSqlEamDb implements EamDb { } } catch (SQLException ex) { - throw new EamDbException("Error getting/setting artifact instance knownStatus=" + knownStatus.getName(), ex); // NON-NLS + throw new CentralRepoException("Error getting/setting artifact instance knownStatus=" + knownStatus.getName(), ex); // NON-NLS } finally { - EamDbUtil.closeStatement(preparedUpdate); - EamDbUtil.closeStatement(preparedQuery); - EamDbUtil.closeResultSet(resultSet); - EamDbUtil.closeConnection(conn); + CentralRepoDbUtil.closeStatement(preparedUpdate); + CentralRepoDbUtil.closeStatement(preparedQuery); + CentralRepoDbUtil.closeResultSet(resultSet); + CentralRepoDbUtil.closeConnection(conn); } } @@ -1853,7 +1853,7 @@ abstract class AbstractSqlEamDb implements EamDb { * @return Number of matching eamArtifacts */ @Override - public Long getCountArtifactInstancesKnownBad(CorrelationAttributeInstance.Type aType, String value) throws EamDbException, CorrelationAttributeNormalizationException { + public Long getCountArtifactInstancesKnownBad(CorrelationAttributeInstance.Type aType, String value) throws CentralRepoException, CorrelationAttributeNormalizationException { String normalizedValue = CorrelationAttributeNormalizer.normalize(aType, value); @@ -1863,7 +1863,7 @@ abstract class AbstractSqlEamDb implements EamDb { PreparedStatement preparedStatement = null; ResultSet resultSet = null; - String tableName = EamDbUtil.correlationTypeToInstanceTableName(aType); + String tableName = CentralRepoDbUtil.correlationTypeToInstanceTableName(aType); String sql = "SELECT count(*) FROM " + tableName @@ -1877,11 +1877,11 @@ abstract class AbstractSqlEamDb implements EamDb { resultSet.next(); badInstances = resultSet.getLong(1); } catch (SQLException ex) { - throw new EamDbException("Error getting count of notable artifact instances.", ex); // NON-NLS + throw new CentralRepoException("Error getting count of notable artifact instances.", ex); // NON-NLS } finally { - EamDbUtil.closeStatement(preparedStatement); - EamDbUtil.closeResultSet(resultSet); - EamDbUtil.closeConnection(conn); + CentralRepoDbUtil.closeStatement(preparedStatement); + CentralRepoDbUtil.closeResultSet(resultSet); + CentralRepoDbUtil.closeConnection(conn); } return badInstances; @@ -1897,10 +1897,10 @@ abstract class AbstractSqlEamDb implements EamDb { * @return List of cases containing this artifact with instances marked as * bad * - * @throws EamDbException + * @throws CentralRepoException */ @Override - public List getListCasesHavingArtifactInstancesKnownBad(CorrelationAttributeInstance.Type aType, String value) throws EamDbException, CorrelationAttributeNormalizationException { + public List getListCasesHavingArtifactInstancesKnownBad(CorrelationAttributeInstance.Type aType, String value) throws CentralRepoException, CorrelationAttributeNormalizationException { String normalizedValue = CorrelationAttributeNormalizer.normalize(aType, value); @@ -1911,7 +1911,7 @@ abstract class AbstractSqlEamDb implements EamDb { PreparedStatement preparedStatement = null; ResultSet resultSet = null; - String tableName = EamDbUtil.correlationTypeToInstanceTableName(aType); + String tableName = CentralRepoDbUtil.correlationTypeToInstanceTableName(aType); String sql = "SELECT DISTINCT case_name FROM " + tableName @@ -1932,11 +1932,11 @@ abstract class AbstractSqlEamDb implements EamDb { caseNames.add(resultSet.getString("case_name")); } } catch (SQLException ex) { - throw new EamDbException("Error getting notable artifact instances.", ex); // NON-NLS + throw new CentralRepoException("Error getting notable artifact instances.", ex); // NON-NLS } finally { - EamDbUtil.closeStatement(preparedStatement); - EamDbUtil.closeResultSet(resultSet); - EamDbUtil.closeConnection(conn); + CentralRepoDbUtil.closeStatement(preparedStatement); + CentralRepoDbUtil.closeResultSet(resultSet); + CentralRepoDbUtil.closeConnection(conn); } return caseNames.stream().collect(Collectors.toList()); @@ -1952,10 +1952,10 @@ abstract class AbstractSqlEamDb implements EamDb { * @return List of cases containing this artifact with instances marked as * bad * - * @throws EamDbException + * @throws CentralRepoException */ @Override - public List getListCasesHavingArtifactInstances(CorrelationAttributeInstance.Type aType, String value) throws EamDbException, CorrelationAttributeNormalizationException { + public List getListCasesHavingArtifactInstances(CorrelationAttributeInstance.Type aType, String value) throws CentralRepoException, CorrelationAttributeNormalizationException { String normalizedValue = CorrelationAttributeNormalizer.normalize(aType, value); @@ -1966,7 +1966,7 @@ abstract class AbstractSqlEamDb implements EamDb { PreparedStatement preparedStatement = null; ResultSet resultSet = null; - String tableName = EamDbUtil.correlationTypeToInstanceTableName(aType); + String tableName = CentralRepoDbUtil.correlationTypeToInstanceTableName(aType); String sql = "SELECT DISTINCT case_name FROM " + tableName @@ -1984,11 +1984,11 @@ abstract class AbstractSqlEamDb implements EamDb { caseNames.add(resultSet.getString("case_name")); } } catch (SQLException ex) { - throw new EamDbException("Error getting notable artifact instances.", ex); // NON-NLS + throw new CentralRepoException("Error getting notable artifact instances.", ex); // NON-NLS } finally { - EamDbUtil.closeStatement(preparedStatement); - EamDbUtil.closeResultSet(resultSet); - EamDbUtil.closeConnection(conn); + CentralRepoDbUtil.closeStatement(preparedStatement); + CentralRepoDbUtil.closeResultSet(resultSet); + CentralRepoDbUtil.closeConnection(conn); } return caseNames.stream().collect(Collectors.toList()); @@ -1999,10 +1999,10 @@ abstract class AbstractSqlEamDb implements EamDb { * * @param referenceSetID * - * @throws EamDbException + * @throws CentralRepoException */ @Override - public void deleteReferenceSet(int referenceSetID) throws EamDbException { + public void deleteReferenceSet(int referenceSetID) throws CentralRepoException { deleteReferenceSetEntries(referenceSetID); deleteReferenceSetEntry(referenceSetID); } @@ -2012,9 +2012,9 @@ abstract class AbstractSqlEamDb implements EamDb { * * @param referenceSetID * - * @throws EamDbException + * @throws CentralRepoException */ - private void deleteReferenceSetEntry(int referenceSetID) throws EamDbException { + private void deleteReferenceSetEntry(int referenceSetID) throws CentralRepoException { Connection conn = connect(); PreparedStatement preparedStatement = null; @@ -2025,10 +2025,10 @@ abstract class AbstractSqlEamDb implements EamDb { preparedStatement.setInt(1, referenceSetID); preparedStatement.executeUpdate(); } catch (SQLException ex) { - throw new EamDbException("Error deleting reference set " + referenceSetID, ex); // NON-NLS + throw new CentralRepoException("Error deleting reference set " + referenceSetID, ex); // NON-NLS } finally { - EamDbUtil.closeStatement(preparedStatement); - EamDbUtil.closeConnection(conn); + CentralRepoDbUtil.closeStatement(preparedStatement); + CentralRepoDbUtil.closeConnection(conn); } } @@ -2038,26 +2038,26 @@ abstract class AbstractSqlEamDb implements EamDb { * * @param referenceSetID * - * @throws EamDbException + * @throws CentralRepoException */ - private void deleteReferenceSetEntries(int referenceSetID) throws EamDbException { + private void deleteReferenceSetEntries(int referenceSetID) throws CentralRepoException { Connection conn = connect(); PreparedStatement preparedStatement = null; String sql = "DELETE FROM %s WHERE reference_set_id=?"; // When other reference types are added, this will need to loop over all the tables - String fileTableName = EamDbUtil.correlationTypeToReferenceTableName(getCorrelationTypeById(CorrelationAttributeInstance.FILES_TYPE_ID)); + String fileTableName = CentralRepoDbUtil.correlationTypeToReferenceTableName(getCorrelationTypeById(CorrelationAttributeInstance.FILES_TYPE_ID)); try { preparedStatement = conn.prepareStatement(String.format(sql, fileTableName)); preparedStatement.setInt(1, referenceSetID); preparedStatement.executeUpdate(); } catch (SQLException ex) { - throw new EamDbException("Error deleting files from reference set " + referenceSetID, ex); // NON-NLS + throw new CentralRepoException("Error deleting files from reference set " + referenceSetID, ex); // NON-NLS } finally { - EamDbUtil.closeStatement(preparedStatement); - EamDbUtil.closeConnection(conn); + CentralRepoDbUtil.closeStatement(preparedStatement); + CentralRepoDbUtil.closeConnection(conn); } } @@ -2072,11 +2072,11 @@ abstract class AbstractSqlEamDb implements EamDb { * * @return true if a matching entry exists in the central repository * - * @throws EamDbException + * @throws CentralRepoException */ @Override - public boolean referenceSetIsValid(int referenceSetID, String setName, String version) throws EamDbException { - EamGlobalSet refSet = this.getReferenceSetByID(referenceSetID); + public boolean referenceSetIsValid(int referenceSetID, String setName, String version) throws CentralRepoException { + CentralRepoFileSet refSet = this.getReferenceSetByID(referenceSetID); if (refSet == null) { return false; } @@ -2093,10 +2093,10 @@ abstract class AbstractSqlEamDb implements EamDb { * * @return true if the hash is found in the reference set * - * @throws EamDbException + * @throws CentralRepoException */ @Override - public boolean isFileHashInReferenceSet(String hash, int referenceSetID) throws EamDbException, CorrelationAttributeNormalizationException { + public boolean isFileHashInReferenceSet(String hash, int referenceSetID) throws CentralRepoException, CorrelationAttributeNormalizationException { return isValueInReferenceSet(hash, referenceSetID, CorrelationAttributeInstance.FILES_TYPE_ID); } @@ -2110,7 +2110,7 @@ abstract class AbstractSqlEamDb implements EamDb { * @return true if the value is found in the reference set */ @Override - public boolean isValueInReferenceSet(String value, int referenceSetID, int correlationTypeID) throws EamDbException, CorrelationAttributeNormalizationException { + public boolean isValueInReferenceSet(String value, int referenceSetID, int correlationTypeID) throws CentralRepoException, CorrelationAttributeNormalizationException { String normalizeValued = CorrelationAttributeNormalizer.normalize(this.getCorrelationTypeById(correlationTypeID), value); @@ -2121,7 +2121,7 @@ abstract class AbstractSqlEamDb implements EamDb { ResultSet resultSet = null; String sql = "SELECT count(*) FROM %s WHERE value=? AND reference_set_id=?"; - String fileTableName = EamDbUtil.correlationTypeToReferenceTableName(getCorrelationTypeById(correlationTypeID)); + String fileTableName = CentralRepoDbUtil.correlationTypeToReferenceTableName(getCorrelationTypeById(correlationTypeID)); try { preparedStatement = conn.prepareStatement(String.format(sql, fileTableName)); @@ -2131,11 +2131,11 @@ abstract class AbstractSqlEamDb implements EamDb { resultSet.next(); matchingInstances = resultSet.getLong(1); } catch (SQLException ex) { - throw new EamDbException("Error determining if value (" + normalizeValued + ") is in reference set " + referenceSetID, ex); // NON-NLS + throw new CentralRepoException("Error determining if value (" + normalizeValued + ") is in reference set " + referenceSetID, ex); // NON-NLS } finally { - EamDbUtil.closeStatement(preparedStatement); - EamDbUtil.closeResultSet(resultSet); - EamDbUtil.closeConnection(conn); + CentralRepoDbUtil.closeStatement(preparedStatement); + CentralRepoDbUtil.closeResultSet(resultSet); + CentralRepoDbUtil.closeConnection(conn); } return 0 < matchingInstances; @@ -2150,7 +2150,7 @@ abstract class AbstractSqlEamDb implements EamDb { * @return Global known status of the artifact */ @Override - public boolean isArtifactKnownBadByReference(CorrelationAttributeInstance.Type aType, String value) throws EamDbException, CorrelationAttributeNormalizationException { + public boolean isArtifactKnownBadByReference(CorrelationAttributeInstance.Type aType, String value) throws CentralRepoException, CorrelationAttributeNormalizationException { //this should be done here so that we can be certain that aType and value are valid before we proceed String normalizeValued = CorrelationAttributeNormalizer.normalize(aType, value); @@ -2168,18 +2168,18 @@ abstract class AbstractSqlEamDb implements EamDb { String sql = "SELECT count(*) FROM %s WHERE value=? AND known_status=?"; try { - preparedStatement = conn.prepareStatement(String.format(sql, EamDbUtil.correlationTypeToReferenceTableName(aType))); + preparedStatement = conn.prepareStatement(String.format(sql, CentralRepoDbUtil.correlationTypeToReferenceTableName(aType))); preparedStatement.setString(1, normalizeValued); preparedStatement.setByte(2, TskData.FileKnown.BAD.getFileKnownValue()); resultSet = preparedStatement.executeQuery(); resultSet.next(); badInstances = resultSet.getLong(1); } catch (SQLException ex) { - throw new EamDbException("Error determining if artifact is notable by reference.", ex); // NON-NLS + throw new CentralRepoException("Error determining if artifact is notable by reference.", ex); // NON-NLS } finally { - EamDbUtil.closeStatement(preparedStatement); - EamDbUtil.closeResultSet(resultSet); - EamDbUtil.closeConnection(conn); + CentralRepoDbUtil.closeStatement(preparedStatement); + CentralRepoDbUtil.closeResultSet(resultSet); + CentralRepoDbUtil.closeConnection(conn); } return 0 < badInstances; @@ -2191,22 +2191,22 @@ abstract class AbstractSqlEamDb implements EamDb { * @param type EamArtifact.Type to search for * @param instanceTableCallback callback to process the instance * - * @throws EamDbException + * @throws CentralRepoException */ @Override - public void processInstanceTable(CorrelationAttributeInstance.Type type, InstanceTableCallback instanceTableCallback) throws EamDbException { + public void processInstanceTable(CorrelationAttributeInstance.Type type, InstanceTableCallback instanceTableCallback) throws CentralRepoException { if (type == null) { - throw new EamDbException("Correlation type is null"); + throw new CentralRepoException("Correlation type is null"); } if (instanceTableCallback == null) { - throw new EamDbException("Callback interface is null"); + throw new CentralRepoException("Callback interface is null"); } Connection conn = connect(); PreparedStatement preparedStatement = null; ResultSet resultSet = null; - String tableName = EamDbUtil.correlationTypeToInstanceTableName(type); + String tableName = CentralRepoDbUtil.correlationTypeToInstanceTableName(type); StringBuilder sql = new StringBuilder(); sql.append("select * from "); sql.append(tableName); @@ -2216,11 +2216,11 @@ abstract class AbstractSqlEamDb implements EamDb { resultSet = preparedStatement.executeQuery(); instanceTableCallback.process(resultSet); } catch (SQLException ex) { - throw new EamDbException("Error getting all artifact instances from instances table", ex); + throw new CentralRepoException("Error getting all artifact instances from instances table", ex); } finally { - EamDbUtil.closeStatement(preparedStatement); - EamDbUtil.closeResultSet(resultSet); - EamDbUtil.closeConnection(conn); + CentralRepoDbUtil.closeStatement(preparedStatement); + CentralRepoDbUtil.closeResultSet(resultSet); + CentralRepoDbUtil.closeConnection(conn); } } @@ -2231,26 +2231,26 @@ abstract class AbstractSqlEamDb implements EamDb { * @param instanceTableCallback callback to process the instance * @param whereClause query string to execute * - * @throws EamDbException + * @throws CentralRepoException */ @Override - public void processInstanceTableWhere(CorrelationAttributeInstance.Type type, String whereClause, InstanceTableCallback instanceTableCallback) throws EamDbException { + public void processInstanceTableWhere(CorrelationAttributeInstance.Type type, String whereClause, InstanceTableCallback instanceTableCallback) throws CentralRepoException { if (type == null) { - throw new EamDbException("Correlation type is null"); + throw new CentralRepoException("Correlation type is null"); } if (instanceTableCallback == null) { - throw new EamDbException("Callback interface is null"); + throw new CentralRepoException("Callback interface is null"); } if (whereClause == null) { - throw new EamDbException("Where clause is null"); + throw new CentralRepoException("Where clause is null"); } Connection conn = connect(); PreparedStatement preparedStatement = null; ResultSet resultSet = null; - String tableName = EamDbUtil.correlationTypeToInstanceTableName(type); + String tableName = CentralRepoDbUtil.correlationTypeToInstanceTableName(type); StringBuilder sql = new StringBuilder(300); sql.append("select * from ") .append(tableName) @@ -2262,11 +2262,11 @@ abstract class AbstractSqlEamDb implements EamDb { resultSet = preparedStatement.executeQuery(); instanceTableCallback.process(resultSet); } catch (SQLException ex) { - throw new EamDbException("Error getting all artifact instances from instances table", ex); + throw new CentralRepoException("Error getting all artifact instances from instances table", ex); } finally { - EamDbUtil.closeStatement(preparedStatement); - EamDbUtil.closeResultSet(resultSet); - EamDbUtil.closeConnection(conn); + CentralRepoDbUtil.closeStatement(preparedStatement); + CentralRepoDbUtil.closeResultSet(resultSet); + CentralRepoDbUtil.closeConnection(conn); } } @@ -2276,17 +2276,17 @@ abstract class AbstractSqlEamDb implements EamDb { * @param selectClause query string to execute * @param instanceTableCallback callback to process the instance * - * @throws EamDbException + * @throws CentralRepoException */ @Override - public void processSelectClause(String selectClause, InstanceTableCallback instanceTableCallback) throws EamDbException { + public void processSelectClause(String selectClause, InstanceTableCallback instanceTableCallback) throws CentralRepoException { if (instanceTableCallback == null) { - throw new EamDbException("Callback interface is null"); + throw new CentralRepoException("Callback interface is null"); } if (selectClause == null) { - throw new EamDbException("Select clause is null"); + throw new CentralRepoException("Select clause is null"); } Connection conn = connect(); @@ -2301,20 +2301,20 @@ abstract class AbstractSqlEamDb implements EamDb { resultSet = preparedStatement.executeQuery(); instanceTableCallback.process(resultSet); } catch (SQLException ex) { - throw new EamDbException("Error running query", ex); + throw new CentralRepoException("Error running query", ex); } finally { - EamDbUtil.closeStatement(preparedStatement); - EamDbUtil.closeResultSet(resultSet); - EamDbUtil.closeConnection(conn); + CentralRepoDbUtil.closeStatement(preparedStatement); + CentralRepoDbUtil.closeResultSet(resultSet); + CentralRepoDbUtil.closeConnection(conn); } } @Override - public EamOrganization newOrganization(EamOrganization eamOrg) throws EamDbException { + public CentralRepoOrganization newOrganization(CentralRepoOrganization eamOrg) throws CentralRepoException { if (eamOrg == null) { - throw new EamDbException("EamOrganization is null"); + throw new CentralRepoException("EamOrganization is null"); } else if (eamOrg.getOrgID() != -1) { - throw new EamDbException("EamOrganization already has an ID"); + throw new CentralRepoException("EamOrganization already has an ID"); } Connection conn = connect(); @@ -2339,11 +2339,11 @@ abstract class AbstractSqlEamDb implements EamDb { throw new SQLException("Creating user failed, no ID obtained."); } } catch (SQLException ex) { - throw new EamDbException("Error inserting new organization.", ex); // NON-NLS + throw new CentralRepoException("Error inserting new organization.", ex); // NON-NLS } finally { - EamDbUtil.closeStatement(preparedStatement); - EamDbUtil.closeResultSet(generatedKeys); - EamDbUtil.closeConnection(conn); + CentralRepoDbUtil.closeStatement(preparedStatement); + CentralRepoDbUtil.closeResultSet(generatedKeys); + CentralRepoDbUtil.closeConnection(conn); } } @@ -2352,13 +2352,13 @@ abstract class AbstractSqlEamDb implements EamDb { * * @return A list of all organizations * - * @throws EamDbException + * @throws CentralRepoException */ @Override - public List getOrganizations() throws EamDbException { + public List getOrganizations() throws CentralRepoException { Connection conn = connect(); - List orgs = new ArrayList<>(); + List orgs = new ArrayList<>(); PreparedStatement preparedStatement = null; ResultSet resultSet = null; String sql = "SELECT * FROM organizations"; @@ -2372,11 +2372,11 @@ abstract class AbstractSqlEamDb implements EamDb { return orgs; } catch (SQLException ex) { - throw new EamDbException("Error getting all organizations.", ex); // NON-NLS + throw new CentralRepoException("Error getting all organizations.", ex); // NON-NLS } finally { - EamDbUtil.closeStatement(preparedStatement); - EamDbUtil.closeResultSet(resultSet); - EamDbUtil.closeConnection(conn); + CentralRepoDbUtil.closeStatement(preparedStatement); + CentralRepoDbUtil.closeResultSet(resultSet); + CentralRepoDbUtil.closeConnection(conn); } } @@ -2387,10 +2387,10 @@ abstract class AbstractSqlEamDb implements EamDb { * * @return The organization with the given ID * - * @throws EamDbException + * @throws CentralRepoException */ @Override - public EamOrganization getOrganizationByID(int orgID) throws EamDbException { + public CentralRepoOrganization getOrganizationByID(int orgID) throws CentralRepoException { Connection conn = connect(); PreparedStatement preparedStatement = null; @@ -2405,11 +2405,11 @@ abstract class AbstractSqlEamDb implements EamDb { return getEamOrganizationFromResultSet(resultSet); } catch (SQLException ex) { - throw new EamDbException("Error getting organization by id.", ex); // NON-NLS + throw new CentralRepoException("Error getting organization by id.", ex); // NON-NLS } finally { - EamDbUtil.closeStatement(preparedStatement); - EamDbUtil.closeResultSet(resultSet); - EamDbUtil.closeConnection(conn); + CentralRepoDbUtil.closeStatement(preparedStatement); + CentralRepoDbUtil.closeResultSet(resultSet); + CentralRepoDbUtil.closeConnection(conn); } } @@ -2420,14 +2420,14 @@ abstract class AbstractSqlEamDb implements EamDb { * * @return The organization object * - * @throws EamDbException + * @throws CentralRepoException */ @Override - public EamOrganization getReferenceSetOrganization(int referenceSetID) throws EamDbException { + public CentralRepoOrganization getReferenceSetOrganization(int referenceSetID) throws CentralRepoException { - EamGlobalSet globalSet = getReferenceSetByID(referenceSetID); + CentralRepoFileSet globalSet = getReferenceSetByID(referenceSetID); if (globalSet == null) { - throw new EamDbException("Reference set with ID " + referenceSetID + " not found"); + throw new CentralRepoException("Reference set with ID " + referenceSetID + " not found"); } return (getOrganizationByID(globalSet.getOrgID())); } @@ -2437,13 +2437,13 @@ abstract class AbstractSqlEamDb implements EamDb { * * @param org * - * @throws EamDbException if invalid + * @throws CentralRepoException if invalid */ - private void testArgument(EamOrganization org) throws EamDbException { + private void testArgument(CentralRepoOrganization org) throws CentralRepoException { if (org == null) { - throw new EamDbException("EamOrganization is null"); + throw new CentralRepoException("EamOrganization is null"); } else if (org.getOrgID() == -1) { - throw new EamDbException("Organization has -1 row ID"); + throw new CentralRepoException("Organization has -1 row ID"); } } @@ -2453,10 +2453,10 @@ abstract class AbstractSqlEamDb implements EamDb { * @param updatedOrganization the values the Organization with the same ID * will be updated to in the database. * - * @throws EamDbException + * @throws CentralRepoException */ @Override - public void updateOrganization(EamOrganization updatedOrganization) throws EamDbException { + public void updateOrganization(CentralRepoOrganization updatedOrganization) throws CentralRepoException { testArgument(updatedOrganization); Connection conn = connect(); @@ -2471,15 +2471,15 @@ abstract class AbstractSqlEamDb implements EamDb { preparedStatement.setInt(5, updatedOrganization.getOrgID()); preparedStatement.executeUpdate(); } catch (SQLException ex) { - throw new EamDbException("Error updating organization.", ex); // NON-NLS + throw new CentralRepoException("Error updating organization.", ex); // NON-NLS } finally { - EamDbUtil.closeStatement(preparedStatement); - EamDbUtil.closeConnection(conn); + CentralRepoDbUtil.closeStatement(preparedStatement); + CentralRepoDbUtil.closeConnection(conn); } } @Override - public void deleteOrganization(EamOrganization organizationToDelete) throws EamDbException { + public void deleteOrganization(CentralRepoOrganization organizationToDelete) throws CentralRepoException { testArgument(organizationToDelete); Connection conn = connect(); @@ -2495,18 +2495,18 @@ abstract class AbstractSqlEamDb implements EamDb { resultSet = checkIfUsedStatement.executeQuery(); resultSet.next(); if (resultSet.getLong(1) > 0) { - throw new EamDbException("Can not delete organization which is currently in use by a case or reference set in the central repository."); + throw new CentralRepoException("Can not delete organization which is currently in use by a case or reference set in the central repository."); } deleteOrgStatement = conn.prepareStatement(deleteOrgSql); deleteOrgStatement.setInt(1, organizationToDelete.getOrgID()); deleteOrgStatement.executeUpdate(); } catch (SQLException ex) { - throw new EamDbException("Error executing query when attempting to delete organization by id.", ex); // NON-NLS + throw new CentralRepoException("Error executing query when attempting to delete organization by id.", ex); // NON-NLS } finally { - EamDbUtil.closeStatement(checkIfUsedStatement); - EamDbUtil.closeStatement(deleteOrgStatement); - EamDbUtil.closeResultSet(resultSet); - EamDbUtil.closeConnection(conn); + CentralRepoDbUtil.closeStatement(checkIfUsedStatement); + CentralRepoDbUtil.closeStatement(deleteOrgStatement); + CentralRepoDbUtil.closeResultSet(resultSet); + CentralRepoDbUtil.closeConnection(conn); } } @@ -2517,20 +2517,20 @@ abstract class AbstractSqlEamDb implements EamDb { * * @return The ID of the new global set * - * @throws EamDbException + * @throws CentralRepoException */ @Override - public int newReferenceSet(EamGlobalSet eamGlobalSet) throws EamDbException { + public int newReferenceSet(CentralRepoFileSet eamGlobalSet) throws CentralRepoException { if (eamGlobalSet == null) { - throw new EamDbException("EamGlobalSet is null"); + throw new CentralRepoException("EamGlobalSet is null"); } if (eamGlobalSet.getFileKnownStatus() == null) { - throw new EamDbException("File known status on the EamGlobalSet is null"); + throw new CentralRepoException("File known status on the EamGlobalSet is null"); } if (eamGlobalSet.getType() == null) { - throw new EamDbException("Type on the EamGlobalSet is null"); + throw new CentralRepoException("Type on the EamGlobalSet is null"); } Connection conn = connect(); @@ -2565,12 +2565,12 @@ abstract class AbstractSqlEamDb implements EamDb { return resultSet.getInt("id"); } catch (SQLException ex) { - throw new EamDbException("Error inserting new global set.", ex); // NON-NLS + throw new CentralRepoException("Error inserting new global set.", ex); // NON-NLS } finally { - EamDbUtil.closeStatement(preparedStatement1); - EamDbUtil.closeStatement(preparedStatement2); - EamDbUtil.closeResultSet(resultSet); - EamDbUtil.closeConnection(conn); + CentralRepoDbUtil.closeStatement(preparedStatement1); + CentralRepoDbUtil.closeStatement(preparedStatement2); + CentralRepoDbUtil.closeResultSet(resultSet); + CentralRepoDbUtil.closeConnection(conn); } } @@ -2581,10 +2581,10 @@ abstract class AbstractSqlEamDb implements EamDb { * * @return The global set associated with the ID * - * @throws EamDbException + * @throws CentralRepoException */ @Override - public EamGlobalSet getReferenceSetByID(int referenceSetID) throws EamDbException { + public CentralRepoFileSet getReferenceSetByID(int referenceSetID) throws CentralRepoException { Connection conn = connect(); PreparedStatement preparedStatement1 = null; @@ -2602,11 +2602,11 @@ abstract class AbstractSqlEamDb implements EamDb { } } catch (SQLException ex) { - throw new EamDbException("Error getting reference set by id.", ex); // NON-NLS + throw new CentralRepoException("Error getting reference set by id.", ex); // NON-NLS } finally { - EamDbUtil.closeStatement(preparedStatement1); - EamDbUtil.closeResultSet(resultSet); - EamDbUtil.closeConnection(conn); + CentralRepoDbUtil.closeStatement(preparedStatement1); + CentralRepoDbUtil.closeResultSet(resultSet); + CentralRepoDbUtil.closeConnection(conn); } } @@ -2617,16 +2617,16 @@ abstract class AbstractSqlEamDb implements EamDb { * * @return List of all reference sets in the central repository * - * @throws EamDbException + * @throws CentralRepoException */ @Override - public List getAllReferenceSets(CorrelationAttributeInstance.Type correlationType) throws EamDbException { + public List getAllReferenceSets(CorrelationAttributeInstance.Type correlationType) throws CentralRepoException { if (correlationType == null) { - throw new EamDbException("Correlation type is null"); + throw new CentralRepoException("Correlation type is null"); } - List results = new ArrayList<>(); + List results = new ArrayList<>(); Connection conn = connect(); PreparedStatement preparedStatement1 = null; @@ -2641,11 +2641,11 @@ abstract class AbstractSqlEamDb implements EamDb { } } catch (SQLException ex) { - throw new EamDbException("Error getting reference sets.", ex); // NON-NLS + throw new CentralRepoException("Error getting reference sets.", ex); // NON-NLS } finally { - EamDbUtil.closeStatement(preparedStatement1); - EamDbUtil.closeResultSet(resultSet); - EamDbUtil.closeConnection(conn); + CentralRepoDbUtil.closeStatement(preparedStatement1); + CentralRepoDbUtil.closeResultSet(resultSet); + CentralRepoDbUtil.closeConnection(conn); } return results; } @@ -2657,15 +2657,15 @@ abstract class AbstractSqlEamDb implements EamDb { * @param correlationType Correlation Type that this Reference * Instance is * - * @throws EamDbException + * @throws CentralRepoException */ @Override - public void addReferenceInstance(EamGlobalFileInstance eamGlobalFileInstance, CorrelationAttributeInstance.Type correlationType) throws EamDbException { + public void addReferenceInstance(CentralRepoFileInstance eamGlobalFileInstance, CorrelationAttributeInstance.Type correlationType) throws CentralRepoException { if (eamGlobalFileInstance.getKnownStatus() == null) { - throw new EamDbException("Known status of EamGlobalFileInstance is null"); + throw new CentralRepoException("Known status of EamGlobalFileInstance is null"); } if (correlationType == null) { - throw new EamDbException("Correlation type is null"); + throw new CentralRepoException("Correlation type is null"); } Connection conn = connect(); @@ -2676,17 +2676,17 @@ abstract class AbstractSqlEamDb implements EamDb { + getConflictClause(); try { - preparedStatement = conn.prepareStatement(String.format(sql, EamDbUtil.correlationTypeToReferenceTableName(correlationType))); + preparedStatement = conn.prepareStatement(String.format(sql, CentralRepoDbUtil.correlationTypeToReferenceTableName(correlationType))); preparedStatement.setInt(1, eamGlobalFileInstance.getGlobalSetID()); preparedStatement.setString(2, eamGlobalFileInstance.getMD5Hash()); preparedStatement.setByte(3, eamGlobalFileInstance.getKnownStatus().getFileKnownValue()); preparedStatement.setString(4, eamGlobalFileInstance.getComment()); preparedStatement.executeUpdate(); } catch (SQLException ex) { - throw new EamDbException("Error inserting new reference instance into reference_ table.", ex); // NON-NLS + throw new CentralRepoException("Error inserting new reference instance into reference_ table.", ex); // NON-NLS } finally { - EamDbUtil.closeStatement(preparedStatement); - EamDbUtil.closeConnection(conn); + CentralRepoDbUtil.closeStatement(preparedStatement); + CentralRepoDbUtil.closeConnection(conn); } } @@ -2700,10 +2700,10 @@ abstract class AbstractSqlEamDb implements EamDb { * * @return true if a matching set is found * - * @throws EamDbException + * @throws CentralRepoException */ @Override - public boolean referenceSetExists(String referenceSetName, String version) throws EamDbException { + public boolean referenceSetExists(String referenceSetName, String version) throws CentralRepoException { Connection conn = connect(); PreparedStatement preparedStatement1 = null; @@ -2718,27 +2718,27 @@ abstract class AbstractSqlEamDb implements EamDb { return (resultSet.next()); } catch (SQLException ex) { - throw new EamDbException("Error testing whether reference set exists (name: " + referenceSetName + throw new CentralRepoException("Error testing whether reference set exists (name: " + referenceSetName + " version: " + version, ex); // NON-NLS } finally { - EamDbUtil.closeStatement(preparedStatement1); - EamDbUtil.closeResultSet(resultSet); - EamDbUtil.closeConnection(conn); + CentralRepoDbUtil.closeStatement(preparedStatement1); + CentralRepoDbUtil.closeResultSet(resultSet); + CentralRepoDbUtil.closeConnection(conn); } } /** * Insert the bulk collection of Reference Type Instances * - * @throws EamDbException + * @throws CentralRepoException */ @Override - public void bulkInsertReferenceTypeEntries(Set globalInstances, CorrelationAttributeInstance.Type contentType) throws EamDbException { + public void bulkInsertReferenceTypeEntries(Set globalInstances, CorrelationAttributeInstance.Type contentType) throws CentralRepoException { if (contentType == null) { - throw new EamDbException("Correlation type is null"); + throw new CentralRepoException("Correlation type is null"); } if (globalInstances == null) { - throw new EamDbException("Null set of EamGlobalFileInstance"); + throw new CentralRepoException("Null set of EamGlobalFileInstance"); } Connection conn = connect(); @@ -2751,11 +2751,11 @@ abstract class AbstractSqlEamDb implements EamDb { String sql = "INSERT INTO %s(reference_set_id, value, known_status, comment) VALUES (?, ?, ?, ?) " + getConflictClause(); - bulkPs = conn.prepareStatement(String.format(sql, EamDbUtil.correlationTypeToReferenceTableName(contentType))); + bulkPs = conn.prepareStatement(String.format(sql, CentralRepoDbUtil.correlationTypeToReferenceTableName(contentType))); - for (EamGlobalFileInstance globalInstance : globalInstances) { + for (CentralRepoFileInstance globalInstance : globalInstances) { if (globalInstance.getKnownStatus() == null) { - throw new EamDbException("EamGlobalFileInstance with value " + globalInstance.getMD5Hash() + " has null known status"); + throw new CentralRepoException("EamGlobalFileInstance with value " + globalInstance.getMD5Hash() + " has null known status"); } bulkPs.setInt(1, globalInstance.getGlobalSetID()); @@ -2767,16 +2767,16 @@ abstract class AbstractSqlEamDb implements EamDb { bulkPs.executeBatch(); conn.commit(); - } catch (SQLException | EamDbException ex) { + } catch (SQLException | CentralRepoException ex) { try { conn.rollback(); } catch (SQLException ex2) { // We're alredy in an error state } - throw new EamDbException("Error inserting bulk artifacts.", ex); // NON-NLS + throw new CentralRepoException("Error inserting bulk artifacts.", ex); // NON-NLS } finally { - EamDbUtil.closeStatement(bulkPs); - EamDbUtil.closeConnection(conn); + CentralRepoDbUtil.closeStatement(bulkPs); + CentralRepoDbUtil.closeConnection(conn); } } @@ -2788,21 +2788,21 @@ abstract class AbstractSqlEamDb implements EamDb { * * @return List of all global file instances with a type and value * - * @throws EamDbException + * @throws CentralRepoException */ @Override - public List getReferenceInstancesByTypeValue(CorrelationAttributeInstance.Type aType, String aValue) throws EamDbException, CorrelationAttributeNormalizationException { + public List getReferenceInstancesByTypeValue(CorrelationAttributeInstance.Type aType, String aValue) throws CentralRepoException, CorrelationAttributeNormalizationException { String normalizeValued = CorrelationAttributeNormalizer.normalize(aType, aValue); Connection conn = connect(); - List globalFileInstances = new ArrayList<>(); + List globalFileInstances = new ArrayList<>(); PreparedStatement preparedStatement1 = null; ResultSet resultSet = null; String sql1 = "SELECT * FROM %s WHERE value=?"; try { - preparedStatement1 = conn.prepareStatement(String.format(sql1, EamDbUtil.correlationTypeToReferenceTableName(aType))); + preparedStatement1 = conn.prepareStatement(String.format(sql1, CentralRepoDbUtil.correlationTypeToReferenceTableName(aType))); preparedStatement1.setString(1, normalizeValued); resultSet = preparedStatement1.executeQuery(); while (resultSet.next()) { @@ -2810,11 +2810,11 @@ abstract class AbstractSqlEamDb implements EamDb { } } catch (SQLException ex) { - throw new EamDbException("Error getting reference instances by type and value.", ex); // NON-NLS + throw new CentralRepoException("Error getting reference instances by type and value.", ex); // NON-NLS } finally { - EamDbUtil.closeStatement(preparedStatement1); - EamDbUtil.closeResultSet(resultSet); - EamDbUtil.closeConnection(conn); + CentralRepoDbUtil.closeStatement(preparedStatement1); + CentralRepoDbUtil.closeResultSet(resultSet); + CentralRepoDbUtil.closeConnection(conn); } return globalFileInstances; @@ -2827,12 +2827,12 @@ abstract class AbstractSqlEamDb implements EamDb { * * @return ID of this new Correlation Type * - * @throws EamDbException + * @throws CentralRepoException */ @Override - public int newCorrelationType(CorrelationAttributeInstance.Type newType) throws EamDbException { + public int newCorrelationType(CorrelationAttributeInstance.Type newType) throws CentralRepoException { if (newType == null) { - throw new EamDbException("Correlation type is null"); + throw new CentralRepoException("Correlation type is null"); } int typeId; if (-1 == newType.getId()) { @@ -2852,9 +2852,9 @@ abstract class AbstractSqlEamDb implements EamDb { * * @return ID of this new Correlation Type * - * @throws EamDbException + * @throws CentralRepoException */ - public int newCorrelationTypeNotKnownId(CorrelationAttributeInstance.Type newType) throws EamDbException { + public int newCorrelationTypeNotKnownId(CorrelationAttributeInstance.Type newType) throws CentralRepoException { Connection conn = connect(); PreparedStatement preparedStatement = null; @@ -2888,12 +2888,12 @@ abstract class AbstractSqlEamDb implements EamDb { typeId = correlationType.getId(); } } catch (SQLException ex) { - throw new EamDbException("Error inserting new correlation type.", ex); // NON-NLS + throw new CentralRepoException("Error inserting new correlation type.", ex); // NON-NLS } finally { - EamDbUtil.closeStatement(preparedStatement); - EamDbUtil.closeStatement(preparedStatementQuery); - EamDbUtil.closeResultSet(resultSet); - EamDbUtil.closeConnection(conn); + CentralRepoDbUtil.closeStatement(preparedStatement); + CentralRepoDbUtil.closeStatement(preparedStatementQuery); + CentralRepoDbUtil.closeResultSet(resultSet); + CentralRepoDbUtil.closeConnection(conn); } return typeId; } @@ -2905,9 +2905,9 @@ abstract class AbstractSqlEamDb implements EamDb { * * @return ID of this new Correlation Type * - * @throws EamDbException + * @throws CentralRepoException */ - private int newCorrelationTypeKnownId(CorrelationAttributeInstance.Type newType) throws EamDbException { + private int newCorrelationTypeKnownId(CorrelationAttributeInstance.Type newType) throws CentralRepoException { Connection conn = connect(); PreparedStatement preparedStatement = null; @@ -2942,18 +2942,18 @@ abstract class AbstractSqlEamDb implements EamDb { typeId = correlationType.getId(); } } catch (SQLException ex) { - throw new EamDbException("Error inserting new correlation type.", ex); // NON-NLS + throw new CentralRepoException("Error inserting new correlation type.", ex); // NON-NLS } finally { - EamDbUtil.closeStatement(preparedStatement); - EamDbUtil.closeStatement(preparedStatementQuery); - EamDbUtil.closeResultSet(resultSet); - EamDbUtil.closeConnection(conn); + CentralRepoDbUtil.closeStatement(preparedStatement); + CentralRepoDbUtil.closeStatement(preparedStatementQuery); + CentralRepoDbUtil.closeResultSet(resultSet); + CentralRepoDbUtil.closeConnection(conn); } return typeId; } @Override - public List getDefinedCorrelationTypes() throws EamDbException { + public List getDefinedCorrelationTypes() throws CentralRepoException { Connection conn = connect(); List aTypes = new ArrayList<>(); @@ -2970,11 +2970,11 @@ abstract class AbstractSqlEamDb implements EamDb { return aTypes; } catch (SQLException ex) { - throw new EamDbException("Error getting all correlation types.", ex); // NON-NLS + throw new CentralRepoException("Error getting all correlation types.", ex); // NON-NLS } finally { - EamDbUtil.closeStatement(preparedStatement); - EamDbUtil.closeResultSet(resultSet); - EamDbUtil.closeConnection(conn); + CentralRepoDbUtil.closeStatement(preparedStatement); + CentralRepoDbUtil.closeResultSet(resultSet); + CentralRepoDbUtil.closeConnection(conn); } } @@ -2985,10 +2985,10 @@ abstract class AbstractSqlEamDb implements EamDb { * @return List of enabled EamArtifact.Type's. If none are defined in the * database, the default list will be returned. * - * @throws EamDbException + * @throws CentralRepoException */ @Override - public List getEnabledCorrelationTypes() throws EamDbException { + public List getEnabledCorrelationTypes() throws CentralRepoException { Connection conn = connect(); List aTypes = new ArrayList<>(); @@ -3005,11 +3005,11 @@ abstract class AbstractSqlEamDb implements EamDb { return aTypes; } catch (SQLException ex) { - throw new EamDbException("Error getting enabled correlation types.", ex); // NON-NLS + throw new CentralRepoException("Error getting enabled correlation types.", ex); // NON-NLS } finally { - EamDbUtil.closeStatement(preparedStatement); - EamDbUtil.closeResultSet(resultSet); - EamDbUtil.closeConnection(conn); + CentralRepoDbUtil.closeStatement(preparedStatement); + CentralRepoDbUtil.closeResultSet(resultSet); + CentralRepoDbUtil.closeConnection(conn); } } @@ -3020,10 +3020,10 @@ abstract class AbstractSqlEamDb implements EamDb { * @return List of supported EamArtifact.Type's. If none are defined in the * database, the default list will be returned. * - * @throws EamDbException + * @throws CentralRepoException */ @Override - public List getSupportedCorrelationTypes() throws EamDbException { + public List getSupportedCorrelationTypes() throws CentralRepoException { Connection conn = connect(); List aTypes = new ArrayList<>(); @@ -3040,11 +3040,11 @@ abstract class AbstractSqlEamDb implements EamDb { return aTypes; } catch (SQLException ex) { - throw new EamDbException("Error getting supported correlation types.", ex); // NON-NLS + throw new CentralRepoException("Error getting supported correlation types.", ex); // NON-NLS } finally { - EamDbUtil.closeStatement(preparedStatement); - EamDbUtil.closeResultSet(resultSet); - EamDbUtil.closeConnection(conn); + CentralRepoDbUtil.closeStatement(preparedStatement); + CentralRepoDbUtil.closeResultSet(resultSet); + CentralRepoDbUtil.closeConnection(conn); } } @@ -3053,10 +3053,10 @@ abstract class AbstractSqlEamDb implements EamDb { * * @param aType EamArtifact.Type to update. * - * @throws EamDbException + * @throws CentralRepoException */ @Override - public void updateCorrelationType(CorrelationAttributeInstance.Type aType) throws EamDbException { + public void updateCorrelationType(CorrelationAttributeInstance.Type aType) throws CentralRepoException { Connection conn = connect(); PreparedStatement preparedStatement = null; @@ -3072,10 +3072,10 @@ abstract class AbstractSqlEamDb implements EamDb { preparedStatement.executeUpdate(); typeCache.put(aType.getId(), aType); } catch (SQLException ex) { - throw new EamDbException("Error updating correlation type.", ex); // NON-NLS + throw new CentralRepoException("Error updating correlation type.", ex); // NON-NLS } finally { - EamDbUtil.closeStatement(preparedStatement); - EamDbUtil.closeConnection(conn); + CentralRepoDbUtil.closeStatement(preparedStatement); + CentralRepoDbUtil.closeConnection(conn); } } @@ -3087,17 +3087,17 @@ abstract class AbstractSqlEamDb implements EamDb { * * @return EamArtifact.Type or null if it doesn't exist. * - * @throws EamDbException + * @throws CentralRepoException */ @Override - public CorrelationAttributeInstance.Type getCorrelationTypeById(int typeId) throws EamDbException { + public CorrelationAttributeInstance.Type getCorrelationTypeById(int typeId) throws CentralRepoException { try { return typeCache.get(typeId, () -> getCorrelationTypeByIdFromCr(typeId)); } catch (CacheLoader.InvalidCacheLoadException ignored) { //lambda valueloader returned a null value and cache can not store null values this is normal if the correlation type does not exist in the central repo yet return null; } catch (ExecutionException ex) { - throw new EamDbException("Error getting correlation type", ex); + throw new CentralRepoException("Error getting correlation type", ex); } } @@ -3108,9 +3108,9 @@ abstract class AbstractSqlEamDb implements EamDb { * * @return EamArtifact.Type or null if it doesn't exist. * - * @throws EamDbException + * @throws CentralRepoException */ - private CorrelationAttributeInstance.Type getCorrelationTypeByIdFromCr(int typeId) throws EamDbException { + private CorrelationAttributeInstance.Type getCorrelationTypeByIdFromCr(int typeId) throws CentralRepoException { Connection conn = connect(); CorrelationAttributeInstance.Type aType; @@ -3126,15 +3126,15 @@ abstract class AbstractSqlEamDb implements EamDb { aType = getCorrelationTypeFromResultSet(resultSet); return aType; } else { - throw new EamDbException("Failed to find entry for correlation type ID = " + typeId); + throw new CentralRepoException("Failed to find entry for correlation type ID = " + typeId); } } catch (SQLException ex) { - throw new EamDbException("Error getting correlation type by id.", ex); // NON-NLS + throw new CentralRepoException("Error getting correlation type by id.", ex); // NON-NLS } finally { - EamDbUtil.closeStatement(preparedStatement); - EamDbUtil.closeResultSet(resultSet); - EamDbUtil.closeConnection(conn); + CentralRepoDbUtil.closeStatement(preparedStatement); + CentralRepoDbUtil.closeResultSet(resultSet); + CentralRepoDbUtil.closeConnection(conn); } } @@ -3153,12 +3153,12 @@ abstract class AbstractSqlEamDb implements EamDb { return null; } - EamOrganization eamOrg = null; + CentralRepoOrganization eamOrg = null; resultSet.getInt("org_id"); if (!resultSet.wasNull()) { - eamOrg = new EamOrganization(resultSet.getInt("org_id"), + eamOrg = new CentralRepoOrganization(resultSet.getInt("org_id"), resultSet.getString("org_name"), resultSet.getString("poc_name"), resultSet.getString("poc_email"), @@ -3191,7 +3191,7 @@ abstract class AbstractSqlEamDb implements EamDb { return eamDataSource; } - private CorrelationAttributeInstance.Type getCorrelationTypeFromResultSet(ResultSet resultSet) throws EamDbException, SQLException { + private CorrelationAttributeInstance.Type getCorrelationTypeFromResultSet(ResultSet resultSet) throws CentralRepoException, SQLException { if (null == resultSet) { return null; } @@ -3217,12 +3217,12 @@ abstract class AbstractSqlEamDb implements EamDb { * * @throws SQLException when an expected column name is not in the resultSet */ - private CorrelationAttributeInstance getEamArtifactInstanceFromResultSet(ResultSet resultSet, CorrelationAttributeInstance.Type aType) throws SQLException, EamDbException, CorrelationAttributeNormalizationException { + private CorrelationAttributeInstance getEamArtifactInstanceFromResultSet(ResultSet resultSet, CorrelationAttributeInstance.Type aType) throws SQLException, CentralRepoException, CorrelationAttributeNormalizationException { if (null == resultSet) { return null; } - EamOrganization eamOrg = new EamOrganization(resultSet.getInt("org_id"), + CentralRepoOrganization eamOrg = new CentralRepoOrganization(resultSet.getInt("org_id"), resultSet.getString("org_name"), resultSet.getString("poc_name"), resultSet.getString("poc_email"), @@ -3244,12 +3244,12 @@ abstract class AbstractSqlEamDb implements EamDb { resultSet.getLong("file_obj_id")); } - private EamOrganization getEamOrganizationFromResultSet(ResultSet resultSet) throws SQLException { + private CentralRepoOrganization getEamOrganizationFromResultSet(ResultSet resultSet) throws SQLException { if (null == resultSet) { return null; } - return new EamOrganization( + return new CentralRepoOrganization( resultSet.getInt("id"), resultSet.getString("org_name"), resultSet.getString("poc_name"), @@ -3258,29 +3258,29 @@ abstract class AbstractSqlEamDb implements EamDb { ); } - private EamGlobalSet getEamGlobalSetFromResultSet(ResultSet resultSet) throws SQLException, EamDbException { + private CentralRepoFileSet getEamGlobalSetFromResultSet(ResultSet resultSet) throws SQLException, CentralRepoException { if (null == resultSet) { return null; } - return new EamGlobalSet( + return new CentralRepoFileSet( resultSet.getInt("id"), resultSet.getInt("org_id"), resultSet.getString("set_name"), resultSet.getString("version"), TskData.FileKnown.valueOf(resultSet.getByte("known_status")), resultSet.getBoolean("read_only"), - EamDb.getInstance().getCorrelationTypeById(resultSet.getInt("type")), + CentralRepository.getInstance().getCorrelationTypeById(resultSet.getInt("type")), LocalDate.parse(resultSet.getString("import_date")) ); } - private EamGlobalFileInstance getEamGlobalFileInstanceFromResultSet(ResultSet resultSet) throws SQLException, EamDbException, CorrelationAttributeNormalizationException { + private CentralRepoFileInstance getEamGlobalFileInstanceFromResultSet(ResultSet resultSet) throws SQLException, CentralRepoException, CorrelationAttributeNormalizationException { if (null == resultSet) { return null; } - return new EamGlobalFileInstance( + return new CentralRepoFileInstance( resultSet.getInt("id"), resultSet.getInt("reference_set_id"), resultSet.getString("value"), @@ -3297,14 +3297,14 @@ abstract class AbstractSqlEamDb implements EamDb { * * @return true if the column exists, false if the column does not exist * - * @throws EamDbException + * @throws CentralRepoException */ abstract boolean doesColumnExist(Connection conn, String tableName, String columnName) throws SQLException; /** * Upgrade the schema of the database (if needed) * - * @throws EamDbException + * @throws CentralRepoException */ @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.", "# {0} - minorVersion", @@ -3316,45 +3316,45 @@ abstract class AbstractSqlEamDb implements EamDb { "# {0} - platformName", "AbstractSqlEamDb.cannotUpgrage.message=Currently selected database platform \"{0}\" can not be upgraded."}) @Override - public void upgradeSchema() throws EamDbException, SQLException, IncompatibleCentralRepoException { + public void upgradeSchema() throws CentralRepoException, SQLException, IncompatibleCentralRepoException { ResultSet resultSet = null; Statement statement = null; PreparedStatement preparedStatement = null; Connection conn = null; - EamDbPlatformEnum selectedPlatform = null; + CentralRepoPlatforms selectedPlatform = null; try { conn = connect(false); conn.setAutoCommit(false); statement = conn.createStatement(); - selectedPlatform = EamDbPlatformEnum.getSelectedPlatform(); + selectedPlatform = CentralRepoPlatforms.getSelectedPlatform(); int minorVersion = 0; String minorVersionStr = null; - resultSet = statement.executeQuery("SELECT value FROM db_info WHERE name='" + AbstractSqlEamDb.SCHEMA_MINOR_VERSION_KEY + "'"); + resultSet = statement.executeQuery("SELECT value FROM db_info WHERE name='" + RdbmsCentralRepo.SCHEMA_MINOR_VERSION_KEY + "'"); if (resultSet.next()) { minorVersionStr = resultSet.getString("value"); try { minorVersion = Integer.parseInt(minorVersionStr); } catch (NumberFormatException ex) { - throw new EamDbException("Bad value for schema minor version (" + minorVersionStr + ") - database is corrupt", Bundle.AbstractSqlEamDb_badMinorSchema_message(minorVersionStr), ex); + throw new CentralRepoException("Bad value for schema minor version (" + minorVersionStr + ") - database is corrupt", Bundle.AbstractSqlEamDb_badMinorSchema_message(minorVersionStr), ex); } } else { - throw new EamDbException("Failed to read schema minor version from db_info table", Bundle.AbstractSqlEamDb_failedToReadMinorVersion_message()); + throw new CentralRepoException("Failed to read schema minor version from db_info table", Bundle.AbstractSqlEamDb_failedToReadMinorVersion_message()); } int majorVersion = 0; String majorVersionStr = null; - resultSet = statement.executeQuery("SELECT value FROM db_info WHERE name='" + AbstractSqlEamDb.SCHEMA_MAJOR_VERSION_KEY + "'"); + resultSet = statement.executeQuery("SELECT value FROM db_info WHERE name='" + RdbmsCentralRepo.SCHEMA_MAJOR_VERSION_KEY + "'"); if (resultSet.next()) { majorVersionStr = resultSet.getString("value"); try { majorVersion = Integer.parseInt(majorVersionStr); } catch (NumberFormatException ex) { - throw new EamDbException("Bad value for schema version (" + majorVersionStr + ") - database is corrupt", Bundle.AbstractSqlEamDb_badMajorSchema_message(majorVersionStr), ex); + throw new CentralRepoException("Bad value for schema version (" + majorVersionStr + ") - database is corrupt", Bundle.AbstractSqlEamDb_badMajorSchema_message(majorVersionStr), ex); } } else { - throw new EamDbException("Failed to read schema major version from db_info table", Bundle.AbstractSqlEamDb_failedToReadMajorVersion_message()); + throw new CentralRepoException("Failed to read schema major version from db_info table", Bundle.AbstractSqlEamDb_failedToReadMajorVersion_message()); } /* @@ -3393,7 +3393,7 @@ abstract class AbstractSqlEamDb implements EamDb { // There's an outide chance that the user has already made an organization with the default name, // and the default org being missing will not impact any database operations, so continue on // regardless of whether this succeeds. - EamDbUtil.insertDefaultOrganization(conn); + CentralRepoDbUtil.insertDefaultOrganization(conn); } /* @@ -3414,25 +3414,25 @@ abstract class AbstractSqlEamDb implements EamDb { case POSTGRESQL: addAttributeSql = "INSERT INTO correlation_types(id, display_name, db_table_name, supported, enabled) VALUES (?, ?, ?, ?, ?) " + getConflictClause(); //NON-NLS - addSsidTableTemplate = PostgresEamDbSettings.getCreateArtifactInstancesTableTemplate(); - addCaseIdIndexTemplate = PostgresEamDbSettings.getAddCaseIdIndexTemplate(); - addDataSourceIdIndexTemplate = PostgresEamDbSettings.getAddDataSourceIdIndexTemplate(); - addValueIndexTemplate = PostgresEamDbSettings.getAddValueIndexTemplate(); - addKnownStatusIndexTemplate = PostgresEamDbSettings.getAddKnownStatusIndexTemplate(); - addObjectIdIndexTemplate = PostgresEamDbSettings.getAddObjectIdIndexTemplate(); + addSsidTableTemplate = PostgresCentralRepoSettings.getCreateArtifactInstancesTableTemplate(); + addCaseIdIndexTemplate = PostgresCentralRepoSettings.getAddCaseIdIndexTemplate(); + addDataSourceIdIndexTemplate = PostgresCentralRepoSettings.getAddDataSourceIdIndexTemplate(); + addValueIndexTemplate = PostgresCentralRepoSettings.getAddValueIndexTemplate(); + addKnownStatusIndexTemplate = PostgresCentralRepoSettings.getAddKnownStatusIndexTemplate(); + addObjectIdIndexTemplate = PostgresCentralRepoSettings.getAddObjectIdIndexTemplate(); break; case SQLITE: addAttributeSql = "INSERT OR IGNORE INTO correlation_types(id, display_name, db_table_name, supported, enabled) VALUES (?, ?, ?, ?, ?)"; //NON-NLS - addSsidTableTemplate = SqliteEamDbSettings.getCreateArtifactInstancesTableTemplate(); - addCaseIdIndexTemplate = SqliteEamDbSettings.getAddCaseIdIndexTemplate(); - addDataSourceIdIndexTemplate = SqliteEamDbSettings.getAddDataSourceIdIndexTemplate(); - addValueIndexTemplate = SqliteEamDbSettings.getAddValueIndexTemplate(); - addKnownStatusIndexTemplate = SqliteEamDbSettings.getAddKnownStatusIndexTemplate(); - addObjectIdIndexTemplate = SqliteEamDbSettings.getAddObjectIdIndexTemplate(); + addSsidTableTemplate = SqliteCentralRepoSettings.getCreateArtifactInstancesTableTemplate(); + addCaseIdIndexTemplate = SqliteCentralRepoSettings.getAddCaseIdIndexTemplate(); + addDataSourceIdIndexTemplate = SqliteCentralRepoSettings.getAddDataSourceIdIndexTemplate(); + addValueIndexTemplate = SqliteCentralRepoSettings.getAddValueIndexTemplate(); + addKnownStatusIndexTemplate = SqliteCentralRepoSettings.getAddKnownStatusIndexTemplate(); + addObjectIdIndexTemplate = SqliteCentralRepoSettings.getAddObjectIdIndexTemplate(); break; default: - throw new EamDbException("Currently selected database platform \"" + selectedPlatform.name() + "\" can not be upgraded.", Bundle.AbstractSqlEamDb_cannotUpgrage_message(selectedPlatform.name())); + throw new CentralRepoException("Currently selected database platform \"" + selectedPlatform.name() + "\" can not be upgraded.", Bundle.AbstractSqlEamDb_cannotUpgrage_message(selectedPlatform.name())); } final String dataSourcesTableName = "data_sources"; final String dataSourceObjectIdColumnName = "datasource_obj_id"; @@ -3512,7 +3512,7 @@ abstract class AbstractSqlEamDb implements EamDb { String instance_type_dbname; final String objectIdColumnName = "file_obj_id"; for (CorrelationAttributeInstance.Type type : CorrelationAttributeInstance.getDefaultCorrelationTypes()) { - instance_type_dbname = EamDbUtil.correlationTypeToInstanceTableName(type); + instance_type_dbname = CentralRepoDbUtil.correlationTypeToInstanceTableName(type); if (!doesColumnExist(conn, instance_type_dbname, objectIdColumnName)) { statement.execute(String.format(addIntegerColumnTemplate, instance_type_dbname, objectIdColumnName)); //NON-NLS } @@ -3541,29 +3541,29 @@ abstract class AbstractSqlEamDb implements EamDb { * indicate that it is unknown. */ String creationMajorVer; - resultSet = statement.executeQuery("SELECT value FROM db_info WHERE name = '" + AbstractSqlEamDb.CREATION_SCHEMA_MAJOR_VERSION_KEY + "'"); + resultSet = statement.executeQuery("SELECT value FROM db_info WHERE name = '" + RdbmsCentralRepo.CREATION_SCHEMA_MAJOR_VERSION_KEY + "'"); if (resultSet.next()) { creationMajorVer = resultSet.getString("value"); } else { creationMajorVer = "0"; } String creationMinorVer; - resultSet = statement.executeQuery("SELECT value FROM db_info WHERE name = '" + AbstractSqlEamDb.CREATION_SCHEMA_MINOR_VERSION_KEY + "'"); + resultSet = statement.executeQuery("SELECT value FROM db_info WHERE name = '" + RdbmsCentralRepo.CREATION_SCHEMA_MINOR_VERSION_KEY + "'"); if (resultSet.next()) { creationMinorVer = resultSet.getString("value"); } else { creationMinorVer = "0"; } statement.execute("DROP TABLE db_info"); - if (selectedPlatform == EamDbPlatformEnum.POSTGRESQL) { + if (selectedPlatform == CentralRepoPlatforms.POSTGRESQL) { statement.execute("CREATE TABLE db_info (id SERIAL, name TEXT UNIQUE NOT NULL, value TEXT NOT NULL)"); } else { statement.execute("CREATE TABLE db_info (id INTEGER PRIMARY KEY, name TEXT UNIQUE NOT NULL, value TEXT NOT NULL)"); } - statement.execute("INSERT INTO db_info (name, value) VALUES ('" + AbstractSqlEamDb.SCHEMA_MAJOR_VERSION_KEY + "','" + majorVersionStr + "')"); - statement.execute("INSERT INTO db_info (name, value) VALUES ('" + AbstractSqlEamDb.SCHEMA_MINOR_VERSION_KEY + "','" + minorVersionStr + "')"); - statement.execute("INSERT INTO db_info (name, value) VALUES ('" + AbstractSqlEamDb.CREATION_SCHEMA_MAJOR_VERSION_KEY + "','" + creationMajorVer + "')"); - statement.execute("INSERT INTO db_info (name, value) VALUES ('" + AbstractSqlEamDb.CREATION_SCHEMA_MINOR_VERSION_KEY + "','" + creationMinorVer + "')"); + statement.execute("INSERT INTO db_info (name, value) VALUES ('" + RdbmsCentralRepo.SCHEMA_MAJOR_VERSION_KEY + "','" + majorVersionStr + "')"); + statement.execute("INSERT INTO db_info (name, value) VALUES ('" + RdbmsCentralRepo.SCHEMA_MINOR_VERSION_KEY + "','" + minorVersionStr + "')"); + statement.execute("INSERT INTO db_info (name, value) VALUES ('" + RdbmsCentralRepo.CREATION_SCHEMA_MAJOR_VERSION_KEY + "','" + creationMajorVer + "')"); + statement.execute("INSERT INTO db_info (name, value) VALUES ('" + RdbmsCentralRepo.CREATION_SCHEMA_MINOR_VERSION_KEY + "','" + creationMinorVer + "')"); } /* * Update to 1.3 @@ -3586,19 +3586,19 @@ abstract class AbstractSqlEamDb implements EamDb { + "md5 text DEFAULT NULL,sha1 text DEFAULT NULL,sha256 text DEFAULT NULL," + "foreign key (case_id) references cases(id) ON UPDATE SET NULL ON DELETE SET NULL," + "CONSTRAINT datasource_unique UNIQUE (case_id, device_id, name, datasource_obj_id))"); - statement.execute(SqliteEamDbSettings.getAddDataSourcesNameIndexStatement()); - statement.execute(SqliteEamDbSettings.getAddDataSourcesObjectIdIndexStatement()); + statement.execute(SqliteCentralRepoSettings.getAddDataSourcesNameIndexStatement()); + statement.execute(SqliteCentralRepoSettings.getAddDataSourcesObjectIdIndexStatement()); statement.execute("INSERT INTO data_sources SELECT * FROM old_data_sources"); statement.execute("DROP TABLE old_data_sources"); break; default: - throw new EamDbException("Currently selected database platform \"" + selectedPlatform.name() + "\" can not be upgraded.", Bundle.AbstractSqlEamDb_cannotUpgrage_message(selectedPlatform.name())); + throw new CentralRepoException("Currently selected database platform \"" + selectedPlatform.name() + "\" can not be upgraded.", Bundle.AbstractSqlEamDb_cannotUpgrage_message(selectedPlatform.name())); } } updateSchemaVersion(conn); conn.commit(); logger.log(Level.INFO, String.format("Central Repository schema updated to version %s", SOFTWARE_CR_DB_SCHEMA_VERSION)); - } catch (SQLException | EamDbException ex) { + } catch (SQLException | CentralRepoException ex) { try { if (conn != null) { conn.rollback(); @@ -3608,10 +3608,10 @@ abstract class AbstractSqlEamDb implements EamDb { } throw ex; } finally { - EamDbUtil.closeResultSet(resultSet); - EamDbUtil.closeStatement(preparedStatement); - EamDbUtil.closeStatement(statement); - EamDbUtil.closeConnection(conn); + CentralRepoDbUtil.closeResultSet(resultSet); + CentralRepoDbUtil.closeStatement(preparedStatement); + CentralRepoDbUtil.closeStatement(statement); + CentralRepoDbUtil.closeConnection(conn); } } diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/SqliteEamDb.java b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/SqliteCentralRepo.java similarity index 81% rename from Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/SqliteEamDb.java rename to Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/SqliteCentralRepo.java index 28374a1311..17d1393bbf 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/SqliteEamDb.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/SqliteCentralRepo.java @@ -1,7 +1,7 @@ /* * Central Repository * - * Copyright 2015-2019 Basis Technology Corp. + * Copyright 2015-2020 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -39,15 +39,15 @@ import org.sleuthkit.autopsy.coordinationservice.CoordinationService; * AbstractSqlEamDb that read or write to the database should be overriden here * and use appropriate locking. */ -final class SqliteEamDb extends AbstractSqlEamDb { +final class SqliteCentralRepo extends RdbmsCentralRepo { - private final static Logger LOGGER = Logger.getLogger(SqliteEamDb.class.getName()); + private final static Logger LOGGER = Logger.getLogger(SqliteCentralRepo.class.getName()); - private static SqliteEamDb instance; + private static SqliteCentralRepo instance; private BasicDataSource connectionPool = null; - private final SqliteEamDbSettings dbSettings; + private final SqliteCentralRepoSettings dbSettings; // While the Sqlite database should only be used for single users, it is still // possible for multiple threads to attempt to write to the database simultaneously. @@ -58,12 +58,12 @@ final class SqliteEamDb extends AbstractSqlEamDb { * * @return the singleton instance of SqliteEamDb * - * @throws EamDbException if one or more default correlation type(s) have an + * @throws CentralRepoException if one or more default correlation type(s) have an * invalid db table name. */ - public synchronized static SqliteEamDb getInstance() throws EamDbException { + public synchronized static SqliteCentralRepo getInstance() throws CentralRepoException { if (instance == null) { - instance = new SqliteEamDb(); + instance = new SqliteCentralRepo(); } return instance; @@ -71,17 +71,17 @@ final class SqliteEamDb extends AbstractSqlEamDb { /** * - * @throws EamDbException if the AbstractSqlEamDb class has one or more + * @throws CentralRepoException if the AbstractSqlEamDb class has one or more * default correlation type(s) having an invalid db * table name. */ - private SqliteEamDb() throws EamDbException { - dbSettings = new SqliteEamDbSettings(); + private SqliteCentralRepo() throws CentralRepoException { + dbSettings = new SqliteCentralRepoSettings(); bulkArtifactsThreshold = dbSettings.getBulkThreshold(); } @Override - public void shutdownConnections() throws EamDbException { + public void shutdownConnections() throws CentralRepoException { try { synchronized (this) { if (null != connectionPool) { @@ -91,7 +91,7 @@ final class SqliteEamDb extends AbstractSqlEamDb { clearCaches(); } } catch (SQLException ex) { - throw new EamDbException("Failed to close existing database connections.", ex); // NON-NLS + throw new CentralRepoException("Failed to close existing database connections.", ex); // NON-NLS } } @@ -111,7 +111,7 @@ final class SqliteEamDb extends AbstractSqlEamDb { } @Override - public void reset() throws EamDbException { + public void reset() throws CentralRepoException { try { acquireExclusiveLock(); @@ -141,7 +141,7 @@ final class SqliteEamDb extends AbstractSqlEamDb { } catch (SQLException ex) { LOGGER.log(Level.WARNING, "Failed to reset database.", ex); } finally { - EamDbUtil.closeConnection(conn); + CentralRepoDbUtil.closeConnection(conn); } dbSettings.insertDefaultDatabaseContent(); @@ -155,10 +155,10 @@ final class SqliteEamDb extends AbstractSqlEamDb { * */ @Messages({"SqliteEamDb.databaseMissing.message=Central repository database missing"}) - private void setupConnectionPool(boolean foreignKeysEnabled) throws EamDbException { + private void setupConnectionPool(boolean foreignKeysEnabled) throws CentralRepoException { if (dbSettings.dbFileExists() == false) { - throw new EamDbException("Central repository database missing", Bundle.SqliteEamDb_databaseMissing_message()); + throw new CentralRepoException("Central repository database missing", Bundle.SqliteEamDb_databaseMissing_message()); } connectionPool = new BasicDataSource(); @@ -186,15 +186,15 @@ final class SqliteEamDb extends AbstractSqlEamDb { * * @return A connection from the connection pool. * - * @throws EamDbException + * @throws CentralRepoException */ @Messages({"SqliteEamDb.connectionFailedMessage.message=Error getting connection to database.", "SqliteEamDb.centralRepositoryDisabled.message=Central Repository module is not enabled."}) @Override - protected Connection connect(boolean foreignKeys) throws EamDbException { + protected Connection connect(boolean foreignKeys) throws CentralRepoException { synchronized (this) { - if (!EamDb.isEnabled()) { - throw new EamDbException("Central repository database missing", Bundle.SqliteEamDb_centralRepositoryDisabled_message()); // NON-NLS + if (!CentralRepository.isEnabled()) { + throw new CentralRepoException("Central repository database missing", Bundle.SqliteEamDb_centralRepositoryDisabled_message()); // NON-NLS } if (connectionPool == null) { setupConnectionPool(foreignKeys); @@ -202,7 +202,7 @@ final class SqliteEamDb extends AbstractSqlEamDb { try { return connectionPool.getConnection(); } catch (SQLException ex) { - throw new EamDbException("Error getting connection from connection pool.", Bundle.SqliteEamDb_connectionFailedMessage_message(), ex); // NON-NLS + throw new CentralRepoException("Error getting connection from connection pool.", Bundle.SqliteEamDb_connectionFailedMessage_message(), ex); // NON-NLS } } } @@ -213,10 +213,10 @@ final class SqliteEamDb extends AbstractSqlEamDb { * * @return A connection from the connection pool. * - * @throws EamDbException + * @throws CentralRepoException */ @Override - protected Connection connect() throws EamDbException { + protected Connection connect() throws CentralRepoException { return connect(true); } @@ -232,10 +232,10 @@ final class SqliteEamDb extends AbstractSqlEamDb { * @param name Key to set * @param value Value to set * - * @throws EamDbException + * @throws CentralRepoException */ @Override - public void newDbInfo(String name, String value) throws EamDbException { + public void newDbInfo(String name, String value) throws CentralRepoException { try { acquireExclusiveLock(); super.newDbInfo(name, value); @@ -251,10 +251,10 @@ final class SqliteEamDb extends AbstractSqlEamDb { * * @return value associated with name. * - * @throws EamDbException + * @throws CentralRepoException */ @Override - public String getDbInfo(String name) throws EamDbException { + public String getDbInfo(String name) throws CentralRepoException { try { acquireSharedLock(); return super.getDbInfo(name); @@ -269,10 +269,10 @@ final class SqliteEamDb extends AbstractSqlEamDb { * @param name Name to find * @param value Value to assign to name. * - * @throws EamDbException + * @throws CentralRepoException */ @Override - public void updateDbInfo(String name, String value) throws EamDbException { + public void updateDbInfo(String name, String value) throws CentralRepoException { try { acquireExclusiveLock(); super.updateDbInfo(name, value); @@ -287,7 +287,7 @@ final class SqliteEamDb extends AbstractSqlEamDb { * @param autopsyCase The case to add */ @Override - public CorrelationCase newCase(Case autopsyCase) throws EamDbException { + public CorrelationCase newCase(Case autopsyCase) throws CentralRepoException { try { acquireExclusiveLock(); return super.newCase(autopsyCase); @@ -297,7 +297,7 @@ final class SqliteEamDb extends AbstractSqlEamDb { } @Override - public void addDataSourceObjectId(int rowId, long dataSourceObjectId) throws EamDbException { + public void addDataSourceObjectId(int rowId, long dataSourceObjectId) throws CentralRepoException { try { acquireExclusiveLock(); super.addDataSourceObjectId(rowId, dataSourceObjectId); @@ -314,7 +314,7 @@ final class SqliteEamDb extends AbstractSqlEamDb { * @param eamCase The case to add */ @Override - public CorrelationCase newCase(CorrelationCase eamCase) throws EamDbException { + public CorrelationCase newCase(CorrelationCase eamCase) throws CentralRepoException { try { acquireExclusiveLock(); return super.newCase(eamCase); @@ -329,7 +329,7 @@ final class SqliteEamDb extends AbstractSqlEamDb { * @param eamCase The case to update */ @Override - public void updateCase(CorrelationCase eamCase) throws EamDbException { + public void updateCase(CorrelationCase eamCase) throws CentralRepoException { try { acquireExclusiveLock(); super.updateCase(eamCase); @@ -346,7 +346,7 @@ final class SqliteEamDb extends AbstractSqlEamDb { * @return The retrieved case */ @Override - public CorrelationCase getCaseByUUID(String caseUUID) throws EamDbException { + public CorrelationCase getCaseByUUID(String caseUUID) throws CentralRepoException { try { acquireSharedLock(); return super.getCaseByUUID(caseUUID); @@ -363,7 +363,7 @@ final class SqliteEamDb extends AbstractSqlEamDb { * @return The retrieved case */ @Override - public CorrelationCase getCaseById(int caseId) throws EamDbException { + public CorrelationCase getCaseById(int caseId) throws CentralRepoException { try { acquireSharedLock(); return super.getCaseById(caseId); @@ -379,7 +379,7 @@ final class SqliteEamDb extends AbstractSqlEamDb { * @return List of cases */ @Override - public List getCases() throws EamDbException { + public List getCases() throws CentralRepoException { try { acquireSharedLock(); return super.getCases(); @@ -394,7 +394,7 @@ final class SqliteEamDb extends AbstractSqlEamDb { * @param eamDataSource the data source to add */ @Override - public CorrelationDataSource newDataSource(CorrelationDataSource eamDataSource) throws EamDbException { + public CorrelationDataSource newDataSource(CorrelationDataSource eamDataSource) throws CentralRepoException { try { acquireExclusiveLock(); return super.newDataSource(eamDataSource); @@ -413,7 +413,7 @@ final class SqliteEamDb extends AbstractSqlEamDb { * @return The data source */ @Override - public CorrelationDataSource getDataSource(CorrelationCase correlationCase, Long caseDbDataSourceId) throws EamDbException { + public CorrelationDataSource getDataSource(CorrelationCase correlationCase, Long caseDbDataSourceId) throws CentralRepoException { try { acquireSharedLock(); return super.getDataSource(correlationCase, caseDbDataSourceId); @@ -432,7 +432,7 @@ final class SqliteEamDb extends AbstractSqlEamDb { * @return The data source */ @Override - public CorrelationDataSource getDataSourceById(CorrelationCase correlationCase, int dataSourceId) throws EamDbException { + public CorrelationDataSource getDataSourceById(CorrelationCase correlationCase, int dataSourceId) throws CentralRepoException { try { acquireSharedLock(); return super.getDataSourceById(correlationCase, dataSourceId); @@ -447,7 +447,7 @@ final class SqliteEamDb extends AbstractSqlEamDb { * @return list of data sources in the DB */ @Override - public List getDataSources() throws EamDbException { + public List getDataSources() throws CentralRepoException { try { acquireSharedLock(); return super.getDataSources(); @@ -462,10 +462,10 @@ final class SqliteEamDb extends AbstractSqlEamDb { * @param eamDataSource The data source * @param newName The new name * - * @throws EamDbException + * @throws CentralRepoException */ @Override - public void updateDataSourceName(CorrelationDataSource eamDataSource, String newName) throws EamDbException { + public void updateDataSourceName(CorrelationDataSource eamDataSource, String newName) throws CentralRepoException { try { acquireExclusiveLock(); super.updateDataSourceName(eamDataSource, newName); @@ -480,7 +480,7 @@ final class SqliteEamDb extends AbstractSqlEamDb { * @param eamDataSource The data source to update */ @Override - public void updateDataSourceMd5Hash(CorrelationDataSource eamDataSource) throws EamDbException { + public void updateDataSourceMd5Hash(CorrelationDataSource eamDataSource) throws CentralRepoException { try { acquireExclusiveLock(); super.updateDataSourceMd5Hash(eamDataSource); @@ -495,7 +495,7 @@ final class SqliteEamDb extends AbstractSqlEamDb { * @param eamDataSource The data source to update */ @Override - public void updateDataSourceSha1Hash(CorrelationDataSource eamDataSource) throws EamDbException { + public void updateDataSourceSha1Hash(CorrelationDataSource eamDataSource) throws CentralRepoException { try { acquireExclusiveLock(); super.updateDataSourceSha1Hash(eamDataSource); @@ -511,7 +511,7 @@ final class SqliteEamDb extends AbstractSqlEamDb { * @param eamDataSource The data source to update */ @Override - public void updateDataSourceSha256Hash(CorrelationDataSource eamDataSource) throws EamDbException { + public void updateDataSourceSha256Hash(CorrelationDataSource eamDataSource) throws CentralRepoException { try { acquireExclusiveLock(); super.updateDataSourceSha256Hash(eamDataSource); @@ -527,7 +527,7 @@ final class SqliteEamDb extends AbstractSqlEamDb { * @param eamArtifact The artifact to add */ @Override - public void addArtifactInstance(CorrelationAttributeInstance eamArtifact) throws EamDbException { + public void addArtifactInstance(CorrelationAttributeInstance eamArtifact) throws CentralRepoException { try { acquireExclusiveLock(); super.addArtifactInstance(eamArtifact); @@ -537,7 +537,7 @@ final class SqliteEamDb extends AbstractSqlEamDb { } @Override - public List getArtifactInstancesByTypeValue(CorrelationAttributeInstance.Type aType, String value) throws EamDbException, CorrelationAttributeNormalizationException { + public List getArtifactInstancesByTypeValue(CorrelationAttributeInstance.Type aType, String value) throws CentralRepoException, CorrelationAttributeNormalizationException { try { acquireSharedLock(); return super.getArtifactInstancesByTypeValue(aType, value); @@ -547,7 +547,7 @@ final class SqliteEamDb extends AbstractSqlEamDb { } @Override - public List getArtifactInstancesByTypeValues(CorrelationAttributeInstance.Type aType, List values) throws EamDbException, CorrelationAttributeNormalizationException { + public List getArtifactInstancesByTypeValues(CorrelationAttributeInstance.Type aType, List values) throws CentralRepoException, CorrelationAttributeNormalizationException { try { acquireSharedLock(); return super.getArtifactInstancesByTypeValues(aType, values); @@ -557,7 +557,7 @@ final class SqliteEamDb extends AbstractSqlEamDb { } @Override - public List getArtifactInstancesByTypeValuesAndCases(CorrelationAttributeInstance.Type aType, List values, List caseIds) throws EamDbException, CorrelationAttributeNormalizationException { + public List getArtifactInstancesByTypeValuesAndCases(CorrelationAttributeInstance.Type aType, List values, List caseIds) throws CentralRepoException, CorrelationAttributeNormalizationException { try { acquireSharedLock(); return super.getArtifactInstancesByTypeValuesAndCases(aType, values, caseIds); @@ -576,10 +576,10 @@ final class SqliteEamDb extends AbstractSqlEamDb { * @return Number of artifact instances having ArtifactType and * ArtifactValue. * - * @throws EamDbException + * @throws CentralRepoException */ @Override - public Long getCountArtifactInstancesByTypeValue(CorrelationAttributeInstance.Type aType, String value) throws EamDbException, CorrelationAttributeNormalizationException { + public Long getCountArtifactInstancesByTypeValue(CorrelationAttributeInstance.Type aType, String value) throws CentralRepoException, CorrelationAttributeNormalizationException { try { acquireSharedLock(); return super.getCountArtifactInstancesByTypeValue(aType, value); @@ -589,7 +589,7 @@ final class SqliteEamDb extends AbstractSqlEamDb { } @Override - public int getFrequencyPercentage(CorrelationAttributeInstance corAttr) throws EamDbException, CorrelationAttributeNormalizationException { + public int getFrequencyPercentage(CorrelationAttributeInstance corAttr) throws CentralRepoException, CorrelationAttributeNormalizationException { try { acquireSharedLock(); return super.getFrequencyPercentage(corAttr); @@ -608,10 +608,10 @@ final class SqliteEamDb extends AbstractSqlEamDb { * * @return Number of unique tuples * - * @throws EamDbException + * @throws CentralRepoException */ @Override - public Long getCountUniqueCaseDataSourceTuplesHavingTypeValue(CorrelationAttributeInstance.Type aType, String value) throws EamDbException, CorrelationAttributeNormalizationException { + public Long getCountUniqueCaseDataSourceTuplesHavingTypeValue(CorrelationAttributeInstance.Type aType, String value) throws CentralRepoException, CorrelationAttributeNormalizationException { try { acquireSharedLock(); return super.getCountUniqueCaseDataSourceTuplesHavingTypeValue(aType, value); @@ -621,7 +621,7 @@ final class SqliteEamDb extends AbstractSqlEamDb { } @Override - public Long getCountUniqueDataSources() throws EamDbException { + public Long getCountUniqueDataSources() throws CentralRepoException { try { acquireSharedLock(); return super.getCountUniqueDataSources(); @@ -642,7 +642,7 @@ final class SqliteEamDb extends AbstractSqlEamDb { * dataSource */ @Override - public Long getCountArtifactInstancesByCaseDataSource(CorrelationDataSource correlationDataSource) throws EamDbException { + public Long getCountArtifactInstancesByCaseDataSource(CorrelationDataSource correlationDataSource) throws CentralRepoException { try { acquireSharedLock(); return super.getCountArtifactInstancesByCaseDataSource(correlationDataSource); @@ -656,7 +656,7 @@ final class SqliteEamDb extends AbstractSqlEamDb { * addAttributeInstanceBulk() method */ @Override - public void commitAttributeInstancesBulk() throws EamDbException { + public void commitAttributeInstancesBulk() throws CentralRepoException { try { acquireExclusiveLock(); super.commitAttributeInstancesBulk(); @@ -669,7 +669,7 @@ final class SqliteEamDb extends AbstractSqlEamDb { * Executes a bulk insert of the cases */ @Override - public void bulkInsertCases(List cases) throws EamDbException { + public void bulkInsertCases(List cases) throws CentralRepoException { try { acquireExclusiveLock(); super.bulkInsertCases(cases); @@ -689,7 +689,7 @@ final class SqliteEamDb extends AbstractSqlEamDb { * KNOWN */ @Override - public void setAttributeInstanceKnownStatus(CorrelationAttributeInstance eamArtifact, TskData.FileKnown knownStatus) throws EamDbException { + public void setAttributeInstanceKnownStatus(CorrelationAttributeInstance eamArtifact, TskData.FileKnown knownStatus) throws CentralRepoException { try { acquireExclusiveLock(); super.setAttributeInstanceKnownStatus(eamArtifact, knownStatus); @@ -707,7 +707,7 @@ final class SqliteEamDb extends AbstractSqlEamDb { * @return Number of matching eamArtifacts */ @Override - public Long getCountArtifactInstancesKnownBad(CorrelationAttributeInstance.Type aType, String value) throws EamDbException, CorrelationAttributeNormalizationException { + public Long getCountArtifactInstancesKnownBad(CorrelationAttributeInstance.Type aType, String value) throws CentralRepoException, CorrelationAttributeNormalizationException { try { acquireSharedLock(); return super.getCountArtifactInstancesKnownBad(aType, value); @@ -726,10 +726,10 @@ final class SqliteEamDb extends AbstractSqlEamDb { * @return List of cases containing this artifact with instances marked as * bad * - * @throws EamDbException + * @throws CentralRepoException */ @Override - public List getListCasesHavingArtifactInstancesKnownBad(CorrelationAttributeInstance.Type aType, String value) throws EamDbException, CorrelationAttributeNormalizationException { + public List getListCasesHavingArtifactInstancesKnownBad(CorrelationAttributeInstance.Type aType, String value) throws CentralRepoException, CorrelationAttributeNormalizationException { try { acquireSharedLock(); return super.getListCasesHavingArtifactInstancesKnownBad(aType, value); @@ -743,10 +743,10 @@ final class SqliteEamDb extends AbstractSqlEamDb { * * @param referenceSetID * - * @throws EamDbException + * @throws CentralRepoException */ @Override - public void deleteReferenceSet(int referenceSetID) throws EamDbException { + public void deleteReferenceSet(int referenceSetID) throws CentralRepoException { try { acquireExclusiveLock(); super.deleteReferenceSet(referenceSetID); @@ -765,7 +765,7 @@ final class SqliteEamDb extends AbstractSqlEamDb { * @return true if the hash is found in the reference set */ @Override - public boolean isValueInReferenceSet(String value, int referenceSetID, int correlationTypeID) throws EamDbException, CorrelationAttributeNormalizationException { + public boolean isValueInReferenceSet(String value, int referenceSetID, int correlationTypeID) throws CentralRepoException, CorrelationAttributeNormalizationException { try { acquireSharedLock(); return super.isValueInReferenceSet(value, referenceSetID, correlationTypeID); @@ -780,10 +780,10 @@ final class SqliteEamDb extends AbstractSqlEamDb { * @param type EamArtifact.Type to search for * @param instanceTableCallback callback to process the instance * - * @throws EamDbException + * @throws CentralRepoException */ @Override - public void processInstanceTable(CorrelationAttributeInstance.Type type, InstanceTableCallback instanceTableCallback) throws EamDbException { + public void processInstanceTable(CorrelationAttributeInstance.Type type, InstanceTableCallback instanceTableCallback) throws CentralRepoException { try { acquireSharedLock(); super.processInstanceTable(type, instanceTableCallback); @@ -798,10 +798,10 @@ final class SqliteEamDb extends AbstractSqlEamDb { * @param type EamArtifact.Type to search for * @param instanceTableCallback callback to process the instance * - * @throws EamDbException + * @throws CentralRepoException */ @Override - public void processInstanceTableWhere(CorrelationAttributeInstance.Type type, String whereClause, InstanceTableCallback instanceTableCallback) throws EamDbException { + public void processInstanceTableWhere(CorrelationAttributeInstance.Type type, String whereClause, InstanceTableCallback instanceTableCallback) throws CentralRepoException { try { acquireSharedLock(); super.processInstanceTableWhere(type, whereClause, instanceTableCallback); @@ -816,10 +816,10 @@ final class SqliteEamDb extends AbstractSqlEamDb { * @param selectClause query string to execute * @param instanceTableCallback callback to process the instance * - * @throws EamDbException + * @throws CentralRepoException */ @Override - public void processSelectClause(String selectClause, InstanceTableCallback instanceTableCallback) throws EamDbException { + public void processSelectClause(String selectClause, InstanceTableCallback instanceTableCallback) throws CentralRepoException { try { acquireSharedLock(); super.processSelectClause(selectClause, instanceTableCallback); @@ -838,10 +838,10 @@ final class SqliteEamDb extends AbstractSqlEamDb { * * @return true if a matching set is found * - * @throws EamDbException + * @throws CentralRepoException */ @Override - public boolean referenceSetExists(String referenceSetName, String version) throws EamDbException { + public boolean referenceSetExists(String referenceSetName, String version) throws CentralRepoException { try { acquireSharedLock(); return super.referenceSetExists(referenceSetName, version); @@ -859,7 +859,7 @@ final class SqliteEamDb extends AbstractSqlEamDb { * @return Global known status of the artifact */ @Override - public boolean isArtifactKnownBadByReference(CorrelationAttributeInstance.Type aType, String value) throws EamDbException, CorrelationAttributeNormalizationException { + public boolean isArtifactKnownBadByReference(CorrelationAttributeInstance.Type aType, String value) throws CentralRepoException, CorrelationAttributeNormalizationException { try { acquireSharedLock(); return super.isArtifactKnownBadByReference(aType, value); @@ -875,10 +875,10 @@ final class SqliteEamDb extends AbstractSqlEamDb { * * @param eamOrg The organization to add * - * @throws EamDbException + * @throws CentralRepoException */ @Override - public EamOrganization newOrganization(EamOrganization eamOrg) throws EamDbException { + public CentralRepoOrganization newOrganization(CentralRepoOrganization eamOrg) throws CentralRepoException { try { acquireExclusiveLock(); return super.newOrganization(eamOrg); @@ -892,10 +892,10 @@ final class SqliteEamDb extends AbstractSqlEamDb { * * @return A list of all organizations * - * @throws EamDbException + * @throws CentralRepoException */ @Override - public List getOrganizations() throws EamDbException { + public List getOrganizations() throws CentralRepoException { try { acquireSharedLock(); return super.getOrganizations(); @@ -911,10 +911,10 @@ final class SqliteEamDb extends AbstractSqlEamDb { * * @return The organization with the given ID * - * @throws EamDbException + * @throws CentralRepoException */ @Override - public EamOrganization getOrganizationByID(int orgID) throws EamDbException { + public CentralRepoOrganization getOrganizationByID(int orgID) throws CentralRepoException { try { acquireSharedLock(); return super.getOrganizationByID(orgID); @@ -924,7 +924,7 @@ final class SqliteEamDb extends AbstractSqlEamDb { } @Override - public void updateOrganization(EamOrganization updatedOrganization) throws EamDbException { + public void updateOrganization(CentralRepoOrganization updatedOrganization) throws CentralRepoException { try { acquireExclusiveLock(); super.updateOrganization(updatedOrganization); @@ -934,7 +934,7 @@ final class SqliteEamDb extends AbstractSqlEamDb { } @Override - public void deleteOrganization(EamOrganization organizationToDelete) throws EamDbException { + public void deleteOrganization(CentralRepoOrganization organizationToDelete) throws CentralRepoException { try { acquireExclusiveLock(); super.deleteOrganization(organizationToDelete); @@ -950,10 +950,10 @@ final class SqliteEamDb extends AbstractSqlEamDb { * * @return The ID of the new global set * - * @throws EamDbException + * @throws CentralRepoException */ @Override - public int newReferenceSet(EamGlobalSet eamGlobalSet) throws EamDbException { + public int newReferenceSet(CentralRepoFileSet eamGlobalSet) throws CentralRepoException { try { acquireExclusiveLock(); return super.newReferenceSet(eamGlobalSet); @@ -969,10 +969,10 @@ final class SqliteEamDb extends AbstractSqlEamDb { * * @return The global set associated with the ID * - * @throws EamDbException + * @throws CentralRepoException */ @Override - public EamGlobalSet getReferenceSetByID(int referenceSetID) throws EamDbException { + public CentralRepoFileSet getReferenceSetByID(int referenceSetID) throws CentralRepoException { try { acquireSharedLock(); return super.getReferenceSetByID(referenceSetID); @@ -988,10 +988,10 @@ final class SqliteEamDb extends AbstractSqlEamDb { * * @return List of all reference sets in the central repository * - * @throws EamDbException + * @throws CentralRepoException */ @Override - public List getAllReferenceSets(CorrelationAttributeInstance.Type correlationType) throws EamDbException { + public List getAllReferenceSets(CorrelationAttributeInstance.Type correlationType) throws CentralRepoException { try { acquireSharedLock(); return super.getAllReferenceSets(correlationType); @@ -1007,10 +1007,10 @@ final class SqliteEamDb extends AbstractSqlEamDb { * @param correlationType Correlation Type that this Reference * Instance is * - * @throws EamDbException + * @throws CentralRepoException */ @Override - public void addReferenceInstance(EamGlobalFileInstance eamGlobalFileInstance, CorrelationAttributeInstance.Type correlationType) throws EamDbException { + public void addReferenceInstance(CentralRepoFileInstance eamGlobalFileInstance, CorrelationAttributeInstance.Type correlationType) throws CentralRepoException { try { acquireExclusiveLock(); super.addReferenceInstance(eamGlobalFileInstance, correlationType); @@ -1022,10 +1022,10 @@ final class SqliteEamDb extends AbstractSqlEamDb { /** * Insert the bulk collection of Reference Type Instances * - * @throws EamDbException + * @throws CentralRepoException */ @Override - public void bulkInsertReferenceTypeEntries(Set globalInstances, CorrelationAttributeInstance.Type contentType) throws EamDbException { + public void bulkInsertReferenceTypeEntries(Set globalInstances, CorrelationAttributeInstance.Type contentType) throws CentralRepoException { try { acquireExclusiveLock(); super.bulkInsertReferenceTypeEntries(globalInstances, contentType); @@ -1042,10 +1042,10 @@ final class SqliteEamDb extends AbstractSqlEamDb { * * @return List of all global file instances with a type and value * - * @throws EamDbException + * @throws CentralRepoException */ @Override - public List getReferenceInstancesByTypeValue(CorrelationAttributeInstance.Type aType, String aValue) throws EamDbException, CorrelationAttributeNormalizationException { + public List getReferenceInstancesByTypeValue(CorrelationAttributeInstance.Type aType, String aValue) throws CentralRepoException, CorrelationAttributeNormalizationException { try { acquireSharedLock(); return super.getReferenceInstancesByTypeValue(aType, aValue); @@ -1061,10 +1061,10 @@ final class SqliteEamDb extends AbstractSqlEamDb { * * @return ID of this new Correlation Type * - * @throws EamDbException + * @throws CentralRepoException */ @Override - public int newCorrelationType(CorrelationAttributeInstance.Type newType) throws EamDbException { + public int newCorrelationType(CorrelationAttributeInstance.Type newType) throws CentralRepoException { try { acquireExclusiveLock(); return super.newCorrelationType(newType); @@ -1080,10 +1080,10 @@ final class SqliteEamDb extends AbstractSqlEamDb { * @return List of EamArtifact.Type's. If none are defined in the database, * the default list will be returned. * - * @throws EamDbException + * @throws CentralRepoException */ @Override - public List getDefinedCorrelationTypes() throws EamDbException { + public List getDefinedCorrelationTypes() throws CentralRepoException { try { acquireSharedLock(); return super.getDefinedCorrelationTypes(); @@ -1099,10 +1099,10 @@ final class SqliteEamDb extends AbstractSqlEamDb { * @return List of enabled EamArtifact.Type's. If none are defined in the * database, the default list will be returned. * - * @throws EamDbException + * @throws CentralRepoException */ @Override - public List getEnabledCorrelationTypes() throws EamDbException { + public List getEnabledCorrelationTypes() throws CentralRepoException { try { acquireSharedLock(); return super.getEnabledCorrelationTypes(); @@ -1118,10 +1118,10 @@ final class SqliteEamDb extends AbstractSqlEamDb { * @return List of supported EamArtifact.Type's. If none are defined in the * database, the default list will be returned. * - * @throws EamDbException + * @throws CentralRepoException */ @Override - public List getSupportedCorrelationTypes() throws EamDbException { + public List getSupportedCorrelationTypes() throws CentralRepoException { try { acquireSharedLock(); return super.getSupportedCorrelationTypes(); @@ -1135,10 +1135,10 @@ final class SqliteEamDb extends AbstractSqlEamDb { * * @param aType EamArtifact.Type to update. * - * @throws EamDbException + * @throws CentralRepoException */ @Override - public void updateCorrelationType(CorrelationAttributeInstance.Type aType) throws EamDbException { + public void updateCorrelationType(CorrelationAttributeInstance.Type aType) throws CentralRepoException { try { acquireExclusiveLock(); super.updateCorrelationType(aType); @@ -1154,10 +1154,10 @@ final class SqliteEamDb extends AbstractSqlEamDb { * * @return EamArtifact.Type or null if it doesn't exist. * - * @throws EamDbException + * @throws CentralRepoException */ @Override - public CorrelationAttributeInstance.Type getCorrelationTypeById(int typeId) throws EamDbException { + public CorrelationAttributeInstance.Type getCorrelationTypeById(int typeId) throws CentralRepoException { try { acquireSharedLock(); return super.getCorrelationTypeById(typeId); @@ -1169,10 +1169,10 @@ final class SqliteEamDb extends AbstractSqlEamDb { /** * Upgrade the schema of the database (if needed) * - * @throws EamDbException + * @throws CentralRepoException */ @Override - public void upgradeSchema() throws EamDbException, SQLException, IncompatibleCentralRepoException { + public void upgradeSchema() throws CentralRepoException, SQLException, IncompatibleCentralRepoException { try { acquireExclusiveLock(); super.upgradeSchema(); @@ -1189,11 +1189,11 @@ final class SqliteEamDb extends AbstractSqlEamDb { * * @return the lock, or null if locking is not supported * - * @throws EamDbException if the coordination service is running but we fail + * @throws CentralRepoException if the coordination service is running but we fail * to get the lock */ @Override - public CoordinationService.Lock getExclusiveMultiUserDbLock() throws EamDbException { + public CoordinationService.Lock getExclusiveMultiUserDbLock() throws CentralRepoException { // Multiple users are not supported for SQLite return null; } @@ -1251,8 +1251,8 @@ final class SqliteEamDb extends AbstractSqlEamDb { } } } finally { - EamDbUtil.closeResultSet(resultSet); - EamDbUtil.closeStatement(statement); + CentralRepoDbUtil.closeResultSet(resultSet); + CentralRepoDbUtil.closeStatement(statement); } return columnExists; } diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/SqliteEamDbSettings.java b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/SqliteCentralRepoSettings.java similarity index 92% rename from Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/SqliteEamDbSettings.java rename to Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/SqliteCentralRepoSettings.java index c76ab19783..3b2a424c4a 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/SqliteEamDbSettings.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/SqliteCentralRepoSettings.java @@ -1,7 +1,7 @@ /* * Central Repository * - * Copyright 2015-2019 Basis Technology Corp. + * Copyright 2015-2020 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -32,7 +32,7 @@ import java.util.regex.Pattern; 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; +import static org.sleuthkit.autopsy.centralrepository.datamodel.RdbmsCentralRepo.SOFTWARE_CR_DB_SCHEMA_VERSION; /** * Settings for the sqlite implementation of the Central Repository database @@ -40,9 +40,9 @@ import static org.sleuthkit.autopsy.centralrepository.datamodel.AbstractSqlEamDb * NOTE: This is public scope because the options panel calls it directly to * set/get */ -public final class SqliteEamDbSettings { +public final class SqliteCentralRepoSettings { - private final static Logger LOGGER = Logger.getLogger(SqliteEamDbSettings.class.getName()); + private final static Logger LOGGER = Logger.getLogger(SqliteCentralRepoSettings.class.getName()); private final static String DEFAULT_DBNAME = "central_repository.db"; // NON-NLS private final static String DEFAULT_DBDIRECTORY = PlatformUtil.getUserDirectory() + File.separator + "central_repository"; // NON-NLS private final static String JDBC_DRIVER = "org.sqlite.JDBC"; // NON-NLS @@ -60,7 +60,7 @@ public final class SqliteEamDbSettings { private String dbDirectory; private int bulkThreshold; - public SqliteEamDbSettings() { + public SqliteCentralRepoSettings() { loadSettings(); } @@ -78,15 +78,15 @@ public final class SqliteEamDbSettings { try { String bulkThresholdString = ModuleSettings.getConfigSetting("CentralRepository", "db.sqlite.bulkThreshold"); // NON-NLS if (bulkThresholdString == null || bulkThresholdString.isEmpty()) { - this.bulkThreshold = AbstractSqlEamDb.DEFAULT_BULK_THRESHHOLD; + this.bulkThreshold = RdbmsCentralRepo.DEFAULT_BULK_THRESHHOLD; } else { this.bulkThreshold = Integer.parseInt(bulkThresholdString); if (getBulkThreshold() <= 0) { - this.bulkThreshold = AbstractSqlEamDb.DEFAULT_BULK_THRESHHOLD; + this.bulkThreshold = RdbmsCentralRepo.DEFAULT_BULK_THRESHHOLD; } } } catch (NumberFormatException ex) { - this.bulkThreshold = AbstractSqlEamDb.DEFAULT_BULK_THRESHHOLD; + this.bulkThreshold = RdbmsCentralRepo.DEFAULT_BULK_THRESHHOLD; } } @@ -211,8 +211,8 @@ public final class SqliteEamDbSettings { return false; } - boolean result = EamDbUtil.executeValidationQuery(conn, VALIDATION_QUERY); - EamDbUtil.closeConnection(conn); + boolean result = CentralRepoDbUtil.executeValidationQuery(conn, VALIDATION_QUERY); + CentralRepoDbUtil.closeConnection(conn); return result; } @@ -228,8 +228,8 @@ public final class SqliteEamDbSettings { return false; } - boolean result = EamDbUtil.schemaVersionIsSet(conn); - EamDbUtil.closeConnection(conn); + boolean result = CentralRepoDbUtil.schemaVersionIsSet(conn); + CentralRepoDbUtil.closeConnection(conn); return result; } @@ -369,10 +369,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 + "', '" + 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() + "')"); + stmt.execute("INSERT INTO db_info (name, value) VALUES ('" + RdbmsCentralRepo.SCHEMA_MAJOR_VERSION_KEY + "', '" + SOFTWARE_CR_DB_SCHEMA_VERSION.getMajor() + "')"); + stmt.execute("INSERT INTO db_info (name, value) VALUES ('" + RdbmsCentralRepo.SCHEMA_MINOR_VERSION_KEY + "', '" + SOFTWARE_CR_DB_SCHEMA_VERSION.getMinor() + "')"); + stmt.execute("INSERT INTO db_info (name, value) VALUES ('" + RdbmsCentralRepo.CREATION_SCHEMA_MAJOR_VERSION_KEY + "', '" + SOFTWARE_CR_DB_SCHEMA_VERSION.getMajor() + "')"); + stmt.execute("INSERT INTO db_info (name, value) VALUES ('" + RdbmsCentralRepo.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(); @@ -380,8 +380,8 @@ public final class SqliteEamDbSettings { String reference_type_dbname; String instance_type_dbname; for (CorrelationAttributeInstance.Type type : DEFAULT_CORRELATION_TYPES) { - reference_type_dbname = EamDbUtil.correlationTypeToReferenceTableName(type); - instance_type_dbname = EamDbUtil.correlationTypeToInstanceTableName(type); + reference_type_dbname = CentralRepoDbUtil.correlationTypeToReferenceTableName(type); + instance_type_dbname = CentralRepoDbUtil.correlationTypeToInstanceTableName(type); stmt.execute(String.format(createArtifactInstancesTableTemplate, instance_type_dbname, instance_type_dbname)); stmt.execute(String.format(instancesCaseIdIdx, instance_type_dbname, instance_type_dbname)); @@ -400,11 +400,11 @@ public final class SqliteEamDbSettings { } catch (SQLException ex) { LOGGER.log(Level.SEVERE, "Error initializing db schema.", ex); // NON-NLS return false; - } catch (EamDbException ex) { + } catch (CentralRepoException ex) { LOGGER.log(Level.SEVERE, "Error getting default correlation types. Likely due to one or more Type's with an invalid db table name."); // NON-NLS return false; } finally { - EamDbUtil.closeConnection(conn); + CentralRepoDbUtil.closeConnection(conn); } return true; } @@ -534,8 +534,8 @@ public final class SqliteEamDbSettings { return false; } - boolean result = EamDbUtil.insertDefaultCorrelationTypes(conn) && EamDbUtil.insertDefaultOrganization(conn); - EamDbUtil.closeConnection(conn); + boolean result = CentralRepoDbUtil.insertDefaultCorrelationTypes(conn) && CentralRepoDbUtil.insertDefaultOrganization(conn); + CentralRepoDbUtil.closeConnection(conn); return result; } @@ -561,11 +561,11 @@ public final class SqliteEamDbSettings { * * @param dbName the dbName to set */ - public void setDbName(String dbName) throws EamDbException { + public void setDbName(String dbName) throws CentralRepoException { if (dbName == null || dbName.isEmpty()) { - throw new EamDbException("Invalid database file name. Cannot be null or empty."); // NON-NLS + throw new CentralRepoException("Invalid database file name. Cannot be null or empty."); // NON-NLS } else if (!Pattern.matches(DB_NAMES_REGEX, dbName)) { - throw new EamDbException("Invalid database file name. Name must start with a lowercase letter and can only contain lowercase letters, numbers, and '_'."); // NON-NLS + throw new CentralRepoException("Invalid database file name. Name must start with a lowercase letter and can only contain lowercase letters, numbers, and '_'."); // NON-NLS } this.dbName = dbName; @@ -581,11 +581,11 @@ public final class SqliteEamDbSettings { /** * @param bulkThreshold the bulkThreshold to set */ - void setBulkThreshold(int bulkThreshold) throws EamDbException { + void setBulkThreshold(int bulkThreshold) throws CentralRepoException { if (bulkThreshold > 0) { this.bulkThreshold = bulkThreshold; } else { - throw new EamDbException("Invalid bulk threshold."); // NON-NLS + throw new CentralRepoException("Invalid bulk threshold."); // NON-NLS } } @@ -603,11 +603,11 @@ public final class SqliteEamDbSettings { * * @param dbDirectory the dbDirectory to set */ - public void setDbDirectory(String dbDirectory) throws EamDbException { + public void setDbDirectory(String dbDirectory) throws CentralRepoException { if (dbDirectory != null && !dbDirectory.isEmpty()) { this.dbDirectory = dbDirectory; } else { - throw new EamDbException("Invalid directory for sqlite database. Cannot empty"); // NON-NLS + throw new CentralRepoException("Invalid directory for sqlite database. Cannot empty"); // NON-NLS } } diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/eventlisteners/CaseEventListener.java b/Core/src/org/sleuthkit/autopsy/centralrepository/eventlisteners/CaseEventListener.java index 1874729135..c5f6ebdbe2 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/eventlisteners/CaseEventListener.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/eventlisteners/CaseEventListener.java @@ -39,11 +39,10 @@ import org.sleuthkit.autopsy.casemodule.events.DataSourceNameChangedEvent; import org.sleuthkit.autopsy.casemodule.services.TagsManager; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttributeInstance; -import org.sleuthkit.autopsy.centralrepository.datamodel.EamArtifactUtil; +import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttributeUtil; import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationCase; import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationDataSource; -import org.sleuthkit.autopsy.centralrepository.datamodel.EamDb; -import org.sleuthkit.autopsy.centralrepository.datamodel.EamDbException; +import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoException; import org.sleuthkit.autopsy.coreutils.ThreadUtils; import org.sleuthkit.datamodel.AbstractFile; import org.sleuthkit.datamodel.BlackboardArtifact; @@ -54,6 +53,7 @@ import org.sleuthkit.datamodel.TagName; import org.sleuthkit.datamodel.TskCoreException; import org.sleuthkit.datamodel.TskData; import org.sleuthkit.datamodel.TskDataException; +import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepository; /** * Listen for case events and update entries in the Central Repository database @@ -76,10 +76,10 @@ final class CaseEventListener implements PropertyChangeListener { @Override public void propertyChange(PropertyChangeEvent evt) { - EamDb dbManager; + CentralRepository dbManager; try { - dbManager = EamDb.getInstance(); - } catch (EamDbException ex) { + dbManager = CentralRepository.getInstance(); + } catch (CentralRepoException ex) { LOGGER.log(Level.SEVERE, "Failed to get instance of db manager.", ex); return; } @@ -117,17 +117,17 @@ final class CaseEventListener implements PropertyChangeListener { private final class ContentTagTask implements Runnable { - private final EamDb dbManager; + private final CentralRepository dbManager; private final PropertyChangeEvent event; - private ContentTagTask(EamDb db, PropertyChangeEvent evt) { + private ContentTagTask(CentralRepository db, PropertyChangeEvent evt) { dbManager = db; event = evt; } @Override public void run() { - if (!EamDb.isEnabled()) { + if (!CentralRepository.isEnabled()) { return; } @@ -197,13 +197,13 @@ final class CaseEventListener implements PropertyChangeListener { } } - final CorrelationAttributeInstance eamArtifact = EamArtifactUtil.makeInstanceFromContent(af); + final CorrelationAttributeInstance eamArtifact = CorrelationAttributeUtil.makeInstanceFromContent(af); if (eamArtifact != null) { // send update to Central Repository db try { dbManager.setAttributeInstanceKnownStatus(eamArtifact, knownStatus); - } catch (EamDbException ex) { + } catch (CentralRepoException ex) { LOGGER.log(Level.SEVERE, "Error connecting to Central Repository database while setting artifact known status.", ex); //NON-NLS } } @@ -212,17 +212,17 @@ final class CaseEventListener implements PropertyChangeListener { private final class BlackboardTagTask implements Runnable { - private final EamDb dbManager; + private final CentralRepository dbManager; private final PropertyChangeEvent event; - private BlackboardTagTask(EamDb db, PropertyChangeEvent evt) { + private BlackboardTagTask(CentralRepository db, PropertyChangeEvent evt) { dbManager = db; event = evt; } @Override public void run() { - if (!EamDb.isEnabled()) { + if (!CentralRepository.isEnabled()) { return; } @@ -297,12 +297,12 @@ final class CaseEventListener implements PropertyChangeListener { return; } - List convertedArtifacts = EamArtifactUtil.makeInstancesFromBlackboardArtifact(bbArtifact, true); + List convertedArtifacts = CorrelationAttributeUtil.makeInstancesFromBlackboardArtifact(bbArtifact, true); for (CorrelationAttributeInstance eamArtifact : convertedArtifacts) { eamArtifact.setComment(comment); try { dbManager.setAttributeInstanceKnownStatus(eamArtifact, knownStatus); - } catch (EamDbException ex) { + } catch (CentralRepoException ex) { LOGGER.log(Level.SEVERE, "Error connecting to Central Repository database while setting artifact known status.", ex); //NON-NLS } } @@ -320,7 +320,7 @@ final class CaseEventListener implements PropertyChangeListener { @Override public void run() { - if (!EamDb.isEnabled()) { + if (!CentralRepository.isEnabled()) { return; } //get the display name of the tag that has had it's definition modified @@ -370,9 +370,9 @@ final class CaseEventListener implements PropertyChangeListener { if (!hasTagWithConflictingKnownStatus) { //Get the correlation atttributes that correspond to the current BlackboardArtifactTag if their status should be changed //with the initial set of correlation attributes this should be a single correlation attribute - List convertedArtifacts = EamArtifactUtil.makeInstancesFromBlackboardArtifact(bbTag.getArtifact(), true); + List convertedArtifacts = CorrelationAttributeUtil.makeInstancesFromBlackboardArtifact(bbTag.getArtifact(), true); for (CorrelationAttributeInstance eamArtifact : convertedArtifacts) { - EamDb.getInstance().setAttributeInstanceKnownStatus(eamArtifact, tagName.getKnownStatus()); + CentralRepository.getInstance().setAttributeInstanceKnownStatus(eamArtifact, tagName.getKnownStatus()); } } } @@ -406,15 +406,15 @@ final class CaseEventListener implements PropertyChangeListener { } //if the file will have no tags with a status which would prevent the current status from being changed if (!hasTagWithConflictingKnownStatus) { - final CorrelationAttributeInstance eamArtifact = EamArtifactUtil.makeInstanceFromContent(contentTag.getContent()); + final CorrelationAttributeInstance eamArtifact = CorrelationAttributeUtil.makeInstanceFromContent(contentTag.getContent()); if (eamArtifact != null) { - EamDb.getInstance().setAttributeInstanceKnownStatus(eamArtifact, tagName.getKnownStatus()); + CentralRepository.getInstance().setAttributeInstanceKnownStatus(eamArtifact, tagName.getKnownStatus()); } } } } catch (TskCoreException ex) { LOGGER.log(Level.SEVERE, "Cannot update known status in central repository for tag: " + modifiedTagName, ex); //NON-NLS - } catch (EamDbException ex) { + } catch (CentralRepoException ex) { LOGGER.log(Level.SEVERE, "Cannot get central repository for tag: " + modifiedTagName, ex); //NON-NLS } catch (NoCurrentCaseException ex) { LOGGER.log(Level.SEVERE, "Exception while getting open case.", ex); //NON-NLS @@ -424,17 +424,17 @@ final class CaseEventListener implements PropertyChangeListener { private final class DataSourceAddedTask implements Runnable { - private final EamDb dbManager; + private final CentralRepository dbManager; private final PropertyChangeEvent event; - private DataSourceAddedTask(EamDb db, PropertyChangeEvent evt) { + private DataSourceAddedTask(CentralRepository db, PropertyChangeEvent evt) { dbManager = db; event = evt; } @Override public void run() { - if (!EamDb.isEnabled()) { + if (!CentralRepository.isEnabled()) { return; } Case openCase; @@ -453,7 +453,7 @@ final class CaseEventListener implements PropertyChangeListener { if (null == dbManager.getDataSource(correlationCase, newDataSource.getId())) { CorrelationDataSource.fromTSKDataSource(correlationCase, newDataSource); } - } catch (EamDbException ex) { + } catch (CentralRepoException ex) { LOGGER.log(Level.SEVERE, "Error adding new data source to the central repository", ex); //NON-NLS } } // DATA_SOURCE_ADDED @@ -461,10 +461,10 @@ final class CaseEventListener implements PropertyChangeListener { private final class CurrentCaseTask implements Runnable { - private final EamDb dbManager; + private final CentralRepository dbManager; private final PropertyChangeEvent event; - private CurrentCaseTask(EamDb db, PropertyChangeEvent evt) { + private CurrentCaseTask(CentralRepository db, PropertyChangeEvent evt) { dbManager = db; event = evt; } @@ -479,7 +479,7 @@ final class CaseEventListener implements PropertyChangeListener { Case curCase = (Case) event.getNewValue(); IngestEventsListener.resetCeModuleInstanceCount(); - if (!EamDb.isEnabled()) { + if (!CentralRepository.isEnabled()) { return; } @@ -489,7 +489,7 @@ final class CaseEventListener implements PropertyChangeListener { if (dbManager.getCase(curCase) == null) { dbManager.newCase(curCase); } - } catch (EamDbException ex) { + } catch (CentralRepoException ex) { LOGGER.log(Level.SEVERE, "Error connecting to Central Repository database.", ex); //NON-NLS } } @@ -498,10 +498,10 @@ final class CaseEventListener implements PropertyChangeListener { private final class DataSourceNameChangedTask implements Runnable { - private final EamDb dbManager; + private final CentralRepository dbManager; private final PropertyChangeEvent event; - private DataSourceNameChangedTask(EamDb db, PropertyChangeEvent evt) { + private DataSourceNameChangedTask(CentralRepository db, PropertyChangeEvent evt) { dbManager = db; event = evt; } @@ -515,7 +515,7 @@ final class CaseEventListener implements PropertyChangeListener { if (! StringUtils.isEmpty(newName)) { - if (!EamDb.isEnabled()) { + if (!CentralRepository.isEnabled()) { return; } @@ -523,7 +523,7 @@ final class CaseEventListener implements PropertyChangeListener { CorrelationCase correlationCase = dbManager.getCase(Case.getCurrentCaseThrows()); CorrelationDataSource existingEamDataSource = dbManager.getDataSource(correlationCase, dataSource.getId()); dbManager.updateDataSourceName(existingEamDataSource, newName); - } catch (EamDbException ex) { + } catch (CentralRepoException ex) { LOGGER.log(Level.SEVERE, "Error updating data source with ID " + dataSource.getId() + " to " + newName, ex); //NON-NLS } catch (NoCurrentCaseException ex) { LOGGER.log(Level.SEVERE, "No open case", ex); diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/eventlisteners/IngestEventsListener.java b/Core/src/org/sleuthkit/autopsy/centralrepository/eventlisteners/IngestEventsListener.java index 355c7c8dbc..803f20b8c4 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/eventlisteners/IngestEventsListener.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/eventlisteners/IngestEventsListener.java @@ -39,8 +39,8 @@ import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttributeInstance; import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttributeNormalizationException; -import org.sleuthkit.autopsy.centralrepository.datamodel.EamArtifactUtil; -import org.sleuthkit.autopsy.centralrepository.datamodel.EamDbException; +import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttributeUtil; +import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoException; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.ingest.IngestManager; import org.sleuthkit.autopsy.ingest.ModuleDataEvent; @@ -51,7 +51,6 @@ import org.sleuthkit.datamodel.Blackboard; import org.sleuthkit.datamodel.BlackboardArtifact; import static org.sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE.TSK_INTERESTING_ARTIFACT_HIT; import org.sleuthkit.datamodel.BlackboardAttribute; -import org.sleuthkit.autopsy.centralrepository.datamodel.EamDb; import org.sleuthkit.autopsy.coreutils.ThreadUtils; import static org.sleuthkit.autopsy.ingest.IngestManager.IngestModuleEvent.DATA_ADDED; import static org.sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE.TSK_ASSOCIATED_ARTIFACT; @@ -62,6 +61,7 @@ import org.sleuthkit.datamodel.Content; import org.sleuthkit.datamodel.Image; import org.sleuthkit.datamodel.SleuthkitCase; import org.sleuthkit.datamodel.TskCoreException; +import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepository; /** * Listen for ingest events and update entries in the Central Repository @@ -280,10 +280,10 @@ public class IngestEventsListener { //sometimes artifacts are generated by DSPs or other sources while ingest is not running //in these cases we still want to create correlation attributesForNewArtifact for those artifacts when appropriate if (!IngestManager.getInstance().isIngestRunning() || getCeModuleInstanceCount() > 0) { - EamDb dbManager; + CentralRepository dbManager; try { - dbManager = EamDb.getInstance(); - } catch (EamDbException ex) { + dbManager = CentralRepository.getInstance(); + } catch (CentralRepoException ex) { LOGGER.log(Level.SEVERE, "Failed to connect to Central Repository database.", ex); return; } @@ -307,10 +307,10 @@ public class IngestEventsListener { @Override public void propertyChange(PropertyChangeEvent evt) { - EamDb dbManager; + CentralRepository dbManager; try { - dbManager = EamDb.getInstance(); - } catch (EamDbException ex) { + dbManager = CentralRepository.getInstance(); + } catch (CentralRepoException ex) { LOGGER.log(Level.SEVERE, "Failed to connect to Central Repository database.", ex); return; } @@ -329,10 +329,10 @@ public class IngestEventsListener { private final class AnalysisCompleteTask implements Runnable { - private final EamDb dbManager; + private final CentralRepository dbManager; private final PropertyChangeEvent event; - private AnalysisCompleteTask(EamDb db, PropertyChangeEvent evt) { + private AnalysisCompleteTask(CentralRepository db, PropertyChangeEvent evt) { dbManager = db; event = evt; } @@ -349,7 +349,7 @@ public class IngestEventsListener { * Ensure the data source in the Central Repository has hash values * that match those in the case database. */ - if (!EamDb.isEnabled()) { + if (!CentralRepository.isEnabled()) { return; } Content dataSource; @@ -412,7 +412,7 @@ public class IngestEventsListener { } } } - } catch (EamDbException ex) { + } catch (CentralRepoException ex) { LOGGER.log(Level.SEVERE, String.format( "Unable to fetch data from the Central Repository for data source '%s' (obj_id=%d)", dataSourceName, dataSourceObjectId), ex); @@ -428,13 +428,13 @@ public class IngestEventsListener { private final class DataAddedTask implements Runnable { - private final EamDb dbManager; + private final CentralRepository dbManager; private final PropertyChangeEvent event; private final boolean flagNotableItemsEnabled; private final boolean flagPreviousItemsEnabled; private final boolean createCorrelationAttributes; - private DataAddedTask(EamDb db, PropertyChangeEvent evt, boolean flagNotableItemsEnabled, boolean flagPreviousItemsEnabled, boolean createCorrelationAttributes) { + private DataAddedTask(CentralRepository db, PropertyChangeEvent evt, boolean flagNotableItemsEnabled, boolean flagPreviousItemsEnabled, boolean createCorrelationAttributes) { this.dbManager = db; this.event = evt; this.flagNotableItemsEnabled = flagNotableItemsEnabled; @@ -444,7 +444,7 @@ public class IngestEventsListener { @Override public void run() { - if (!EamDb.isEnabled()) { + if (!CentralRepository.isEnabled()) { return; } final ModuleDataEvent mde = (ModuleDataEvent) event.getOldValue(); @@ -456,7 +456,7 @@ public class IngestEventsListener { for (BlackboardArtifact bbArtifact : bbArtifacts) { // eamArtifact will be null OR a EamArtifact containing one EamArtifactInstance. - List convertedArtifacts = EamArtifactUtil.makeInstancesFromBlackboardArtifact(bbArtifact, true); + List convertedArtifacts = CorrelationAttributeUtil.makeInstancesFromBlackboardArtifact(bbArtifact, true); for (CorrelationAttributeInstance eamArtifact : convertedArtifacts) { try { // Only do something with this artifact if it's unique within the job @@ -502,7 +502,7 @@ public class IngestEventsListener { eamArtifacts.add(eamArtifact); } } - } catch (EamDbException ex) { + } catch (CentralRepoException ex) { LOGGER.log(Level.SEVERE, "Error counting notable artifacts.", ex); } } @@ -511,7 +511,7 @@ public class IngestEventsListener { for (CorrelationAttributeInstance eamArtifact : eamArtifacts) { try { dbManager.addArtifactInstance(eamArtifact); - } catch (EamDbException ex) { + } catch (CentralRepoException ex) { LOGGER.log(Level.SEVERE, "Error adding artifact to database.", ex); //NON-NLS } } diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/eventlisteners/Installer.java b/Core/src/org/sleuthkit/autopsy/centralrepository/eventlisteners/Installer.java index 690fb9189d..272a9047bb 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/eventlisteners/Installer.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/eventlisteners/Installer.java @@ -23,8 +23,8 @@ 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.centralrepository.datamodel.CentralRepoException; +import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoDbUtil; import org.sleuthkit.autopsy.core.RuntimeProperties; import org.sleuthkit.autopsy.coreutils.Logger; @@ -59,8 +59,8 @@ public class Installer extends ModuleInstall { // Perform the database upgrade and inform the user if it fails try { - EamDbUtil.upgradeDatabase(); - } catch (EamDbException ex) { + CentralRepoDbUtil.upgradeDatabase(); + } catch (CentralRepoException ex) { if (RuntimeProperties.runningWithGUI()) { WindowManager.getDefault().invokeWhenUIReady(() -> { JOptionPane.showMessageDialog(null, diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/ingestmodule/CentralRepoIngestModule.java b/Core/src/org/sleuthkit/autopsy/centralrepository/ingestmodule/CentralRepoIngestModule.java index bea9b801b8..ec00dffe88 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/ingestmodule/CentralRepoIngestModule.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/ingestmodule/CentralRepoIngestModule.java @@ -30,10 +30,9 @@ import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttributeIns import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttributeNormalizationException; import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationCase; import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationDataSource; -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.EamDbPlatformEnum; +import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttributeUtil; +import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoException; +import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoPlatforms; import org.sleuthkit.autopsy.centralrepository.eventlisteners.IngestEventsListener; import org.sleuthkit.autopsy.core.RuntimeProperties; import org.sleuthkit.autopsy.coreutils.Logger; @@ -55,6 +54,7 @@ import static org.sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE.TSK_SET import org.sleuthkit.datamodel.HashUtility; import org.sleuthkit.datamodel.TskCoreException; import org.sleuthkit.datamodel.TskData; +import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepository; /** * Ingest module for inserting entries into the Central Repository database on @@ -96,7 +96,7 @@ final class CentralRepoIngestModule implements FileIngestModule { @Override public ProcessResult process(AbstractFile abstractFile) { - if (EamDb.isEnabled() == false) { + if (CentralRepository.isEnabled() == false) { /* * Not signaling an error for now. This is a workaround for the way * all newly didscovered ingest modules are automatically anabled. @@ -113,7 +113,7 @@ final class CentralRepoIngestModule implements FileIngestModule { return ProcessResult.ERROR; } - if (!EamArtifactUtil.isSupportedAbstractFileType(abstractFile)) { + if (!CorrelationAttributeUtil.isSupportedAbstractFileType(abstractFile)) { return ProcessResult.OK; } @@ -121,10 +121,10 @@ final class CentralRepoIngestModule implements FileIngestModule { return ProcessResult.OK; } - EamDb dbManager; + CentralRepository dbManager; try { - dbManager = EamDb.getInstance(); - } catch (EamDbException ex) { + dbManager = CentralRepository.getInstance(); + } catch (CentralRepoException ex) { logger.log(Level.SEVERE, "Error connecting to Central Repository database.", ex); return ProcessResult.ERROR; } @@ -152,7 +152,7 @@ final class CentralRepoIngestModule implements FileIngestModule { if (!caseDisplayNamesList.isEmpty()) { postCorrelatedBadFileToBlackboard(abstractFile, caseDisplayNamesList); } - } catch (EamDbException ex) { + } catch (CentralRepoException ex) { logger.log(Level.SEVERE, "Error searching database for artifact.", ex); // NON-NLS return ProcessResult.ERROR; } catch (CorrelationAttributeNormalizationException ex) { @@ -175,7 +175,7 @@ final class CentralRepoIngestModule implements FileIngestModule { , abstractFile.getId()); dbManager.addAttributeInstanceBulk(cefi); - } catch (EamDbException ex) { + } catch (CentralRepoException ex) { logger.log(Level.SEVERE, "Error adding artifact to bulk artifacts.", ex); // NON-NLS return ProcessResult.ERROR; } catch (CorrelationAttributeNormalizationException ex) { @@ -190,25 +190,25 @@ final class CentralRepoIngestModule implements FileIngestModule { public void shutDown() { IngestEventsListener.decrementCorrelationEngineModuleCount(); - if ((EamDb.isEnabled() == false) || (eamCase == null) || (eamDataSource == null)) { + if ((CentralRepository.isEnabled() == false) || (eamCase == null) || (eamDataSource == null)) { return; } - EamDb dbManager; + CentralRepository dbManager; try { - dbManager = EamDb.getInstance(); - } catch (EamDbException ex) { + dbManager = CentralRepository.getInstance(); + } catch (CentralRepoException ex) { logger.log(Level.SEVERE, "Error connecting to Central Repository database.", ex); return; } try { dbManager.commitAttributeInstancesBulk(); - } catch (EamDbException ex) { + } catch (CentralRepoException ex) { logger.log(Level.SEVERE, "Error doing bulk insert of artifacts.", ex); // NON-NLS } try { Long count = dbManager.getCountArtifactInstancesByCaseDataSource(eamDataSource); logger.log(Level.INFO, "{0} artifacts in db for case: {1} ds:{2}", new Object[]{count, eamCase.getDisplayName(), eamDataSource.getName()}); // NON-NLS - } catch (EamDbException ex) { + } catch (CentralRepoException ex) { logger.log(Level.SEVERE, "Error counting artifacts.", ex); // NON-NLS } @@ -249,7 +249,7 @@ final class CentralRepoIngestModule implements FileIngestModule { IngestEventsListener.setCreateCrProperties(createCorrelationProperties); } - if (EamDb.isEnabled() == false) { + if (CentralRepository.isEnabled() == false) { /* * Not throwing the customary exception for now. This is a * workaround for the way all newly didscovered ingest modules are @@ -274,36 +274,36 @@ final class CentralRepoIngestModule implements FileIngestModule { // Don't allow sqlite central repo databases to be used for multi user cases if ((autopsyCase.getCaseType() == Case.CaseType.MULTI_USER_CASE) - && (EamDbPlatformEnum.getSelectedPlatform() == EamDbPlatformEnum.SQLITE)) { + && (CentralRepoPlatforms.getSelectedPlatform() == CentralRepoPlatforms.SQLITE)) { logger.log(Level.SEVERE, "Cannot run correlation engine on a multi-user case with a SQLite central repository."); throw new IngestModuleException("Cannot run on a multi-user case with a SQLite central repository."); // NON-NLS } jobId = context.getJobId(); - EamDb centralRepoDb; + CentralRepository centralRepoDb; try { - centralRepoDb = EamDb.getInstance(); - } catch (EamDbException ex) { + centralRepoDb = CentralRepository.getInstance(); + } catch (CentralRepoException ex) { logger.log(Level.SEVERE, "Error connecting to central repository database.", ex); // NON-NLS throw new IngestModuleException("Error connecting to central repository database.", ex); // NON-NLS } try { filesType = centralRepoDb.getCorrelationTypeById(CorrelationAttributeInstance.FILES_TYPE_ID); - } catch (EamDbException ex) { + } catch (CentralRepoException ex) { logger.log(Level.SEVERE, "Error getting correlation type FILES in ingest module start up.", ex); // NON-NLS throw new IngestModuleException("Error getting correlation type FILES in ingest module start up.", ex); // NON-NLS } try { eamCase = centralRepoDb.getCase(autopsyCase); - } catch (EamDbException ex) { + } catch (CentralRepoException ex) { throw new IngestModuleException("Unable to get case from central repository database ", ex); } try { eamDataSource = CorrelationDataSource.fromTSKDataSource(eamCase, context.getDataSource()); - } catch (EamDbException ex) { + } catch (CentralRepoException ex) { logger.log(Level.SEVERE, "Error getting data source info.", ex); // NON-NLS throw new IngestModuleException("Error getting data source info.", ex); // NON-NLS } @@ -317,7 +317,7 @@ final class CentralRepoIngestModule implements FileIngestModule { if (null == centralRepoDb.getDataSource(eamCase, eamDataSource.getDataSourceObjectID())) { centralRepoDb.newDataSource(eamDataSource); } - } catch (EamDbException ex) { + } catch (CentralRepoException ex) { logger.log(Level.SEVERE, "Error adding data source to Central Repository.", ex); // NON-NLS throw new IngestModuleException("Error adding data source to Central Repository.", ex); // NON-NLS } diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/AddNewOrganizationDialog.java b/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/AddNewOrganizationDialog.java index 79ce921dfe..291fdb8589 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/AddNewOrganizationDialog.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/AddNewOrganizationDialog.java @@ -29,9 +29,9 @@ import org.netbeans.spi.options.OptionsPanelController; import org.openide.util.NbBundle.Messages; import org.openide.windows.WindowManager; import org.sleuthkit.autopsy.coreutils.Logger; -import org.sleuthkit.autopsy.centralrepository.datamodel.EamDbException; -import org.sleuthkit.autopsy.centralrepository.datamodel.EamOrganization; -import org.sleuthkit.autopsy.centralrepository.datamodel.EamDb; +import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoException; +import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoOrganization; +import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepository; /** * Dialog to add a new organization to the Central Repository database @@ -45,8 +45,8 @@ class AddNewOrganizationDialog extends javax.swing.JDialog { private final Collection textBoxes; private final TextBoxChangedListener textBoxChangedListener; private boolean hasChanged; - private EamOrganization newOrg; - private final EamOrganization organizationToEdit; + private CentralRepoOrganization newOrg; + private final CentralRepoOrganization organizationToEdit; /** * Creates new form AddNewOrganizationDialog @@ -67,7 +67,7 @@ class AddNewOrganizationDialog extends javax.swing.JDialog { } // populates the dialog with existing case information to edit - public AddNewOrganizationDialog(EamOrganization orgToEdit) { + public AddNewOrganizationDialog(CentralRepoOrganization orgToEdit) { super((JFrame) WindowManager.getDefault().getMainWindow(), Bundle.AddNewOrganizationDialog_addNewOrg_msg(), true); // NON-NLS @@ -208,7 +208,7 @@ class AddNewOrganizationDialog extends javax.swing.JDialog { * * @return Org that was added or changed. null if nothing changed */ - public EamOrganization getNewOrg() { + public CentralRepoOrganization getNewOrg() { return newOrg; } @@ -341,7 +341,7 @@ class AddNewOrganizationDialog extends javax.swing.JDialog { private void bnOKActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bnOKActionPerformed try { - EamDb dbManager = EamDb.getInstance(); + CentralRepository dbManager = CentralRepository.getInstance(); if (organizationToEdit != null) { // make a copy in case the update fails newOrg = dbManager.getOrganizationByID(organizationToEdit.getOrgID()); @@ -351,7 +351,7 @@ class AddNewOrganizationDialog extends javax.swing.JDialog { newOrg.setPocPhone(tfPocPhone.getText()); dbManager.updateOrganization(newOrg); } else { - newOrg = new EamOrganization( + newOrg = new CentralRepoOrganization( tfOrganizationName.getText(), tfPocName.getText(), tfPocEmail.getText(), @@ -360,7 +360,7 @@ class AddNewOrganizationDialog extends javax.swing.JDialog { } hasChanged = true; dispose(); - } catch (EamDbException ex) { + } catch (CentralRepoException ex) { lbWarningMsg.setText(Bundle.AddNewOrganizationDialog_bnOk_addFailed_text()); logger.log(Level.SEVERE, "Failed adding new organization.", ex); newOrg = null; diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/CaseDataSourcesWrapper.java b/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/CaseDataSourcesWrapper.java index 34695fc354..c0a21f4ff3 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/CaseDataSourcesWrapper.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/CaseDataSourcesWrapper.java @@ -22,7 +22,7 @@ import java.util.Collections; import java.util.List; import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationCase; import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationDataSource; -import org.sleuthkit.autopsy.centralrepository.datamodel.EamOrganization; +import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoOrganization; /** * An object to contain both a CorrelationCase and the list of @@ -80,7 +80,7 @@ class CaseDataSourcesWrapper { * @return the organization name of the CorrelationCase. */ String getOrganizationName() { - EamOrganization org = eamCase.getOrg(); + CentralRepoOrganization org = eamCase.getOrg(); return org == null ? "" : org.getName(); } diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/EamDbSettingsDialog.form b/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/EamDbSettingsDialog.form index b063773f48..0f39326bec 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/EamDbSettingsDialog.form +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/EamDbSettingsDialog.form @@ -320,7 +320,7 @@ - + @@ -330,7 +330,7 @@ - + @@ -410,4 +410,4 @@ - + \ No newline at end of file diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/EamDbSettingsDialog.java b/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/EamDbSettingsDialog.java index 5c68b51b92..271a8a4f04 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/EamDbSettingsDialog.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/EamDbSettingsDialog.java @@ -1,7 +1,7 @@ /* * Central Repository * - * Copyright 2015-2018 Basis Technology Corp. + * Copyright 2015-2020 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -37,14 +37,14 @@ import javax.swing.filechooser.FileFilter; import org.netbeans.spi.options.OptionsPanelController; import org.openide.util.NbBundle.Messages; import org.openide.windows.WindowManager; -import org.sleuthkit.autopsy.centralrepository.datamodel.EamDb; import org.sleuthkit.autopsy.corecomponents.TextPrompt; import org.sleuthkit.autopsy.coreutils.Logger; -import org.sleuthkit.autopsy.centralrepository.datamodel.EamDbException; -import org.sleuthkit.autopsy.centralrepository.datamodel.EamDbPlatformEnum; -import static org.sleuthkit.autopsy.centralrepository.datamodel.EamDbPlatformEnum.SQLITE; -import org.sleuthkit.autopsy.centralrepository.datamodel.PostgresEamDbSettings; -import org.sleuthkit.autopsy.centralrepository.datamodel.SqliteEamDbSettings; +import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoException; +import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoPlatforms; +import static org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoPlatforms.SQLITE; +import org.sleuthkit.autopsy.centralrepository.datamodel.PostgresCentralRepoSettings; +import org.sleuthkit.autopsy.centralrepository.datamodel.SqliteCentralRepoSettings; +import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepository; /** * Configuration dialog for Central Repository database settings. @@ -59,10 +59,10 @@ public class EamDbSettingsDialog extends JDialog { private final Collection textBoxes; private final TextBoxChangedListener textBoxChangedListener; - private final PostgresEamDbSettings dbSettingsPostgres; - private final SqliteEamDbSettings dbSettingsSqlite; + private final PostgresCentralRepoSettings dbSettingsPostgres; + private final SqliteCentralRepoSettings dbSettingsSqlite; private DatabaseTestResult testingStatus; - private EamDbPlatformEnum selectedPlatform; + private CentralRepoPlatforms selectedPlatform; private boolean configurationChanged = false; /** @@ -80,11 +80,11 @@ public class EamDbSettingsDialog extends JDialog { textBoxes = new ArrayList<>(); textBoxChangedListener = new TextBoxChangedListener(); - dbSettingsPostgres = new PostgresEamDbSettings(); - dbSettingsSqlite = new SqliteEamDbSettings(); - selectedPlatform = EamDbPlatformEnum.getSelectedPlatform(); - if (selectedPlatform == null || selectedPlatform.equals(EamDbPlatformEnum.DISABLED)) { - selectedPlatform = EamDbPlatformEnum.POSTGRESQL; + dbSettingsPostgres = new PostgresCentralRepoSettings(); + dbSettingsSqlite = new SqliteCentralRepoSettings(); + selectedPlatform = CentralRepoPlatforms.getSelectedPlatform(); + if (selectedPlatform == null || selectedPlatform.equals(CentralRepoPlatforms.DISABLED)) { + selectedPlatform = CentralRepoPlatforms.POSTGRESQL; } initComponents(); @@ -226,7 +226,7 @@ public class EamDbSettingsDialog extends JDialog { jpDbPassword.setPreferredSize(new java.awt.Dimension(509, 20)); - cbDatabaseType.setModel(new javax.swing.DefaultComboBoxModel<>(new EamDbPlatformEnum[]{EamDbPlatformEnum.POSTGRESQL, EamDbPlatformEnum.SQLITE})); + cbDatabaseType.setModel(new javax.swing.DefaultComboBoxModel<>(new CentralRepoPlatforms[]{CentralRepoPlatforms.POSTGRESQL, CentralRepoPlatforms.SQLITE})); cbDatabaseType.setPreferredSize(new java.awt.Dimension(120, 20)); cbDatabaseType.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { @@ -372,7 +372,7 @@ public class EamDbSettingsDialog extends JDialog { break; } - displayDatabaseSettings(selectedPlatform.equals(EamDbPlatformEnum.POSTGRESQL)); + displayDatabaseSettings(selectedPlatform.equals(CentralRepoPlatforms.POSTGRESQL)); } private void display() { @@ -548,12 +548,12 @@ public class EamDbSettingsDialog extends JDialog { * using those new settings. */ try { - EamDb previousDbManager = EamDb.getInstance(); + CentralRepository previousDbManager = CentralRepository.getInstance(); if (null != previousDbManager) { // NOTE: do not set/save the seleted platform before calling this. - EamDb.getInstance().shutdownConnections(); + CentralRepository.getInstance().shutdownConnections(); } - } catch (EamDbException ex) { + } catch (CentralRepoException ex) { logger.log(Level.SEVERE, "Failed to close database connections in previously selected platform.", ex); // NON-NLS SwingUtilities.invokeLater(() -> { JOptionPane.showMessageDialog(this, @@ -566,8 +566,8 @@ public class EamDbSettingsDialog extends JDialog { // Even if we fail to close the existing connections, make sure that we // save the new connection settings, so an Autopsy restart will correctly // start with the new settings. - EamDbPlatformEnum.setSelectedPlatform(selectedPlatform.name()); - EamDbPlatformEnum.saveSelectedPlatform(); + CentralRepoPlatforms.setSelectedPlatform(selectedPlatform.name()); + CentralRepoPlatforms.saveSelectedPlatform(); switch (selectedPlatform) { case POSTGRESQL: @@ -576,9 +576,9 @@ public class EamDbSettingsDialog extends JDialog { // Load those newly saved settings into the postgres db manager instance // in case we are still using the same instance. try { - EamDb.getInstance().updateSettings(); + CentralRepository.getInstance().updateSettings(); configurationChanged = true; - } catch (EamDbException ex) { + } catch (CentralRepoException ex) { logger.log(Level.SEVERE, Bundle.EamDbSettingsDialog_okButton_connectionErrorMsg_text(), ex); //NON-NLS setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); return; @@ -591,9 +591,9 @@ public class EamDbSettingsDialog extends JDialog { // Load those newly saved settings into the sqlite db manager instance // in case we are still using the same instance. try { - EamDb.getInstance().updateSettings(); + CentralRepository.getInstance().updateSettings(); configurationChanged = true; - } catch (EamDbException ex) { + } catch (CentralRepoException ex) { logger.log(Level.SEVERE, Bundle.EamDbSettingsDialog_okButton_connectionErrorMsg_text(), ex); //NON-NLS setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); return; @@ -613,7 +613,7 @@ public class EamDbSettingsDialog extends JDialog { private void cbDatabaseTypeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbDatabaseTypeActionPerformed - selectedPlatform = (EamDbPlatformEnum) cbDatabaseType.getSelectedItem(); + selectedPlatform = (CentralRepoPlatforms) cbDatabaseType.getSelectedItem(); customizeComponents(); }//GEN-LAST:event_cbDatabaseTypeActionPerformed @@ -770,35 +770,35 @@ public class EamDbSettingsDialog extends JDialog { case POSTGRESQL: try { dbSettingsPostgres.setHost(tbDbHostname.getText().trim()); - } catch (EamDbException ex) { + } catch (CentralRepoException ex) { guidanceText.append(ex.getMessage()); result = false; } try { dbSettingsPostgres.setPort(Integer.valueOf(tbDbPort.getText().trim())); - } catch (NumberFormatException | EamDbException ex) { + } catch (NumberFormatException | CentralRepoException ex) { guidanceText.append(ex.getMessage()); result = false; } try { dbSettingsPostgres.setDbName(CENTRAL_REPO_DB_NAME); - } catch (EamDbException ex) { + } catch (CentralRepoException ex) { guidanceText.append(ex.getMessage()); result = false; } try { dbSettingsPostgres.setUserName(tbDbUsername.getText().trim()); - } catch (EamDbException ex) { + } catch (CentralRepoException ex) { guidanceText.append(ex.getMessage()); result = false; } try { dbSettingsPostgres.setPassword(new String(jpDbPassword.getPassword())); - } catch (EamDbException ex) { + } catch (CentralRepoException ex) { guidanceText.append(ex.getMessage()); result = false; } @@ -808,7 +808,7 @@ public class EamDbSettingsDialog extends JDialog { File databasePath = new File(tfDatabasePath.getText()); dbSettingsSqlite.setDbName(CENTRAL_REPO_DB_NAME + CENTRAL_REPO_SQLITE_EXT); dbSettingsSqlite.setDbDirectory(databasePath.getPath()); - } catch (EamDbException ex) { + } catch (CentralRepoException ex) { guidanceText.append(ex.getMessage()); result = false; } @@ -889,7 +889,7 @@ public class EamDbSettingsDialog extends JDialog { private javax.swing.JButton bnDatabasePathFileOpen; private javax.swing.ButtonGroup bnGrpDatabasePlatforms; private javax.swing.JButton bnOk; - private javax.swing.JComboBox cbDatabaseType; + private javax.swing.JComboBox cbDatabaseType; private javax.swing.JScrollPane dataBaseFileScrollPane; private javax.swing.JTextArea dataBaseFileTextArea; private javax.swing.JFileChooser fcDatabasePath; diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/GlobalSettingsPanel.java b/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/GlobalSettingsPanel.java index 37718a8d7c..ebd85ba527 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/GlobalSettingsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/GlobalSettingsPanel.java @@ -1,7 +1,7 @@ /* * Central Repository * - * Copyright 2015-2019 Basis Technology Corp. + * Copyright 2015-2020 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -31,16 +31,16 @@ 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.centralrepository.datamodel.CentralRepoException; import org.sleuthkit.autopsy.corecomponents.OptionsPanel; import org.sleuthkit.autopsy.events.AutopsyEvent; import org.sleuthkit.autopsy.ingest.IngestManager; import org.sleuthkit.autopsy.ingest.IngestModuleGlobalSettingsPanel; -import org.sleuthkit.autopsy.centralrepository.datamodel.EamDbPlatformEnum; -import static org.sleuthkit.autopsy.centralrepository.datamodel.EamDbPlatformEnum.DISABLED; -import org.sleuthkit.autopsy.centralrepository.datamodel.EamDbUtil; -import org.sleuthkit.autopsy.centralrepository.datamodel.PostgresEamDbSettings; -import org.sleuthkit.autopsy.centralrepository.datamodel.SqliteEamDbSettings; +import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoPlatforms; +import static org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoPlatforms.DISABLED; +import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoDbUtil; +import org.sleuthkit.autopsy.centralrepository.datamodel.PostgresCentralRepoSettings; +import org.sleuthkit.autopsy.centralrepository.datamodel.SqliteCentralRepoSettings; /** * Main settings panel for the Central Repository @@ -80,15 +80,15 @@ public final class GlobalSettingsPanel extends IngestModuleGlobalSettingsPanel i @Messages({"GlobalSettingsPanel.updateFailed.title=Central repository disabled"}) private void updateDatabase() { - if (EamDbPlatformEnum.getSelectedPlatform().equals(DISABLED)) { + if (CentralRepoPlatforms.getSelectedPlatform().equals(DISABLED)) { return; } setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); try { - EamDbUtil.upgradeDatabase(); + CentralRepoDbUtil.upgradeDatabase(); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); - } catch (EamDbException ex) { + } catch (CentralRepoException ex) { setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); JOptionPane.showMessageDialog(this, ex.getUserMessage(), @@ -456,25 +456,25 @@ public final class GlobalSettingsPanel extends IngestModuleGlobalSettingsPanel i public void load() { tbOops.setText(""); enableButtonSubComponents(false); - EamDbPlatformEnum selectedPlatform = EamDbPlatformEnum.getSelectedPlatform(); - cbUseCentralRepo.setSelected(EamDbUtil.allowUseOfCentralRepository()); // NON-NLS + CentralRepoPlatforms selectedPlatform = CentralRepoPlatforms.getSelectedPlatform(); + cbUseCentralRepo.setSelected(CentralRepoDbUtil.allowUseOfCentralRepository()); // NON-NLS switch (selectedPlatform) { case POSTGRESQL: - PostgresEamDbSettings dbSettingsPg = new PostgresEamDbSettings(); - lbDbPlatformValue.setText(EamDbPlatformEnum.POSTGRESQL.toString()); + PostgresCentralRepoSettings dbSettingsPg = new PostgresCentralRepoSettings(); + lbDbPlatformValue.setText(CentralRepoPlatforms.POSTGRESQL.toString()); lbDbNameValue.setText(dbSettingsPg.getDbName()); lbDbLocationValue.setText(dbSettingsPg.getHost()); enableButtonSubComponents(cbUseCentralRepo.isSelected()); break; case SQLITE: - SqliteEamDbSettings dbSettingsSqlite = new SqliteEamDbSettings(); - lbDbPlatformValue.setText(EamDbPlatformEnum.SQLITE.toString()); + SqliteCentralRepoSettings dbSettingsSqlite = new SqliteCentralRepoSettings(); + lbDbPlatformValue.setText(CentralRepoPlatforms.SQLITE.toString()); lbDbNameValue.setText(dbSettingsSqlite.getDbName()); lbDbLocationValue.setText(dbSettingsSqlite.getDbDirectory()); enableButtonSubComponents(cbUseCentralRepo.isSelected()); break; default: - lbDbPlatformValue.setText(EamDbPlatformEnum.DISABLED.toString()); + lbDbPlatformValue.setText(CentralRepoPlatforms.DISABLED.toString()); lbDbNameValue.setText(""); lbDbLocationValue.setText(""); tbOops.setText(Bundle.GlobalSettingsPanel_validationerrMsg_mustConfigure()); @@ -485,7 +485,7 @@ public final class GlobalSettingsPanel extends IngestModuleGlobalSettingsPanel i @Override public void store() { // Click OK or Apply on Options Panel - EamDbUtil.setUseCentralRepo(cbUseCentralRepo.isSelected()); + CentralRepoDbUtil.setUseCentralRepo(cbUseCentralRepo.isSelected()); } /** diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/ManageCasesDialog.java b/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/ManageCasesDialog.java index f782af67c5..687aba7ff6 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/ManageCasesDialog.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/ManageCasesDialog.java @@ -28,10 +28,10 @@ import javax.swing.event.ListSelectionListener; import org.openide.windows.WindowManager; import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationCase; import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationDataSource; -import org.sleuthkit.autopsy.centralrepository.datamodel.EamDb; -import org.sleuthkit.autopsy.centralrepository.datamodel.EamDbException; +import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoException; import org.sleuthkit.autopsy.coreutils.Logger; import org.openide.util.NbBundle.Messages; +import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepository; /** * A dialog which displays cases existing in the central repository and the @@ -55,7 +55,7 @@ final class ManageCasesDialog extends javax.swing.JDialog { true); initComponents(); try { - EamDb dbManager = EamDb.getInstance(); + CentralRepository dbManager = CentralRepository.getInstance(); Map> dataSourcesByCaseId = new HashMap<>(); for (CorrelationDataSource dataSource : dbManager.getDataSources()) { int caseID = dataSource.getCaseID(); @@ -66,7 +66,7 @@ final class ManageCasesDialog extends javax.swing.JDialog { for (CorrelationCase eamCase : dbManager.getCases()) { casesTableModel.addEamCase(eamCase, dataSourcesByCaseId.getOrDefault(eamCase.getID(), new ArrayList<>())); } - } catch (EamDbException ex) { + } catch (CentralRepoException ex) { logger.log(Level.SEVERE, "Error getting list of cases from database.", ex); // NON-NLS } diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/ManageCorrelationPropertiesDialog.java b/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/ManageCorrelationPropertiesDialog.java index e426534742..2aafcb7310 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/ManageCorrelationPropertiesDialog.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/ManageCorrelationPropertiesDialog.java @@ -30,8 +30,8 @@ import org.openide.util.NbBundle.Messages; import org.openide.windows.WindowManager; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttributeInstance; -import org.sleuthkit.autopsy.centralrepository.datamodel.EamDbException; -import org.sleuthkit.autopsy.centralrepository.datamodel.EamDb; +import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoException; +import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepository; /** * Dialog to handle management of artifact types handled by the Central @@ -69,10 +69,10 @@ final class ManageCorrelationPropertiesDialog extends javax.swing.JDialog { private void loadData() { DefaultTableModel model = (DefaultTableModel) tbCorrelatableTypes.getModel(); try { - EamDb dbManager = EamDb.getInstance(); + CentralRepository dbManager = CentralRepository.getInstance(); correlationTypes.clear(); correlationTypes.addAll(dbManager.getDefinedCorrelationTypes()); - } catch (EamDbException ex) { + } catch (CentralRepoException ex) { LOGGER.log(Level.WARNING, "Error loading data", ex); } @@ -243,10 +243,10 @@ final class ManageCorrelationPropertiesDialog extends javax.swing.JDialog { if (0 == correlationTypes.size()) { dispose(); } else { - EamDb dbManager; + CentralRepository dbManager; try { - dbManager = EamDb.getInstance(); - } catch (EamDbException ex) { + dbManager = CentralRepository.getInstance(); + } catch (CentralRepoException ex) { LOGGER.log(Level.SEVERE, "Failed to connect to central repository database.", ex); lbWarningMsg.setText(Bundle.ManageCorrelationPropertiesDialog_okbutton_failure()); return; @@ -255,7 +255,7 @@ final class ManageCorrelationPropertiesDialog extends javax.swing.JDialog { try { dbManager.updateCorrelationType(aType); dispose(); - } catch (EamDbException ex) { + } catch (CentralRepoException ex) { LOGGER.log(Level.SEVERE, "Failed to update correlation properties with selections from dialog.", ex); // NON-NLS lbWarningMsg.setText(Bundle.ManageCorrelationPropertiesDialog_okbutton_failure()); } diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/ManageOrganizationsDialog.form b/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/ManageOrganizationsDialog.form index 33c03ebf9d..965ba5da5c 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/ManageOrganizationsDialog.form +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/ManageOrganizationsDialog.form @@ -183,7 +183,7 @@ - + @@ -357,4 +357,4 @@ - + \ No newline at end of file diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/ManageOrganizationsDialog.java b/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/ManageOrganizationsDialog.java index 04403be0f4..8df751ba57 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/ManageOrganizationsDialog.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/ManageOrganizationsDialog.java @@ -30,11 +30,11 @@ import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; import org.openide.util.NbBundle.Messages; import org.openide.windows.WindowManager; -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.centralrepository.datamodel.EamOrganization; +import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoException; +import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoDbUtil; +import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoOrganization; import org.sleuthkit.autopsy.coreutils.Logger; +import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepository; /** * Configuration dialog to manage organizations for the Central Repository. @@ -44,9 +44,9 @@ public final class ManageOrganizationsDialog extends JDialog { private static final long serialVersionUID = 1L; - private EamDb dbManager; - private EamOrganization newOrg; - private final DefaultListModel rulesListModel = new DefaultListModel<>(); + private CentralRepository dbManager; + private CentralRepoOrganization newOrg; + private final DefaultListModel rulesListModel = new DefaultListModel<>(); private final static Logger logger = Logger.getLogger(ManageOrganizationsDialog.class.getName()); @Messages({"ManageOrganizationsDialog.title.text=Manage Organizations"}) @@ -59,7 +59,7 @@ public final class ManageOrganizationsDialog extends JDialog { true); // NON-NLS initComponents(); try { - this.dbManager = EamDb.getInstance(); + this.dbManager = CentralRepository.getInstance(); organizationList.setCellRenderer(new DefaultListCellRenderer() { private static final long serialVersionUID = 1L; @@ -67,7 +67,7 @@ public final class ManageOrganizationsDialog extends JDialog { @Override public Component getListCellRendererComponent(javax.swing.JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { Component c = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); - setText(((EamOrganization) value).getName()); + setText(((CentralRepoOrganization) value).getName()); return c; } }); @@ -76,7 +76,7 @@ public final class ManageOrganizationsDialog extends JDialog { populateList(); setButtonsEnabled(organizationList.getSelectedValue()); newOrg = null; - } catch (EamDbException ex) { + } catch (CentralRepoException ex) { logger.log(Level.WARNING, "Error getting Central Repo for Organizations dialog", ex); } display(); @@ -87,11 +87,11 @@ public final class ManageOrganizationsDialog extends JDialog { setVisible(true); } - private void populateListAndSelect(EamOrganization selected) throws EamDbException { + private void populateListAndSelect(CentralRepoOrganization selected) throws CentralRepoException { rulesListModel.clear(); - List orgs = dbManager.getOrganizations(); + List orgs = dbManager.getOrganizations(); if (orgs.size() > 0) { - for (EamOrganization org : orgs) { + for (CentralRepoOrganization org : orgs) { rulesListModel.addElement(org); if (selected != null && org.getOrgID() == selected.getOrgID()) { selected = org; @@ -107,8 +107,8 @@ public final class ManageOrganizationsDialog extends JDialog { } } - private void populateList() throws EamDbException { - EamOrganization selected = organizationList.getSelectedValue(); + private void populateList() throws CentralRepoException { + CentralRepoOrganization selected = organizationList.getSelectedValue(); populateListAndSelect(selected); } @@ -344,16 +344,16 @@ public final class ManageOrganizationsDialog extends JDialog { }// //GEN-END:initComponents private void deleteButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deleteButtonActionPerformed - EamOrganization orgToDelete = organizationList.getSelectedValue(); + CentralRepoOrganization orgToDelete = organizationList.getSelectedValue(); if (orgToDelete != null) { if (JOptionPane.YES_OPTION == JOptionPane.showConfirmDialog(WindowManager.getDefault().getMainWindow(), Bundle.ManageOrganizationsDialog_confirmDeletion_message(), Bundle.ManageOrganizationsDialog_confirmDeletion_title(), JOptionPane.YES_NO_OPTION)) { try { - EamDb.getInstance().deleteOrganization(orgToDelete); + CentralRepository.getInstance().deleteOrganization(orgToDelete); populateList(); - } catch (EamDbException ex) { + } catch (CentralRepoException ex) { JOptionPane.showMessageDialog(this, ex.getMessage(), Bundle.ManageOrganizationsDialog_unableToDeleteOrg_title(), JOptionPane.WARNING_MESSAGE); logger.log(Level.INFO, "Was unable to delete organization from central repository", ex); @@ -372,21 +372,21 @@ public final class ManageOrganizationsDialog extends JDialog { try { newOrg = dialogO.getNewOrg(); populateListAndSelect(dialogO.getNewOrg()); - } catch (EamDbException ex) { + } catch (CentralRepoException ex) { } } }//GEN-LAST:event_newButtonActionPerformed private void editButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_editButtonActionPerformed - EamOrganization orgToEdit = organizationList.getSelectedValue(); + CentralRepoOrganization orgToEdit = organizationList.getSelectedValue(); if (orgToEdit != null) { AddNewOrganizationDialog dialogO = new AddNewOrganizationDialog(orgToEdit); if (dialogO.isChanged()) { try { newOrg = dialogO.getNewOrg(); populateListAndSelect(dialogO.getNewOrg()); - } catch (EamDbException ex) { + } catch (CentralRepoException ex) { } } @@ -409,7 +409,7 @@ public final class ManageOrganizationsDialog extends JDialog { private javax.swing.JScrollPane orgListScrollPane; private javax.swing.JLabel orgNameLabel; private javax.swing.JTextField orgNameTextField; - private javax.swing.JList organizationList; + private javax.swing.JList organizationList; private javax.swing.JLabel pocEmailLabel; private javax.swing.JTextField pocEmailTextField; private javax.swing.JLabel pocNameLabel; @@ -421,15 +421,15 @@ public final class ManageOrganizationsDialog extends JDialog { return newOrg != null; } - public EamOrganization getNewOrg() { + public CentralRepoOrganization getNewOrg() { return newOrg; } - private void setButtonsEnabled(EamOrganization selectedOrg) { + private void setButtonsEnabled(CentralRepoOrganization selectedOrg) { boolean isSelected = (selectedOrg != null); boolean isDefaultOrg = false; if(selectedOrg != null){ - isDefaultOrg = EamDbUtil.isDefaultOrg(selectedOrg); + isDefaultOrg = CentralRepoDbUtil.isDefaultOrg(selectedOrg); } editButton.setEnabled(isSelected && (! isDefaultOrg)); @@ -446,7 +446,7 @@ public final class ManageOrganizationsDialog extends JDialog { if (e.getValueIsAdjusting()) { return; } - EamOrganization selected = organizationList.getSelectedValue(); + CentralRepoOrganization selected = organizationList.getSelectedValue(); setButtonsEnabled(selected); if (selected != null) { orgNameTextField.setText(selected.getName()); diff --git a/Core/src/org/sleuthkit/autopsy/commonpropertiessearch/AbstractCommonAttributeSearcher.java b/Core/src/org/sleuthkit/autopsy/commonpropertiessearch/AbstractCommonAttributeSearcher.java index 1880489cc4..e241908042 100644 --- a/Core/src/org/sleuthkit/autopsy/commonpropertiessearch/AbstractCommonAttributeSearcher.java +++ b/Core/src/org/sleuthkit/autopsy/commonpropertiessearch/AbstractCommonAttributeSearcher.java @@ -29,7 +29,7 @@ import java.util.stream.Collectors; import java.util.stream.Stream; import org.openide.util.NbBundle; import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; -import org.sleuthkit.autopsy.centralrepository.datamodel.EamDbException; +import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoException; import org.sleuthkit.datamodel.TskCoreException; /** @@ -60,9 +60,9 @@ public abstract class AbstractCommonAttributeSearcher { * @throws TskCoreException * @throws NoCurrentCaseException * @throws SQLException - * @throws EamDbException + * @throws CentralRepoException */ - public abstract CommonAttributeCountSearchResults findMatchesByCount() throws TskCoreException, NoCurrentCaseException, SQLException, EamDbException; + public abstract CommonAttributeCountSearchResults findMatchesByCount() throws TskCoreException, NoCurrentCaseException, SQLException, CentralRepoException; /** * Implement this to search for files with common attributes. Creates an @@ -78,9 +78,9 @@ public abstract class AbstractCommonAttributeSearcher { * @throws TskCoreException * @throws NoCurrentCaseException * @throws SQLException - * @throws EamDbException + * @throws CentralRepoException */ - public abstract CommonAttributeCaseSearchResults findMatchesByCase() throws TskCoreException, NoCurrentCaseException, SQLException, EamDbException; + public abstract CommonAttributeCaseSearchResults findMatchesByCase() throws TskCoreException, NoCurrentCaseException, SQLException, CentralRepoException; /** * Implement this to create a descriptive string for the tab which will diff --git a/Core/src/org/sleuthkit/autopsy/commonpropertiessearch/AllInterCaseCommonAttributeSearcher.java b/Core/src/org/sleuthkit/autopsy/commonpropertiessearch/AllInterCaseCommonAttributeSearcher.java index ee9c70211f..b41d484b12 100644 --- a/Core/src/org/sleuthkit/autopsy/commonpropertiessearch/AllInterCaseCommonAttributeSearcher.java +++ b/Core/src/org/sleuthkit/autopsy/commonpropertiessearch/AllInterCaseCommonAttributeSearcher.java @@ -26,7 +26,7 @@ import java.util.Set; import org.openide.util.NbBundle; import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; -import org.sleuthkit.autopsy.centralrepository.datamodel.EamDbException; +import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoException; import org.sleuthkit.datamodel.TskCoreException; import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttributeInstance.Type; import static org.sleuthkit.autopsy.commonpropertiessearch.AbstractCommonAttributeSearcher.MEDIA_PICS_VIDEO_MIME_TYPES; @@ -47,14 +47,14 @@ public class AllInterCaseCommonAttributeSearcher extends InterCaseCommonAttribut * @param percentageThreshold omit any matches with frequency above this * threshold * - * @throws EamDbException + * @throws CentralRepoException */ - public AllInterCaseCommonAttributeSearcher(boolean filterByMediaMimeType, boolean filterByDocMimeType, Type corAttrType, int percentageThreshold) throws EamDbException { + public AllInterCaseCommonAttributeSearcher(boolean filterByMediaMimeType, boolean filterByDocMimeType, Type corAttrType, int percentageThreshold) throws CentralRepoException { super(filterByMediaMimeType, filterByDocMimeType, corAttrType, percentageThreshold); } @Override - public CommonAttributeCountSearchResults findMatchesByCount() throws TskCoreException, NoCurrentCaseException, SQLException, EamDbException { + public CommonAttributeCountSearchResults findMatchesByCount() throws TskCoreException, NoCurrentCaseException, SQLException, CentralRepoException { InterCaseSearchResultsProcessor eamDbAttrInst = new InterCaseSearchResultsProcessor(corAttrType); Set mimeTypesToFilterOn = new HashSet<>(); if (isFilterByMedia()) { @@ -68,7 +68,7 @@ public class AllInterCaseCommonAttributeSearcher extends InterCaseCommonAttribut } @Override - public CommonAttributeCaseSearchResults findMatchesByCase() throws TskCoreException, NoCurrentCaseException, SQLException, EamDbException { + public CommonAttributeCaseSearchResults findMatchesByCase() throws TskCoreException, NoCurrentCaseException, SQLException, CentralRepoException { InterCaseSearchResultsProcessor eamDbAttrInst = new InterCaseSearchResultsProcessor(corAttrType); Set mimeTypesToFilterOn = new HashSet<>(); if (isFilterByMedia()) { diff --git a/Core/src/org/sleuthkit/autopsy/commonpropertiessearch/CommonAttributeCaseSearchResults.java b/Core/src/org/sleuthkit/autopsy/commonpropertiessearch/CommonAttributeCaseSearchResults.java index 3ff7d40070..0f87533504 100644 --- a/Core/src/org/sleuthkit/autopsy/commonpropertiessearch/CommonAttributeCaseSearchResults.java +++ b/Core/src/org/sleuthkit/autopsy/commonpropertiessearch/CommonAttributeCaseSearchResults.java @@ -30,9 +30,9 @@ import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttributeInstance; import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttributeNormalizationException; -import org.sleuthkit.autopsy.centralrepository.datamodel.EamDb; -import org.sleuthkit.autopsy.centralrepository.datamodel.EamDbException; +import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoException; import org.sleuthkit.autopsy.coreutils.Logger; +import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepository; /** * Stores the results from the various types of common attribute searching @@ -116,7 +116,7 @@ final public class CommonAttributeCaseSearchResults { try { currentCaseName = Case.getCurrentCaseThrows().getDisplayName(); } catch (NoCurrentCaseException ex) { - throw new EamDbException("Unable to get current case while performing filtering", ex); + throw new CentralRepoException("Unable to get current case while performing filtering", ex); } Map currentCaseDataSourceMap = metadata.get(currentCaseName); Map> filteredCaseNameToDataSourcesTree = new HashMap<>(); @@ -129,7 +129,7 @@ final public class CommonAttributeCaseSearchResults { .filter(filterType -> filterType.getId() == resultTypeId) .findFirst().get(); //Call countUniqueDataSources once to reduce the number of DB queries needed to get the frequencyPercentage - Double uniqueCaseDataSourceTuples = EamDb.getInstance().getCountUniqueDataSources().doubleValue(); + Double uniqueCaseDataSourceTuples = CentralRepository.getInstance().getCountUniqueDataSources().doubleValue(); Map valuesToKeepCurrentCase = getValuesToKeepFromCurrentCase(currentCaseDataSourceMap, attributeType, percentageThreshold, uniqueCaseDataSourceTuples); for (Entry> mapOfDataSources : Collections.unmodifiableMap(metadata).entrySet()) { if (!mapOfDataSources.getKey().equals(currentCaseName)) { @@ -141,7 +141,7 @@ final public class CommonAttributeCaseSearchResults { } } return filteredCaseNameToDataSourcesTree; - } catch (EamDbException ex) { + } catch (CentralRepoException ex) { LOGGER.log(Level.INFO, "Unable to perform filtering returning unfiltered result set", ex); return metadata; } @@ -164,9 +164,9 @@ final public class CommonAttributeCaseSearchResults { * @return a map of correlation value to CommonAttributeValue for results * from the current case * - * @throws EamDbException + * @throws CentralRepoException */ - private Map getValuesToKeepFromCurrentCase(Map dataSourceToValueList, CorrelationAttributeInstance.Type attributeType, int maximumPercentageThreshold, Double uniqueCaseDataSourceTuples) throws EamDbException { + private Map getValuesToKeepFromCurrentCase(Map dataSourceToValueList, CorrelationAttributeInstance.Type attributeType, int maximumPercentageThreshold, Double uniqueCaseDataSourceTuples) throws CentralRepoException { Map valuesToKeep = new HashMap<>(); Set valuesToRemove = new HashSet<>(); for (Entry mapOfValueLists : Collections.unmodifiableMap(dataSourceToValueList).entrySet()) { @@ -194,9 +194,9 @@ final public class CommonAttributeCaseSearchResults { * * @return the modified results for the case * - * @throws EamDbException + * @throws CentralRepoException */ - private Map createTreeForCase(Map valuesToKeepCurrentCase, Map dataSourceToValueList) throws EamDbException { + private Map createTreeForCase(Map valuesToKeepCurrentCase, Map dataSourceToValueList) throws CentralRepoException { Map treeForCase = new HashMap<>(); for (Entry mapOfValueLists : Collections.unmodifiableMap(dataSourceToValueList).entrySet()) { for (CommonAttributeValue value : mapOfValueLists.getValue().getDelayedMetadataSet()) { @@ -228,12 +228,12 @@ final public class CommonAttributeCaseSearchResults { * shown to the user, false if the value should not be removed and * the user will see it as a result * - * @throws EamDbException + * @throws CentralRepoException */ - private boolean filterValue(CorrelationAttributeInstance.Type attributeType, CommonAttributeValue value, int maximumPercentageThreshold, Double uniqueCaseDataSourceTuples) throws EamDbException { + private boolean filterValue(CorrelationAttributeInstance.Type attributeType, CommonAttributeValue value, int maximumPercentageThreshold, Double uniqueCaseDataSourceTuples) throws CentralRepoException { if (maximumPercentageThreshold != 0) { //only do the frequency filtering when a max % was set try { - Double uniqueTypeValueTuples = EamDb.getInstance().getCountUniqueCaseDataSourceTuplesHavingTypeValue( + Double uniqueTypeValueTuples = CentralRepository.getInstance().getCountUniqueCaseDataSourceTuplesHavingTypeValue( attributeType, value.getValue()).doubleValue(); Double commonalityPercentage = uniqueTypeValueTuples / uniqueCaseDataSourceTuples * 100; int frequencyPercentage = commonalityPercentage.intValue(); diff --git a/Core/src/org/sleuthkit/autopsy/commonpropertiessearch/CommonAttributeCountSearchResults.java b/Core/src/org/sleuthkit/autopsy/commonpropertiessearch/CommonAttributeCountSearchResults.java index 8265a8db25..18e7195f34 100644 --- a/Core/src/org/sleuthkit/autopsy/commonpropertiessearch/CommonAttributeCountSearchResults.java +++ b/Core/src/org/sleuthkit/autopsy/commonpropertiessearch/CommonAttributeCountSearchResults.java @@ -29,9 +29,9 @@ import java.util.TreeMap; import java.util.logging.Level; import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttributeInstance; import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttributeNormalizationException; -import org.sleuthkit.autopsy.centralrepository.datamodel.EamDb; -import org.sleuthkit.autopsy.centralrepository.datamodel.EamDbException; +import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoException; import org.sleuthkit.autopsy.coreutils.Logger; +import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepository; /** * Stores the results from the various types of common attribute searching @@ -107,9 +107,9 @@ final public class CommonAttributeCountSearchResults { /** * Filter the results based on the criteria the user specified * - * @throws EamDbException + * @throws CentralRepoException */ - public void filterMetadata() throws EamDbException { + public void filterMetadata() throws CentralRepoException { filterMetadata(this.percentageThreshold); } @@ -123,8 +123,8 @@ final public class CommonAttributeCountSearchResults { * * @return metadata */ - private void filterMetadata(int maximumPercentageThreshold) throws EamDbException { - if (!EamDb.isEnabled()) { + private void filterMetadata(int maximumPercentageThreshold) throws CentralRepoException { + if (!CentralRepository.isEnabled()) { return; } @@ -134,7 +134,7 @@ final public class CommonAttributeCountSearchResults { .filter(filterType -> filterType.getId() == this.resultTypeId) .findFirst().get(); - EamDb eamDb = EamDb.getInstance(); + CentralRepository eamDb = CentralRepository.getInstance(); Map> itemsToRemove = new HashMap<>(); //Call countUniqueDataSources once to reduce the number of DB queries needed to get diff --git a/Core/src/org/sleuthkit/autopsy/commonpropertiessearch/CommonAttributePanel.java b/Core/src/org/sleuthkit/autopsy/commonpropertiessearch/CommonAttributePanel.java index 73765acab8..f56f9dd9a8 100644 --- a/Core/src/org/sleuthkit/autopsy/commonpropertiessearch/CommonAttributePanel.java +++ b/Core/src/org/sleuthkit/autopsy/commonpropertiessearch/CommonAttributePanel.java @@ -49,8 +49,7 @@ import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttributeInstance; import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationCase; import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationDataSource; -import org.sleuthkit.autopsy.centralrepository.datamodel.EamDb; -import org.sleuthkit.autopsy.centralrepository.datamodel.EamDbException; +import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoException; import org.sleuthkit.autopsy.centralrepository.ingestmodule.CentralRepoIngestModuleFactory; import org.sleuthkit.autopsy.corecomponentinterfaces.DataResultViewer; import org.sleuthkit.autopsy.corecomponents.DataResultTopComponent; @@ -65,6 +64,7 @@ import org.sleuthkit.datamodel.IngestJobInfo; import org.sleuthkit.datamodel.IngestModuleInfo; import org.sleuthkit.datamodel.SleuthkitCase; import org.sleuthkit.datamodel.TskCoreException; +import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepository; /** * Panel used for common files search configuration and configuration business @@ -162,13 +162,13 @@ final class CommonAttributePanel extends javax.swing.JDialog implements Observer */ static boolean isEamDbAvailableForIntercaseSearch() { try { - return EamDb.isEnabled() - && EamDb.getInstance() != null - && EamDb.getInstance().getCases().size() > 1 + return CentralRepository.isEnabled() + && CentralRepository.getInstance() != null + && CentralRepository.getInstance().getCases().size() > 1 && Case.isCaseOpen() && Case.getCurrentCase() != null - && EamDb.getInstance().getCase(Case.getCurrentCase()) != null; - } catch (EamDbException ex) { + && CentralRepository.getInstance().getCase(Case.getCurrentCase()) != null; + } catch (CentralRepoException ex) { LOGGER.log(Level.SEVERE, "Unexpected exception while checking for EamDB enabled.", ex); } return false; @@ -188,11 +188,11 @@ final class CommonAttributePanel extends javax.swing.JDialog implements Observer */ private static Long getNumberOfDataSourcesAvailable() { try { - if (EamDb.isEnabled() - && EamDb.getInstance() != null) { - return EamDb.getInstance().getCountUniqueDataSources(); + if (CentralRepository.isEnabled() + && CentralRepository.getInstance() != null) { + return CentralRepository.getInstance().getCountUniqueDataSources(); } - } catch (EamDbException ex) { + } catch (CentralRepoException ex) { LOGGER.log(Level.SEVERE, "Unexpected exception while checking for EamDB enabled.", ex); } return 0L; @@ -227,7 +227,7 @@ final class CommonAttributePanel extends javax.swing.JDialog implements Observer private ProgressHandle progress; @Override - protected CommonAttributeCountSearchResults doInBackground() throws TskCoreException, NoCurrentCaseException, SQLException, EamDbException { + protected CommonAttributeCountSearchResults doInBackground() throws TskCoreException, NoCurrentCaseException, SQLException, CentralRepoException { progress = ProgressHandle.createHandle(Bundle.CommonAttributePanel_search_done_searchProgressGathering()); progress.start(); progress.switchToIndeterminate(); @@ -344,7 +344,7 @@ final class CommonAttributePanel extends javax.swing.JDialog implements Observer private ProgressHandle progress; @Override - protected CommonAttributeCaseSearchResults doInBackground() throws TskCoreException, NoCurrentCaseException, SQLException, EamDbException { + protected CommonAttributeCaseSearchResults doInBackground() throws TskCoreException, NoCurrentCaseException, SQLException, CentralRepoException { progress = ProgressHandle.createHandle(Bundle.CommonAttributePanel_search_done_searchProgressGathering()); progress.start(); progress.switchToIndeterminate(); @@ -573,11 +573,11 @@ final class CommonAttributePanel extends javax.swing.JDialog implements Observer * * @return a map of Cases * - * @throws EamDbException + * @throws CentralRepoException */ - private Map mapCases(List cases) throws EamDbException { + private Map mapCases(List cases) throws CentralRepoException { Map casemap = new HashMap<>(); - CorrelationCase currentCorCase = EamDb.getInstance().getCase(Case.getCurrentCase()); + CorrelationCase currentCorCase = CentralRepository.getInstance().getCase(Case.getCurrentCase()); for (CorrelationCase correlationCase : cases) { if (currentCorCase.getID() != correlationCase.getID()) { // if not the current Case casemap.put(correlationCase.getID(), correlationCase.getDisplayName()); @@ -587,9 +587,9 @@ final class CommonAttributePanel extends javax.swing.JDialog implements Observer } @Override - protected Map doInBackground() throws EamDbException { + protected Map doInBackground() throws CentralRepoException { - List dataSources = EamDb.getInstance().getCases(); + List dataSources = CentralRepository.getInstance().getCases(); Map caseMap = mapCases(dataSources); return caseMap; @@ -874,14 +874,14 @@ final class CommonAttributePanel extends javax.swing.JDialog implements Observer @Override protected List doInBackground() throws Exception { List unCorrelatedDataSources = new ArrayList<>(); - if (!interCaseRadio.isSelected() || !EamDb.isEnabled() || EamDb.getInstance() == null) { + if (!interCaseRadio.isSelected() || !CentralRepository.isEnabled() || CentralRepository.getInstance() == null) { return unCorrelatedDataSources; } //if the eamdb is enabled and an instance is able to be retrieved check if each data source has been processed into the cr HashMap dataSourceCorrelationMap = new HashMap<>(); //keep track of the status of all data sources that have been ingested String correlationEngineModuleName = CentralRepoIngestModuleFactory.getModuleName(); SleuthkitCase skCase = Case.getCurrentCaseThrows().getSleuthkitCase(); - List correlatedDataSources = EamDb.getInstance().getDataSources(); + List correlatedDataSources = CentralRepository.getInstance().getDataSources(); List ingestJobs = skCase.getIngestJobs(); for (IngestJobInfo jobInfo : ingestJobs) { //get the data source for each ingest job diff --git a/Core/src/org/sleuthkit/autopsy/commonpropertiessearch/CommonAttributeSearchAction.java b/Core/src/org/sleuthkit/autopsy/commonpropertiessearch/CommonAttributeSearchAction.java index f53b96a38b..bca07d757d 100644 --- a/Core/src/org/sleuthkit/autopsy/commonpropertiessearch/CommonAttributeSearchAction.java +++ b/Core/src/org/sleuthkit/autopsy/commonpropertiessearch/CommonAttributeSearchAction.java @@ -28,8 +28,8 @@ import org.openide.util.HelpCtx; import org.openide.util.NbBundle; import org.openide.util.actions.CallableSystemAction; import org.sleuthkit.autopsy.casemodule.Case; -import org.sleuthkit.autopsy.centralrepository.datamodel.EamDb; import org.sleuthkit.autopsy.coreutils.Logger; +import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepository; /** * Encapsulates a menu action which triggers the common files search dialog. @@ -107,19 +107,19 @@ final public class CommonAttributeSearchAction extends CallableSystemAction { } else { reason += Bundle.CommonAttributeSearchAction_openPanel_notEnoughDataSources(); } - if (!EamDb.isEnabled()) { + if (!CentralRepository.isEnabled()) { reason += Bundle.CommonAttributeSearchAction_openPanel_centralRepoDisabled(); return false; } - if (EamDb.getInstance() == null) { + if (CentralRepository.getInstance() == null) { reason += Bundle.CommonAttributeSearchAction_openPanel_centralRepoInvalid(); return false; } - if (EamDb.getInstance().getCases().size() < 2) { + if (CentralRepository.getInstance().getCases().size() < 2) { reason += Bundle.CommonAttributeSearchAction_openPanel_notEnoughCases(); return false; } - if (EamDb.getInstance().getCase(Case.getCurrentCase()) == null) { + if (CentralRepository.getInstance().getCase(Case.getCurrentCase()) == null) { reason += Bundle.CommonAttributeSearchAction_openPanel_caseNotInCentralRepo(); return false; } diff --git a/Core/src/org/sleuthkit/autopsy/commonpropertiessearch/InterCaseCommonAttributeSearcher.java b/Core/src/org/sleuthkit/autopsy/commonpropertiessearch/InterCaseCommonAttributeSearcher.java index 381ccf441c..543a46c87d 100644 --- a/Core/src/org/sleuthkit/autopsy/commonpropertiessearch/InterCaseCommonAttributeSearcher.java +++ b/Core/src/org/sleuthkit/autopsy/commonpropertiessearch/InterCaseCommonAttributeSearcher.java @@ -20,9 +20,9 @@ package org.sleuthkit.autopsy.commonpropertiessearch; import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationCase; -import org.sleuthkit.autopsy.centralrepository.datamodel.EamDb; -import org.sleuthkit.autopsy.centralrepository.datamodel.EamDbException; +import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoException; import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttributeInstance.Type; +import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepository; /** * Provides logic for selecting common files from all data sources and all cases @@ -30,7 +30,7 @@ import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttributeIns */ abstract class InterCaseCommonAttributeSearcher extends AbstractCommonAttributeSearcher { - private final EamDb dbManager; + private final CentralRepository dbManager; /** * The Correlation Type to find matches on. */ @@ -45,15 +45,15 @@ abstract class InterCaseCommonAttributeSearcher extends AbstractCommonAttributeS * @param filterByDocMimeType match only on files whose mime types can be * broadly categorized as document types * - * @throws EamDbException + * @throws CentralRepoException */ - InterCaseCommonAttributeSearcher(boolean filterByMediaMimeType, boolean filterByDocMimeType, Type corAttrType, int percentageThreshold) throws EamDbException { + InterCaseCommonAttributeSearcher(boolean filterByMediaMimeType, boolean filterByDocMimeType, Type corAttrType, int percentageThreshold) throws CentralRepoException { super(filterByMediaMimeType, filterByDocMimeType, percentageThreshold); - dbManager = EamDb.getInstance(); + dbManager = CentralRepository.getInstance(); this.corAttrType = corAttrType; } - protected CorrelationCase getCorrelationCaseFromId(int correlationCaseId) throws EamDbException { + protected CorrelationCase getCorrelationCaseFromId(int correlationCaseId) throws CentralRepoException { for (CorrelationCase cCase : this.dbManager.getCases()) { if (cCase.getID() == correlationCaseId) { return cCase; diff --git a/Core/src/org/sleuthkit/autopsy/commonpropertiessearch/InterCasePanel.java b/Core/src/org/sleuthkit/autopsy/commonpropertiessearch/InterCasePanel.java index bdd5d1fb56..88d60db3be 100644 --- a/Core/src/org/sleuthkit/autopsy/commonpropertiessearch/InterCasePanel.java +++ b/Core/src/org/sleuthkit/autopsy/commonpropertiessearch/InterCasePanel.java @@ -30,7 +30,7 @@ import java.util.Observer; import java.util.logging.Level; import javax.swing.ComboBoxModel; import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttributeInstance; -import org.sleuthkit.autopsy.centralrepository.datamodel.EamDbException; +import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoException; import org.sleuthkit.autopsy.coreutils.Logger; /** @@ -122,7 +122,7 @@ public final class InterCasePanel extends javax.swing.JPanel { correlationTypeFilters.put(type.getDisplayName(), type); this.correlationTypeComboBox.addItem(type.getDisplayName()); } - } catch (EamDbException ex) { + } catch (CentralRepoException ex) { logger.log(Level.WARNING, "Error getting correlation types", ex); } this.correlationTypeComboBox.setSelectedIndex(0); diff --git a/Core/src/org/sleuthkit/autopsy/commonpropertiessearch/InterCaseSearchResultsProcessor.java b/Core/src/org/sleuthkit/autopsy/commonpropertiessearch/InterCaseSearchResultsProcessor.java index a6dd6833b3..6d321f0340 100644 --- a/Core/src/org/sleuthkit/autopsy/commonpropertiessearch/InterCaseSearchResultsProcessor.java +++ b/Core/src/org/sleuthkit/autopsy/commonpropertiessearch/InterCaseSearchResultsProcessor.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2018-2019 Basis Technology Corp. + * Copyright 2018-2020 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -38,8 +38,7 @@ import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttributeIns import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttributeNormalizationException; import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationCase; import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationDataSource; -import org.sleuthkit.autopsy.centralrepository.datamodel.EamDb; -import org.sleuthkit.autopsy.centralrepository.datamodel.EamDbException; +import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoException; import org.sleuthkit.autopsy.centralrepository.datamodel.InstanceTableCallback; import org.sleuthkit.autopsy.commonpropertiessearch.AbstractCommonAttributeInstance.NODE_TYPE; import org.sleuthkit.autopsy.coreutils.Logger; @@ -47,6 +46,7 @@ import org.sleuthkit.datamodel.CaseDbAccessManager; import org.sleuthkit.datamodel.TskData; import org.sleuthkit.datamodel.HashUtility; import org.sleuthkit.datamodel.TskCoreException; +import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepository; /** * Used to process and return CorrelationCase values from the EamDB for @@ -83,12 +83,12 @@ final class InterCaseSearchResultsProcessor { try { InterCaseCommonAttributeRowCallback instancetableCallback = new InterCaseCommonAttributeRowCallback(); - EamDb dbManager = EamDb.getInstance(); + CentralRepository dbManager = CentralRepository.getInstance(); dbManager.processInstanceTableWhere(correlationType, String.format("id = %s", attrbuteId), instancetableCallback); return instancetableCallback.getCorrelationAttribute(); - } catch (EamDbException ex) { + } catch (CentralRepoException ex) { LOGGER.log(Level.SEVERE, "Error accessing EamDb processing InstanceTable row.", ex); } @@ -104,9 +104,9 @@ final class InterCaseSearchResultsProcessor { * @return the portion of a query which follows the SELECT keyword for * finding MD5s which we are correlating on * - * @throws EamDbException + * @throws CentralRepoException */ - private String getFileQuery(Set mimeTypesToFilterOn) throws EamDbException { + private String getFileQuery(Set mimeTypesToFilterOn) throws CentralRepoException { String query; query = "md5 AS value FROM tsk_files WHERE known!=" + TskData.FileKnown.KNOWN.getFileKnownValue() + " AND md5 IS NOT NULL"; //NON-NLS if (!mimeTypesToFilterOn.isEmpty()) { @@ -129,7 +129,7 @@ final class InterCaseSearchResultsProcessor { Map> findInterCaseValuesByCase(Case currentCase, Set mimeTypesToFilterOn) { try { - EamDb dbManager = EamDb.getInstance(); + CentralRepository dbManager = CentralRepository.getInstance(); int caseId = dbManager.getCase(currentCase).getID(); InterCaseByCaseCallback instancetableCallback = new InterCaseByCaseCallback(caseId); if (correlationType.getId() == CorrelationAttributeInstance.FILES_TYPE_ID) { @@ -141,7 +141,7 @@ final class InterCaseSearchResultsProcessor { } return instancetableCallback.getInstanceCollatedCommonFiles(); - } catch (EamDbException | TskCoreException ex) { + } catch (CentralRepoException | TskCoreException ex) { LOGGER.log(Level.SEVERE, "Error accessing EamDb processing CaseInstancesTable.", ex); } return new HashMap<>(); @@ -159,7 +159,7 @@ final class InterCaseSearchResultsProcessor { Map findInterCaseValuesByCount(Case currentCase, Set mimeTypesToFilterOn) { try { - EamDb dbManager = EamDb.getInstance(); + CentralRepository dbManager = CentralRepository.getInstance(); int caseId = dbManager.getCase(currentCase).getID(); InterCaseByCountCallback instancetableCallback = new InterCaseByCountCallback(caseId); @@ -172,7 +172,7 @@ final class InterCaseSearchResultsProcessor { } return instancetableCallback.getInstanceCollatedCommonFiles(); - } catch (EamDbException | TskCoreException ex) { + } catch (CentralRepoException | TskCoreException ex) { LOGGER.log(Level.SEVERE, "Error accessing EamDb processing CaseInstancesTable.", ex); } return new TreeMap<>(); @@ -192,7 +192,7 @@ final class InterCaseSearchResultsProcessor { */ Map findSingleInterCaseValuesByCount(Case currentCase, Set mimeTypesToFilterOn, CorrelationCase singleCase) { try { - EamDb dbManager = EamDb.getInstance(); + CentralRepository dbManager = CentralRepository.getInstance(); int caseId = dbManager.getCase(currentCase).getID(); int targetCaseId = singleCase.getID(); InterCaseByCountCallback instancetableCallback = new InterCaseByCountCallback(caseId, targetCaseId); @@ -204,7 +204,7 @@ final class InterCaseSearchResultsProcessor { instancetableCallback); } return instancetableCallback.getInstanceCollatedCommonFiles(); - } catch (EamDbException | TskCoreException ex) { + } catch (CentralRepoException | TskCoreException ex) { LOGGER.log(Level.SEVERE, "Error accessing EamDb processing CaseInstancesTable.", ex); } return new TreeMap<>(); @@ -226,7 +226,7 @@ final class InterCaseSearchResultsProcessor { Map> findSingleInterCaseValuesByCase(Case currentCase, Set mimeTypesToFilterOn, CorrelationCase singleCase) { try { - EamDb dbManager = EamDb.getInstance(); + CentralRepository dbManager = CentralRepository.getInstance(); int caseId = dbManager.getCase(currentCase).getID(); int targetCaseId = singleCase.getID(); InterCaseByCaseCallback instancetableCallback = new InterCaseByCaseCallback(caseId, targetCaseId); @@ -238,7 +238,7 @@ final class InterCaseSearchResultsProcessor { instancetableCallback); } return instancetableCallback.getInstanceCollatedCommonFiles(); - } catch (EamDbException | TskCoreException ex) { + } catch (CentralRepoException | TskCoreException ex) { LOGGER.log(Level.SEVERE, "Error accessing EamDb processing CaseInstancesTable.", ex); } return new HashMap<>(); @@ -282,9 +282,9 @@ final class InterCaseSearchResultsProcessor { for (String corValue : values) { List instances; if (targetCases.isEmpty()) { - instances = EamDb.getInstance().getArtifactInstancesByTypeValues(correlationType, Arrays.asList(corValue)); + instances = CentralRepository.getInstance().getArtifactInstancesByTypeValues(correlationType, Arrays.asList(corValue)); } else { - instances = EamDb.getInstance().getArtifactInstancesByTypeValuesAndCases(correlationType, Arrays.asList(corValue), targetCases); + instances = CentralRepository.getInstance().getArtifactInstancesByTypeValuesAndCases(correlationType, Arrays.asList(corValue), targetCases); } int size = instances.stream().map(instance -> instance.getCorrelationDataSource().getID()).collect(Collectors.toSet()).size(); if (size > 1) { @@ -307,7 +307,7 @@ final class InterCaseSearchResultsProcessor { } } } - } catch (SQLException | EamDbException | CorrelationAttributeNormalizationException ex) { + } catch (SQLException | CentralRepoException | CorrelationAttributeNormalizationException ex) { LOGGER.log(Level.WARNING, "Error getting artifact instances from database.", ex); // NON-NLS } } @@ -356,9 +356,9 @@ final class InterCaseSearchResultsProcessor { for (List valuesChunk : Iterables.partition(values, VALUE_BATCH_SIZE)) { List instances; if (targetCases.isEmpty()) { - instances = EamDb.getInstance().getArtifactInstancesByTypeValues(correlationType, valuesChunk); + instances = CentralRepository.getInstance().getArtifactInstancesByTypeValues(correlationType, valuesChunk); } else { - instances = EamDb.getInstance().getArtifactInstancesByTypeValuesAndCases(correlationType, valuesChunk, targetCases); + instances = CentralRepository.getInstance().getArtifactInstancesByTypeValuesAndCases(correlationType, valuesChunk, targetCases); } if (instances.size() > 1) { for (CorrelationAttributeInstance instance : instances) { @@ -385,7 +385,7 @@ final class InterCaseSearchResultsProcessor { } } } - } catch (EamDbException | SQLException | CorrelationAttributeNormalizationException ex) { + } catch (CentralRepoException | SQLException | CorrelationAttributeNormalizationException ex) { LOGGER.log(Level.WARNING, "Error getting artifact instances from database.", ex); // NON-NLS } } @@ -406,7 +406,7 @@ final class InterCaseSearchResultsProcessor { @Override public void process(ResultSet resultSet) { try { - EamDb dbManager = EamDb.getInstance(); + CentralRepository dbManager = CentralRepository.getInstance(); while (resultSet.next()) { CorrelationCase correlationCase = dbManager.getCaseById(InstanceTableCallback.getCaseId(resultSet)); @@ -428,7 +428,7 @@ final class InterCaseSearchResultsProcessor { } } - } catch (SQLException | EamDbException ex) { + } catch (SQLException | CentralRepoException ex) { LOGGER.log(Level.WARNING, "Error getting single correlation artifact instance from database.", ex); // NON-NLS } } diff --git a/Core/src/org/sleuthkit/autopsy/commonpropertiessearch/IntraCaseCommonAttributeSearcher.java b/Core/src/org/sleuthkit/autopsy/commonpropertiessearch/IntraCaseCommonAttributeSearcher.java index dac83a333e..83187bf7bf 100644 --- a/Core/src/org/sleuthkit/autopsy/commonpropertiessearch/IntraCaseCommonAttributeSearcher.java +++ b/Core/src/org/sleuthkit/autopsy/commonpropertiessearch/IntraCaseCommonAttributeSearcher.java @@ -28,7 +28,7 @@ import java.util.Map; import java.util.Set; import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; -import org.sleuthkit.autopsy.centralrepository.datamodel.EamDbException; +import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoException; import org.sleuthkit.datamodel.HashUtility; import org.sleuthkit.datamodel.SleuthkitCase; import org.sleuthkit.datamodel.SleuthkitCase.CaseDbQuery; @@ -143,8 +143,8 @@ public abstract class IntraCaseCommonAttributeSearcher extends AbstractCommonAtt } @Override - public CommonAttributeCaseSearchResults findMatchesByCase() throws TskCoreException, NoCurrentCaseException, SQLException, EamDbException { - throw new EamDbException("Not Supported at the moment"); + public CommonAttributeCaseSearchResults findMatchesByCase() throws TskCoreException, NoCurrentCaseException, SQLException, CentralRepoException { + throw new CentralRepoException("Not Supported at the moment"); } /** diff --git a/Core/src/org/sleuthkit/autopsy/commonpropertiessearch/SingleInterCaseCommonAttributeSearcher.java b/Core/src/org/sleuthkit/autopsy/commonpropertiessearch/SingleInterCaseCommonAttributeSearcher.java index 8d0cca8412..ed8b8bdc27 100644 --- a/Core/src/org/sleuthkit/autopsy/commonpropertiessearch/SingleInterCaseCommonAttributeSearcher.java +++ b/Core/src/org/sleuthkit/autopsy/commonpropertiessearch/SingleInterCaseCommonAttributeSearcher.java @@ -27,7 +27,7 @@ import org.openide.util.NbBundle; import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationCase; -import org.sleuthkit.autopsy.centralrepository.datamodel.EamDbException; +import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoException; import org.sleuthkit.datamodel.TskCoreException; import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttributeInstance.Type; import static org.sleuthkit.autopsy.commonpropertiessearch.AbstractCommonAttributeSearcher.MEDIA_PICS_VIDEO_MIME_TYPES; @@ -49,10 +49,10 @@ public class SingleInterCaseCommonAttributeSearcher extends InterCaseCommonAttri * @param corAttrType * @param percentageThreshold * - * @throws EamDbException + * @throws CentralRepoException */ public SingleInterCaseCommonAttributeSearcher(int correlationCaseId, boolean filterByMediaMimeType, - boolean filterByDocMimeType, Type corAttrType, int percentageThreshold) throws EamDbException { + boolean filterByDocMimeType, Type corAttrType, int percentageThreshold) throws CentralRepoException { super(filterByMediaMimeType, filterByDocMimeType, corAttrType, percentageThreshold); this.corrleationCaseId = correlationCaseId; @@ -68,10 +68,10 @@ public class SingleInterCaseCommonAttributeSearcher extends InterCaseCommonAttri * @throws TskCoreException * @throws NoCurrentCaseException * @throws SQLException - * @throws EamDbException + * @throws CentralRepoException */ @Override - public CommonAttributeCountSearchResults findMatchesByCount() throws TskCoreException, NoCurrentCaseException, SQLException, EamDbException { + public CommonAttributeCountSearchResults findMatchesByCount() throws TskCoreException, NoCurrentCaseException, SQLException, CentralRepoException { CorrelationCase correlationCase = this.getCorrelationCaseFromId(this.corrleationCaseId); this.correlationCaseName = correlationCase.getDisplayName(); @@ -97,10 +97,10 @@ public class SingleInterCaseCommonAttributeSearcher extends InterCaseCommonAttri * @throws TskCoreException * @throws NoCurrentCaseException * @throws SQLException - * @throws EamDbException + * @throws CentralRepoException */ @Override - public CommonAttributeCaseSearchResults findMatchesByCase() throws TskCoreException, NoCurrentCaseException, SQLException, EamDbException { + public CommonAttributeCaseSearchResults findMatchesByCase() throws TskCoreException, NoCurrentCaseException, SQLException, CentralRepoException { CorrelationCase correlationCase = this.getCorrelationCaseFromId(this.corrleationCaseId); this.correlationCaseName = correlationCase.getDisplayName(); diff --git a/Core/src/org/sleuthkit/autopsy/communications/relationships/AccountSummary.java b/Core/src/org/sleuthkit/autopsy/communications/relationships/AccountSummary.java index 5c14125d87..0888a105a3 100755 --- a/Core/src/org/sleuthkit/autopsy/communications/relationships/AccountSummary.java +++ b/Core/src/org/sleuthkit/autopsy/communications/relationships/AccountSummary.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2019 Basis Technology Corp. + * Copyright 2019-2020 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -31,8 +31,8 @@ import org.sleuthkit.datamodel.BlackboardArtifact; import org.sleuthkit.datamodel.BlackboardAttribute; import org.sleuthkit.datamodel.Content; import org.sleuthkit.datamodel.TskCoreException; -import org.sleuthkit.datamodel.blackboardutils.FileAttachment; -import org.sleuthkit.datamodel.blackboardutils.MessageAttachments; +import org.sleuthkit.datamodel.blackboardutils.attributes.MessageAttachments.FileAttachment; +import org.sleuthkit.datamodel.blackboardutils.attributes.MessageAttachments; /** * diff --git a/Core/src/org/sleuthkit/autopsy/communications/relationships/AttachmentThumbnailsChildren.java b/Core/src/org/sleuthkit/autopsy/communications/relationships/AttachmentThumbnailsChildren.java index 816eb05d75..74ee109b6f 100755 --- a/Core/src/org/sleuthkit/autopsy/communications/relationships/AttachmentThumbnailsChildren.java +++ b/Core/src/org/sleuthkit/autopsy/communications/relationships/AttachmentThumbnailsChildren.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2019 Basis Technology Corp. + * Copyright 2019-2020 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -38,8 +38,8 @@ import org.sleuthkit.datamodel.BlackboardArtifact; import org.sleuthkit.datamodel.BlackboardAttribute; import org.sleuthkit.datamodel.Content; import org.sleuthkit.datamodel.TskCoreException; -import org.sleuthkit.datamodel.blackboardutils.FileAttachment; -import org.sleuthkit.datamodel.blackboardutils.MessageAttachments; +import org.sleuthkit.datamodel.blackboardutils.attributes.MessageAttachments.FileAttachment; +import org.sleuthkit.datamodel.blackboardutils.attributes.MessageAttachments; /** * Factory for creating thumbnail children nodes. diff --git a/Core/src/org/sleuthkit/autopsy/communications/relationships/CallLogNode.java b/Core/src/org/sleuthkit/autopsy/communications/relationships/CallLogNode.java index a9e92d6451..288b3efa3f 100755 --- a/Core/src/org/sleuthkit/autopsy/communications/relationships/CallLogNode.java +++ b/Core/src/org/sleuthkit/autopsy/communications/relationships/CallLogNode.java @@ -71,6 +71,9 @@ final class CallLogNode extends BlackboardArtifactNode { if(phoneNumber == null || phoneNumber.isEmpty()) { phoneNumber = getAttributeDisplayString(artifact, TSK_PHONE_NUMBER_TO); } + if(phoneNumber == null || phoneNumber.isEmpty()) { + phoneNumber = getAttributeDisplayString(artifact, TSK_PHONE_NUMBER); + } long duration = -1; try{ diff --git a/Core/src/org/sleuthkit/autopsy/communications/relationships/CorrelationCaseChildNodeFactory.java b/Core/src/org/sleuthkit/autopsy/communications/relationships/CorrelationCaseChildNodeFactory.java index 564c8e4f54..5105f1628d 100755 --- a/Core/src/org/sleuthkit/autopsy/communications/relationships/CorrelationCaseChildNodeFactory.java +++ b/Core/src/org/sleuthkit/autopsy/communications/relationships/CorrelationCaseChildNodeFactory.java @@ -31,11 +31,11 @@ import org.openide.nodes.Sheet; import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttributeInstance; import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttributeNormalizationException; import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationCase; -import org.sleuthkit.autopsy.centralrepository.datamodel.EamDb; -import org.sleuthkit.autopsy.centralrepository.datamodel.EamDbException; +import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoException; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.datamodel.NodeProperty; import org.sleuthkit.datamodel.Account; +import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepository; /** * ChildFactory for CorrelationCases. Finds the cases that reference the given @@ -59,14 +59,14 @@ final class CorrelationCaseChildNodeFactory extends ChildFactory list) { - if (!EamDb.isEnabled()) { + if (!CentralRepository.isEnabled()) { return true; } - EamDb dbInstance; + CentralRepository dbInstance; try { - dbInstance = EamDb.getInstance(); - } catch (EamDbException ex) { + dbInstance = CentralRepository.getInstance(); + } catch (CentralRepoException ex) { logger.log(Level.SEVERE, "Unable to connect to the Central Repository database.", ex); //NON-NLS return false; } @@ -83,7 +83,7 @@ final class CorrelationCaseChildNodeFactory extends ChildFactory(); List correcationTypeList = CorrelationAttributeInstance.getDefaultCorrelationTypes(); diff --git a/Core/src/org/sleuthkit/autopsy/communications/relationships/MessageNode.java b/Core/src/org/sleuthkit/autopsy/communications/relationships/MessageNode.java index aad258ed0f..038452dcd7 100755 --- a/Core/src/org/sleuthkit/autopsy/communications/relationships/MessageNode.java +++ b/Core/src/org/sleuthkit/autopsy/communications/relationships/MessageNode.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2019 Basis Technology Corp. + * Copyright 2019-2020 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -40,7 +40,7 @@ import org.sleuthkit.autopsy.datamodel.BlackboardArtifactNode; import static org.sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE.TSK_EMAIL_MSG; import static org.sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE.TSK_MESSAGE; import org.sleuthkit.datamodel.BlackboardAttribute; -import org.sleuthkit.datamodel.blackboardutils.MessageAttachments; +import org.sleuthkit.datamodel.blackboardutils.attributes.MessageAttachments; /** * Wraps a BlackboardArtifact as an AbstractNode for use in an OutlookView diff --git a/Core/src/org/sleuthkit/autopsy/communications/relationships/SummaryViewer.java b/Core/src/org/sleuthkit/autopsy/communications/relationships/SummaryViewer.java index f373b8a333..fbfc28e493 100755 --- a/Core/src/org/sleuthkit/autopsy/communications/relationships/SummaryViewer.java +++ b/Core/src/org/sleuthkit/autopsy/communications/relationships/SummaryViewer.java @@ -27,8 +27,8 @@ import org.openide.nodes.AbstractNode; import org.openide.nodes.Children; import org.openide.util.Lookup; import org.openide.util.NbBundle.Messages; -import org.sleuthkit.autopsy.centralrepository.datamodel.EamDb; import org.sleuthkit.datamodel.Account; +import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepository; /** * Account Summary View Panel. This panel shows a list of various counts related @@ -92,7 +92,7 @@ public class SummaryViewer extends javax.swing.JPanel implements RelationshipsVi @Override public void setSelectionInfo(SelectionInfo info) { - if (!EamDb.isEnabled()) { + if (!CentralRepository.isEnabled()) { caseReferencesPanel.hideOutlineView(Bundle.SummaryViewer_CentralRepository_Message()); } else { caseReferencesPanel.showOutlineView(); diff --git a/Core/src/org/sleuthkit/autopsy/contentviewers/AnnotationsContentViewer.java b/Core/src/org/sleuthkit/autopsy/contentviewers/AnnotationsContentViewer.java index 72343ec616..9116ff9b45 100755 --- a/Core/src/org/sleuthkit/autopsy/contentviewers/AnnotationsContentViewer.java +++ b/Core/src/org/sleuthkit/autopsy/contentviewers/AnnotationsContentViewer.java @@ -34,9 +34,8 @@ import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttributeIns import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttributeNormalizationException; import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationCase; import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationDataSource; -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.CorrelationAttributeUtil; +import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoException; import org.sleuthkit.autopsy.corecomponentinterfaces.DataContentViewer; import org.sleuthkit.datamodel.AbstractFile; import org.sleuthkit.datamodel.BlackboardArtifact; @@ -46,6 +45,7 @@ import org.sleuthkit.datamodel.ContentTag; import org.sleuthkit.datamodel.SleuthkitCase; import org.sleuthkit.datamodel.Tag; import org.sleuthkit.datamodel.TskCoreException; +import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepository; /** * Annotations view of file contents. @@ -194,19 +194,19 @@ public class AnnotationsContentViewer extends javax.swing.JPanel implements Data * artifact. */ private void populateCentralRepositoryData(StringBuilder html, BlackboardArtifact artifact, AbstractFile sourceFile) { - if (EamDb.isEnabled()) { + if (CentralRepository.isEnabled()) { startSection(html, "Central Repository Comments"); List instancesList = new ArrayList<>(); if (artifact != null) { - instancesList.addAll(EamArtifactUtil.makeInstancesFromBlackboardArtifact(artifact, false)); + instancesList.addAll(CorrelationAttributeUtil.makeInstancesFromBlackboardArtifact(artifact, false)); } try { - List artifactTypes = EamDb.getInstance().getDefinedCorrelationTypes(); + List artifactTypes = CentralRepository.getInstance().getDefinedCorrelationTypes(); String md5 = sourceFile.getMd5Hash(); if (md5 != null && !md5.isEmpty() && null != artifactTypes && !artifactTypes.isEmpty()) { for (CorrelationAttributeInstance.Type attributeType : artifactTypes) { if (attributeType.getId() == CorrelationAttributeInstance.FILES_TYPE_ID) { - CorrelationCase correlationCase = EamDb.getInstance().getCase(Case.getCurrentCase()); + CorrelationCase correlationCase = CentralRepository.getInstance().getCase(Case.getCurrentCase()); instancesList.add(new CorrelationAttributeInstance( attributeType, md5, @@ -225,7 +225,7 @@ public class AnnotationsContentViewer extends javax.swing.JPanel implements Data for (CorrelationAttributeInstance instance : instancesList) { List correlatedInstancesList - = EamDb.getInstance().getArtifactInstancesByTypeValue(instance.getCorrelationType(), instance.getCorrelationValue()); + = CentralRepository.getInstance().getArtifactInstancesByTypeValue(instance.getCorrelationType(), instance.getCorrelationValue()); for (CorrelationAttributeInstance correlatedInstance : correlatedInstancesList) { if (correlatedInstance.getComment() != null && correlatedInstance.getComment().isEmpty() == false) { commentDataFound = true; @@ -237,7 +237,7 @@ public class AnnotationsContentViewer extends javax.swing.JPanel implements Data if (commentDataFound == false) { addMessage(html, "There is no comment data for the selected content in the Central Repository."); } - } catch (EamDbException | TskCoreException ex) { + } catch (CentralRepoException | TskCoreException ex) { logger.log(Level.SEVERE, "Error connecting to the Central Repository database.", ex); // NON-NLS } catch (CorrelationAttributeNormalizationException ex) { logger.log(Level.SEVERE, "Error normalizing instance from Central Repository database.", ex); // NON-NLS diff --git a/Core/src/org/sleuthkit/autopsy/contentviewers/Bundle.properties b/Core/src/org/sleuthkit/autopsy/contentviewers/Bundle.properties index b3a384ce48..cf07682e5d 100644 --- a/Core/src/org/sleuthkit/autopsy/contentviewers/Bundle.properties +++ b/Core/src/org/sleuthkit/autopsy/contentviewers/Bundle.properties @@ -87,9 +87,9 @@ HtmlPanel.showImagesToggleButton.text=Download Images MediaViewImagePanel.tagsMenu.text_1=Tags Menu MediaPlayerPanel.progressLabel.text=00:00:00/00:00:00 MediaPlayerPanel.audioSlider.toolTipText= -MediaPlayerPanel.rewindButton.text=\u2bc7\u2bc7 -MediaPlayerPanel.fastForwardButton.text=\u2bc8\u2bc8 -MediaPlayerPanel.playButton.text=\u25ba +MediaPlayerPanel.rewindButton.text= +MediaPlayerPanel.fastForwardButton.text= +MediaPlayerPanel.playButton.text= MediaPlayerPanel.infoLabel.text=No Errors MediaPlayerPanel.VolumeIcon.text=Volume MediaPlayerPanel.playBackSpeedLabel.text=Speed: diff --git a/Core/src/org/sleuthkit/autopsy/contentviewers/Bundle.properties-MERGED b/Core/src/org/sleuthkit/autopsy/contentviewers/Bundle.properties-MERGED index 2d9df0ae33..13f3ef0710 100755 --- a/Core/src/org/sleuthkit/autopsy/contentviewers/Bundle.properties-MERGED +++ b/Core/src/org/sleuthkit/autopsy/contentviewers/Bundle.properties-MERGED @@ -158,9 +158,9 @@ HtmlPanel.showImagesToggleButton.text=Download Images MediaViewImagePanel.tagsMenu.text_1=Tags Menu MediaPlayerPanel.progressLabel.text=00:00:00/00:00:00 MediaPlayerPanel.audioSlider.toolTipText= -MediaPlayerPanel.rewindButton.text=\u2bc7\u2bc7 -MediaPlayerPanel.fastForwardButton.text=\u2bc8\u2bc8 -MediaPlayerPanel.playButton.text=\u25ba +MediaPlayerPanel.rewindButton.text= +MediaPlayerPanel.fastForwardButton.text= +MediaPlayerPanel.playButton.text= MediaPlayerPanel.infoLabel.text=No Errors MediaPlayerPanel.VolumeIcon.text=Volume MediaPlayerPanel.playBackSpeedLabel.text=Speed: diff --git a/Core/src/org/sleuthkit/autopsy/contentviewers/MediaPlayerPanel.form b/Core/src/org/sleuthkit/autopsy/contentviewers/MediaPlayerPanel.form index d8433a907b..0b00c43d8a 100755 --- a/Core/src/org/sleuthkit/autopsy/contentviewers/MediaPlayerPanel.form +++ b/Core/src/org/sleuthkit/autopsy/contentviewers/MediaPlayerPanel.form @@ -41,7 +41,7 @@ - + @@ -83,7 +83,7 @@ - + @@ -107,7 +107,7 @@ - + @@ -123,9 +123,21 @@ + + + + + + + + + + + + @@ -138,6 +150,9 @@ + + + @@ -153,6 +168,9 @@ + + + @@ -172,6 +190,15 @@ + + + + + + + + + @@ -188,15 +215,19 @@ + + + - + - + + - + @@ -223,7 +254,7 @@ - + @@ -233,12 +264,15 @@ - - - - + + + + + + + - + @@ -260,14 +294,15 @@ - + - + - + + @@ -281,6 +316,15 @@ + + + + + + + + + diff --git a/Core/src/org/sleuthkit/autopsy/contentviewers/MediaPlayerPanel.java b/Core/src/org/sleuthkit/autopsy/contentviewers/MediaPlayerPanel.java index 9ed6727388..c518abdd45 100755 --- a/Core/src/org/sleuthkit/autopsy/contentviewers/MediaPlayerPanel.java +++ b/Core/src/org/sleuthkit/autopsy/contentviewers/MediaPlayerPanel.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2013-2019 Basis Technology Corp. + * Copyright 2013-2020 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -29,6 +29,7 @@ import java.awt.RenderingHints; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; import java.io.File; import java.io.IOException; import java.util.Arrays; @@ -61,6 +62,7 @@ import org.sleuthkit.autopsy.modules.filetypeid.FileTypeDetector; import org.sleuthkit.datamodel.AbstractFile; import org.sleuthkit.datamodel.TskData; import javafx.embed.swing.JFXPanel; +import javax.swing.ImageIcon; import javax.swing.JComponent; import javax.swing.JSlider; import javax.swing.SwingUtilities; @@ -110,7 +112,7 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie ".wav", ".webm", ".wma", - ".wmv",}; //NON-NLS + ".wmv"}; //NON-NLS private static final List MIME_TYPES = Arrays.asList( "video/3gpp", "video/3gpp2", @@ -201,15 +203,18 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie private static final int PROGRESS_SLIDER_SIZE = 2000; private static final int SKIP_IN_SECONDS = 30; + private final ImageIcon playIcon = new ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/contentviewers/images/Play-arrow-01.png")); + private final ImageIcon pauseIcon = new ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/contentviewers/images/Pause-01.png")); + private ExtractMedia extractMediaWorker; //Serialize setting the value of the Video progress slider. //The slider is a shared resource between the VideoPanelUpdater - //and the TrackListener of the JSliderUI. + //and the TrackListener on the slider itself. private final Semaphore sliderLock; /** - * Creates new form MediaViewVideoPanel + * Creates a new MediaPlayerPanel */ public MediaPlayerPanel() throws GstException, UnsatisfiedLinkError { initComponents(); @@ -217,12 +222,12 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie //True for fairness. In other words, //acquire() calls are processed in order of invocation. sliderLock = new Semaphore(1, true); - + /** * See JIRA-5888 for details. Initializing gstreamer here is more stable * on Windows. */ - if(PlatformUtil.isWindowsOS()) { + if (PlatformUtil.isWindowsOS()) { Gst.init(); } } @@ -256,7 +261,37 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie } } }); - //Manage the audio level when the user is adjusting the volumn slider + //Manage the video while the user is performing actions on the track. + progressSlider.addMouseListener(new MouseListener() { + private State previousState = State.NULL; + + @Override + public void mousePressed(MouseEvent e) { + previousState = gstPlayBin.getState(); + gstPlayBin.pause(); + } + + @Override + public void mouseReleased(MouseEvent e) { + if(previousState.equals(State.PLAYING)) { + gstPlayBin.play(); + } + previousState = State.NULL; + } + @Override + public void mouseClicked(MouseEvent e) { + } + + @Override + public void mouseEntered(MouseEvent e) { + } + + @Override + public void mouseExited(MouseEvent e) { + } + + }); + //Manage the audio level when the user is adjusting the volume slider audioSlider.addChangeListener((ChangeEvent event) -> { if (audioSlider.getValueIsAdjusting()) { double audioPercent = (audioSlider.getValue() * 2.0) / 100.0; @@ -280,11 +315,11 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie public void stateChanged(GstObject go, State oldState, State currentState, State pendingState) { if (State.PLAYING.equals(currentState)) { SwingUtilities.invokeLater(() -> { - playButton.setText("||"); + playButton.setIcon(pauseIcon); }); } else { SwingUtilities.invokeLater(() -> { - playButton.setText("►"); + playButton.setIcon(playIcon); }); } } @@ -514,7 +549,7 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie // Initialize Gstreamer. It is safe to call this for every file. // It was moved here from the constructor because having it happen // earlier resulted in conflicts on Linux. See JIRA-5888. - if(!PlatformUtil.isWindowsOS()) { + if (!PlatformUtil.isWindowsOS()) { Gst.init(); } @@ -585,63 +620,15 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie } } - /** - * Represents the default configuration for the circular JSliderUI. - */ - private class CircularJSliderConfiguration { - - //Thumb configurations - private final Color thumbColor; - private final Dimension thumbDimension; - - //Track configurations - //Progress bar can be bisected into a seen group - //and an unseen group. - private final Color unseen; - private final Color seen; - - /** - * Default configuration - * - * JSlider is light blue RGB(0,130,255). Seen track is light blue - * RGB(0,130,255). Unseen track is light grey RGB(192, 192, 192). - * - * @param thumbDimension Size of the oval thumb. - */ - public CircularJSliderConfiguration(Dimension thumbDimension) { - Color lightBlue = new Color(0, 130, 255); - - seen = lightBlue; - unseen = Color.LIGHT_GRAY; - - thumbColor = lightBlue; - - this.thumbDimension = new Dimension(thumbDimension); - } - - public Color getThumbColor() { - return thumbColor; - } - - public Color getUnseenTrackColor() { - return unseen; - } - - public Color getSeenTrackColor() { - return seen; - } - - public Dimension getThumbDimension() { - return new Dimension(thumbDimension); - } - } - /** * Custom view for the JSlider. */ private class CircularJSliderUI extends BasicSliderUI { - private final CircularJSliderConfiguration config; + private final Dimension thumbDimension; + private final Color thumbColor; + private final Color trackUnseen; + private final Color trackSeen; /** * Creates a custom view for the JSlider. This view draws a blue oval @@ -649,21 +636,27 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie * the thumb progresses. * * @param slider JSlider component - * @param config Configuration object. Contains info about thumb - * dimensions and colors. + * @param thumbDimension */ - public CircularJSliderUI(JSlider slider, CircularJSliderConfiguration config) { + public CircularJSliderUI(JSlider slider, Dimension thumbDimension) { super(slider); - this.config = config; + this.thumbDimension = thumbDimension; + + //Configure track and thumb colors. + Color lightBlue = new Color(0, 130, 255); + thumbColor = lightBlue; + trackSeen = lightBlue; + trackUnseen = Color.LIGHT_GRAY; } @Override protected Dimension getThumbSize() { - return config.getThumbDimension(); + return new Dimension(thumbDimension); } /** - * Modifies the View to be an oval rather than the rectangle Controller. + * Modifies the View to be an oval rather than the underlying + * rectangle Controller. */ @Override public void paintThumb(Graphics graphic) { @@ -673,8 +666,7 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie //Change the thumb view from the rectangle //controller to an oval. - graphic.setColor(config.getThumbColor()); - Dimension thumbDimension = config.getThumbDimension(); + graphic.setColor(thumbColor); graphic.fillOval(thumb.x, thumb.y, thumbDimension.width, thumbDimension.height); //Preserve the graphics original color @@ -697,12 +689,12 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie Color original = graphic.getColor(); //Paint the seen side - graphic.setColor(config.getSeenTrackColor()); + graphic.setColor(trackSeen); graphic.drawLine(track.x, track.y + track.height / 2, thumbX, thumbY + track.height / 2); //Paint the unseen side - graphic.setColor(config.getUnseenTrackColor()); + graphic.setColor(trackUnseen); graphic.drawLine(thumbX, thumbY + track.height / 2, track.x + track.width, track.y + track.height / 2); @@ -712,7 +704,26 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie @Override protected TrackListener createTrackListener(JSlider slider) { - return new CustomTrackListener(); + /** + * This track listener will force the thumb to be snapped to the mouse + * location. This makes grabbing and dragging the JSlider much easier. + * Using the default track listener, the user would have to click + * exactly on the slider thumb to drag it. Now the thumb positions + * itself under the mouse so that it can always be dragged. + */ + return new TrackListener() { + @Override + public void mousePressed(MouseEvent e) { + if (!slider.isEnabled() || !SwingUtilities.isLeftMouseButton(e)) { + return; + } + //Snap the thumb to position of the mouse + scrollDueToClickInTrack(0); + + //Handle the event as normal. + super.mousePressed(e); + } + }; } @Override @@ -726,7 +737,7 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie int value = this.valueForXPosition(mousePosition.x); //Lock the slider down, which is a shared resource. - //The VideoPanelUpdater (dedicated thread) keeps the + //The VideoPanelUpdater keeps the //slider in sync with the video position, so without //proper locking our change could be overwritten. sliderLock.acquireUninterruptibly(); @@ -749,43 +760,6 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie super.update(graphic, component); } - - /** - * This track listener will force the thumb to be snapped to the mouse - * location. This makes grabbing and dragging the JSlider much easier. - * Using the default track listener, the user would have to click - * exactly on the slider thumb to drag it. Now the thumb positions - * itself under the mouse so that it can always be dragged. - */ - private class CustomTrackListener extends CircularJSliderUI.TrackListener { - - @Override - public void mousePressed(MouseEvent e) { - if (!slider.isEnabled() || !SwingUtilities.isLeftMouseButton(e)) { - return; - } - //Snap the thumb to position of the mouse - scrollDueToClickInTrack(0); - - //Pause the video for convenience - gstPlayBin.pause(); - - //Handle the event as normal. - super.mousePressed(e); - } - - @Override - public void mouseReleased(MouseEvent e) { - if (!slider.isEnabled() || !SwingUtilities.isLeftMouseButton(e)) { - return; - } - - super.mouseReleased(e); - - //Unpause once the mouse has been released. - gstPlayBin.play(); - } - } } /** @@ -821,7 +795,7 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie ); videoPanelLayout.setVerticalGroup( videoPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGap(0, 131, Short.MAX_VALUE) + .addGap(0, 117, Short.MAX_VALUE) ); progressSlider.setValue(0); @@ -829,13 +803,17 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie progressSlider.setDoubleBuffered(true); progressSlider.setMinimumSize(new java.awt.Dimension(36, 21)); progressSlider.setPreferredSize(new java.awt.Dimension(200, 21)); - progressSlider.setUI(new CircularJSliderUI(progressSlider, new CircularJSliderConfiguration(new Dimension(18,18)))); + progressSlider.setUI(new CircularJSliderUI(progressSlider, new Dimension(18,18))); org.openide.awt.Mnemonics.setLocalizedText(progressLabel, org.openide.util.NbBundle.getMessage(MediaPlayerPanel.class, "MediaPlayerPanel.progressLabel.text")); // NOI18N buttonPanel.setLayout(new java.awt.GridBagLayout()); + playButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/contentviewers/images/Play-arrow-01.png"))); // NOI18N org.openide.awt.Mnemonics.setLocalizedText(playButton, org.openide.util.NbBundle.getMessage(MediaPlayerPanel.class, "MediaPlayerPanel.playButton.text")); // NOI18N + playButton.setMaximumSize(new java.awt.Dimension(53, 29)); + playButton.setMinimumSize(new java.awt.Dimension(53, 29)); + playButton.setPreferredSize(new java.awt.Dimension(49, 29)); playButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { playButtonActionPerformed(evt); @@ -849,6 +827,7 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie gridBagConstraints.insets = new java.awt.Insets(5, 6, 0, 0); buttonPanel.add(playButton, gridBagConstraints); + fastForwardButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/contentviewers/images/Fast-forward-01.png"))); // NOI18N org.openide.awt.Mnemonics.setLocalizedText(fastForwardButton, org.openide.util.NbBundle.getMessage(MediaPlayerPanel.class, "MediaPlayerPanel.fastForwardButton.text")); // NOI18N fastForwardButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { @@ -862,6 +841,7 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie gridBagConstraints.insets = new java.awt.Insets(5, 6, 0, 0); buttonPanel.add(fastForwardButton, gridBagConstraints); + rewindButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/contentviewers/images/Fast-rewind-01.png"))); // NOI18N org.openide.awt.Mnemonics.setLocalizedText(rewindButton, org.openide.util.NbBundle.getMessage(MediaPlayerPanel.class, "MediaPlayerPanel.rewindButton.text")); // NOI18N rewindButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { @@ -877,6 +857,9 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie org.openide.awt.Mnemonics.setLocalizedText(VolumeIcon, org.openide.util.NbBundle.getMessage(MediaPlayerPanel.class, "MediaPlayerPanel.VolumeIcon.text")); // NOI18N VolumeIcon.setHorizontalTextPosition(javax.swing.SwingConstants.LEFT); + VolumeIcon.setMaximumSize(new java.awt.Dimension(34, 29)); + VolumeIcon.setMinimumSize(new java.awt.Dimension(34, 29)); + VolumeIcon.setPreferredSize(new java.awt.Dimension(34, 19)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 3; gridBagConstraints.gridy = 0; @@ -891,9 +874,11 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie audioSlider.setMinorTickSpacing(5); audioSlider.setToolTipText(org.openide.util.NbBundle.getMessage(MediaPlayerPanel.class, "MediaPlayerPanel.audioSlider.toolTipText")); // NOI18N audioSlider.setValue(25); - audioSlider.setMinimumSize(new java.awt.Dimension(200, 21)); - audioSlider.setPreferredSize(new java.awt.Dimension(200, 21)); - audioSlider.setUI(new CircularJSliderUI(audioSlider, new CircularJSliderConfiguration(new Dimension(15,15)))); + audioSlider.setMaximumSize(new java.awt.Dimension(32767, 19)); + audioSlider.setMinimumSize(new java.awt.Dimension(200, 19)); + audioSlider.setPreferredSize(new java.awt.Dimension(200, 30)); + audioSlider.setRequestFocusEnabled(false); + audioSlider.setUI(new CircularJSliderUI(audioSlider, new Dimension(15,15))); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 4; gridBagConstraints.gridy = 0; @@ -909,9 +894,10 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie playBackSpeedComboBox.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "0.25x", "0.50x", "0.75x", "1x", "1.25x", "1.50x", "1.75x", "2x" })); playBackSpeedComboBox.setSelectedIndex(3); - playBackSpeedComboBox.setMaximumSize(new java.awt.Dimension(53, 23)); - playBackSpeedComboBox.setMinimumSize(new java.awt.Dimension(53, 23)); - playBackSpeedComboBox.setPreferredSize(new java.awt.Dimension(53, 23)); + playBackSpeedComboBox.setMaximumSize(new java.awt.Dimension(53, 29)); + playBackSpeedComboBox.setMinimumSize(new java.awt.Dimension(53, 29)); + playBackSpeedComboBox.setPreferredSize(new java.awt.Dimension(53, 29)); + playBackSpeedComboBox.setRequestFocusEnabled(false); playBackSpeedComboBox.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { playBackSpeedComboBoxActionPerformed(evt); @@ -919,13 +905,16 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie }); org.openide.awt.Mnemonics.setLocalizedText(playBackSpeedLabel, org.openide.util.NbBundle.getMessage(MediaPlayerPanel.class, "MediaPlayerPanel.playBackSpeedLabel.text")); // NOI18N + playBackSpeedLabel.setMaximumSize(new java.awt.Dimension(34, 19)); + playBackSpeedLabel.setMinimumSize(new java.awt.Dimension(34, 19)); + playBackSpeedLabel.setPreferredSize(new java.awt.Dimension(34, 19)); javax.swing.GroupLayout playBackPanelLayout = new javax.swing.GroupLayout(playBackPanel); playBackPanel.setLayout(playBackPanelLayout); playBackPanelLayout.setHorizontalGroup( playBackPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(playBackPanelLayout.createSequentialGroup() - .addComponent(playBackSpeedLabel) + .addComponent(playBackSpeedLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(playBackSpeedComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(13, 13, 13)) @@ -933,11 +922,13 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie playBackPanelLayout.setVerticalGroup( playBackPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(playBackPanelLayout.createSequentialGroup() - .addGap(6, 6, 6) - .addGroup(playBackPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(playBackSpeedComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(playBackSpeedLabel)) - .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addGap(7, 7, 7) + .addGroup(playBackPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addGroup(playBackPanelLayout.createSequentialGroup() + .addGap(2, 2, 2) + .addComponent(playBackSpeedLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addComponent(playBackSpeedComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(10, 10, 10)) ); javax.swing.GroupLayout controlPanelLayout = new javax.swing.GroupLayout(controlPanel); @@ -969,7 +960,7 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie .addGap(5, 5, 5) .addGroup(controlPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(buttonPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(playBackPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)) + .addComponent(playBackPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGap(14, 14, 14) .addComponent(infoLabel)) ); @@ -1013,13 +1004,21 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie long currentTime = gstPlayBin.queryPosition(TimeUnit.NANOSECONDS); //Skip 30 seconds. long fastForwardDelta = TimeUnit.NANOSECONDS.convert(SKIP_IN_SECONDS, TimeUnit.SECONDS); - - //Ignore fast forward requests if there are less than 30 seconds left. - if (currentTime + fastForwardDelta >= duration) { + //Don't allow skipping within 2 seconds of video ending. Skipping right to + //the end causes undefined behavior for some gstreamer plugins. + long twoSecondsInNano = TimeUnit.NANOSECONDS.convert(2, TimeUnit.SECONDS); + if((duration - currentTime) <= twoSecondsInNano) { return; } + + long newTime; + if (currentTime + fastForwardDelta >= duration) { + //If there are less than 30 seconds left, only fast forward to the midpoint. + newTime = currentTime + (duration - currentTime)/2; + } else { + newTime = currentTime + fastForwardDelta; + } - long newTime = currentTime + fastForwardDelta; double playBackRate = getPlayBackRate(); gstPlayBin.seek(playBackRate, Format.TIME, diff --git a/Core/src/org/sleuthkit/autopsy/contentviewers/MessageContentViewer.java b/Core/src/org/sleuthkit/autopsy/contentviewers/MessageContentViewer.java index d93a46ab0a..cadd311f70 100644 --- a/Core/src/org/sleuthkit/autopsy/contentviewers/MessageContentViewer.java +++ b/Core/src/org/sleuthkit/autopsy/contentviewers/MessageContentViewer.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2017-2019 Basis Technology Corp. + * Copyright 2017-2020 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -72,10 +72,10 @@ import static org.sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE.TSK_TEX import org.sleuthkit.datamodel.Content; import org.sleuthkit.datamodel.SleuthkitCase; import org.sleuthkit.datamodel.TskCoreException; -import org.sleuthkit.datamodel.blackboardutils.FileAttachment; -import org.sleuthkit.datamodel.blackboardutils.MessageAttachments; -import org.sleuthkit.datamodel.blackboardutils.Attachment; -import org.sleuthkit.datamodel.blackboardutils.URLAttachment; +import org.sleuthkit.datamodel.blackboardutils.attributes.MessageAttachments; +import org.sleuthkit.datamodel.blackboardutils.attributes.MessageAttachments.FileAttachment; +import org.sleuthkit.datamodel.blackboardutils.attributes.MessageAttachments.Attachment; +import org.sleuthkit.datamodel.blackboardutils.attributes.MessageAttachments.URLAttachment; /** * Shows SMS/MMS/EMail messages diff --git a/Core/src/org/sleuthkit/autopsy/contentviewers/images/Fast-forward-01.png b/Core/src/org/sleuthkit/autopsy/contentviewers/images/Fast-forward-01.png new file mode 100755 index 0000000000..8261b2962a Binary files /dev/null and b/Core/src/org/sleuthkit/autopsy/contentviewers/images/Fast-forward-01.png differ diff --git a/Core/src/org/sleuthkit/autopsy/contentviewers/images/Fast-rewind-01.png b/Core/src/org/sleuthkit/autopsy/contentviewers/images/Fast-rewind-01.png new file mode 100755 index 0000000000..a941bae845 Binary files /dev/null and b/Core/src/org/sleuthkit/autopsy/contentviewers/images/Fast-rewind-01.png differ diff --git a/Core/src/org/sleuthkit/autopsy/contentviewers/images/Pause-01.png b/Core/src/org/sleuthkit/autopsy/contentviewers/images/Pause-01.png new file mode 100755 index 0000000000..8f3db42f5b Binary files /dev/null and b/Core/src/org/sleuthkit/autopsy/contentviewers/images/Pause-01.png differ diff --git a/Core/src/org/sleuthkit/autopsy/contentviewers/images/Play-arrow-01.png b/Core/src/org/sleuthkit/autopsy/contentviewers/images/Play-arrow-01.png new file mode 100755 index 0000000000..624c1841d8 Binary files /dev/null and b/Core/src/org/sleuthkit/autopsy/contentviewers/images/Play-arrow-01.png differ diff --git a/Core/src/org/sleuthkit/autopsy/core/geolocationWsmode.xml b/Core/src/org/sleuthkit/autopsy/core/geolocationWsmode.xml index 4e29bb3e2d..498f502777 100755 --- a/Core/src/org/sleuthkit/autopsy/core/geolocationWsmode.xml +++ b/Core/src/org/sleuthkit/autopsy/core/geolocationWsmode.xml @@ -3,7 +3,7 @@ - + diff --git a/Core/src/org/sleuthkit/autopsy/core/layer.xml b/Core/src/org/sleuthkit/autopsy/core/layer.xml index e853720824..2b54236d77 100644 --- a/Core/src/org/sleuthkit/autopsy/core/layer.xml +++ b/Core/src/org/sleuthkit/autopsy/core/layer.xml @@ -341,9 +341,9 @@ - + - +