mirror of
https://github.com/elisspace/autopsy.git
synced 2026-10-05 08:46:20 +00:00
Merge pull request #5621 from rcordovano/rename-cr-data-model-classes
Rename central repository data model classes
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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<CorrelationAttributeInstance> 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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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<WizardDesc
|
||||
panel.setExaminerName(lastExaminerName);
|
||||
panel.setExaminerPhone(lastExaminerPhone);
|
||||
panel.setExaminerEmail(lastExaminerEmail);
|
||||
panel.setOrganization(EamDb.isEnabled() ? lastOrganizationName : "");
|
||||
panel.setOrganization(CentralRepository.isEnabled() ? lastOrganizationName : "");
|
||||
panel.setCaseNumber(""); //clear the number field
|
||||
panel.setCaseNotes(""); //clear the notes field
|
||||
} catch (Exception e) {
|
||||
|
||||
@@ -23,13 +23,13 @@ import java.util.logging.Level;
|
||||
import javax.swing.JComboBox;
|
||||
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.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.centralrepository.optionspanel.ManageOrganizationsDialog;
|
||||
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||
import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil;
|
||||
import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepository;
|
||||
|
||||
/**
|
||||
* Panel which allows for editing and setting of the case details which are
|
||||
@@ -40,8 +40,8 @@ final class OptionalCasePropertiesPanel extends javax.swing.JPanel {
|
||||
|
||||
private final static Logger logger = Logger.getLogger(OptionalCasePropertiesPanel.class.getName());
|
||||
private static final long serialVersionUID = 1L;
|
||||
private EamOrganization selectedOrg = null;
|
||||
private java.util.List<EamOrganization> orgs = null;
|
||||
private CentralRepoOrganization selectedOrg = null;
|
||||
private java.util.List<CentralRepoOrganization> 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
|
||||
|
||||
+8
-8
@@ -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.",
|
||||
|
||||
+3
-3
@@ -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);
|
||||
|
||||
+33
-33
@@ -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<OtherOccurrenceNodeData> 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<CorrelationAttributeInstance.Type> artifactTypes = EamDb.getInstance().getDefinedCorrelationTypes();
|
||||
List<CorrelationAttributeInstance.Type> 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<CorrelationCase> 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<UniquePathKey, OtherOccurrenceNodeInstanceData> nodeDataMap = new HashMap<>();
|
||||
|
||||
if (EamDb.isEnabled()) {
|
||||
List<CorrelationAttributeInstance> instances = EamDb.getInstance().getArtifactInstancesByTypeValue(corAttr.getCorrelationType(), corAttr.getCorrelationValue());
|
||||
if (CentralRepository.isEnabled()) {
|
||||
List<CorrelationAttributeInstance> 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<AbstractFile> getCaseDbMatches(CorrelationAttributeInstance corAttr, Case openCase) throws NoCurrentCaseException, TskCoreException, EamDbException {
|
||||
private List<AbstractFile> getCaseDbMatches(CorrelationAttributeInstance corAttr, Case openCase) throws NoCurrentCaseException, TskCoreException, CentralRepoException {
|
||||
String md5 = corAttr.getCorrelationValue();
|
||||
SleuthkitCase tsk = openCase.getSleuthkitCase();
|
||||
List<AbstractFile> 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<UniquePathKey, OtherOccurrenceNodeInstanceData> nodeDataMap, AbstractFile newFile) throws TskCoreException, EamDbException {
|
||||
private void addOrUpdateNodeData(final Case autopsyCase, Map<UniquePathKey, OtherOccurrenceNodeInstanceData> 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<OtherOccurrenceNodeData> 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();
|
||||
|
||||
@@ -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
|
||||
|
||||
+9
-9
@@ -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;
|
||||
}
|
||||
|
||||
+2
-2
@@ -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();
|
||||
|
||||
+2
-2
@@ -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();
|
||||
|
||||
+35
-35
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Central Repository
|
||||
*
|
||||
* Copyright 2015-2017 Basis Technology Corp.
|
||||
* Copyright 2015-2020 Basis Technology Corp.
|
||||
* Contact: carrier <at> sleuthkit <dot> 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.RelationalDbCentralRepo.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 = '" + RelationalDbCentralRepo.SCHEMA_MAJOR_VERSION_KEY + "'");
|
||||
statement.execute("UPDATE db_info SET value = '" + SOFTWARE_CR_DB_SCHEMA_VERSION.getMinor() + "' WHERE name = '" + RelationalDbCentralRepo.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) {
|
||||
+6
-6
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Central Repository
|
||||
*
|
||||
* Copyright 2015-2019 Basis Technology Corp.
|
||||
* Copyright 2015-2020 Basis Technology Corp.
|
||||
* Contact: carrier <at> sleuthkit <dot> 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);
|
||||
}
|
||||
}
|
||||
+8
-8
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Central Repository
|
||||
*
|
||||
* Copyright 2015-2017 Basis Technology Corp.
|
||||
* Copyright 2015-2020 Basis Technology Corp.
|
||||
* Contact: carrier <at> sleuthkit <dot> 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());
|
||||
+5
-5
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Central Repository
|
||||
*
|
||||
* Copyright 2015-2017 Basis Technology Corp.
|
||||
* Copyright 2015-2020 Basis Technology Corp.
|
||||
* Contact: carrier <at> sleuthkit <dot> 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,
|
||||
+5
-5
@@ -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;
|
||||
+11
-11
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Central Repository
|
||||
*
|
||||
* Copyright 2015-2017 Basis Technology Corp.
|
||||
* Copyright 2015-2020 Basis Technology Corp.
|
||||
* Contact: carrier <at> sleuthkit <dot> 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;
|
||||
}
|
||||
+121
-121
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Central Repository
|
||||
*
|
||||
* Copyright 2015-2019 Basis Technology Corp.
|
||||
* Copyright 2015-2020 Basis Technology Corp.
|
||||
* Contact: carrier <at> sleuthkit <dot> 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<CorrelationCase> getCases() throws EamDbException;
|
||||
List<CorrelationCase> 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<CorrelationDataSource> getDataSources() throws EamDbException;
|
||||
List<CorrelationDataSource> 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<CorrelationAttributeInstance> getArtifactInstancesByTypeValues(CorrelationAttributeInstance.Type aType, List<String> values) throws EamDbException, CorrelationAttributeNormalizationException;
|
||||
List<CorrelationAttributeInstance> getArtifactInstancesByTypeValues(CorrelationAttributeInstance.Type aType, List<String> 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<CorrelationAttributeInstance> getArtifactInstancesByTypeValue(CorrelationAttributeInstance.Type aType, String value) throws EamDbException, CorrelationAttributeNormalizationException;
|
||||
List<CorrelationAttributeInstance> 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<CorrelationAttributeInstance> getArtifactInstancesByTypeValuesAndCases(CorrelationAttributeInstance.Type aType, List<String> values, List<Integer> caseIds) throws EamDbException, CorrelationAttributeNormalizationException;
|
||||
List<CorrelationAttributeInstance> getArtifactInstancesByTypeValuesAndCases(CorrelationAttributeInstance.Type aType, List<String> values, List<Integer> 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<CorrelationCase> cases) throws EamDbException;
|
||||
void bulkInsertCases(List<CorrelationCase> 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<String> getListCasesHavingArtifactInstancesKnownBad(CorrelationAttributeInstance.Type aType, String value) throws EamDbException, CorrelationAttributeNormalizationException;
|
||||
List<String> 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<String> getListCasesHavingArtifactInstances(CorrelationAttributeInstance.Type aType, String value) throws EamDbException, CorrelationAttributeNormalizationException;
|
||||
List<String> 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<EamOrganization> getOrganizations() throws EamDbException;
|
||||
List<CentralRepoOrganization> 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<EamGlobalSet> getAllReferenceSets(CorrelationAttributeInstance.Type correlationType) throws EamDbException;
|
||||
List<CentralRepoFileSet> 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<EamGlobalFileInstance> globalInstances, CorrelationAttributeInstance.Type contentType) throws EamDbException;
|
||||
void bulkInsertReferenceTypeEntries(Set<CentralRepoFileInstance> 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<EamGlobalFileInstance> getReferenceInstancesByTypeValue(CorrelationAttributeInstance.Type aType, String aValue) throws EamDbException, CorrelationAttributeNormalizationException;
|
||||
List<CentralRepoFileInstance> 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<CorrelationAttributeInstance.Type> getDefinedCorrelationTypes() throws EamDbException;
|
||||
List<CorrelationAttributeInstance.Type> 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<CorrelationAttributeInstance.Type> getEnabledCorrelationTypes() throws EamDbException;
|
||||
List<CorrelationAttributeInstance.Type> 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<CorrelationAttributeInstance.Type> getSupportedCorrelationTypes() throws EamDbException;
|
||||
List<CorrelationAttributeInstance.Type> 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;
|
||||
}
|
||||
+12
-12
@@ -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<CorrelationAttributeInstance.Type> getDefaultCorrelationTypes() throws EamDbException {
|
||||
public static List<CorrelationAttributeInstance.Type> getDefaultCorrelationTypes() throws CentralRepoException {
|
||||
List<CorrelationAttributeInstance.Type> 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;
|
||||
}
|
||||
|
||||
+1
-1
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
+22
-22
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Central Repository
|
||||
*
|
||||
* Copyright 2015-2019 Basis Technology Corp.
|
||||
* Copyright 2015-2020 Basis Technology Corp.
|
||||
* Contact: carrier <at> sleuthkit <dot> 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<CorrelationAttributeInstance> eamArtifacts, BlackboardArtifact artifact, ATTRIBUTE_TYPE bbAttributeType, int typeId) throws EamDbException, TskCoreException {
|
||||
private static void addCorrelationAttributeToList(List<CorrelationAttributeInstance> 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
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
+15
-16
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
+28
-28
@@ -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 RelationalDbCentralRepo {
|
||||
|
||||
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;
|
||||
}
|
||||
+40
-40
@@ -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.RelationalDbCentralRepo.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 = RelationalDbCentralRepo.DEFAULT_BULK_THRESHHOLD;
|
||||
} else {
|
||||
this.bulkThreshold = Integer.parseInt(bulkThresholdString);
|
||||
if (getBulkThreshold() <= 0) {
|
||||
this.bulkThreshold = AbstractSqlEamDb.DEFAULT_BULK_THRESHHOLD;
|
||||
this.bulkThreshold = RelationalDbCentralRepo.DEFAULT_BULK_THRESHHOLD;
|
||||
}
|
||||
}
|
||||
} catch (NumberFormatException ex) {
|
||||
this.bulkThreshold = AbstractSqlEamDb.DEFAULT_BULK_THRESHHOLD;
|
||||
this.bulkThreshold = RelationalDbCentralRepo.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 ('" + RelationalDbCentralRepo.SCHEMA_MAJOR_VERSION_KEY + "', '" + SOFTWARE_CR_DB_SCHEMA_VERSION.getMajor() + "')");
|
||||
stmt.execute("INSERT INTO db_info (name, value) VALUES ('" + RelationalDbCentralRepo.SCHEMA_MINOR_VERSION_KEY + "', '" + SOFTWARE_CR_DB_SCHEMA_VERSION.getMinor() + "')");
|
||||
stmt.execute("INSERT INTO db_info (name, value) VALUES ('" + RelationalDbCentralRepo.CREATION_SCHEMA_MAJOR_VERSION_KEY + "', '" + SOFTWARE_CR_DB_SCHEMA_VERSION.getMajor() + "')");
|
||||
stmt.execute("INSERT INTO db_info (name, value) VALUES ('" + RelationalDbCentralRepo.CREATION_SCHEMA_MINOR_VERSION_KEY + "', '" + SOFTWARE_CR_DB_SCHEMA_VERSION.getMinor() + "')");
|
||||
|
||||
// Create a separate instance and reference table for each correlation type
|
||||
List<CorrelationAttributeInstance.Type> 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;
|
||||
}
|
||||
+486
-486
File diff suppressed because it is too large
Load Diff
+113
-113
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Central Repository
|
||||
*
|
||||
* Copyright 2015-2019 Basis Technology Corp.
|
||||
* Copyright 2015-2020 Basis Technology Corp.
|
||||
* Contact: carrier <at> sleuthkit <dot> 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 RelationalDbCentralRepo {
|
||||
|
||||
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<CorrelationCase> getCases() throws EamDbException {
|
||||
public List<CorrelationCase> 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<CorrelationDataSource> getDataSources() throws EamDbException {
|
||||
public List<CorrelationDataSource> 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<CorrelationAttributeInstance> getArtifactInstancesByTypeValue(CorrelationAttributeInstance.Type aType, String value) throws EamDbException, CorrelationAttributeNormalizationException {
|
||||
public List<CorrelationAttributeInstance> 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<CorrelationAttributeInstance> getArtifactInstancesByTypeValues(CorrelationAttributeInstance.Type aType, List<String> values) throws EamDbException, CorrelationAttributeNormalizationException {
|
||||
public List<CorrelationAttributeInstance> getArtifactInstancesByTypeValues(CorrelationAttributeInstance.Type aType, List<String> values) throws CentralRepoException, CorrelationAttributeNormalizationException {
|
||||
try {
|
||||
acquireSharedLock();
|
||||
return super.getArtifactInstancesByTypeValues(aType, values);
|
||||
@@ -557,7 +557,7 @@ final class SqliteEamDb extends AbstractSqlEamDb {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CorrelationAttributeInstance> getArtifactInstancesByTypeValuesAndCases(CorrelationAttributeInstance.Type aType, List<String> values, List<Integer> caseIds) throws EamDbException, CorrelationAttributeNormalizationException {
|
||||
public List<CorrelationAttributeInstance> getArtifactInstancesByTypeValuesAndCases(CorrelationAttributeInstance.Type aType, List<String> values, List<Integer> 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<CorrelationCase> cases) throws EamDbException {
|
||||
public void bulkInsertCases(List<CorrelationCase> 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<String> getListCasesHavingArtifactInstancesKnownBad(CorrelationAttributeInstance.Type aType, String value) throws EamDbException, CorrelationAttributeNormalizationException {
|
||||
public List<String> 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<EamOrganization> getOrganizations() throws EamDbException {
|
||||
public List<CentralRepoOrganization> 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<EamGlobalSet> getAllReferenceSets(CorrelationAttributeInstance.Type correlationType) throws EamDbException {
|
||||
public List<CentralRepoFileSet> 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<EamGlobalFileInstance> globalInstances, CorrelationAttributeInstance.Type contentType) throws EamDbException {
|
||||
public void bulkInsertReferenceTypeEntries(Set<CentralRepoFileInstance> 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<EamGlobalFileInstance> getReferenceInstancesByTypeValue(CorrelationAttributeInstance.Type aType, String aValue) throws EamDbException, CorrelationAttributeNormalizationException {
|
||||
public List<CentralRepoFileInstance> 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<CorrelationAttributeInstance.Type> getDefinedCorrelationTypes() throws EamDbException {
|
||||
public List<CorrelationAttributeInstance.Type> 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<CorrelationAttributeInstance.Type> getEnabledCorrelationTypes() throws EamDbException {
|
||||
public List<CorrelationAttributeInstance.Type> 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<CorrelationAttributeInstance.Type> getSupportedCorrelationTypes() throws EamDbException {
|
||||
public List<CorrelationAttributeInstance.Type> 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;
|
||||
}
|
||||
+29
-29
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Central Repository
|
||||
*
|
||||
* Copyright 2015-2019 Basis Technology Corp.
|
||||
* Copyright 2015-2020 Basis Technology Corp.
|
||||
* Contact: carrier <at> sleuthkit <dot> 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.RelationalDbCentralRepo.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 = RelationalDbCentralRepo.DEFAULT_BULK_THRESHHOLD;
|
||||
} else {
|
||||
this.bulkThreshold = Integer.parseInt(bulkThresholdString);
|
||||
if (getBulkThreshold() <= 0) {
|
||||
this.bulkThreshold = AbstractSqlEamDb.DEFAULT_BULK_THRESHHOLD;
|
||||
this.bulkThreshold = RelationalDbCentralRepo.DEFAULT_BULK_THRESHHOLD;
|
||||
}
|
||||
}
|
||||
} catch (NumberFormatException ex) {
|
||||
this.bulkThreshold = AbstractSqlEamDb.DEFAULT_BULK_THRESHHOLD;
|
||||
this.bulkThreshold = RelationalDbCentralRepo.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 ('" + RelationalDbCentralRepo.SCHEMA_MAJOR_VERSION_KEY + "', '" + SOFTWARE_CR_DB_SCHEMA_VERSION.getMajor() + "')");
|
||||
stmt.execute("INSERT INTO db_info (name, value) VALUES ('" + RelationalDbCentralRepo.SCHEMA_MINOR_VERSION_KEY + "', '" + SOFTWARE_CR_DB_SCHEMA_VERSION.getMinor() + "')");
|
||||
stmt.execute("INSERT INTO db_info (name, value) VALUES ('" + RelationalDbCentralRepo.CREATION_SCHEMA_MAJOR_VERSION_KEY + "', '" + SOFTWARE_CR_DB_SCHEMA_VERSION.getMajor() + "')");
|
||||
stmt.execute("INSERT INTO db_info (name, value) VALUES ('" + RelationalDbCentralRepo.CREATION_SCHEMA_MINOR_VERSION_KEY + "', '" + SOFTWARE_CR_DB_SCHEMA_VERSION.getMinor() + "')");
|
||||
|
||||
// Create a separate instance and reference table for each artifact type
|
||||
List<CorrelationAttributeInstance.Type> 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
|
||||
}
|
||||
}
|
||||
|
||||
+34
-34
@@ -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<CorrelationAttributeInstance> convertedArtifacts = EamArtifactUtil.makeInstancesFromBlackboardArtifact(bbArtifact, true);
|
||||
List<CorrelationAttributeInstance> 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<CorrelationAttributeInstance> convertedArtifacts = EamArtifactUtil.makeInstancesFromBlackboardArtifact(bbTag.getArtifact(), true);
|
||||
List<CorrelationAttributeInstance> 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);
|
||||
|
||||
+19
-19
@@ -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<CorrelationAttributeInstance> convertedArtifacts = EamArtifactUtil.makeInstancesFromBlackboardArtifact(bbArtifact, true);
|
||||
List<CorrelationAttributeInstance> 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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
+26
-26
@@ -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
|
||||
}
|
||||
|
||||
+10
-10
@@ -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<JTextField> 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;
|
||||
|
||||
+2
-2
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -320,7 +320,7 @@
|
||||
<Component class="javax.swing.JComboBox" name="cbDatabaseType">
|
||||
<Properties>
|
||||
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
|
||||
<Connection code="new javax.swing.DefaultComboBoxModel<>(new EamDbPlatformEnum[]{EamDbPlatformEnum.POSTGRESQL, EamDbPlatformEnum.SQLITE})" type="code"/>
|
||||
<Connection code="new javax.swing.DefaultComboBoxModel<>(new org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoPlatforms[]{org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoPlatforms.POSTGRESQL, org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoPlatforms.SQLITE})" type="code"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[120, 20]"/>
|
||||
@@ -330,7 +330,7 @@
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="cbDatabaseTypeActionPerformed"/>
|
||||
</Events>
|
||||
<AuxValues>
|
||||
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="<EamDbPlatformEnum>"/>
|
||||
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="<org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoPlatforms>"/>
|
||||
</AuxValues>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="lbSingleUserSqLite">
|
||||
@@ -410,4 +410,4 @@
|
||||
</SubComponents>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
</Form>
|
||||
+34
-34
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Central Repository
|
||||
*
|
||||
* Copyright 2015-2018 Basis Technology Corp.
|
||||
* Copyright 2015-2020 Basis Technology Corp.
|
||||
* Contact: carrier <at> sleuthkit <dot> 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<JTextField> 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<EamDbPlatformEnum> cbDatabaseType;
|
||||
private javax.swing.JComboBox<CentralRepoPlatforms> cbDatabaseType;
|
||||
private javax.swing.JScrollPane dataBaseFileScrollPane;
|
||||
private javax.swing.JTextArea dataBaseFileTextArea;
|
||||
private javax.swing.JFileChooser fcDatabasePath;
|
||||
|
||||
+18
-18
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Central Repository
|
||||
*
|
||||
* Copyright 2015-2019 Basis Technology Corp.
|
||||
* Copyright 2015-2020 Basis Technology Corp.
|
||||
* Contact: carrier <at> sleuthkit <dot> 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());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+4
-4
@@ -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<Integer, List<CorrelationDataSource>> 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
|
||||
}
|
||||
|
||||
|
||||
+8
-8
@@ -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());
|
||||
}
|
||||
|
||||
+2
-2
@@ -183,7 +183,7 @@
|
||||
<Property name="selectionMode" type="int" value="0"/>
|
||||
</Properties>
|
||||
<AuxValues>
|
||||
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="<EamOrganization>"/>
|
||||
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="<org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoOrganization>"/>
|
||||
</AuxValues>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
@@ -357,4 +357,4 @@
|
||||
</SubComponents>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
</Form>
|
||||
+26
-26
@@ -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<EamOrganization> rulesListModel = new DefaultListModel<>();
|
||||
private CentralRepository dbManager;
|
||||
private CentralRepoOrganization newOrg;
|
||||
private final DefaultListModel<CentralRepoOrganization> 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<EamOrganization> orgs = dbManager.getOrganizations();
|
||||
List<CentralRepoOrganization> 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 {
|
||||
}// </editor-fold>//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<EamOrganization> organizationList;
|
||||
private javax.swing.JList<CentralRepoOrganization> 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());
|
||||
|
||||
+5
-5
@@ -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
|
||||
|
||||
+5
-5
@@ -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<String> 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<String> mimeTypesToFilterOn = new HashSet<>();
|
||||
if (isFilterByMedia()) {
|
||||
|
||||
+12
-12
@@ -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<String, CommonAttributeValueList> currentCaseDataSourceMap = metadata.get(currentCaseName);
|
||||
Map<String, Map<String, CommonAttributeValueList>> 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<String, CommonAttributeValue> valuesToKeepCurrentCase = getValuesToKeepFromCurrentCase(currentCaseDataSourceMap, attributeType, percentageThreshold, uniqueCaseDataSourceTuples);
|
||||
for (Entry<String, Map<String, CommonAttributeValueList>> 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<String, CommonAttributeValue> getValuesToKeepFromCurrentCase(Map<String, CommonAttributeValueList> dataSourceToValueList, CorrelationAttributeInstance.Type attributeType, int maximumPercentageThreshold, Double uniqueCaseDataSourceTuples) throws EamDbException {
|
||||
private Map<String, CommonAttributeValue> getValuesToKeepFromCurrentCase(Map<String, CommonAttributeValueList> dataSourceToValueList, CorrelationAttributeInstance.Type attributeType, int maximumPercentageThreshold, Double uniqueCaseDataSourceTuples) throws CentralRepoException {
|
||||
Map<String, CommonAttributeValue> valuesToKeep = new HashMap<>();
|
||||
Set<String> valuesToRemove = new HashSet<>();
|
||||
for (Entry<String, CommonAttributeValueList> 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<String, CommonAttributeValueList> createTreeForCase(Map<String, CommonAttributeValue> valuesToKeepCurrentCase, Map<String, CommonAttributeValueList> dataSourceToValueList) throws EamDbException {
|
||||
private Map<String, CommonAttributeValueList> createTreeForCase(Map<String, CommonAttributeValue> valuesToKeepCurrentCase, Map<String, CommonAttributeValueList> dataSourceToValueList) throws CentralRepoException {
|
||||
Map<String, CommonAttributeValueList> treeForCase = new HashMap<>();
|
||||
for (Entry<String, CommonAttributeValueList> 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();
|
||||
|
||||
+7
-7
@@ -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<Integer, List<CommonAttributeValue>> itemsToRemove = new HashMap<>();
|
||||
//Call countUniqueDataSources once to reduce the number of DB queries needed to get
|
||||
|
||||
@@ -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<Integer, String> mapCases(List<CorrelationCase> cases) throws EamDbException {
|
||||
private Map<Integer, String> mapCases(List<CorrelationCase> cases) throws CentralRepoException {
|
||||
Map<Integer, String> 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<Integer, String> doInBackground() throws EamDbException {
|
||||
protected Map<Integer, String> doInBackground() throws CentralRepoException {
|
||||
|
||||
List<CorrelationCase> dataSources = EamDb.getInstance().getCases();
|
||||
List<CorrelationCase> dataSources = CentralRepository.getInstance().getCases();
|
||||
Map<Integer, String> caseMap = mapCases(dataSources);
|
||||
|
||||
return caseMap;
|
||||
@@ -874,14 +874,14 @@ final class CommonAttributePanel extends javax.swing.JDialog implements Observer
|
||||
@Override
|
||||
protected List<String> doInBackground() throws Exception {
|
||||
List<String> 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<DataSource, CorrelatedStatus> 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<CorrelationDataSource> correlatedDataSources = EamDb.getInstance().getDataSources();
|
||||
List<CorrelationDataSource> correlatedDataSources = CentralRepository.getInstance().getDataSources();
|
||||
List<IngestJobInfo> ingestJobs = skCase.getIngestJobs();
|
||||
for (IngestJobInfo jobInfo : ingestJobs) {
|
||||
//get the data source for each ingest job
|
||||
|
||||
+5
-5
@@ -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;
|
||||
}
|
||||
|
||||
+7
-7
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
+23
-23
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Autopsy Forensic Browser
|
||||
*
|
||||
* Copyright 2018-2019 Basis Technology Corp.
|
||||
* Copyright 2018-2020 Basis Technology Corp.
|
||||
* Contact: carrier <at> sleuthkit <dot> 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<String> mimeTypesToFilterOn) throws EamDbException {
|
||||
private String getFileQuery(Set<String> 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<String, Map<String, CommonAttributeValueList>> findInterCaseValuesByCase(Case currentCase, Set<String> 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<Integer, CommonAttributeValueList> findInterCaseValuesByCount(Case currentCase, Set<String> 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<Integer, CommonAttributeValueList> findSingleInterCaseValuesByCount(Case currentCase, Set<String> 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<String, Map<String, CommonAttributeValueList>> findSingleInterCaseValuesByCase(Case currentCase, Set<String> 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<CorrelationAttributeInstance> 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<String> valuesChunk : Iterables.partition(values, VALUE_BATCH_SIZE)) {
|
||||
List<CorrelationAttributeInstance> 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
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -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");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+7
-7
@@ -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();
|
||||
|
||||
+9
-9
@@ -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<CorrelationCase
|
||||
|
||||
@Override
|
||||
protected boolean createKeys(List<CorrelationCase> 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<CorrelationCase
|
||||
uniqueCaseMap.put(correlationCase.getCaseUUID(), correlationCase);
|
||||
});
|
||||
}
|
||||
} catch (EamDbException | CorrelationAttributeNormalizationException ex) {
|
||||
} catch (CentralRepoException | CorrelationAttributeNormalizationException ex) {
|
||||
logger.log(Level.WARNING, String.format("Unable to getArtifactInstance for accountID: %d", account.getAccountID()), ex); //NON-NLS
|
||||
}
|
||||
});
|
||||
@@ -106,9 +106,9 @@ final class CorrelationCaseChildNodeFactory extends ChildFactory<CorrelationCase
|
||||
* @return CorrelationAttributeInstance.Type for given account or null if
|
||||
* there is no match
|
||||
*
|
||||
* @throws EamDbException
|
||||
* @throws CentralRepoException
|
||||
*/
|
||||
private CorrelationAttributeInstance.Type getCorrelationType(Account.Type accountType) throws EamDbException {
|
||||
private CorrelationAttributeInstance.Type getCorrelationType(Account.Type accountType) throws CentralRepoException {
|
||||
if (correlationTypeMap == null) {
|
||||
correlationTypeMap = new HashMap<>();
|
||||
List<CorrelationAttributeInstance.Type> correcationTypeList = CorrelationAttributeInstance.getDefaultCorrelationTypes();
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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<CorrelationAttributeInstance> instancesList = new ArrayList<>();
|
||||
if (artifact != null) {
|
||||
instancesList.addAll(EamArtifactUtil.makeInstancesFromBlackboardArtifact(artifact, false));
|
||||
instancesList.addAll(CorrelationAttributeUtil.makeInstancesFromBlackboardArtifact(artifact, false));
|
||||
}
|
||||
try {
|
||||
List<CorrelationAttributeInstance.Type> artifactTypes = EamDb.getInstance().getDefinedCorrelationTypes();
|
||||
List<CorrelationAttributeInstance.Type> 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<CorrelationAttributeInstance> 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
|
||||
|
||||
@@ -27,11 +27,11 @@ import javax.swing.JSpinner;
|
||||
import org.netbeans.spi.options.OptionsPanelController;
|
||||
import org.sleuthkit.autopsy.casemodule.Case;
|
||||
import org.sleuthkit.autopsy.casemodule.CasePreferences;
|
||||
import org.sleuthkit.autopsy.centralrepository.datamodel.EamDb;
|
||||
import org.sleuthkit.autopsy.core.UserPreferences;
|
||||
import org.sleuthkit.autopsy.coreutils.TimeZoneUtils;
|
||||
import org.sleuthkit.autopsy.directorytree.DirectoryTreeTopComponent;
|
||||
import org.sleuthkit.autopsy.texttranslation.TextTranslationService;
|
||||
import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepository;
|
||||
|
||||
/**
|
||||
* Panel for configuring view preferences.
|
||||
|
||||
@@ -41,9 +41,8 @@ import org.sleuthkit.autopsy.casemodule.events.ContentTagAddedEvent;
|
||||
import org.sleuthkit.autopsy.casemodule.events.ContentTagDeletedEvent;
|
||||
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.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.core.UserPreferences;
|
||||
import org.sleuthkit.autopsy.corecomponents.DataResultViewerTable;
|
||||
import org.sleuthkit.autopsy.corecomponents.DataResultViewerTable.HasCommentStatus;
|
||||
@@ -66,6 +65,7 @@ import org.sleuthkit.datamodel.ContentTag;
|
||||
import org.sleuthkit.datamodel.Tag;
|
||||
import org.sleuthkit.datamodel.TskCoreException;
|
||||
import org.sleuthkit.datamodel.TskData;
|
||||
import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepository;
|
||||
|
||||
/**
|
||||
* An abstract node that encapsulates AbstractFile data
|
||||
@@ -329,7 +329,7 @@ public abstract class AbstractAbstractFileNode<T extends AbstractFile> extends A
|
||||
if (!UserPreferences.getHideSCOColumns()) {
|
||||
properties.add(new NodeProperty<>(SCORE.toString(), SCORE.toString(), VALUE_LOADING, ""));
|
||||
properties.add(new NodeProperty<>(COMMENT.toString(), COMMENT.toString(), VALUE_LOADING, ""));
|
||||
if (EamDb.isEnabled()) {
|
||||
if (CentralRepository.isEnabled()) {
|
||||
properties.add(new NodeProperty<>(OCCURRENCES.toString(), OCCURRENCES.toString(), VALUE_LOADING, ""));
|
||||
}
|
||||
// Get the SCO columns data in a background task
|
||||
@@ -405,12 +405,12 @@ public abstract class AbstractAbstractFileNode<T extends AbstractFile> extends A
|
||||
try {
|
||||
//don't perform the query if there is no correlation value
|
||||
if (attributeType != null && StringUtils.isNotBlank(attributeValue)) {
|
||||
count = EamDb.getInstance().getCountUniqueCaseDataSourceTuplesHavingTypeValue(attributeType, attributeValue);
|
||||
count = CentralRepository.getInstance().getCountUniqueCaseDataSourceTuplesHavingTypeValue(attributeType, attributeValue);
|
||||
description = Bundle.AbstractAbstractFileNode_createSheet_count_description(count);
|
||||
} else if (attributeType != null) {
|
||||
description = Bundle.AbstractAbstractFileNode_createSheet_count_hashLookupNotRun_description();
|
||||
}
|
||||
} catch (EamDbException ex) {
|
||||
} catch (CentralRepoException ex) {
|
||||
logger.log(Level.WARNING, "Error getting count of datasources with correlation attribute", ex);
|
||||
} catch (CorrelationAttributeNormalizationException ex) {
|
||||
logger.log(Level.WARNING, "Unable to normalize data to get count of datasources with correlation attribute", ex);
|
||||
@@ -538,8 +538,8 @@ public abstract class AbstractAbstractFileNode<T extends AbstractFile> extends A
|
||||
@Override
|
||||
protected CorrelationAttributeInstance getCorrelationAttributeInstance() {
|
||||
CorrelationAttributeInstance attribute = null;
|
||||
if (EamDb.isEnabled() && !UserPreferences.getHideSCOColumns()) {
|
||||
attribute = EamArtifactUtil.getInstanceFromContent(content);
|
||||
if (CentralRepository.isEnabled() && !UserPreferences.getHideSCOColumns()) {
|
||||
attribute = CorrelationAttributeUtil.getInstanceFromContent(content);
|
||||
}
|
||||
return attribute;
|
||||
}
|
||||
|
||||
@@ -54,9 +54,8 @@ import org.sleuthkit.autopsy.casemodule.events.ContentTagDeletedEvent;
|
||||
import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttributeInstance;
|
||||
import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttributeInstance.Type;
|
||||
import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttributeNormalizationException;
|
||||
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.core.UserPreferences;
|
||||
import org.sleuthkit.autopsy.corecomponents.DataResultViewerTable;
|
||||
import org.sleuthkit.autopsy.corecomponents.DataResultViewerTable.Score;
|
||||
@@ -77,6 +76,7 @@ import org.sleuthkit.datamodel.Content;
|
||||
import org.sleuthkit.datamodel.Tag;
|
||||
import org.sleuthkit.datamodel.TskCoreException;
|
||||
import org.sleuthkit.datamodel.TskData;
|
||||
import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepository;
|
||||
|
||||
/**
|
||||
* Node wrapping a blackboard artifact object. This is generated from several
|
||||
@@ -370,7 +370,7 @@ public class BlackboardArtifactNode extends AbstractContentNode<BlackboardArtifa
|
||||
if (!UserPreferences.getHideSCOColumns()) {
|
||||
sheetSet.put(new NodeProperty<>(Bundle.BlackboardArtifactNode_createSheet_score_name(), Bundle.BlackboardArtifactNode_createSheet_score_displayName(), VALUE_LOADING, ""));
|
||||
sheetSet.put(new NodeProperty<>(Bundle.BlackboardArtifactNode_createSheet_comment_name(), Bundle.BlackboardArtifactNode_createSheet_comment_displayName(), VALUE_LOADING, ""));
|
||||
if (EamDb.isEnabled()) {
|
||||
if (CentralRepository.isEnabled()) {
|
||||
sheetSet.put(new NodeProperty<>(Bundle.BlackboardArtifactNode_createSheet_count_name(), Bundle.BlackboardArtifactNode_createSheet_count_displayName(), VALUE_LOADING, ""));
|
||||
}
|
||||
// Get the SCO columns data in a background task
|
||||
@@ -595,8 +595,8 @@ public class BlackboardArtifactNode extends AbstractContentNode<BlackboardArtifa
|
||||
@Override
|
||||
protected final CorrelationAttributeInstance getCorrelationAttributeInstance() {
|
||||
CorrelationAttributeInstance correlationAttribute = null;
|
||||
if (EamDb.isEnabled()) {
|
||||
correlationAttribute = EamArtifactUtil.getInstanceFromContent(associated);
|
||||
if (CentralRepository.isEnabled()) {
|
||||
correlationAttribute = CorrelationAttributeUtil.getInstanceFromContent(associated);
|
||||
}
|
||||
return correlationAttribute;
|
||||
}
|
||||
@@ -779,12 +779,12 @@ public class BlackboardArtifactNode extends AbstractContentNode<BlackboardArtifa
|
||||
try {
|
||||
//don't perform the query if there is no correlation value
|
||||
if (attributeType != null && StringUtils.isNotBlank(attributeValue)) {
|
||||
count = EamDb.getInstance().getCountUniqueCaseDataSourceTuplesHavingTypeValue(attributeType, attributeValue);
|
||||
count = CentralRepository.getInstance().getCountUniqueCaseDataSourceTuplesHavingTypeValue(attributeType, attributeValue);
|
||||
description = Bundle.BlackboardArtifactNode_createSheet_count_description(count, attributeType.getDisplayName());
|
||||
} else if (attributeType != null) {
|
||||
description = Bundle.BlackboardArtifactNode_createSheet_count_noCorrelationValues_description();
|
||||
}
|
||||
} catch (EamDbException ex) {
|
||||
} catch (CentralRepoException ex) {
|
||||
logger.log(Level.WARNING, "Error getting count of datasources with correlation attribute", ex);
|
||||
} catch (CorrelationAttributeNormalizationException ex) {
|
||||
logger.log(Level.WARNING, "Unable to normalize data to get count of datasources with correlation attribute", ex);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Autopsy Forensic Browser
|
||||
*
|
||||
* Copyright 2019 Basis Technology Corp.
|
||||
* Copyright 2019-2020 Basis Technology Corp.
|
||||
* Contact: carrier <at> sleuthkit <dot> org
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -26,9 +26,8 @@ import java.util.logging.Level;
|
||||
import org.openide.util.NbBundle.Messages;
|
||||
import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttributeInstance;
|
||||
import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttributeInstance.Type;
|
||||
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.core.UserPreferences;
|
||||
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||
import org.sleuthkit.autopsy.events.AutopsyEvent;
|
||||
@@ -36,6 +35,7 @@ import org.sleuthkit.datamodel.AbstractFile;
|
||||
import org.sleuthkit.datamodel.BlackboardArtifact;
|
||||
import org.sleuthkit.datamodel.Tag;
|
||||
import org.sleuthkit.datamodel.TskCoreException;
|
||||
import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepository;
|
||||
|
||||
/**
|
||||
* Background task to get Score, Comment and Occurrences values for an Abstract
|
||||
@@ -73,7 +73,7 @@ class GetSCOTask implements Runnable {
|
||||
CorrelationAttributeInstance fileAttribute = contentNode.getCorrelationAttributeInstance();
|
||||
scoData.setComment(contentNode.getCommentProperty(tags, fileAttribute));
|
||||
|
||||
if (EamDb.isEnabled()) {
|
||||
if (CentralRepository.isEnabled()) {
|
||||
Type type = null;
|
||||
String value = null;
|
||||
String description = Bundle.GetSCOTask_occurrences_defaultDescription();
|
||||
@@ -93,11 +93,11 @@ class GetSCOTask implements Runnable {
|
||||
type = CorrelationAttributeInstance.getDefaultCorrelationTypes().get(CorrelationAttributeInstance.FILES_TYPE_ID);
|
||||
value = ((AbstractFile) bbArtifact.getParent()).getMd5Hash();
|
||||
}
|
||||
} catch (TskCoreException | EamDbException ex) {
|
||||
} catch (TskCoreException | CentralRepoException ex) {
|
||||
logger.log(Level.WARNING, "Unable to get correlation type or value to determine value for O column for artifact", ex);
|
||||
}
|
||||
} else {
|
||||
List<CorrelationAttributeInstance> listOfPossibleAttributes = EamArtifactUtil.makeInstancesFromBlackboardArtifact(bbArtifact, false);
|
||||
List<CorrelationAttributeInstance> listOfPossibleAttributes = CorrelationAttributeUtil.makeInstancesFromBlackboardArtifact(bbArtifact, false);
|
||||
if (listOfPossibleAttributes.size() > 1) {
|
||||
//Don't display anything if there is more than 1 correlation property for an artifact but let the user know
|
||||
description = Bundle.GetSCOTask_occurrences_multipleProperties();
|
||||
@@ -112,7 +112,7 @@ class GetSCOTask implements Runnable {
|
||||
try {
|
||||
type = CorrelationAttributeInstance.getDefaultCorrelationTypes().get(CorrelationAttributeInstance.FILES_TYPE_ID);
|
||||
value = ((AbstractFile) contentNode.getContent()).getMd5Hash();
|
||||
} catch (EamDbException ex) {
|
||||
} catch (CentralRepoException ex) {
|
||||
logger.log(Level.WARNING, "Unable to get correlation type to determine value for O column for file", ex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,9 +50,8 @@ import org.openide.util.NbBundle;
|
||||
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.EamDb;
|
||||
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.centralrepository.datamodel.InstanceTableCallback;
|
||||
import org.sleuthkit.autopsy.corelibs.ScalrWrapper;
|
||||
import org.sleuthkit.autopsy.coreutils.ImageUtils;
|
||||
@@ -71,6 +70,7 @@ import org.sleuthkit.datamodel.ContentTag;
|
||||
import org.sleuthkit.datamodel.SleuthkitCase;
|
||||
import org.sleuthkit.datamodel.TskCoreException;
|
||||
import org.sleuthkit.datamodel.TskData;
|
||||
import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepository;
|
||||
|
||||
/**
|
||||
* Main class to perform the file search.
|
||||
@@ -108,7 +108,7 @@ class FileSearch {
|
||||
AttributeType groupAttributeType,
|
||||
FileGroup.GroupSortingAlgorithm groupSortingType,
|
||||
FileSorter.SortingMethod fileSortingMethod,
|
||||
SleuthkitCase caseDb, EamDb centralRepoDb) throws FileSearchException {
|
||||
SleuthkitCase caseDb, CentralRepository centralRepoDb) throws FileSearchException {
|
||||
// Make a list of attributes that we want to add values for. This ensures the
|
||||
// ResultFile objects will have all needed fields set when it's time to group
|
||||
// and sort them. For example, if we're grouping by central repo frequency, we need
|
||||
@@ -160,7 +160,7 @@ class FileSearch {
|
||||
AttributeType groupAttributeType,
|
||||
FileGroup.GroupSortingAlgorithm groupSortingType,
|
||||
FileSorter.SortingMethod fileSortingMethod,
|
||||
SleuthkitCase caseDb, EamDb centralRepoDb) throws FileSearchException {
|
||||
SleuthkitCase caseDb, CentralRepository centralRepoDb) throws FileSearchException {
|
||||
Map<GroupKey, List<ResultFile>> searchResults = runFileSearch(userName, filters,
|
||||
groupAttributeType, groupSortingType, fileSortingMethod, caseDb, centralRepoDb);
|
||||
LinkedHashMap<GroupKey, Integer> groupSizes = new LinkedHashMap<>();
|
||||
@@ -200,7 +200,7 @@ class FileSearch {
|
||||
GroupKey groupKey,
|
||||
int startingEntry,
|
||||
int numberOfEntries,
|
||||
SleuthkitCase caseDb, EamDb centralRepoDb) throws FileSearchException {
|
||||
SleuthkitCase caseDb, CentralRepository centralRepoDb) throws FileSearchException {
|
||||
//the group should be in the cache at this point
|
||||
List<ResultFile> filesInGroup = null;
|
||||
SearchKey searchKey = new SearchKey(userName, filters, groupAttributeType, groupSortingType, fileSortingMethod);
|
||||
@@ -261,7 +261,7 @@ class FileSearch {
|
||||
AttributeType groupAttributeType,
|
||||
FileGroup.GroupSortingAlgorithm groupSortingType,
|
||||
FileSorter.SortingMethod fileSortingMethod,
|
||||
SleuthkitCase caseDb, EamDb centralRepoDb) throws FileSearchException {
|
||||
SleuthkitCase caseDb, CentralRepository centralRepoDb) throws FileSearchException {
|
||||
|
||||
// Make a list of attributes that we want to add values for. This ensures the
|
||||
// ResultFile objects will have all needed fields set when it's time to group
|
||||
@@ -302,7 +302,7 @@ class FileSearch {
|
||||
*
|
||||
* @throws FileSearchException
|
||||
*/
|
||||
private static void addAttributes(List<AttributeType> attrs, List<ResultFile> resultFiles, SleuthkitCase caseDb, EamDb centralRepoDb)
|
||||
private static void addAttributes(List<AttributeType> attrs, List<ResultFile> resultFiles, SleuthkitCase caseDb, CentralRepository centralRepoDb)
|
||||
throws FileSearchException {
|
||||
for (AttributeType attr : attrs) {
|
||||
attr.addAttributeToResultFiles(resultFiles, caseDb, centralRepoDb);
|
||||
@@ -316,7 +316,7 @@ class FileSearch {
|
||||
* @param hashesToLookUp Hashes to find the frequency of
|
||||
* @param currentFiles List of files to update with frequencies
|
||||
*/
|
||||
private static void computeFrequency(Set<String> hashesToLookUp, List<ResultFile> currentFiles, EamDb centralRepoDb) {
|
||||
private static void computeFrequency(Set<String> hashesToLookUp, List<ResultFile> currentFiles, CentralRepository centralRepoDb) {
|
||||
|
||||
if (hashesToLookUp.isEmpty()) {
|
||||
return;
|
||||
@@ -326,7 +326,7 @@ class FileSearch {
|
||||
hashes = "'" + hashes + "'";
|
||||
try {
|
||||
CorrelationAttributeInstance.Type attributeType = centralRepoDb.getCorrelationTypeById(CorrelationAttributeInstance.FILES_TYPE_ID);
|
||||
String tableName = EamDbUtil.correlationTypeToInstanceTableName(attributeType);
|
||||
String tableName = CentralRepoDbUtil.correlationTypeToInstanceTableName(attributeType);
|
||||
|
||||
String selectClause = " value, COUNT(value) FROM "
|
||||
+ "(SELECT DISTINCT case_id, value FROM " + tableName
|
||||
@@ -337,7 +337,7 @@ class FileSearch {
|
||||
FrequencyCallback callback = new FrequencyCallback(currentFiles);
|
||||
centralRepoDb.processSelectClause(selectClause, callback);
|
||||
|
||||
} catch (EamDbException ex) {
|
||||
} catch (CentralRepoException ex) {
|
||||
logger.log(Level.WARNING, "Error getting frequency counts from Central Repository", ex); // NON-NLS
|
||||
}
|
||||
|
||||
@@ -646,7 +646,7 @@ class FileSearch {
|
||||
*
|
||||
* @throws FileSearchException
|
||||
*/
|
||||
void addAttributeToResultFiles(List<ResultFile> files, SleuthkitCase caseDb, EamDb centralRepoDb) throws FileSearchException {
|
||||
void addAttributeToResultFiles(List<ResultFile> files, SleuthkitCase caseDb, CentralRepository centralRepoDb) throws FileSearchException {
|
||||
// Default is to do nothing
|
||||
}
|
||||
}
|
||||
@@ -1044,7 +1044,7 @@ class FileSearch {
|
||||
|
||||
@Override
|
||||
void addAttributeToResultFiles(List<ResultFile> files, SleuthkitCase caseDb,
|
||||
EamDb centralRepoDb) throws FileSearchException {
|
||||
CentralRepository centralRepoDb) throws FileSearchException {
|
||||
|
||||
// Get pairs of (object ID, keyword list name) for all files in the list of files that have
|
||||
// keyword list hits.
|
||||
@@ -1199,7 +1199,7 @@ class FileSearch {
|
||||
|
||||
@Override
|
||||
void addAttributeToResultFiles(List<ResultFile> files, SleuthkitCase caseDb,
|
||||
EamDb centralRepoDb) throws FileSearchException {
|
||||
CentralRepository centralRepoDb) throws FileSearchException {
|
||||
if (centralRepoDb == null) {
|
||||
for (ResultFile file : files) {
|
||||
if (file.getFrequency() == Frequency.UNKNOWN && file.getFirstInstance().getKnown() == TskData.FileKnown.KNOWN) {
|
||||
@@ -1220,7 +1220,7 @@ class FileSearch {
|
||||
* @param centralRepoDb The central repository currently in use.
|
||||
*/
|
||||
private void processResultFilesForCR(List<ResultFile> files,
|
||||
EamDb centralRepoDb) {
|
||||
CentralRepository centralRepoDb) {
|
||||
List<ResultFile> currentFiles = new ArrayList<>();
|
||||
Set<String> hashesToLookUp = new HashSet<>();
|
||||
for (ResultFile file : files) {
|
||||
@@ -1347,7 +1347,7 @@ class FileSearch {
|
||||
|
||||
@Override
|
||||
void addAttributeToResultFiles(List<ResultFile> files, SleuthkitCase caseDb,
|
||||
EamDb centralRepoDb) throws FileSearchException {
|
||||
CentralRepository centralRepoDb) throws FileSearchException {
|
||||
|
||||
// Get pairs of (object ID, hash set name) for all files in the list of files that have
|
||||
// hash set hits.
|
||||
@@ -1499,7 +1499,7 @@ class FileSearch {
|
||||
|
||||
@Override
|
||||
void addAttributeToResultFiles(List<ResultFile> files, SleuthkitCase caseDb,
|
||||
EamDb centralRepoDb) throws FileSearchException {
|
||||
CentralRepository centralRepoDb) throws FileSearchException {
|
||||
|
||||
// Get pairs of (object ID, interesting item set name) for all files in the list of files that have
|
||||
// interesting file set hits.
|
||||
@@ -1653,7 +1653,7 @@ class FileSearch {
|
||||
|
||||
@Override
|
||||
void addAttributeToResultFiles(List<ResultFile> files, SleuthkitCase caseDb,
|
||||
EamDb centralRepoDb) throws FileSearchException {
|
||||
CentralRepository centralRepoDb) throws FileSearchException {
|
||||
|
||||
// Get pairs of (object ID, object type name) for all files in the list of files that have
|
||||
// objects detected
|
||||
@@ -1806,7 +1806,7 @@ class FileSearch {
|
||||
|
||||
@Override
|
||||
void addAttributeToResultFiles(List<ResultFile> files, SleuthkitCase caseDb,
|
||||
EamDb centralRepoDb) throws FileSearchException {
|
||||
CentralRepository centralRepoDb) throws FileSearchException {
|
||||
|
||||
try {
|
||||
for (ResultFile resultFile : files) {
|
||||
|
||||
@@ -20,8 +20,7 @@ package org.sleuthkit.autopsy.filequery;
|
||||
|
||||
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.filequery.FileSearchData.FileSize;
|
||||
import org.sleuthkit.autopsy.filequery.FileSearchData.FileType;
|
||||
import org.sleuthkit.autopsy.filequery.FileSearchData.Frequency;
|
||||
@@ -38,6 +37,7 @@ import org.openide.util.NbBundle;
|
||||
import org.sleuthkit.datamodel.BlackboardArtifact;
|
||||
import org.sleuthkit.datamodel.BlackboardAttribute;
|
||||
import org.sleuthkit.datamodel.TskData;
|
||||
import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepository;
|
||||
|
||||
/**
|
||||
* Run various filters to return a subset of files from the current case.
|
||||
@@ -54,7 +54,7 @@ class FileSearchFiltering {
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
static List<ResultFile> runQueries(List<FileFilter> filters, SleuthkitCase caseDb, EamDb centralRepoDb) throws FileSearchException {
|
||||
static List<ResultFile> runQueries(List<FileFilter> filters, SleuthkitCase caseDb, CentralRepository centralRepoDb) throws FileSearchException {
|
||||
if (caseDb == null) {
|
||||
throw new FileSearchException("Case DB parameter is null"); // NON-NLS
|
||||
}
|
||||
@@ -94,7 +94,7 @@ class FileSearchFiltering {
|
||||
* @throws TskCoreException
|
||||
* @throws FileSearchException
|
||||
*/
|
||||
private static List<ResultFile> getResultList(List<FileFilter> filters, String combinedQuery, SleuthkitCase caseDb, EamDb centralRepoDb) throws TskCoreException, FileSearchException {
|
||||
private static List<ResultFile> getResultList(List<FileFilter> filters, String combinedQuery, SleuthkitCase caseDb, CentralRepository centralRepoDb) throws TskCoreException, FileSearchException {
|
||||
// Get all matching abstract files
|
||||
List<ResultFile> resultList = new ArrayList<>();
|
||||
List<AbstractFile> sqlResults = caseDb.findAllFilesWhere(combinedQuery);
|
||||
@@ -161,7 +161,7 @@ class FileSearchFiltering {
|
||||
* @throws FileSearchException
|
||||
*/
|
||||
List<ResultFile> applyAlternateFilter(List<ResultFile> currentResults, SleuthkitCase caseDb,
|
||||
EamDb centralRepoDb) throws FileSearchException {
|
||||
CentralRepository centralRepoDb) throws FileSearchException {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
@@ -562,7 +562,7 @@ class FileSearchFiltering {
|
||||
|
||||
@Override
|
||||
List<ResultFile> applyAlternateFilter(List<ResultFile> currentResults, SleuthkitCase caseDb,
|
||||
EamDb centralRepoDb) throws FileSearchException {
|
||||
CentralRepository centralRepoDb) throws FileSearchException {
|
||||
|
||||
// We have to have run some kind of SQL filter before getting to this point,
|
||||
// and should have checked afterward to see if the results were empty.
|
||||
@@ -895,7 +895,7 @@ class FileSearchFiltering {
|
||||
|
||||
@Override
|
||||
List<ResultFile> applyAlternateFilter(List<ResultFile> currentResults, SleuthkitCase caseDb,
|
||||
EamDb centralRepoDb) throws FileSearchException {
|
||||
CentralRepository centralRepoDb) throws FileSearchException {
|
||||
|
||||
if (centralRepoDb == null) {
|
||||
throw new FileSearchException("Can not run Previously Notable filter with null Central Repository DB"); // NON-NLS
|
||||
@@ -924,7 +924,7 @@ class FileSearchFiltering {
|
||||
}
|
||||
}
|
||||
return notableResults;
|
||||
} catch (EamDbException | CorrelationAttributeNormalizationException ex) {
|
||||
} catch (CentralRepoException | CorrelationAttributeNormalizationException ex) {
|
||||
throw new FileSearchException("Error querying central repository", ex); // NON-NLS
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,8 +36,7 @@ import javax.swing.event.ListSelectionEvent;
|
||||
import javax.swing.event.ListSelectionListener;
|
||||
import org.openide.util.NbBundle;
|
||||
import org.sleuthkit.autopsy.casemodule.Case;
|
||||
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.filequery.FileGroup.GroupSortingAlgorithm;
|
||||
import org.sleuthkit.autopsy.filequery.FileSearch.GroupingAttributeType;
|
||||
@@ -52,6 +51,7 @@ import org.sleuthkit.datamodel.BlackboardAttribute;
|
||||
import org.sleuthkit.datamodel.TskCoreException;
|
||||
import org.sleuthkit.datamodel.DataSource;
|
||||
import org.sleuthkit.datamodel.TagName;
|
||||
import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepository;
|
||||
|
||||
/**
|
||||
* Dialog to allow the user to choose filtering and grouping options.
|
||||
@@ -461,7 +461,7 @@ final class FileSearchPanel extends javax.swing.JPanel implements ActionListener
|
||||
int[] selectedSizeIndices = {1, 2, 3, 4, 5};
|
||||
sizeFilterSettings(true, enabled, resetSelected || sizeCheckbox.isSelected(), resetSelected == true ? selectedSizeIndices : null);
|
||||
int[] selectedFrequencyIndices;
|
||||
if (!EamDb.isEnabled()) {
|
||||
if (!CentralRepository.isEnabled()) {
|
||||
selectedFrequencyIndices = new int[]{0};
|
||||
} else {
|
||||
selectedFrequencyIndices = new int[]{1, 2, 3, 4, 5, 6, 7};
|
||||
@@ -493,7 +493,7 @@ final class FileSearchPanel extends javax.swing.JPanel implements ActionListener
|
||||
dataSourceFilterSettings(true, enabled, !resetSelected && dataSourceCheckbox.isSelected(), null);
|
||||
sizeFilterSettings(true, enabled, !resetSelected && sizeCheckbox.isSelected(), null);
|
||||
int[] selectedFrequencyIndices;
|
||||
if (!EamDb.isEnabled()) {
|
||||
if (!CentralRepository.isEnabled()) {
|
||||
selectedFrequencyIndices = new int[]{0};
|
||||
} else {
|
||||
selectedFrequencyIndices = new int[]{1, 2, 3, 4, 5, 6, 7};
|
||||
@@ -553,7 +553,7 @@ final class FileSearchPanel extends javax.swing.JPanel implements ActionListener
|
||||
groupByCombobox.removeAllItems();
|
||||
// Set up the grouping attributes
|
||||
for (FileSearch.GroupingAttributeType type : FileSearch.GroupingAttributeType.getOptionsForGrouping()) {
|
||||
if ((type != GroupingAttributeType.FREQUENCY || EamDb.isEnabled())
|
||||
if ((type != GroupingAttributeType.FREQUENCY || CentralRepository.isEnabled())
|
||||
&& (type != GroupingAttributeType.OBJECT_DETECTED || objectsList.getModel().getSize() > 0)
|
||||
&& (type != GroupingAttributeType.INTERESTING_ITEM_SET || interestingItemsList.getModel().getSize() > 0)
|
||||
&& (type != GroupingAttributeType.HASH_LIST_NAME || hashSetList.getModel().getSize() > 0)) {
|
||||
@@ -564,7 +564,7 @@ final class FileSearchPanel extends javax.swing.JPanel implements ActionListener
|
||||
orderByCombobox.removeAllItems();
|
||||
// Set up the file order list
|
||||
for (FileSorter.SortingMethod method : FileSorter.SortingMethod.getOptionsForOrdering()) {
|
||||
if (method != SortingMethod.BY_FREQUENCY || EamDb.isEnabled()) {
|
||||
if (method != SortingMethod.BY_FREQUENCY || CentralRepository.isEnabled()) {
|
||||
orderByCombobox.addItem(method);
|
||||
}
|
||||
}
|
||||
@@ -623,7 +623,7 @@ final class FileSearchPanel extends javax.swing.JPanel implements ActionListener
|
||||
int count = 0;
|
||||
DefaultListModel<FileSearchData.Frequency> frequencyListModel = (DefaultListModel<FileSearchData.Frequency>) crFrequencyList.getModel();
|
||||
frequencyListModel.removeAllElements();
|
||||
if (!EamDb.isEnabled()) {
|
||||
if (!CentralRepository.isEnabled()) {
|
||||
for (FileSearchData.Frequency freq : FileSearchData.Frequency.getOptionsForFilteringWithoutCr()) {
|
||||
frequencyListModel.add(count, freq);
|
||||
}
|
||||
@@ -1739,11 +1739,11 @@ final class FileSearchPanel extends javax.swing.JPanel implements ActionListener
|
||||
|
||||
// Get the file sorting method
|
||||
FileSorter.SortingMethod fileSort = getFileSortingMethod();
|
||||
EamDb centralRepoDb = null;
|
||||
if (EamDb.isEnabled()) {
|
||||
CentralRepository centralRepoDb = null;
|
||||
if (CentralRepository.isEnabled()) {
|
||||
try {
|
||||
centralRepoDb = EamDb.getInstance();
|
||||
} catch (EamDbException ex) {
|
||||
centralRepoDb = CentralRepository.getInstance();
|
||||
} catch (CentralRepoException ex) {
|
||||
centralRepoDb = null;
|
||||
logger.log(Level.SEVERE, "Error loading central repository database, no central repository options will be available for File Discovery", ex);
|
||||
}
|
||||
|
||||
@@ -23,9 +23,9 @@ import java.util.ArrayList;
|
||||
import java.util.logging.Level;
|
||||
import javax.swing.SwingWorker;
|
||||
import org.sleuthkit.autopsy.casemodule.Case;
|
||||
import org.sleuthkit.autopsy.centralrepository.datamodel.EamDb;
|
||||
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||
import org.sleuthkit.autopsy.filequery.FileSearch.GroupKey;
|
||||
import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepository;
|
||||
|
||||
/**
|
||||
* SwingWorker to retrieve the contents of a page.
|
||||
@@ -42,7 +42,7 @@ final class PageWorker extends SwingWorker<Void, Void> {
|
||||
private final int startingEntry;
|
||||
private final int pageSize;
|
||||
private final FileSearchData.FileType resultType;
|
||||
private final EamDb centralRepo;
|
||||
private final CentralRepository centralRepo;
|
||||
private final List<ResultFile> results = new ArrayList<>();
|
||||
|
||||
/**
|
||||
@@ -63,7 +63,7 @@ final class PageWorker extends SwingWorker<Void, Void> {
|
||||
*/
|
||||
PageWorker(List<FileSearchFiltering.FileFilter> searchfilters, FileSearch.AttributeType groupingAttribute,
|
||||
FileGroup.GroupSortingAlgorithm groupSort, FileSorter.SortingMethod fileSortMethod, GroupKey groupKey,
|
||||
int startingEntry, int pageSize, FileSearchData.FileType resultType, EamDb centralRepo) {
|
||||
int startingEntry, int pageSize, FileSearchData.FileType resultType, CentralRepository centralRepo) {
|
||||
this.searchfilters = searchfilters;
|
||||
this.groupingAttribute = groupingAttribute;
|
||||
this.groupSort = groupSort;
|
||||
|
||||
@@ -41,8 +41,7 @@ import javax.swing.event.ListSelectionListener;
|
||||
import org.openide.util.NbBundle.Messages;
|
||||
import org.sleuthkit.autopsy.actions.AddContentTagAction;
|
||||
import org.sleuthkit.autopsy.actions.DeleteFileContentTagAction;
|
||||
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.ImageUtils;
|
||||
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||
import org.sleuthkit.autopsy.datamodel.FileNode;
|
||||
@@ -53,6 +52,7 @@ import org.sleuthkit.autopsy.filequery.FileSearch.GroupKey;
|
||||
import org.sleuthkit.autopsy.modules.hashdatabase.AddContentToHashDbAction;
|
||||
import org.sleuthkit.datamodel.AbstractFile;
|
||||
import org.sleuthkit.datamodel.TskCoreException;
|
||||
import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepository;
|
||||
|
||||
/**
|
||||
* Panel for displaying of file discovery results and handling the paging of
|
||||
@@ -320,11 +320,11 @@ public class ResultsPanel extends javax.swing.JPanel {
|
||||
if (pageWorker != null && !pageWorker.isDone()) {
|
||||
pageWorker.cancel(true);
|
||||
}
|
||||
EamDb centralRepo = null;
|
||||
if (EamDb.isEnabled()) {
|
||||
CentralRepository centralRepo = null;
|
||||
if (CentralRepository.isEnabled()) {
|
||||
try {
|
||||
centralRepo = EamDb.getInstance();
|
||||
} catch (EamDbException ex) {
|
||||
centralRepo = CentralRepository.getInstance();
|
||||
} catch (CentralRepoException ex) {
|
||||
centralRepo = null;
|
||||
logger.log(Level.SEVERE, "Error loading central repository database, no central repository options will be available for File Discovery", ex);
|
||||
}
|
||||
|
||||
@@ -24,9 +24,9 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Level;
|
||||
import org.sleuthkit.autopsy.casemodule.Case;
|
||||
import org.sleuthkit.autopsy.centralrepository.datamodel.EamDb;
|
||||
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||
import org.sleuthkit.autopsy.filequery.FileSearch.GroupKey;
|
||||
import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepository;
|
||||
|
||||
/**
|
||||
* SwingWorker to perform search on a background thread
|
||||
@@ -39,7 +39,7 @@ final class SearchWorker extends SwingWorker<Void, Void> {
|
||||
private final FileSearch.AttributeType groupingAttr;
|
||||
private final FileSorter.SortingMethod fileSort;
|
||||
private final FileGroup.GroupSortingAlgorithm groupSortAlgorithm;
|
||||
private final EamDb centralRepoDb;
|
||||
private final CentralRepository centralRepoDb;
|
||||
private final Map<GroupKey, Integer> results = new LinkedHashMap<>();
|
||||
|
||||
/**
|
||||
@@ -51,7 +51,7 @@ final class SearchWorker extends SwingWorker<Void, Void> {
|
||||
* @param groupSort the Algorithm to sort groups by
|
||||
* @param fileSortMethod the SortingMethod to use for files
|
||||
*/
|
||||
SearchWorker(EamDb centralRepo, List<FileSearchFiltering.FileFilter> searchfilters, FileSearch.AttributeType groupingAttribute, FileGroup.GroupSortingAlgorithm groupSort, FileSorter.SortingMethod fileSortMethod) {
|
||||
SearchWorker(CentralRepository centralRepo, List<FileSearchFiltering.FileFilter> searchfilters, FileSearch.AttributeType groupingAttribute, FileGroup.GroupSortingAlgorithm groupSort, FileSorter.SortingMethod fileSortMethod) {
|
||||
centralRepoDb = centralRepo;
|
||||
filters = searchfilters;
|
||||
groupingAttr = groupingAttribute;
|
||||
|
||||
+17
-17
@@ -30,11 +30,10 @@ import org.apache.commons.io.FilenameUtils;
|
||||
import org.openide.util.NbBundle;
|
||||
import org.openide.windows.WindowManager;
|
||||
import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttributeInstance;
|
||||
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.EamGlobalSet;
|
||||
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.centralrepository.datamodel.CentralRepoFileSet;
|
||||
import org.sleuthkit.autopsy.centralrepository.optionspanel.ManageOrganizationsDialog;
|
||||
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||
import org.sleuthkit.autopsy.coreutils.ModuleSettings;
|
||||
@@ -44,6 +43,7 @@ import org.sleuthkit.autopsy.modules.hashdatabase.HashDbManager.HashDb.KnownFile
|
||||
import org.sleuthkit.autopsy.modules.hashdatabase.HashDbManager.HashDbManagerException;
|
||||
import org.sleuthkit.datamodel.TskData;
|
||||
import org.sleuthkit.datamodel.TskCoreException;
|
||||
import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepository;
|
||||
|
||||
/**
|
||||
* Instances of this class allow a user to create a new hash database and add it
|
||||
@@ -58,8 +58,8 @@ final class HashDbCreateDatabaseDialog extends javax.swing.JDialog {
|
||||
private JFileChooser fileChooser = null;
|
||||
private HashDb newHashDb = null;
|
||||
private final static String LAST_FILE_PATH_KEY = "HashDbCreate_Path";
|
||||
private EamOrganization selectedOrg = null;
|
||||
private List<EamOrganization> orgs = null;
|
||||
private CentralRepoOrganization selectedOrg = null;
|
||||
private List<CentralRepoOrganization> orgs = null;
|
||||
static final String HASH_DATABASE_DIR_NAME = "HashDatabases";
|
||||
|
||||
/**
|
||||
@@ -127,7 +127,7 @@ final class HashDbCreateDatabaseDialog extends javax.swing.JDialog {
|
||||
|
||||
private void enableComponents(){
|
||||
|
||||
if(! EamDb.isEnabled()){
|
||||
if(! CentralRepository.isEnabled()){
|
||||
centralRepoRadioButton.setEnabled(false);
|
||||
fileTypeRadioButton.setSelected(true);
|
||||
} else {
|
||||
@@ -151,11 +151,11 @@ final class HashDbCreateDatabaseDialog extends javax.swing.JDialog {
|
||||
private void populateCombobox() {
|
||||
orgComboBox.removeAllItems();
|
||||
try {
|
||||
EamDb dbManager = EamDb.getInstance();
|
||||
CentralRepository dbManager = CentralRepository.getInstance();
|
||||
orgs = dbManager.getOrganizations();
|
||||
orgs.forEach((org) -> {
|
||||
orgComboBox.addItem(org.getName());
|
||||
if(EamDbUtil.isDefaultOrg(org)){
|
||||
if(CentralRepoDbUtil.isDefaultOrg(org)){
|
||||
orgComboBox.setSelectedItem(org.getName());
|
||||
selectedOrg = org;
|
||||
}
|
||||
@@ -163,7 +163,7 @@ final class HashDbCreateDatabaseDialog extends javax.swing.JDialog {
|
||||
if ((selectedOrg == null) && (!orgs.isEmpty())) {
|
||||
selectedOrg = orgs.get(0);
|
||||
}
|
||||
} catch (EamDbException ex) {
|
||||
} catch (CentralRepoException ex) {
|
||||
JOptionPane.showMessageDialog(this, Bundle.HashDbCreateDatabaseDialog_populateOrgsError_message());
|
||||
Logger.getLogger(ImportCentralRepoDbProgressDialog.class.getName()).log(Level.SEVERE, "Failure loading organizations", ex);
|
||||
}
|
||||
@@ -511,7 +511,7 @@ final class HashDbCreateDatabaseDialog extends javax.swing.JDialog {
|
||||
} else {
|
||||
// Check if a hash set with the same name/version already exists
|
||||
try{
|
||||
if(EamDb.getInstance().referenceSetExists(hashSetNameTextField.getText(), "")){
|
||||
if(CentralRepository.getInstance().referenceSetExists(hashSetNameTextField.getText(), "")){
|
||||
JOptionPane.showMessageDialog(this,
|
||||
NbBundle.getMessage(this.getClass(),
|
||||
"HashDbCreateDatabaseDialog.duplicateName"),
|
||||
@@ -520,7 +520,7 @@ final class HashDbCreateDatabaseDialog extends javax.swing.JDialog {
|
||||
JOptionPane.ERROR_MESSAGE);
|
||||
return;
|
||||
}
|
||||
} catch (EamDbException ex){
|
||||
} catch (CentralRepoException ex){
|
||||
Logger.getLogger(HashDbImportDatabaseDialog.class.getName()).log(Level.SEVERE, "Error looking up reference set", ex);
|
||||
JOptionPane.showMessageDialog(this,
|
||||
NbBundle.getMessage(this.getClass(),
|
||||
@@ -532,12 +532,12 @@ final class HashDbCreateDatabaseDialog extends javax.swing.JDialog {
|
||||
}
|
||||
|
||||
try{
|
||||
int referenceSetID = EamDb.getInstance().newReferenceSet(new EamGlobalSet(selectedOrg.getOrgID(), hashSetNameTextField.getText(),
|
||||
"", fileKnown, false, EamDb.getInstance().getCorrelationTypeById(CorrelationAttributeInstance.FILES_TYPE_ID)));
|
||||
int referenceSetID = CentralRepository.getInstance().newReferenceSet(new CentralRepoFileSet(selectedOrg.getOrgID(), hashSetNameTextField.getText(),
|
||||
"", fileKnown, false, CentralRepository.getInstance().getCorrelationTypeById(CorrelationAttributeInstance.FILES_TYPE_ID)));
|
||||
newHashDb = HashDbManager.getInstance().addExistingCentralRepoHashSet(hashSetNameTextField.getText(),
|
||||
"", referenceSetID,
|
||||
true, sendIngestMessagesCheckbox.isSelected(), type, false);
|
||||
} catch (EamDbException | TskCoreException ex){
|
||||
} catch (CentralRepoException | TskCoreException ex){
|
||||
Logger.getLogger(HashDbImportDatabaseDialog.class.getName()).log(Level.SEVERE, "Error creating new reference set", ex);
|
||||
JOptionPane.showMessageDialog(this,
|
||||
NbBundle.getMessage(this.getClass(),
|
||||
@@ -567,7 +567,7 @@ final class HashDbCreateDatabaseDialog extends javax.swing.JDialog {
|
||||
private void orgComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_orgComboBoxActionPerformed
|
||||
if (null == orgComboBox.getSelectedItem()) return;
|
||||
String orgName = this.orgComboBox.getSelectedItem().toString();
|
||||
for (EamOrganization org : orgs) {
|
||||
for (CentralRepoOrganization org : orgs) {
|
||||
if (org.getName().equals(orgName)) {
|
||||
selectedOrg = org;
|
||||
return;
|
||||
|
||||
+13
-13
@@ -31,10 +31,9 @@ import org.apache.commons.io.FileUtils;
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
import org.openide.util.NbBundle;
|
||||
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.centralrepository.optionspanel.ManageOrganizationsDialog;
|
||||
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||
import org.sleuthkit.autopsy.coreutils.ModuleSettings;
|
||||
@@ -42,6 +41,7 @@ import org.sleuthkit.autopsy.coreutils.PlatformUtil;
|
||||
import org.sleuthkit.autopsy.modules.hashdatabase.HashDbManager.HashDb.KnownFilesType;
|
||||
import org.sleuthkit.autopsy.modules.hashdatabase.HashDbManager.HashDbManagerException;
|
||||
import org.sleuthkit.autopsy.modules.hashdatabase.HashDbManager.HashDb;
|
||||
import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepository;
|
||||
|
||||
/**
|
||||
* Instances of this class allow a user to select an existing hash database and
|
||||
@@ -55,8 +55,8 @@ final class HashDbImportDatabaseDialog extends javax.swing.JDialog {
|
||||
private String selectedFilePath = "";
|
||||
private HashDb selectedHashDb = null;
|
||||
private final static String LAST_FILE_PATH_KEY = "HashDbImport_Path";
|
||||
private EamOrganization selectedOrg = null;
|
||||
private List<EamOrganization> orgs = null;
|
||||
private CentralRepoOrganization selectedOrg = null;
|
||||
private List<CentralRepoOrganization> orgs = null;
|
||||
|
||||
/**
|
||||
* Displays a dialog that allows a user to select an existing hash database
|
||||
@@ -109,7 +109,7 @@ final class HashDbImportDatabaseDialog extends javax.swing.JDialog {
|
||||
private void enableComponents(){
|
||||
|
||||
|
||||
if(! EamDb.isEnabled()){
|
||||
if(! CentralRepository.isEnabled()){
|
||||
centralRepoRadioButton.setEnabled(false);
|
||||
fileTypeRadioButton.setSelected(true);
|
||||
} else {
|
||||
@@ -132,11 +132,11 @@ final class HashDbImportDatabaseDialog extends javax.swing.JDialog {
|
||||
private void populateCombobox() {
|
||||
orgComboBox.removeAllItems();
|
||||
try {
|
||||
EamDb dbManager = EamDb.getInstance();
|
||||
CentralRepository dbManager = CentralRepository.getInstance();
|
||||
orgs = dbManager.getOrganizations();
|
||||
orgs.forEach((org) -> {
|
||||
orgComboBox.addItem(org.getName());
|
||||
if(EamDbUtil.isDefaultOrg(org)){
|
||||
if(CentralRepoDbUtil.isDefaultOrg(org)){
|
||||
orgComboBox.setSelectedItem(org.getName());
|
||||
selectedOrg = org;
|
||||
}
|
||||
@@ -144,7 +144,7 @@ final class HashDbImportDatabaseDialog extends javax.swing.JDialog {
|
||||
if ((selectedOrg == null) && (!orgs.isEmpty())) {
|
||||
selectedOrg = orgs.get(0);
|
||||
}
|
||||
} catch (EamDbException ex) {
|
||||
} catch (CentralRepoException ex) {
|
||||
JOptionPane.showMessageDialog(this, Bundle.HashDbImportDatabaseDialog_populateOrgsError_message());
|
||||
Logger.getLogger(ImportCentralRepoDbProgressDialog.class.getName()).log(Level.SEVERE, "Failure loading organizations", ex);
|
||||
}
|
||||
@@ -555,7 +555,7 @@ final class HashDbImportDatabaseDialog extends javax.swing.JDialog {
|
||||
|
||||
// Check if a hash set with the same name/version already exists
|
||||
try{
|
||||
if(EamDb.getInstance().referenceSetExists(hashSetNameTextField.getText(), versionTextField.getText())){
|
||||
if(CentralRepository.getInstance().referenceSetExists(hashSetNameTextField.getText(), versionTextField.getText())){
|
||||
JOptionPane.showMessageDialog(this,
|
||||
NbBundle.getMessage(this.getClass(),
|
||||
"HashDbImportDatabaseDialog.duplicateName"),
|
||||
@@ -564,7 +564,7 @@ final class HashDbImportDatabaseDialog extends javax.swing.JDialog {
|
||||
JOptionPane.ERROR_MESSAGE);
|
||||
return;
|
||||
}
|
||||
} catch (EamDbException ex){
|
||||
} catch (CentralRepoException ex){
|
||||
Logger.getLogger(HashDbImportDatabaseDialog.class.getName()).log(Level.SEVERE, "Error looking up reference set", ex);
|
||||
JOptionPane.showMessageDialog(this,
|
||||
NbBundle.getMessage(this.getClass(),
|
||||
@@ -615,7 +615,7 @@ final class HashDbImportDatabaseDialog extends javax.swing.JDialog {
|
||||
private void orgComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_orgComboBoxActionPerformed
|
||||
if (null == orgComboBox.getSelectedItem()) return;
|
||||
String orgName = this.orgComboBox.getSelectedItem().toString();
|
||||
for (EamOrganization org : orgs) {
|
||||
for (CentralRepoOrganization org : orgs) {
|
||||
if (org.getName().equals(orgName)) {
|
||||
selectedOrg = org;
|
||||
return;
|
||||
|
||||
@@ -42,10 +42,9 @@ import org.openide.util.NbBundle.Messages;
|
||||
import org.openide.windows.WindowManager;
|
||||
import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttributeNormalizationException;
|
||||
import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttributeInstance;
|
||||
import org.sleuthkit.autopsy.centralrepository.datamodel.EamDb;
|
||||
import org.sleuthkit.autopsy.centralrepository.datamodel.EamDbException;
|
||||
import org.sleuthkit.autopsy.centralrepository.datamodel.EamGlobalFileInstance;
|
||||
import org.sleuthkit.autopsy.centralrepository.datamodel.EamGlobalSet;
|
||||
import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoException;
|
||||
import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoFileInstance;
|
||||
import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoFileSet;
|
||||
import org.sleuthkit.autopsy.core.RuntimeProperties;
|
||||
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||
import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil;
|
||||
@@ -58,6 +57,7 @@ import org.sleuthkit.datamodel.HashHitInfo;
|
||||
import org.sleuthkit.datamodel.SleuthkitJNI;
|
||||
import org.sleuthkit.datamodel.TskCoreException;
|
||||
import org.sleuthkit.datamodel.TskData;
|
||||
import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepository;
|
||||
|
||||
/**
|
||||
* This class implements a singleton that manages the set of hash databases used
|
||||
@@ -278,7 +278,7 @@ public class HashDbManager implements PropertyChangeListener {
|
||||
boolean searchDuringIngest, boolean sendIngestMessages, HashDb.KnownFilesType knownFilesType,
|
||||
boolean readOnly) throws TskCoreException{
|
||||
|
||||
if(! EamDb.isEnabled()){
|
||||
if(! CentralRepository.isEnabled()){
|
||||
throw new TskCoreException("Could not load central repository hash set " + hashSetName + " - central repository is not enabled");
|
||||
}
|
||||
|
||||
@@ -491,10 +491,10 @@ public class HashDbManager implements PropertyChangeListener {
|
||||
|
||||
private List<HashDbInfo> getCentralRepoHashSetsFromDatabase(){
|
||||
List<HashDbInfo> crHashSets = new ArrayList<>();
|
||||
if(EamDb.isEnabled()){
|
||||
if(CentralRepository.isEnabled()){
|
||||
try{
|
||||
List<EamGlobalSet> crSets = EamDb.getInstance().getAllReferenceSets(EamDb.getInstance().getCorrelationTypeById(CorrelationAttributeInstance.FILES_TYPE_ID));
|
||||
for(EamGlobalSet globalSet:crSets){
|
||||
List<CentralRepoFileSet> crSets = CentralRepository.getInstance().getAllReferenceSets(CentralRepository.getInstance().getCorrelationTypeById(CorrelationAttributeInstance.FILES_TYPE_ID));
|
||||
for(CentralRepoFileSet globalSet:crSets){
|
||||
|
||||
// Defaults for fields not stored in the central repository:
|
||||
// searchDuringIngest: false
|
||||
@@ -503,7 +503,7 @@ public class HashDbManager implements PropertyChangeListener {
|
||||
crHashSets.add(new HashDbInfo(globalSet.getSetName(), globalSet.getVersion(),
|
||||
globalSet.getGlobalSetID(), convertFileKnown(globalSet.getFileKnownStatus()), globalSet.isReadOnly(), false, sendIngestMessages));
|
||||
}
|
||||
} catch (EamDbException ex){
|
||||
} catch (CentralRepoException ex){
|
||||
Logger.getLogger(HashDbManager.class.getName()).log(Level.SEVERE, "Error loading central repository hash sets", ex); //NON-NLS
|
||||
}
|
||||
}
|
||||
@@ -573,7 +573,7 @@ public class HashDbManager implements PropertyChangeListener {
|
||||
allDatabasesLoadedCorrectly = false;
|
||||
}
|
||||
} else {
|
||||
if(EamDb.isEnabled()){
|
||||
if(CentralRepository.isEnabled()){
|
||||
addExistingCentralRepoHashSet(hashDbInfo.getHashSetName(), hashDbInfo.getVersion(),
|
||||
hashDbInfo.getReferenceSetID(),
|
||||
hashDbInfo.getSearchDuringIngest(), hashDbInfo.getSendIngestMessages(),
|
||||
@@ -591,7 +591,7 @@ public class HashDbManager implements PropertyChangeListener {
|
||||
}
|
||||
}
|
||||
|
||||
if(EamDb.isEnabled()){
|
||||
if(CentralRepository.isEnabled()){
|
||||
try{
|
||||
updateHashSetsFromCentralRepository();
|
||||
} catch (TskCoreException ex){
|
||||
@@ -624,7 +624,7 @@ public class HashDbManager implements PropertyChangeListener {
|
||||
}
|
||||
|
||||
private void updateHashSetsFromCentralRepository() throws TskCoreException {
|
||||
if(EamDb.isEnabled()){
|
||||
if(CentralRepository.isEnabled()){
|
||||
List<HashDbInfo> crHashDbInfoList = getCentralRepoHashSetsFromDatabase();
|
||||
for(HashDbInfo hashDbInfo : crHashDbInfoList) {
|
||||
if(hashDbInfoIsNew(hashDbInfo)){
|
||||
@@ -1093,8 +1093,8 @@ public class HashDbManager implements PropertyChangeListener {
|
||||
this.readOnly = readOnly;
|
||||
|
||||
try{
|
||||
orgName = EamDb.getInstance().getReferenceSetOrganization(referenceSetID).getName();
|
||||
} catch (EamDbException ex){
|
||||
orgName = CentralRepository.getInstance().getReferenceSetOrganization(referenceSetID).getName();
|
||||
} catch (CentralRepoException ex){
|
||||
Logger.getLogger(SleuthkitHashSet.class.getName()).log(Level.SEVERE, "Error looking up central repository organization for reference set " + referenceSetID, ex); //NON-NLS
|
||||
orgName = Bundle.HashDbManager_CentralRepoHashDb_orgError();
|
||||
}
|
||||
@@ -1237,10 +1237,10 @@ public class HashDbManager implements PropertyChangeListener {
|
||||
}
|
||||
|
||||
try{
|
||||
EamGlobalFileInstance fileInstance = new EamGlobalFileInstance(referenceSetID, file.getMd5Hash(),
|
||||
CentralRepoFileInstance fileInstance = new CentralRepoFileInstance(referenceSetID, file.getMd5Hash(),
|
||||
type, comment);
|
||||
EamDb.getInstance().addReferenceInstance(fileInstance,EamDb.getInstance().getCorrelationTypeById(CorrelationAttributeInstance.FILES_TYPE_ID));
|
||||
} catch (EamDbException | CorrelationAttributeNormalizationException ex){
|
||||
CentralRepository.getInstance().addReferenceInstance(fileInstance,CentralRepository.getInstance().getCorrelationTypeById(CorrelationAttributeInstance.FILES_TYPE_ID));
|
||||
} catch (CentralRepoException | CorrelationAttributeNormalizationException ex){
|
||||
throw new TskCoreException("Error adding hashes to " + getDisplayName(), ex); //NON-NLS
|
||||
}
|
||||
}
|
||||
@@ -1256,7 +1256,7 @@ public class HashDbManager implements PropertyChangeListener {
|
||||
*/
|
||||
@Override
|
||||
public void addHashes(List<HashEntry> hashes) throws TskCoreException {
|
||||
Set<EamGlobalFileInstance> globalFileInstances = new HashSet<>();
|
||||
Set<CentralRepoFileInstance> globalFileInstances = new HashSet<>();
|
||||
for(HashEntry hashEntry:hashes){
|
||||
TskData.FileKnown type;
|
||||
if(knownFilesType.equals(HashDb.KnownFilesType.KNOWN_BAD)){
|
||||
@@ -1265,16 +1265,16 @@ public class HashDbManager implements PropertyChangeListener {
|
||||
type = TskData.FileKnown.KNOWN;
|
||||
}
|
||||
try {
|
||||
globalFileInstances.add(new EamGlobalFileInstance(referenceSetID, hashEntry.getMd5Hash(), type, hashEntry.getComment()));
|
||||
} catch (EamDbException | CorrelationAttributeNormalizationException ex){
|
||||
globalFileInstances.add(new CentralRepoFileInstance(referenceSetID, hashEntry.getMd5Hash(), type, hashEntry.getComment()));
|
||||
} catch (CentralRepoException | CorrelationAttributeNormalizationException ex){
|
||||
throw new TskCoreException("Error adding hashes to " + getDisplayName(), ex);
|
||||
}
|
||||
}
|
||||
|
||||
try{
|
||||
EamDb.getInstance().bulkInsertReferenceTypeEntries(globalFileInstances,
|
||||
EamDb.getInstance().getCorrelationTypeById(CorrelationAttributeInstance.FILES_TYPE_ID));
|
||||
} catch (EamDbException ex){
|
||||
CentralRepository.getInstance().bulkInsertReferenceTypeEntries(globalFileInstances,
|
||||
CentralRepository.getInstance().getCorrelationTypeById(CorrelationAttributeInstance.FILES_TYPE_ID));
|
||||
} catch (CentralRepoException ex){
|
||||
throw new TskCoreException("Error adding hashes to " + getDisplayName(), ex);
|
||||
}
|
||||
}
|
||||
@@ -1296,8 +1296,8 @@ public class HashDbManager implements PropertyChangeListener {
|
||||
AbstractFile file = (AbstractFile) content;
|
||||
if (null != file.getMd5Hash()) {
|
||||
try{
|
||||
return EamDb.getInstance().isFileHashInReferenceSet(file.getMd5Hash(), this.referenceSetID);
|
||||
} catch (EamDbException | CorrelationAttributeNormalizationException ex){
|
||||
return CentralRepository.getInstance().isFileHashInReferenceSet(file.getMd5Hash(), this.referenceSetID);
|
||||
} catch (CentralRepoException | CorrelationAttributeNormalizationException ex){
|
||||
Logger.getLogger(SleuthkitHashSet.class.getName()).log(Level.SEVERE, "Error performing central reposiotry hash lookup for hash "
|
||||
+ file.getMd5Hash() + " in reference set " + referenceSetID, ex); //NON-NLS
|
||||
throw new TskCoreException("Error performing central reposiotry hash lookup", ex);
|
||||
@@ -1325,11 +1325,11 @@ public class HashDbManager implements PropertyChangeListener {
|
||||
AbstractFile file = (AbstractFile) content;
|
||||
if (null != file.getMd5Hash()) {
|
||||
try{
|
||||
if(EamDb.getInstance().isFileHashInReferenceSet(file.getMd5Hash(), this.referenceSetID)){
|
||||
if(CentralRepository.getInstance().isFileHashInReferenceSet(file.getMd5Hash(), this.referenceSetID)){
|
||||
// Make a bare-bones HashHitInfo for now
|
||||
result = new HashHitInfo(file.getMd5Hash(), "", "");
|
||||
}
|
||||
} catch (EamDbException | CorrelationAttributeNormalizationException ex){
|
||||
} catch (CentralRepoException | CorrelationAttributeNormalizationException ex){
|
||||
Logger.getLogger(SleuthkitHashSet.class.getName()).log(Level.SEVERE, "Error performing central reposiotry hash lookup for hash "
|
||||
+ file.getMd5Hash() + " in reference set " + referenceSetID, ex); //NON-NLS
|
||||
throw new TskCoreException("Error performing central reposiotry hash lookup", ex);
|
||||
@@ -1346,12 +1346,12 @@ public class HashDbManager implements PropertyChangeListener {
|
||||
*/
|
||||
@Override
|
||||
boolean isValid() {
|
||||
if(! EamDb.isEnabled()) {
|
||||
if(! CentralRepository.isEnabled()) {
|
||||
return false;
|
||||
}
|
||||
try{
|
||||
return EamDb.getInstance().referenceSetIsValid(this.referenceSetID, this.hashSetName, this.version);
|
||||
} catch (EamDbException ex){
|
||||
return CentralRepository.getInstance().referenceSetIsValid(this.referenceSetID, this.hashSetName, this.version);
|
||||
} catch (CentralRepoException ex){
|
||||
Logger.getLogger(CentralRepoHashSet.class.getName()).log(Level.SEVERE, "Error validating hash set " + hashSetName, ex); //NON-NLS
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -40,8 +40,7 @@ import javax.swing.table.TableCellRenderer;
|
||||
import org.netbeans.spi.options.OptionsPanelController;
|
||||
import org.openide.util.NbBundle;
|
||||
import org.openide.util.NbBundle.Messages;
|
||||
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.corecomponents.OptionsPanel;
|
||||
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||
import org.sleuthkit.autopsy.coreutils.PlatformUtil;
|
||||
@@ -53,6 +52,7 @@ import org.sleuthkit.autopsy.modules.hashdatabase.HashDbManager.CentralRepoHashS
|
||||
import org.sleuthkit.autopsy.modules.hashdatabase.HashDbManager.HashDb.KnownFilesType;
|
||||
import org.sleuthkit.datamodel.TskCoreException;
|
||||
import org.sleuthkit.autopsy.modules.hashdatabase.HashDbManager.HashDb;
|
||||
import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepository;
|
||||
|
||||
/**
|
||||
* Instances of this class provide a comprehensive UI for managing the hash sets
|
||||
@@ -360,14 +360,14 @@ public final class HashLookupSettingsPanel extends IngestModuleGlobalSettingsPan
|
||||
// Remove any new central repo hash sets from the database
|
||||
for (int refID : newReferenceSetIDs) {
|
||||
try {
|
||||
if (EamDb.isEnabled()) {
|
||||
EamDb.getInstance().deleteReferenceSet(refID);
|
||||
if (CentralRepository.isEnabled()) {
|
||||
CentralRepository.getInstance().deleteReferenceSet(refID);
|
||||
} else {
|
||||
// This is the case where the user imported a database, then switched over to the central
|
||||
// repo panel and disabled it before cancelling. We can't delete the database at this point.
|
||||
Logger.getLogger(HashLookupSettingsPanel.class.getName()).log(Level.WARNING, "Error reverting central repository hash sets"); //NON-NLS
|
||||
}
|
||||
} catch (EamDbException ex) {
|
||||
} catch (CentralRepoException ex) {
|
||||
Logger.getLogger(HashLookupSettingsPanel.class.getName()).log(Level.SEVERE, "Error reverting central repository hash sets", ex); //NON-NLS
|
||||
}
|
||||
}
|
||||
|
||||
+11
-11
@@ -34,13 +34,13 @@ import java.util.concurrent.Executors;
|
||||
import org.openide.util.NbBundle;
|
||||
import org.openide.windows.WindowManager;
|
||||
import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttributeInstance;
|
||||
import org.sleuthkit.autopsy.centralrepository.datamodel.EamDb;
|
||||
import org.sleuthkit.autopsy.centralrepository.datamodel.EamDbException;
|
||||
import org.sleuthkit.autopsy.centralrepository.datamodel.EamGlobalFileInstance;
|
||||
import org.sleuthkit.autopsy.centralrepository.datamodel.EamGlobalSet;
|
||||
import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoException;
|
||||
import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoFileInstance;
|
||||
import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoFileSet;
|
||||
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||
import org.sleuthkit.datamodel.TskCoreException;
|
||||
import org.sleuthkit.datamodel.TskData;
|
||||
import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepository;
|
||||
|
||||
/**
|
||||
* Imports a hash set into the central repository and updates a progress dialog
|
||||
@@ -239,16 +239,16 @@ class ImportCentralRepoDbProgressDialog extends javax.swing.JDialog implements P
|
||||
}
|
||||
|
||||
// Create an empty hashset in the central repository
|
||||
EamDb dbManager = EamDb.getInstance();
|
||||
referenceSetID.set(dbManager.newReferenceSet(new EamGlobalSet(orgId, hashSetName, version, knownStatus,
|
||||
readOnly, EamDb.getInstance().getCorrelationTypeById(CorrelationAttributeInstance.FILES_TYPE_ID))));
|
||||
CentralRepository dbManager = CentralRepository.getInstance();
|
||||
referenceSetID.set(dbManager.newReferenceSet(new CentralRepoFileSet(orgId, hashSetName, version, knownStatus,
|
||||
readOnly, CentralRepository.getInstance().getCorrelationTypeById(CorrelationAttributeInstance.FILES_TYPE_ID))));
|
||||
|
||||
// Get the "FILES" content type. This is a database lookup so we
|
||||
// only want to do it once.
|
||||
CorrelationAttributeInstance.Type contentType = dbManager.getCorrelationTypeById(CorrelationAttributeInstance.FILES_TYPE_ID);
|
||||
|
||||
// Holds the current batch of hashes that need to be written to the central repo
|
||||
Set<EamGlobalFileInstance> globalInstances = new HashSet<>();
|
||||
Set<CentralRepoFileInstance> globalInstances = new HashSet<>();
|
||||
|
||||
while (!hashSetParser.doneReading()) {
|
||||
if (isCancelled()) {
|
||||
@@ -258,7 +258,7 @@ class ImportCentralRepoDbProgressDialog extends javax.swing.JDialog implements P
|
||||
String newHash = hashSetParser.getNextHash();
|
||||
|
||||
if (newHash != null) {
|
||||
EamGlobalFileInstance eamGlobalFileInstance = new EamGlobalFileInstance(
|
||||
CentralRepoFileInstance eamGlobalFileInstance = new CentralRepoFileInstance(
|
||||
referenceSetID.get(),
|
||||
newHash,
|
||||
knownStatus,
|
||||
@@ -299,8 +299,8 @@ class ImportCentralRepoDbProgressDialog extends javax.swing.JDialog implements P
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
EamDb.getInstance().deleteReferenceSet(referenceSetID.get());
|
||||
} catch (EamDbException ex2) {
|
||||
CentralRepository.getInstance().deleteReferenceSet(referenceSetID.get());
|
||||
} catch (CentralRepoException ex2) {
|
||||
Logger.getLogger(ImportCentralRepoDbProgressDialog.class.getName()).log(Level.SEVERE, "Error deleting incomplete hash set from central repository", ex2);
|
||||
}
|
||||
}
|
||||
|
||||
+491
-491
File diff suppressed because it is too large
Load Diff
+1
-1
@@ -28,7 +28,7 @@ import org.netbeans.junit.NbTestCase;
|
||||
import org.openide.util.Exceptions;
|
||||
import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
|
||||
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.commonpropertiessearch.AbstractCommonAttributeSearcher;
|
||||
import org.sleuthkit.autopsy.commonpropertiessearch.AllInterCaseCommonAttributeSearcher;
|
||||
import org.sleuthkit.autopsy.commonpropertiessearch.CommonAttributeCountSearchResults;
|
||||
|
||||
+1
-1
@@ -29,7 +29,7 @@ import org.openide.util.Exceptions;
|
||||
import junit.framework.Assert;
|
||||
import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
|
||||
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.commonpropertiessearch.AbstractCommonAttributeSearcher;
|
||||
import org.sleuthkit.autopsy.commonpropertiessearch.AllInterCaseCommonAttributeSearcher;
|
||||
import org.sleuthkit.autopsy.commonpropertiessearch.CommonAttributeCountSearchResults;
|
||||
|
||||
+10
-10
@@ -30,7 +30,7 @@ import org.openide.util.Exceptions;
|
||||
import junit.framework.Assert;
|
||||
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.commonpropertiessearch.AbstractCommonAttributeSearcher;
|
||||
import org.sleuthkit.autopsy.commonpropertiessearch.AllIntraCaseCommonAttributeSearcher;
|
||||
import org.sleuthkit.autopsy.commonpropertiessearch.CommonAttributeCountSearchResults;
|
||||
@@ -126,7 +126,7 @@ public class IngestedWithHashAndFileTypeIntraCaseTest extends NbTestCase {
|
||||
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, EMPTY, SET3, 0));
|
||||
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, EMPTY, SET4, 0));
|
||||
|
||||
} catch (NoCurrentCaseException | TskCoreException | SQLException | EamDbException ex) {
|
||||
} catch (NoCurrentCaseException | TskCoreException | SQLException | CentralRepoExceptionex) {
|
||||
Exceptions.printStackTrace(ex);
|
||||
Assert.fail(ex.getMessage());
|
||||
}
|
||||
@@ -167,7 +167,7 @@ public class IngestedWithHashAndFileTypeIntraCaseTest extends NbTestCase {
|
||||
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, EMPTY, SET3, 0));
|
||||
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, EMPTY, SET4, 0));
|
||||
|
||||
} catch (NoCurrentCaseException | TskCoreException | SQLException | EamDbException ex) {
|
||||
} catch (NoCurrentCaseException | TskCoreException | SQLException | CentralRepoExceptionex) {
|
||||
Exceptions.printStackTrace(ex);
|
||||
Assert.fail(ex.getMessage());
|
||||
}
|
||||
@@ -208,7 +208,7 @@ public class IngestedWithHashAndFileTypeIntraCaseTest extends NbTestCase {
|
||||
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, EMPTY, SET3, 0));
|
||||
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, EMPTY, SET4, 0));
|
||||
|
||||
} catch (NoCurrentCaseException | TskCoreException | SQLException | EamDbException ex) {
|
||||
} catch (NoCurrentCaseException | TskCoreException | SQLException | CentralRepoExceptionex) {
|
||||
Exceptions.printStackTrace(ex);
|
||||
Assert.fail(ex.getMessage());
|
||||
}
|
||||
@@ -250,7 +250,7 @@ public class IngestedWithHashAndFileTypeIntraCaseTest extends NbTestCase {
|
||||
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, EMPTY, SET3, 0));
|
||||
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, EMPTY, SET4, 0));
|
||||
|
||||
} catch (NoCurrentCaseException | TskCoreException | SQLException | EamDbException ex) {
|
||||
} catch (NoCurrentCaseException | TskCoreException | SQLException | CentralRepoExceptionex) {
|
||||
Exceptions.printStackTrace(ex);
|
||||
Assert.fail(ex.getMessage());
|
||||
}
|
||||
@@ -292,7 +292,7 @@ public class IngestedWithHashAndFileTypeIntraCaseTest extends NbTestCase {
|
||||
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, EMPTY, SET3, 0));
|
||||
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, EMPTY, SET4, 0));
|
||||
|
||||
} catch (NoCurrentCaseException | TskCoreException | SQLException | EamDbException ex) {
|
||||
} catch (NoCurrentCaseException | TskCoreException | SQLException | CentralRepoExceptionex) {
|
||||
Exceptions.printStackTrace(ex);
|
||||
Assert.fail(ex.getMessage());
|
||||
}
|
||||
@@ -334,7 +334,7 @@ public class IngestedWithHashAndFileTypeIntraCaseTest extends NbTestCase {
|
||||
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, EMPTY, SET3, 0));
|
||||
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, EMPTY, SET4, 0));
|
||||
|
||||
} catch (NoCurrentCaseException | TskCoreException | SQLException | EamDbException ex) {
|
||||
} catch (NoCurrentCaseException | TskCoreException | SQLException | CentralRepoExceptionex) {
|
||||
Exceptions.printStackTrace(ex);
|
||||
Assert.fail(ex.getMessage());
|
||||
}
|
||||
@@ -376,7 +376,7 @@ public class IngestedWithHashAndFileTypeIntraCaseTest extends NbTestCase {
|
||||
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, EMPTY, SET3, 0));
|
||||
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, EMPTY, SET4, 0));
|
||||
|
||||
} catch (NoCurrentCaseException | TskCoreException | SQLException | EamDbException ex) {
|
||||
} catch (NoCurrentCaseException | TskCoreException | SQLException | CentralRepoExceptionex) {
|
||||
Exceptions.printStackTrace(ex);
|
||||
Assert.fail(ex.getMessage());
|
||||
}
|
||||
@@ -417,7 +417,7 @@ public class IngestedWithHashAndFileTypeIntraCaseTest extends NbTestCase {
|
||||
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, EMPTY, SET3, 0));
|
||||
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, EMPTY, SET4, 0));
|
||||
|
||||
} catch (NoCurrentCaseException | TskCoreException | SQLException | EamDbException ex) {
|
||||
} catch (NoCurrentCaseException | TskCoreException | SQLException | CentralRepoExceptionex) {
|
||||
Exceptions.printStackTrace(ex);
|
||||
Assert.fail(ex.getMessage());
|
||||
}
|
||||
@@ -458,7 +458,7 @@ public class IngestedWithHashAndFileTypeIntraCaseTest extends NbTestCase {
|
||||
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, EMPTY, SET3, 0));
|
||||
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, EMPTY, SET4, 0));
|
||||
|
||||
} catch (NoCurrentCaseException | TskCoreException | SQLException | EamDbException ex) {
|
||||
} catch (NoCurrentCaseException | TskCoreException | SQLException | CentralRepoExceptionex) {
|
||||
Exceptions.printStackTrace(ex);
|
||||
Assert.fail(ex.getMessage());
|
||||
}
|
||||
|
||||
+17
-17
@@ -33,10 +33,10 @@ import org.netbeans.junit.NbTestCase;
|
||||
import org.openide.util.Exceptions;
|
||||
import org.sleuthkit.autopsy.casemodule.Case;
|
||||
import org.sleuthkit.autopsy.casemodule.ImageDSProcessor;
|
||||
import org.sleuthkit.autopsy.centralrepository.datamodel.EamDbException;
|
||||
import org.sleuthkit.autopsy.centralrepository.datamodel.EamDbPlatformEnum;
|
||||
import org.sleuthkit.autopsy.centralrepository.datamodel.EamDbUtil;
|
||||
import org.sleuthkit.autopsy.centralrepository.datamodel.SqliteEamDbSettings;
|
||||
import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoException;
|
||||
import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoPlatforms;
|
||||
import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoDbUtil;
|
||||
import org.sleuthkit.autopsy.centralrepository.datamodel.SqliteCentralRepoSettings;
|
||||
import org.sleuthkit.autopsy.ingest.IngestJobSettings;
|
||||
import org.sleuthkit.autopsy.ingest.IngestJobSettings.IngestType;
|
||||
import org.sleuthkit.autopsy.ingest.IngestModuleTemplate;
|
||||
@@ -49,7 +49,6 @@ import junit.framework.Assert;
|
||||
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.EamDb;
|
||||
import org.sleuthkit.autopsy.coreutils.TimeStampUtils;
|
||||
import org.sleuthkit.autopsy.datamodel.DisplayableItemNode;
|
||||
import org.sleuthkit.autopsy.datamodel.utils.DataSourceLoader;
|
||||
@@ -62,6 +61,7 @@ import org.sleuthkit.autopsy.modules.interestingitems.InterestingItemsIngestModu
|
||||
import org.sleuthkit.autopsy.modules.photoreccarver.PhotoRecCarverIngestModuleFactory;
|
||||
import org.sleuthkit.autopsy.modules.vmextractor.VMExtractorIngestModuleFactory;
|
||||
import org.sleuthkit.datamodel.AbstractFile;
|
||||
import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepository;
|
||||
|
||||
/**
|
||||
* Utilities for testing intercase correlation feature.
|
||||
@@ -229,7 +229,7 @@ class InterCaseTestUtils {
|
||||
EMAIL_TYPE = types.stream().filter(type -> type.getDisplayName().equals("Email Addresses")).findAny().get();
|
||||
PHONE_TYPE = types.stream().filter(type -> type.getDisplayName().equals("Phone Numbers")).findAny().get();
|
||||
|
||||
} catch (EamDbException ex) {
|
||||
} catch (CentralRepoException ex) {
|
||||
Assert.fail(ex.getMessage());
|
||||
|
||||
//none of this really matters but satisfies the compiler
|
||||
@@ -244,11 +244,11 @@ class InterCaseTestUtils {
|
||||
void clearTestDir() {
|
||||
if (CENTRAL_REPO_DIRECTORY_PATH.toFile().exists()) {
|
||||
try {
|
||||
if (EamDb.isEnabled()) {
|
||||
EamDb.getInstance().shutdownConnections();
|
||||
if (CentralRepository.isEnabled()) {
|
||||
CentralRepository.getInstance().shutdownConnections();
|
||||
}
|
||||
FileUtils.deleteDirectory(CENTRAL_REPO_DIRECTORY_PATH.toFile());
|
||||
} catch (IOException | EamDbException ex) {
|
||||
} catch (IOException | CentralRepoExceptionex) {
|
||||
Exceptions.printStackTrace(ex);
|
||||
Assert.fail(ex.getMessage());
|
||||
}
|
||||
@@ -259,12 +259,12 @@ class InterCaseTestUtils {
|
||||
return DataSourceLoader.getAllDataSources();
|
||||
}
|
||||
|
||||
Map<String, Integer> getCaseMap() throws EamDbException {
|
||||
Map<String, Integer> getCaseMap() throws CentralRepoException {
|
||||
|
||||
if (EamDb.isEnabled()) {
|
||||
if (CentralRepository.isEnabled()) {
|
||||
Map<String, Integer> mapOfCaseIdsToCase = new HashMap<>();
|
||||
|
||||
for (CorrelationCase correlationCase : EamDb.getInstance().getCases()) {
|
||||
for (CorrelationCase correlationCase : CentralRepository.getInstance().getCases()) {
|
||||
mapOfCaseIdsToCase.put(correlationCase.getDisplayName(), correlationCase.getID());
|
||||
}
|
||||
return mapOfCaseIdsToCase;
|
||||
@@ -287,10 +287,10 @@ class InterCaseTestUtils {
|
||||
return this.kitchenShink;
|
||||
}
|
||||
|
||||
void enableCentralRepo() throws EamDbException {
|
||||
void enableCentralRepo() throws CentralRepoException {
|
||||
|
||||
EamDbUtil.setUseCentralRepo(true);
|
||||
SqliteEamDbSettings crSettings = new SqliteEamDbSettings();
|
||||
CentralRepoDbUtil.setUseCentralRepo(true);
|
||||
SqliteCentralRepoSettings crSettings = new SqliteCentralRepoSettings();
|
||||
crSettings.setDbName(CR_DB_NAME);
|
||||
crSettings.setDbDirectory(CENTRAL_REPO_DIRECTORY_PATH.toString());
|
||||
if (!crSettings.dbDirectoryExists()) {
|
||||
@@ -300,8 +300,8 @@ class InterCaseTestUtils {
|
||||
crSettings.initializeDatabaseSchema();
|
||||
crSettings.insertDefaultDatabaseContent();
|
||||
crSettings.saveSettings();
|
||||
EamDbPlatformEnum.setSelectedPlatform(EamDbPlatformEnum.SQLITE.name());
|
||||
EamDbPlatformEnum.saveSelectedPlatform();
|
||||
CentralRepoPlatforms.setSelectedPlatform(CentralRepoPlatforms.SQLITE.name());
|
||||
CentralRepoPlatforms.saveSelectedPlatform();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+2
-2
@@ -31,7 +31,7 @@ import junit.framework.Assert;
|
||||
import org.sleuthkit.autopsy.casemodule.Case;
|
||||
import org.sleuthkit.autopsy.casemodule.ImageDSProcessor;
|
||||
import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
|
||||
import org.sleuthkit.autopsy.centralrepository.datamodel.EamDbException;
|
||||
import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoException;
|
||||
import org.sleuthkit.autopsy.commonpropertiessearch.AbstractCommonAttributeSearcher;
|
||||
import org.sleuthkit.autopsy.commonpropertiessearch.AllIntraCaseCommonAttributeSearcher;
|
||||
import org.sleuthkit.autopsy.commonpropertiessearch.CommonAttributeCountSearchResults;
|
||||
@@ -121,7 +121,7 @@ public class MatchesInAtLeastTwoSourcesIntraCaseTest extends NbTestCase {
|
||||
assertTrue(IntraCaseTestUtils.verifyInstanceExistanceAndCount(files, dataSources, EMPTY, SET1, 0));
|
||||
assertTrue(IntraCaseTestUtils.verifyInstanceExistanceAndCount(files, dataSources, EMPTY, SET4, 0));
|
||||
|
||||
} catch (NoCurrentCaseException | TskCoreException | SQLException | EamDbException ex) {
|
||||
} catch (NoCurrentCaseException | TskCoreException | SQLException | CentralRepoExceptionex) {
|
||||
Exceptions.printStackTrace(ex);
|
||||
Assert.fail(ex.getMessage());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user