Merge branch 'develop' of https://github.com/sleuthkit/autopsy into 5866-CvtExceptionCaseClosed

This commit is contained in:
William Schaefer 2020-02-13 15:34:36 -05:00
commit 2e1d5ac5e1
315 changed files with 12692 additions and 4916 deletions

View File

@ -15,7 +15,7 @@
<target name="-download-ivy" unless="ivy.available">
<mkdir dir="${ivy.jar.dir}"/>
<get src="http://repo2.maven.org/maven2/org/apache/ivy/ivy/${ivy.install.version}/ivy-${ivy.install.version}.jar"
<get src="https://repo1.maven.org/maven2/org/apache/ivy/ivy/${ivy.install.version}/ivy-${ivy.install.version}.jar"
dest="${ivy.jar.file}" usetimestamp="true"/>
</target>

View File

@ -74,6 +74,7 @@
<copy file="${thirdparty.dir}/stix/StixLib.jar" todir="${ext.dir}" />
<copy file="${thirdparty.dir}/jdom/jdom-2.0.5.jar" todir="${ext.dir}" />
<copy file="${thirdparty.dir}/jdom/jdom-2.0.5-contrib.jar" todir="${ext.dir}" />
<copy file="${thirdparty.dir}/DatCon/3.6.9/DatCon.jar" todir="${ext.dir}" />
</target>

View File

@ -2,7 +2,7 @@
<settings defaultResolver="main"/>
<resolvers>
<chain name="main">
<ibiblio name="central" m2compatible="true"/>
<ibiblio name="central" root="https://repo1.maven.org/maven2" m2compatible="true"/>
<ibiblio name="maven.restlet.org" root="http://maven.restlet.com" m2compatible="true" />
<ibiblio name="jitpack.io" root="https://jitpack.io" m2compatible="true" />
</chain>

View File

@ -120,6 +120,7 @@ file.reference.okhttp-2.7.5-javadoc.jar=release/modules/ext/okhttp-2.7.5-javadoc
file.reference.okhttp-2.7.5-sources.jar=release/modules/ext/okhttp-2.7.5-sources.jar
file.reference.okhttp-2.7.5.jar=release/modules/ext/okhttp-2.7.5.jar
file.reference.okio-1.6.0.jar=release/modules/ext/okio-1.6.0.jar
file.reference.datcon.jar=release/modules/ext/DatCon.jar
javac.source=1.8
javac.compilerargs=-Xlint -Xlint:-serial
license.file=../LICENSE-2.0.txt

View File

@ -309,6 +309,8 @@
<package>net.sf.sevenzipjbinding.impl</package>
<package>net.sf.sevenzipjbinding.simple</package>
<package>net.sf.sevenzipjbinding.simple.impl</package>
<package>org.apache.tika</package>
<package>org.apache.tika.io</package>
<package>org.sleuthkit.autopsy.actions</package>
<package>org.sleuthkit.autopsy.appservices</package>
<package>org.sleuthkit.autopsy.casemodule</package>
@ -346,6 +348,7 @@
<package>org.sleuthkit.autopsy.texttranslation</package>
<package>org.sleuthkit.datamodel</package>
<package>org.sleuthkit.datamodel.blackboardutils</package>
<package>org.sleuthkit.datamodel.blackboardutils.attributes</package>
</public-packages>
<class-path-extension>
<runtime-relative-path>ext/commons-lang3-3.8.1.jar</runtime-relative-path>
@ -802,6 +805,10 @@
<class-path-extension>
<runtime-relative-path>ext/jutf7-1.0.0.jar</runtime-relative-path>
<binary-origin>release/modules/ext/jutf7-1.0.0.jar</binary-origin>
</class-path-extension>
<class-path-extension>
<runtime-relative-path>ext/DatCon.jar</runtime-relative-path>
<binary-origin>release/modules/ext/DatCon.jar</binary-origin>
</class-path-extension>
</data>
</configuration>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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.",

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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.RdbmsCentralRepo.SOFTWARE_CR_DB_SCHEMA_VERSION;
/**
*
*/
public class EamDbUtil {
public class CentralRepoDbUtil {
private final static Logger LOGGER = Logger.getLogger(EamDbUtil.class.getName());
private final static Logger LOGGER = Logger.getLogger(CentralRepoDbUtil.class.getName());
private static final String CENTRAL_REPO_NAME = "CentralRepository";
private static final String CENTRAL_REPO_USE_KEY = "db.useCentralRepo";
private static final String DEFAULT_ORG_NAME = "Not Specified";
@ -47,7 +47,7 @@ public class EamDbUtil {
*
* @param statement The statement to be closed.
*
* @throws EamDbException
* @throws CentralRepoException
*/
public static void closeStatement(Statement statement) {
if (null != statement) {
@ -64,7 +64,7 @@ public class EamDbUtil {
*
* @param resultSet
*
* @throws EamDbException
* @throws CentralRepoException
*/
public static void closeResultSet(ResultSet resultSet) {
if (null != resultSet) {
@ -81,7 +81,7 @@ public class EamDbUtil {
*
* @param conn An open connection
*
* @throws EamDbException
* @throws CentralRepoException
*/
public static void closeConnection(Connection conn) {
if (null != conn) {
@ -117,11 +117,11 @@ public class EamDbUtil {
preparedStatement.addBatch();
}
preparedStatement.executeBatch();
} catch (EamDbException | SQLException ex) {
} catch (CentralRepoException | SQLException ex) {
LOGGER.log(Level.SEVERE, "Error inserting default correlation types.", ex); // NON-NLS
return false;
} finally {
EamDbUtil.closePreparedStatement(preparedStatement);
CentralRepoDbUtil.closePreparedStatement(preparedStatement);
}
return true;
}
@ -135,8 +135,8 @@ public class EamDbUtil {
*/
static void updateSchemaVersion(Connection conn) throws SQLException {
try (Statement statement = conn.createStatement()) {
statement.execute("UPDATE db_info SET value = '" + SOFTWARE_CR_DB_SCHEMA_VERSION.getMajor() + "' WHERE name = '" + AbstractSqlEamDb.SCHEMA_MAJOR_VERSION_KEY + "'");
statement.execute("UPDATE db_info SET value = '" + SOFTWARE_CR_DB_SCHEMA_VERSION.getMinor() + "' WHERE name = '" + AbstractSqlEamDb.SCHEMA_MINOR_VERSION_KEY + "'");
statement.execute("UPDATE db_info SET value = '" + SOFTWARE_CR_DB_SCHEMA_VERSION.getMajor() + "' WHERE name = '" + RdbmsCentralRepo.SCHEMA_MAJOR_VERSION_KEY + "'");
statement.execute("UPDATE db_info SET value = '" + SOFTWARE_CR_DB_SCHEMA_VERSION.getMinor() + "' WHERE name = '" + RdbmsCentralRepo.SCHEMA_MINOR_VERSION_KEY + "'");
}
}
@ -161,7 +161,7 @@ public class EamDbUtil {
} catch (SQLException ex) {
return false;
} finally {
EamDbUtil.closeResultSet(resultSet);
CentralRepoDbUtil.closeResultSet(resultSet);
}
return true;
}
@ -175,20 +175,20 @@ public class EamDbUtil {
"EamDbUtil.centralRepoUpgradeFailed.message=Failed to upgrade Central Repository.",
"EamDbUtil.centralRepoConnectionFailed.message=Unable to connect to Central Repository.",
"EamDbUtil.exclusiveLockAquisitionFailure.message=Unable to acquire exclusive lock for Central Repository."})
public static void upgradeDatabase() throws EamDbException {
if (!EamDb.isEnabled()) {
public static void upgradeDatabase() throws CentralRepoException {
if (!CentralRepository.isEnabled()) {
return;
}
EamDb db = null;
CentralRepository db = null;
CoordinationService.Lock lock = null;
//get connection
try {
try {
db = EamDb.getInstance();
} catch (EamDbException ex) {
db = CentralRepository.getInstance();
} catch (CentralRepoException ex) {
LOGGER.log(Level.SEVERE, "Error updating central repository, unable to make connection", ex);
throw new EamDbException("Error updating central repository, unable to make connection", Bundle.EamDbUtil_centralRepoConnectionFailed_message() + Bundle.EamDbUtil_centralRepoDisabled_message(), ex);
throw new CentralRepoException("Error updating central repository, unable to make connection", Bundle.EamDbUtil_centralRepoConnectionFailed_message() + Bundle.EamDbUtil_centralRepoDisabled_message(), ex);
}
//get lock necessary for upgrade
if (db != null) {
@ -198,22 +198,22 @@ public class EamDbUtil {
// (meaning the database is in use by another user)
lock = db.getExclusiveMultiUserDbLock();
//perform upgrade
} catch (EamDbException ex) {
} catch (CentralRepoException ex) {
LOGGER.log(Level.SEVERE, "Error updating central repository, unable to acquire exclusive lock", ex);
throw new EamDbException("Error updating central repository, unable to acquire exclusive lock", Bundle.EamDbUtil_exclusiveLockAquisitionFailure_message() + Bundle.EamDbUtil_centralRepoDisabled_message(), ex);
throw new CentralRepoException("Error updating central repository, unable to acquire exclusive lock", Bundle.EamDbUtil_exclusiveLockAquisitionFailure_message() + Bundle.EamDbUtil_centralRepoDisabled_message(), ex);
}
try {
db.upgradeSchema();
} catch (EamDbException ex) {
} catch (CentralRepoException ex) {
LOGGER.log(Level.SEVERE, "Error updating central repository", ex);
throw new EamDbException("Error updating central repository", ex.getUserMessage() + Bundle.EamDbUtil_centralRepoDisabled_message(), ex);
throw new CentralRepoException("Error updating central repository", ex.getUserMessage() + Bundle.EamDbUtil_centralRepoDisabled_message(), ex);
} catch (SQLException ex) {
LOGGER.log(Level.SEVERE, "Error updating central repository", ex);
throw new EamDbException("Error updating central repository", Bundle.EamDbUtil_centralRepoUpgradeFailed_message() + Bundle.EamDbUtil_centralRepoDisabled_message(), ex);
throw new CentralRepoException("Error updating central repository", Bundle.EamDbUtil_centralRepoUpgradeFailed_message() + Bundle.EamDbUtil_centralRepoDisabled_message(), ex);
} catch (IncompatibleCentralRepoException ex) {
LOGGER.log(Level.SEVERE, "Error updating central repository", ex);
throw new EamDbException("Error updating central repository", ex.getMessage() + "\n\n" + Bundle.EamDbUtil_centralRepoUpgradeFailed_message() + Bundle.EamDbUtil_centralRepoDisabled_message(), ex);
throw new CentralRepoException("Error updating central repository", ex.getMessage() + "\n\n" + Bundle.EamDbUtil_centralRepoUpgradeFailed_message() + Bundle.EamDbUtil_centralRepoDisabled_message(), ex);
} finally {
if (lock != null) {
try {
@ -224,19 +224,19 @@ public class EamDbUtil {
}
}
} else {
throw new EamDbException("Unable to connect to database", Bundle.EamDbUtil_centralRepoConnectionFailed_message() + Bundle.EamDbUtil_centralRepoDisabled_message());
throw new CentralRepoException("Unable to connect to database", Bundle.EamDbUtil_centralRepoConnectionFailed_message() + Bundle.EamDbUtil_centralRepoDisabled_message());
}
} catch (EamDbException ex) {
} catch (CentralRepoException ex) {
// Disable the central repo and clear the current settings.
try {
if (null != EamDb.getInstance()) {
EamDb.getInstance().shutdownConnections();
if (null != CentralRepository.getInstance()) {
CentralRepository.getInstance().shutdownConnections();
}
} catch (EamDbException ex2) {
} catch (CentralRepoException ex2) {
LOGGER.log(Level.SEVERE, "Error shutting down central repo connection pool", ex2);
}
EamDbPlatformEnum.setSelectedPlatform(EamDbPlatformEnum.DISABLED.name());
EamDbPlatformEnum.saveSelectedPlatform();
CentralRepoPlatforms.setSelectedPlatform(CentralRepoPlatforms.DISABLED.name());
CentralRepoPlatforms.saveSelectedPlatform();
throw ex;
}
}
@ -257,7 +257,7 @@ public class EamDbUtil {
*
* @return true if it is the default org, false otherwise
*/
public static boolean isDefaultOrg(EamOrganization org) {
public static boolean isDefaultOrg(CentralRepoOrganization org) {
return DEFAULT_ORG_NAME.equals(org.getName());
}
@ -286,7 +286,7 @@ public class EamDbUtil {
LOGGER.log(Level.SEVERE, "Error adding default organization", ex);
return false;
} finally {
EamDbUtil.closePreparedStatement(preparedStatement);
CentralRepoDbUtil.closePreparedStatement(preparedStatement);
}
return true;
@ -338,7 +338,7 @@ public class EamDbUtil {
} catch (SQLException ex) {
return false;
} finally {
EamDbUtil.closeResultSet(resultSet);
CentralRepoDbUtil.closeResultSet(resultSet);
}
return false;
@ -373,7 +373,7 @@ public class EamDbUtil {
*
* @deprecated Use closeStatement() instead.
*
* @throws EamDbException
* @throws CentralRepoException
*/
@Deprecated
public static void closePreparedStatement(PreparedStatement preparedStatement) {

View File

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

View File

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

View File

@ -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,

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -33,30 +33,30 @@ import org.sleuthkit.autopsy.coreutils.Logger;
/**
* Central Repository database implementation using Postgres as a backend
*/
final class PostgresEamDb extends AbstractSqlEamDb {
final class PostgresCentralRepo extends RdbmsCentralRepo {
private final static Logger LOGGER = Logger.getLogger(PostgresEamDb.class.getName());
private final static Logger LOGGER = Logger.getLogger(PostgresCentralRepo.class.getName());
private final static String CONFLICT_CLAUSE = "ON CONFLICT DO NOTHING";
private static PostgresEamDb instance;
private static PostgresCentralRepo instance;
private static final int CONN_POOL_SIZE = 10;
private BasicDataSource connectionPool = null;
private final PostgresEamDbSettings dbSettings;
private final PostgresCentralRepoSettings dbSettings;
/**
* Get the singleton instance of PostgresEamDb
*
* @return the singleton instance of PostgresEamDb
*
* @throws EamDbException if one or more default correlation type(s) have an
* @throws CentralRepoException if one or more default correlation type(s) have an
* invalid db table name.
*/
public synchronized static PostgresEamDb getInstance() throws EamDbException {
public synchronized static PostgresCentralRepo getInstance() throws CentralRepoException {
if (instance == null) {
instance = new PostgresEamDb();
instance = new PostgresCentralRepo();
}
return instance;
@ -64,17 +64,17 @@ final class PostgresEamDb extends AbstractSqlEamDb {
/**
*
* @throws EamDbException if the AbstractSqlEamDb class has one or more
* @throws CentralRepoException if the AbstractSqlEamDb class has one or more
* default correlation type(s) having an invalid db
* table name.
*/
private PostgresEamDb() throws EamDbException {
dbSettings = new PostgresEamDbSettings();
private PostgresCentralRepo() throws CentralRepoException {
dbSettings = new PostgresCentralRepoSettings();
bulkArtifactsThreshold = dbSettings.getBulkThreshold();
}
@Override
public void shutdownConnections() throws EamDbException {
public void shutdownConnections() throws CentralRepoException {
try {
synchronized (this) {
if (connectionPool != null) {
@ -84,7 +84,7 @@ final class PostgresEamDb extends AbstractSqlEamDb {
clearCaches();
}
} catch (SQLException ex) {
throw new EamDbException("Failed to close existing database connections.", ex); // NON-NLS
throw new CentralRepoException("Failed to close existing database connections.", ex); // NON-NLS
}
}
@ -104,7 +104,7 @@ final class PostgresEamDb extends AbstractSqlEamDb {
}
@Override
public void reset() throws EamDbException {
public void reset() throws CentralRepoException {
Connection conn = connect();
try {
@ -128,7 +128,7 @@ final class PostgresEamDb extends AbstractSqlEamDb {
} catch (SQLException ex) {
LOGGER.log(Level.WARNING, "Failed to reset database.", ex);
} finally {
EamDbUtil.closeConnection(conn);
CentralRepoDbUtil.closeConnection(conn);
}
dbSettings.insertDefaultDatabaseContent();
@ -138,7 +138,7 @@ final class PostgresEamDb extends AbstractSqlEamDb {
* Setup a connection pool for db connections.
*
*/
private void setupConnectionPool() throws EamDbException {
private void setupConnectionPool() throws CentralRepoException {
connectionPool = new BasicDataSource();
connectionPool.setUsername(dbSettings.getUserName());
connectionPool.setPassword(dbSettings.getPassword());
@ -169,10 +169,10 @@ final class PostgresEamDb extends AbstractSqlEamDb {
*
* @return A connection from the connection pool.
*
* @throws EamDbException
* @throws CentralRepoException
*/
@Override
protected Connection connect(boolean foreignKeys) throws EamDbException {
protected Connection connect(boolean foreignKeys) throws CentralRepoException {
//foreignKeys boolean is ignored for postgres
return connect();
}
@ -182,15 +182,15 @@ final class PostgresEamDb extends AbstractSqlEamDb {
*
* @return A connection from the connection pool.
*
* @throws EamDbException
* @throws CentralRepoException
*/
@Messages({"PostgresEamDb.centralRepoDisabled.message=Central Repository module is not enabled.",
"PostgresEamDb.connectionFailed.message=Error getting connection to database."})
@Override
protected Connection connect() throws EamDbException {
protected Connection connect() throws CentralRepoException {
synchronized (this) {
if (!EamDb.isEnabled()) {
throw new EamDbException("Central Repository module is not enabled", Bundle.PostgresEamDb_centralRepoDisabled_message()); // NON-NLS
if (!CentralRepository.isEnabled()) {
throw new CentralRepoException("Central Repository module is not enabled", Bundle.PostgresEamDb_centralRepoDisabled_message()); // NON-NLS
}
if (connectionPool == null) {
@ -200,7 +200,7 @@ final class PostgresEamDb extends AbstractSqlEamDb {
try {
return connectionPool.getConnection();
} catch (SQLException ex) {
throw new EamDbException("Error getting connection from connection pool.", Bundle.PostgresEamDb_connectionFailed_message(), ex); // NON-NLS
throw new CentralRepoException("Error getting connection from connection pool.", Bundle.PostgresEamDb_connectionFailed_message(), ex); // NON-NLS
}
}
@ -217,12 +217,12 @@ final class PostgresEamDb extends AbstractSqlEamDb {
*
* @return the lock, or null if locking is not supported
*
* @throws EamDbException if the coordination service is running but we fail
* @throws CentralRepoException if the coordination service is running but we fail
* to get the lock
*/
@Override
@Messages({"PostgresEamDb.multiUserLockError.message=Error acquiring database lock"})
public CoordinationService.Lock getExclusiveMultiUserDbLock() throws EamDbException {
public CoordinationService.Lock getExclusiveMultiUserDbLock() throws CentralRepoException {
try {
// First check if multi user mode is enabled - if not there's no point trying to get a lock
if (!UserPreferences.getIsMultiUserModeEnabled()) {
@ -235,9 +235,9 @@ final class PostgresEamDb extends AbstractSqlEamDb {
if (lock != null) {
return lock;
}
throw new EamDbException("Error acquiring database lock", Bundle.PostgresEamDb_multiUserLockError_message());
throw new CentralRepoException("Error acquiring database lock", Bundle.PostgresEamDb_multiUserLockError_message());
} catch (InterruptedException ex) {
throw new EamDbException("Error acquiring database lock", Bundle.PostgresEamDb_multiUserLockError_message(), ex);
throw new CentralRepoException("Error acquiring database lock", Bundle.PostgresEamDb_multiUserLockError_message(), ex);
} catch (CoordinationService.CoordinationServiceException ex) {
// This likely just means the coordination service isn't running, which is ok
return null;
@ -257,8 +257,8 @@ final class PostgresEamDb extends AbstractSqlEamDb {
columnExists = resultSet.getBoolean(1);
}
} finally {
EamDbUtil.closeResultSet(resultSet);
EamDbUtil.closeStatement(statement);
CentralRepoDbUtil.closeResultSet(resultSet);
CentralRepoDbUtil.closeStatement(statement);
}
return columnExists;
}

View File

@ -32,7 +32,7 @@ import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.coreutils.ModuleSettings;
import org.sleuthkit.autopsy.coreutils.TextConverter;
import org.sleuthkit.autopsy.coreutils.TextConverterException;
import static org.sleuthkit.autopsy.centralrepository.datamodel.AbstractSqlEamDb.SOFTWARE_CR_DB_SCHEMA_VERSION;
import static org.sleuthkit.autopsy.centralrepository.datamodel.RdbmsCentralRepo.SOFTWARE_CR_DB_SCHEMA_VERSION;
/**
* Settings for the Postgres implementation of the Central Repository database
@ -40,9 +40,9 @@ import static org.sleuthkit.autopsy.centralrepository.datamodel.AbstractSqlEamDb
* NOTE: This is public scope because the options panel calls it directly to
* set/get
*/
public final class PostgresEamDbSettings {
public final class PostgresCentralRepoSettings {
private final static Logger LOGGER = Logger.getLogger(PostgresEamDbSettings.class.getName());
private final static Logger LOGGER = Logger.getLogger(PostgresCentralRepoSettings.class.getName());
private final static String DEFAULT_HOST = ""; // NON-NLS
private final static int DEFAULT_PORT = 5432;
private final static String DEFAULT_DBNAME = "central_repository"; // NON-NLS
@ -60,7 +60,7 @@ public final class PostgresEamDbSettings {
private String userName;
private String password;
public PostgresEamDbSettings() {
public PostgresCentralRepoSettings() {
loadSettings();
}
@ -92,15 +92,15 @@ public final class PostgresEamDbSettings {
try {
String bulkThresholdString = ModuleSettings.getConfigSetting("CentralRepository", "db.postgresql.bulkThreshold"); // NON-NLS
if (bulkThresholdString == null || bulkThresholdString.isEmpty()) {
this.bulkThreshold = AbstractSqlEamDb.DEFAULT_BULK_THRESHHOLD;
this.bulkThreshold = RdbmsCentralRepo.DEFAULT_BULK_THRESHHOLD;
} else {
this.bulkThreshold = Integer.parseInt(bulkThresholdString);
if (getBulkThreshold() <= 0) {
this.bulkThreshold = AbstractSqlEamDb.DEFAULT_BULK_THRESHHOLD;
this.bulkThreshold = RdbmsCentralRepo.DEFAULT_BULK_THRESHHOLD;
}
}
} catch (NumberFormatException ex) {
this.bulkThreshold = AbstractSqlEamDb.DEFAULT_BULK_THRESHHOLD;
this.bulkThreshold = RdbmsCentralRepo.DEFAULT_BULK_THRESHHOLD;
}
userName = ModuleSettings.getConfigSetting("CentralRepository", "db.postgresql.user"); // NON-NLS
@ -193,8 +193,8 @@ public final class PostgresEamDbSettings {
return false;
}
boolean result = EamDbUtil.executeValidationQuery(conn, VALIDATION_QUERY);
EamDbUtil.closeConnection(conn);
boolean result = CentralRepoDbUtil.executeValidationQuery(conn, VALIDATION_QUERY);
CentralRepoDbUtil.closeConnection(conn);
return result;
}
@ -223,9 +223,9 @@ public final class PostgresEamDbSettings {
LOGGER.log(Level.SEVERE, "Failed to execute database existance query.", ex); // NON-NLS
return false;
} finally {
EamDbUtil.closeStatement(ps);
EamDbUtil.closeResultSet(rs);
EamDbUtil.closeConnection(conn);
CentralRepoDbUtil.closeStatement(ps);
CentralRepoDbUtil.closeResultSet(rs);
CentralRepoDbUtil.closeConnection(conn);
}
return false;
}
@ -242,9 +242,9 @@ public final class PostgresEamDbSettings {
return false;
}
boolean result = EamDbUtil.schemaVersionIsSet(conn);
boolean result = CentralRepoDbUtil.schemaVersionIsSet(conn);
EamDbUtil.closeConnection(conn);
CentralRepoDbUtil.closeConnection(conn);
return result;
}
@ -263,7 +263,7 @@ public final class PostgresEamDbSettings {
LOGGER.log(Level.SEVERE, "Failed to execute create database statement.", ex); // NON-NLS
return false;
} finally {
EamDbUtil.closeConnection(conn);
CentralRepoDbUtil.closeConnection(conn);
}
return true;
@ -284,7 +284,7 @@ public final class PostgresEamDbSettings {
LOGGER.log(Level.SEVERE, "Failed to execute drop database statement.", ex); // NON-NLS
return false;
} finally {
EamDbUtil.closeConnection(conn);
CentralRepoDbUtil.closeConnection(conn);
}
return true;
@ -420,10 +420,10 @@ public final class PostgresEamDbSettings {
* name column could be the primary key.
*/
stmt.execute("CREATE TABLE db_info (id SERIAL, name TEXT UNIQUE NOT NULL, value TEXT NOT NULL)");
stmt.execute("INSERT INTO db_info (name, value) VALUES ('" + AbstractSqlEamDb.SCHEMA_MAJOR_VERSION_KEY + "', '" + SOFTWARE_CR_DB_SCHEMA_VERSION.getMajor() + "')");
stmt.execute("INSERT INTO db_info (name, value) VALUES ('" + AbstractSqlEamDb.SCHEMA_MINOR_VERSION_KEY + "', '" + SOFTWARE_CR_DB_SCHEMA_VERSION.getMinor() + "')");
stmt.execute("INSERT INTO db_info (name, value) VALUES ('" + AbstractSqlEamDb.CREATION_SCHEMA_MAJOR_VERSION_KEY + "', '" + SOFTWARE_CR_DB_SCHEMA_VERSION.getMajor() + "')");
stmt.execute("INSERT INTO db_info (name, value) VALUES ('" + AbstractSqlEamDb.CREATION_SCHEMA_MINOR_VERSION_KEY + "', '" + SOFTWARE_CR_DB_SCHEMA_VERSION.getMinor() + "')");
stmt.execute("INSERT INTO db_info (name, value) VALUES ('" + RdbmsCentralRepo.SCHEMA_MAJOR_VERSION_KEY + "', '" + SOFTWARE_CR_DB_SCHEMA_VERSION.getMajor() + "')");
stmt.execute("INSERT INTO db_info (name, value) VALUES ('" + RdbmsCentralRepo.SCHEMA_MINOR_VERSION_KEY + "', '" + SOFTWARE_CR_DB_SCHEMA_VERSION.getMinor() + "')");
stmt.execute("INSERT INTO db_info (name, value) VALUES ('" + RdbmsCentralRepo.CREATION_SCHEMA_MAJOR_VERSION_KEY + "', '" + SOFTWARE_CR_DB_SCHEMA_VERSION.getMajor() + "')");
stmt.execute("INSERT INTO db_info (name, value) VALUES ('" + RdbmsCentralRepo.CREATION_SCHEMA_MINOR_VERSION_KEY + "', '" + SOFTWARE_CR_DB_SCHEMA_VERSION.getMinor() + "')");
// Create a separate instance and reference table for each correlation type
List<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;
}

View File

@ -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 RdbmsCentralRepo {
private final static Logger LOGGER = Logger.getLogger(SqliteEamDb.class.getName());
private final static Logger LOGGER = Logger.getLogger(SqliteCentralRepo.class.getName());
private static SqliteEamDb instance;
private static SqliteCentralRepo instance;
private BasicDataSource connectionPool = null;
private final SqliteEamDbSettings dbSettings;
private final SqliteCentralRepoSettings dbSettings;
// While the Sqlite database should only be used for single users, it is still
// possible for multiple threads to attempt to write to the database simultaneously.
@ -58,12 +58,12 @@ final class SqliteEamDb extends AbstractSqlEamDb {
*
* @return the singleton instance of SqliteEamDb
*
* @throws EamDbException if one or more default correlation type(s) have an
* @throws CentralRepoException if one or more default correlation type(s) have an
* invalid db table name.
*/
public synchronized static SqliteEamDb getInstance() throws EamDbException {
public synchronized static SqliteCentralRepo getInstance() throws CentralRepoException {
if (instance == null) {
instance = new SqliteEamDb();
instance = new SqliteCentralRepo();
}
return instance;
@ -71,17 +71,17 @@ final class SqliteEamDb extends AbstractSqlEamDb {
/**
*
* @throws EamDbException if the AbstractSqlEamDb class has one or more
* @throws CentralRepoException if the AbstractSqlEamDb class has one or more
* default correlation type(s) having an invalid db
* table name.
*/
private SqliteEamDb() throws EamDbException {
dbSettings = new SqliteEamDbSettings();
private SqliteCentralRepo() throws CentralRepoException {
dbSettings = new SqliteCentralRepoSettings();
bulkArtifactsThreshold = dbSettings.getBulkThreshold();
}
@Override
public void shutdownConnections() throws EamDbException {
public void shutdownConnections() throws CentralRepoException {
try {
synchronized (this) {
if (null != connectionPool) {
@ -91,7 +91,7 @@ final class SqliteEamDb extends AbstractSqlEamDb {
clearCaches();
}
} catch (SQLException ex) {
throw new EamDbException("Failed to close existing database connections.", ex); // NON-NLS
throw new CentralRepoException("Failed to close existing database connections.", ex); // NON-NLS
}
}
@ -111,7 +111,7 @@ final class SqliteEamDb extends AbstractSqlEamDb {
}
@Override
public void reset() throws EamDbException {
public void reset() throws CentralRepoException {
try {
acquireExclusiveLock();
@ -141,7 +141,7 @@ final class SqliteEamDb extends AbstractSqlEamDb {
} catch (SQLException ex) {
LOGGER.log(Level.WARNING, "Failed to reset database.", ex);
} finally {
EamDbUtil.closeConnection(conn);
CentralRepoDbUtil.closeConnection(conn);
}
dbSettings.insertDefaultDatabaseContent();
@ -155,10 +155,10 @@ final class SqliteEamDb extends AbstractSqlEamDb {
*
*/
@Messages({"SqliteEamDb.databaseMissing.message=Central repository database missing"})
private void setupConnectionPool(boolean foreignKeysEnabled) throws EamDbException {
private void setupConnectionPool(boolean foreignKeysEnabled) throws CentralRepoException {
if (dbSettings.dbFileExists() == false) {
throw new EamDbException("Central repository database missing", Bundle.SqliteEamDb_databaseMissing_message());
throw new CentralRepoException("Central repository database missing", Bundle.SqliteEamDb_databaseMissing_message());
}
connectionPool = new BasicDataSource();
@ -186,15 +186,15 @@ final class SqliteEamDb extends AbstractSqlEamDb {
*
* @return A connection from the connection pool.
*
* @throws EamDbException
* @throws CentralRepoException
*/
@Messages({"SqliteEamDb.connectionFailedMessage.message=Error getting connection to database.",
"SqliteEamDb.centralRepositoryDisabled.message=Central Repository module is not enabled."})
@Override
protected Connection connect(boolean foreignKeys) throws EamDbException {
protected Connection connect(boolean foreignKeys) throws CentralRepoException {
synchronized (this) {
if (!EamDb.isEnabled()) {
throw new EamDbException("Central repository database missing", Bundle.SqliteEamDb_centralRepositoryDisabled_message()); // NON-NLS
if (!CentralRepository.isEnabled()) {
throw new CentralRepoException("Central repository database missing", Bundle.SqliteEamDb_centralRepositoryDisabled_message()); // NON-NLS
}
if (connectionPool == null) {
setupConnectionPool(foreignKeys);
@ -202,7 +202,7 @@ final class SqliteEamDb extends AbstractSqlEamDb {
try {
return connectionPool.getConnection();
} catch (SQLException ex) {
throw new EamDbException("Error getting connection from connection pool.", Bundle.SqliteEamDb_connectionFailedMessage_message(), ex); // NON-NLS
throw new CentralRepoException("Error getting connection from connection pool.", Bundle.SqliteEamDb_connectionFailedMessage_message(), ex); // NON-NLS
}
}
}
@ -213,10 +213,10 @@ final class SqliteEamDb extends AbstractSqlEamDb {
*
* @return A connection from the connection pool.
*
* @throws EamDbException
* @throws CentralRepoException
*/
@Override
protected Connection connect() throws EamDbException {
protected Connection connect() throws CentralRepoException {
return connect(true);
}
@ -232,10 +232,10 @@ final class SqliteEamDb extends AbstractSqlEamDb {
* @param name Key to set
* @param value Value to set
*
* @throws EamDbException
* @throws CentralRepoException
*/
@Override
public void newDbInfo(String name, String value) throws EamDbException {
public void newDbInfo(String name, String value) throws CentralRepoException {
try {
acquireExclusiveLock();
super.newDbInfo(name, value);
@ -251,10 +251,10 @@ final class SqliteEamDb extends AbstractSqlEamDb {
*
* @return value associated with name.
*
* @throws EamDbException
* @throws CentralRepoException
*/
@Override
public String getDbInfo(String name) throws EamDbException {
public String getDbInfo(String name) throws CentralRepoException {
try {
acquireSharedLock();
return super.getDbInfo(name);
@ -269,10 +269,10 @@ final class SqliteEamDb extends AbstractSqlEamDb {
* @param name Name to find
* @param value Value to assign to name.
*
* @throws EamDbException
* @throws CentralRepoException
*/
@Override
public void updateDbInfo(String name, String value) throws EamDbException {
public void updateDbInfo(String name, String value) throws CentralRepoException {
try {
acquireExclusiveLock();
super.updateDbInfo(name, value);
@ -287,7 +287,7 @@ final class SqliteEamDb extends AbstractSqlEamDb {
* @param autopsyCase The case to add
*/
@Override
public CorrelationCase newCase(Case autopsyCase) throws EamDbException {
public CorrelationCase newCase(Case autopsyCase) throws CentralRepoException {
try {
acquireExclusiveLock();
return super.newCase(autopsyCase);
@ -297,7 +297,7 @@ final class SqliteEamDb extends AbstractSqlEamDb {
}
@Override
public void addDataSourceObjectId(int rowId, long dataSourceObjectId) throws EamDbException {
public void addDataSourceObjectId(int rowId, long dataSourceObjectId) throws CentralRepoException {
try {
acquireExclusiveLock();
super.addDataSourceObjectId(rowId, dataSourceObjectId);
@ -314,7 +314,7 @@ final class SqliteEamDb extends AbstractSqlEamDb {
* @param eamCase The case to add
*/
@Override
public CorrelationCase newCase(CorrelationCase eamCase) throws EamDbException {
public CorrelationCase newCase(CorrelationCase eamCase) throws CentralRepoException {
try {
acquireExclusiveLock();
return super.newCase(eamCase);
@ -329,7 +329,7 @@ final class SqliteEamDb extends AbstractSqlEamDb {
* @param eamCase The case to update
*/
@Override
public void updateCase(CorrelationCase eamCase) throws EamDbException {
public void updateCase(CorrelationCase eamCase) throws CentralRepoException {
try {
acquireExclusiveLock();
super.updateCase(eamCase);
@ -346,7 +346,7 @@ final class SqliteEamDb extends AbstractSqlEamDb {
* @return The retrieved case
*/
@Override
public CorrelationCase getCaseByUUID(String caseUUID) throws EamDbException {
public CorrelationCase getCaseByUUID(String caseUUID) throws CentralRepoException {
try {
acquireSharedLock();
return super.getCaseByUUID(caseUUID);
@ -363,7 +363,7 @@ final class SqliteEamDb extends AbstractSqlEamDb {
* @return The retrieved case
*/
@Override
public CorrelationCase getCaseById(int caseId) throws EamDbException {
public CorrelationCase getCaseById(int caseId) throws CentralRepoException {
try {
acquireSharedLock();
return super.getCaseById(caseId);
@ -379,7 +379,7 @@ final class SqliteEamDb extends AbstractSqlEamDb {
* @return List of cases
*/
@Override
public List<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;
}

View File

@ -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.RdbmsCentralRepo.SOFTWARE_CR_DB_SCHEMA_VERSION;
/**
* Settings for the sqlite implementation of the Central Repository database
@ -40,9 +40,9 @@ import static org.sleuthkit.autopsy.centralrepository.datamodel.AbstractSqlEamDb
* NOTE: This is public scope because the options panel calls it directly to
* set/get
*/
public final class SqliteEamDbSettings {
public final class SqliteCentralRepoSettings {
private final static Logger LOGGER = Logger.getLogger(SqliteEamDbSettings.class.getName());
private final static Logger LOGGER = Logger.getLogger(SqliteCentralRepoSettings.class.getName());
private final static String DEFAULT_DBNAME = "central_repository.db"; // NON-NLS
private final static String DEFAULT_DBDIRECTORY = PlatformUtil.getUserDirectory() + File.separator + "central_repository"; // NON-NLS
private final static String JDBC_DRIVER = "org.sqlite.JDBC"; // NON-NLS
@ -60,7 +60,7 @@ public final class SqliteEamDbSettings {
private String dbDirectory;
private int bulkThreshold;
public SqliteEamDbSettings() {
public SqliteCentralRepoSettings() {
loadSettings();
}
@ -78,15 +78,15 @@ public final class SqliteEamDbSettings {
try {
String bulkThresholdString = ModuleSettings.getConfigSetting("CentralRepository", "db.sqlite.bulkThreshold"); // NON-NLS
if (bulkThresholdString == null || bulkThresholdString.isEmpty()) {
this.bulkThreshold = AbstractSqlEamDb.DEFAULT_BULK_THRESHHOLD;
this.bulkThreshold = RdbmsCentralRepo.DEFAULT_BULK_THRESHHOLD;
} else {
this.bulkThreshold = Integer.parseInt(bulkThresholdString);
if (getBulkThreshold() <= 0) {
this.bulkThreshold = AbstractSqlEamDb.DEFAULT_BULK_THRESHHOLD;
this.bulkThreshold = RdbmsCentralRepo.DEFAULT_BULK_THRESHHOLD;
}
}
} catch (NumberFormatException ex) {
this.bulkThreshold = AbstractSqlEamDb.DEFAULT_BULK_THRESHHOLD;
this.bulkThreshold = RdbmsCentralRepo.DEFAULT_BULK_THRESHHOLD;
}
}
@ -211,8 +211,8 @@ public final class SqliteEamDbSettings {
return false;
}
boolean result = EamDbUtil.executeValidationQuery(conn, VALIDATION_QUERY);
EamDbUtil.closeConnection(conn);
boolean result = CentralRepoDbUtil.executeValidationQuery(conn, VALIDATION_QUERY);
CentralRepoDbUtil.closeConnection(conn);
return result;
}
@ -228,8 +228,8 @@ public final class SqliteEamDbSettings {
return false;
}
boolean result = EamDbUtil.schemaVersionIsSet(conn);
EamDbUtil.closeConnection(conn);
boolean result = CentralRepoDbUtil.schemaVersionIsSet(conn);
CentralRepoDbUtil.closeConnection(conn);
return result;
}
@ -369,10 +369,10 @@ public final class SqliteEamDbSettings {
* name column could be the primary key.
*/
stmt.execute("CREATE TABLE db_info (id INTEGER PRIMARY KEY, name TEXT UNIQUE NOT NULL, value TEXT NOT NULL)");
stmt.execute("INSERT INTO db_info (name, value) VALUES ('" + AbstractSqlEamDb.SCHEMA_MAJOR_VERSION_KEY + "', '" + SOFTWARE_CR_DB_SCHEMA_VERSION.getMajor() + "')");
stmt.execute("INSERT INTO db_info (name, value) VALUES ('" + AbstractSqlEamDb.SCHEMA_MINOR_VERSION_KEY + "', '" + SOFTWARE_CR_DB_SCHEMA_VERSION.getMinor() + "')");
stmt.execute("INSERT INTO db_info (name, value) VALUES ('" + AbstractSqlEamDb.CREATION_SCHEMA_MAJOR_VERSION_KEY + "', '" + SOFTWARE_CR_DB_SCHEMA_VERSION.getMajor() + "')");
stmt.execute("INSERT INTO db_info (name, value) VALUES ('" + AbstractSqlEamDb.CREATION_SCHEMA_MINOR_VERSION_KEY + "', '" + SOFTWARE_CR_DB_SCHEMA_VERSION.getMinor() + "')");
stmt.execute("INSERT INTO db_info (name, value) VALUES ('" + RdbmsCentralRepo.SCHEMA_MAJOR_VERSION_KEY + "', '" + SOFTWARE_CR_DB_SCHEMA_VERSION.getMajor() + "')");
stmt.execute("INSERT INTO db_info (name, value) VALUES ('" + RdbmsCentralRepo.SCHEMA_MINOR_VERSION_KEY + "', '" + SOFTWARE_CR_DB_SCHEMA_VERSION.getMinor() + "')");
stmt.execute("INSERT INTO db_info (name, value) VALUES ('" + RdbmsCentralRepo.CREATION_SCHEMA_MAJOR_VERSION_KEY + "', '" + SOFTWARE_CR_DB_SCHEMA_VERSION.getMajor() + "')");
stmt.execute("INSERT INTO db_info (name, value) VALUES ('" + RdbmsCentralRepo.CREATION_SCHEMA_MINOR_VERSION_KEY + "', '" + SOFTWARE_CR_DB_SCHEMA_VERSION.getMinor() + "')");
// Create a separate instance and reference table for each artifact type
List<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
}
}

View File

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

View File

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

View File

@ -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,

View File

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

View File

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

View File

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

View File

@ -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&lt;&gt;(new EamDbPlatformEnum[]{EamDbPlatformEnum.POSTGRESQL, EamDbPlatformEnum.SQLITE})" type="code"/>
<Connection code="new javax.swing.DefaultComboBoxModel&lt;&gt;(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="&lt;EamDbPlatformEnum&gt;"/>
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="&lt;org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoPlatforms&gt;"/>
</AuxValues>
</Component>
<Component class="javax.swing.JLabel" name="lbSingleUserSqLite">
@ -410,4 +410,4 @@
</SubComponents>
</Container>
</SubComponents>
</Form>
</Form>

View File

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

View File

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

View File

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

View File

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

View File

@ -183,7 +183,7 @@
<Property name="selectionMode" type="int" value="0"/>
</Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="&lt;EamOrganization&gt;"/>
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="&lt;org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoOrganization&gt;"/>
</AuxValues>
</Component>
</SubComponents>
@ -357,4 +357,4 @@
</SubComponents>
</Container>
</SubComponents>
</Form>
</Form>

View File

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

View File

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

View File

@ -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()) {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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");
@ -31,8 +31,8 @@ import org.sleuthkit.datamodel.BlackboardArtifact;
import org.sleuthkit.datamodel.BlackboardAttribute;
import org.sleuthkit.datamodel.Content;
import org.sleuthkit.datamodel.TskCoreException;
import org.sleuthkit.datamodel.blackboardutils.FileAttachment;
import org.sleuthkit.datamodel.blackboardutils.MessageAttachments;
import org.sleuthkit.datamodel.blackboardutils.attributes.MessageAttachments.FileAttachment;
import org.sleuthkit.datamodel.blackboardutils.attributes.MessageAttachments;
/**
*

View File

@ -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");
@ -38,8 +38,8 @@ import org.sleuthkit.datamodel.BlackboardArtifact;
import org.sleuthkit.datamodel.BlackboardAttribute;
import org.sleuthkit.datamodel.Content;
import org.sleuthkit.datamodel.TskCoreException;
import org.sleuthkit.datamodel.blackboardutils.FileAttachment;
import org.sleuthkit.datamodel.blackboardutils.MessageAttachments;
import org.sleuthkit.datamodel.blackboardutils.attributes.MessageAttachments.FileAttachment;
import org.sleuthkit.datamodel.blackboardutils.attributes.MessageAttachments;
/**
* Factory for creating thumbnail children nodes.

View File

@ -71,6 +71,9 @@ final class CallLogNode extends BlackboardArtifactNode {
if(phoneNumber == null || phoneNumber.isEmpty()) {
phoneNumber = getAttributeDisplayString(artifact, TSK_PHONE_NUMBER_TO);
}
if(phoneNumber == null || phoneNumber.isEmpty()) {
phoneNumber = getAttributeDisplayString(artifact, TSK_PHONE_NUMBER);
}
long duration = -1;
try{

View File

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

View File

@ -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");
@ -40,7 +40,7 @@ import org.sleuthkit.autopsy.datamodel.BlackboardArtifactNode;
import static org.sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE.TSK_EMAIL_MSG;
import static org.sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE.TSK_MESSAGE;
import org.sleuthkit.datamodel.BlackboardAttribute;
import org.sleuthkit.datamodel.blackboardutils.MessageAttachments;
import org.sleuthkit.datamodel.blackboardutils.attributes.MessageAttachments;
/**
* Wraps a BlackboardArtifact as an AbstractNode for use in an OutlookView

View File

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

View File

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

View File

@ -87,9 +87,9 @@ HtmlPanel.showImagesToggleButton.text=Download Images
MediaViewImagePanel.tagsMenu.text_1=Tags Menu
MediaPlayerPanel.progressLabel.text=00:00:00/00:00:00
MediaPlayerPanel.audioSlider.toolTipText=
MediaPlayerPanel.rewindButton.text=\u2bc7\u2bc7
MediaPlayerPanel.fastForwardButton.text=\u2bc8\u2bc8
MediaPlayerPanel.playButton.text=\u25ba
MediaPlayerPanel.rewindButton.text=
MediaPlayerPanel.fastForwardButton.text=
MediaPlayerPanel.playButton.text=
MediaPlayerPanel.infoLabel.text=No Errors
MediaPlayerPanel.VolumeIcon.text=Volume
MediaPlayerPanel.playBackSpeedLabel.text=Speed:

View File

@ -158,9 +158,9 @@ HtmlPanel.showImagesToggleButton.text=Download Images
MediaViewImagePanel.tagsMenu.text_1=Tags Menu
MediaPlayerPanel.progressLabel.text=00:00:00/00:00:00
MediaPlayerPanel.audioSlider.toolTipText=
MediaPlayerPanel.rewindButton.text=\u2bc7\u2bc7
MediaPlayerPanel.fastForwardButton.text=\u2bc8\u2bc8
MediaPlayerPanel.playButton.text=\u25ba
MediaPlayerPanel.rewindButton.text=
MediaPlayerPanel.fastForwardButton.text=
MediaPlayerPanel.playButton.text=
MediaPlayerPanel.infoLabel.text=No Errors
MediaPlayerPanel.VolumeIcon.text=Volume
MediaPlayerPanel.playBackSpeedLabel.text=Speed:

View File

@ -41,7 +41,7 @@
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="131" max="32767" attributes="0"/>
<EmptySpace min="0" pref="117" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
</Layout>
@ -83,7 +83,7 @@
<EmptySpace min="-2" pref="5" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="buttonPanel" max="32767" attributes="0"/>
<Component id="playBackPanel" pref="0" max="32767" attributes="0"/>
<Component id="playBackPanel" max="32767" attributes="0"/>
</Group>
<EmptySpace min="-2" pref="14" max="-2" attributes="0"/>
<Component id="infoLabel" min="-2" max="-2" attributes="0"/>
@ -107,7 +107,7 @@
</Property>
</Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_InitCodePost" type="java.lang.String" value="progressSlider.setUI(new CircularJSliderUI(progressSlider, new CircularJSliderConfiguration(new Dimension(18,18))));"/>
<AuxValue name="JavaCodeGenerator_InitCodePost" type="java.lang.String" value="progressSlider.setUI(new CircularJSliderUI(progressSlider, new Dimension(18,18)));"/>
</AuxValues>
</Component>
<Component class="javax.swing.JLabel" name="progressLabel">
@ -123,9 +123,21 @@
<SubComponents>
<Component class="javax.swing.JButton" name="playButton">
<Properties>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/org/sleuthkit/autopsy/contentviewers/images/Play-arrow-01.png"/>
</Property>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/contentviewers/Bundle.properties" key="MediaPlayerPanel.playButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[53, 29]"/>
</Property>
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[53, 29]"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[49, 29]"/>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="playButtonActionPerformed"/>
@ -138,6 +150,9 @@
</Component>
<Component class="javax.swing.JButton" name="fastForwardButton">
<Properties>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/org/sleuthkit/autopsy/contentviewers/images/Fast-forward-01.png"/>
</Property>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/contentviewers/Bundle.properties" key="MediaPlayerPanel.fastForwardButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
@ -153,6 +168,9 @@
</Component>
<Component class="javax.swing.JButton" name="rewindButton">
<Properties>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/org/sleuthkit/autopsy/contentviewers/images/Fast-rewind-01.png"/>
</Property>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/contentviewers/Bundle.properties" key="MediaPlayerPanel.rewindButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
@ -172,6 +190,15 @@
<ResourceString bundle="org/sleuthkit/autopsy/contentviewers/Bundle.properties" key="MediaPlayerPanel.VolumeIcon.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
<Property name="horizontalTextPosition" type="int" value="2"/>
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[34, 29]"/>
</Property>
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[34, 29]"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[34, 19]"/>
</Property>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
@ -188,15 +215,19 @@
<ResourceString bundle="org/sleuthkit/autopsy/contentviewers/Bundle.properties" key="MediaPlayerPanel.audioSlider.toolTipText" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
<Property name="value" type="int" value="25"/>
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[32767, 19]"/>
</Property>
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[200, 21]"/>
<Dimension value="[200, 19]"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[200, 21]"/>
<Dimension value="[200, 30]"/>
</Property>
<Property name="requestFocusEnabled" type="boolean" value="false"/>
</Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_InitCodePost" type="java.lang.String" value="audioSlider.setUI(new CircularJSliderUI(audioSlider, new CircularJSliderConfiguration(new Dimension(15,15))));"/>
<AuxValue name="JavaCodeGenerator_InitCodePost" type="java.lang.String" value="audioSlider.setUI(new CircularJSliderUI(audioSlider, new Dimension(15,15)));"/>
</AuxValues>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
@ -223,7 +254,7 @@
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="playBackSpeedLabel" min="-2" max="-2" attributes="0"/>
<Component id="playBackSpeedLabel" min="-2" pref="34" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Component id="playBackSpeedComboBox" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="13" max="-2" attributes="0"/>
@ -233,12 +264,15 @@
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="6" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="playBackSpeedComboBox" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="playBackSpeedLabel" alignment="3" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="7" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Group type="102" attributes="0">
<EmptySpace min="2" pref="2" max="-2" attributes="0"/>
<Component id="playBackSpeedLabel" max="32767" attributes="0"/>
</Group>
<Component id="playBackSpeedComboBox" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="32767" attributes="0"/>
<EmptySpace min="-2" pref="10" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
@ -260,14 +294,15 @@
</Property>
<Property name="selectedIndex" type="int" value="3"/>
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[53, 23]"/>
<Dimension value="[53, 29]"/>
</Property>
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[53, 23]"/>
<Dimension value="[53, 29]"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[53, 23]"/>
<Dimension value="[53, 29]"/>
</Property>
<Property name="requestFocusEnabled" type="boolean" value="false"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="playBackSpeedComboBoxActionPerformed"/>
@ -281,6 +316,15 @@
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/contentviewers/Bundle.properties" key="MediaPlayerPanel.playBackSpeedLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[34, 19]"/>
</Property>
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[34, 19]"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[34, 19]"/>
</Property>
</Properties>
</Component>
</SubComponents>

View File

@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2013-2019 Basis Technology Corp.
* Copyright 2013-2020 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -29,6 +29,7 @@ import java.awt.RenderingHints;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.io.File;
import java.io.IOException;
import java.util.Arrays;
@ -61,6 +62,7 @@ import org.sleuthkit.autopsy.modules.filetypeid.FileTypeDetector;
import org.sleuthkit.datamodel.AbstractFile;
import org.sleuthkit.datamodel.TskData;
import javafx.embed.swing.JFXPanel;
import javax.swing.ImageIcon;
import javax.swing.JComponent;
import javax.swing.JSlider;
import javax.swing.SwingUtilities;
@ -110,7 +112,7 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie
".wav",
".webm",
".wma",
".wmv",}; //NON-NLS
".wmv"}; //NON-NLS
private static final List<String> MIME_TYPES = Arrays.asList(
"video/3gpp",
"video/3gpp2",
@ -201,15 +203,18 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie
private static final int PROGRESS_SLIDER_SIZE = 2000;
private static final int SKIP_IN_SECONDS = 30;
private final ImageIcon playIcon = new ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/contentviewers/images/Play-arrow-01.png"));
private final ImageIcon pauseIcon = new ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/contentviewers/images/Pause-01.png"));
private ExtractMedia extractMediaWorker;
//Serialize setting the value of the Video progress slider.
//The slider is a shared resource between the VideoPanelUpdater
//and the TrackListener of the JSliderUI.
//and the TrackListener on the slider itself.
private final Semaphore sliderLock;
/**
* Creates new form MediaViewVideoPanel
* Creates a new MediaPlayerPanel
*/
public MediaPlayerPanel() throws GstException, UnsatisfiedLinkError {
initComponents();
@ -217,12 +222,12 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie
//True for fairness. In other words,
//acquire() calls are processed in order of invocation.
sliderLock = new Semaphore(1, true);
/**
* See JIRA-5888 for details. Initializing gstreamer here is more stable
* on Windows.
*/
if(PlatformUtil.isWindowsOS()) {
if (PlatformUtil.isWindowsOS()) {
Gst.init();
}
}
@ -256,7 +261,37 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie
}
}
});
//Manage the audio level when the user is adjusting the volumn slider
//Manage the video while the user is performing actions on the track.
progressSlider.addMouseListener(new MouseListener() {
private State previousState = State.NULL;
@Override
public void mousePressed(MouseEvent e) {
previousState = gstPlayBin.getState();
gstPlayBin.pause();
}
@Override
public void mouseReleased(MouseEvent e) {
if(previousState.equals(State.PLAYING)) {
gstPlayBin.play();
}
previousState = State.NULL;
}
@Override
public void mouseClicked(MouseEvent e) {
}
@Override
public void mouseEntered(MouseEvent e) {
}
@Override
public void mouseExited(MouseEvent e) {
}
});
//Manage the audio level when the user is adjusting the volume slider
audioSlider.addChangeListener((ChangeEvent event) -> {
if (audioSlider.getValueIsAdjusting()) {
double audioPercent = (audioSlider.getValue() * 2.0) / 100.0;
@ -280,11 +315,11 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie
public void stateChanged(GstObject go, State oldState, State currentState, State pendingState) {
if (State.PLAYING.equals(currentState)) {
SwingUtilities.invokeLater(() -> {
playButton.setText("||");
playButton.setIcon(pauseIcon);
});
} else {
SwingUtilities.invokeLater(() -> {
playButton.setText("");
playButton.setIcon(playIcon);
});
}
}
@ -514,7 +549,7 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie
// Initialize Gstreamer. It is safe to call this for every file.
// It was moved here from the constructor because having it happen
// earlier resulted in conflicts on Linux. See JIRA-5888.
if(!PlatformUtil.isWindowsOS()) {
if (!PlatformUtil.isWindowsOS()) {
Gst.init();
}
@ -585,63 +620,15 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie
}
}
/**
* Represents the default configuration for the circular JSliderUI.
*/
private class CircularJSliderConfiguration {
//Thumb configurations
private final Color thumbColor;
private final Dimension thumbDimension;
//Track configurations
//Progress bar can be bisected into a seen group
//and an unseen group.
private final Color unseen;
private final Color seen;
/**
* Default configuration
*
* JSlider is light blue RGB(0,130,255). Seen track is light blue
* RGB(0,130,255). Unseen track is light grey RGB(192, 192, 192).
*
* @param thumbDimension Size of the oval thumb.
*/
public CircularJSliderConfiguration(Dimension thumbDimension) {
Color lightBlue = new Color(0, 130, 255);
seen = lightBlue;
unseen = Color.LIGHT_GRAY;
thumbColor = lightBlue;
this.thumbDimension = new Dimension(thumbDimension);
}
public Color getThumbColor() {
return thumbColor;
}
public Color getUnseenTrackColor() {
return unseen;
}
public Color getSeenTrackColor() {
return seen;
}
public Dimension getThumbDimension() {
return new Dimension(thumbDimension);
}
}
/**
* Custom view for the JSlider.
*/
private class CircularJSliderUI extends BasicSliderUI {
private final CircularJSliderConfiguration config;
private final Dimension thumbDimension;
private final Color thumbColor;
private final Color trackUnseen;
private final Color trackSeen;
/**
* Creates a custom view for the JSlider. This view draws a blue oval
@ -649,21 +636,27 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie
* the thumb progresses.
*
* @param slider JSlider component
* @param config Configuration object. Contains info about thumb
* dimensions and colors.
* @param thumbDimension
*/
public CircularJSliderUI(JSlider slider, CircularJSliderConfiguration config) {
public CircularJSliderUI(JSlider slider, Dimension thumbDimension) {
super(slider);
this.config = config;
this.thumbDimension = thumbDimension;
//Configure track and thumb colors.
Color lightBlue = new Color(0, 130, 255);
thumbColor = lightBlue;
trackSeen = lightBlue;
trackUnseen = Color.LIGHT_GRAY;
}
@Override
protected Dimension getThumbSize() {
return config.getThumbDimension();
return new Dimension(thumbDimension);
}
/**
* Modifies the View to be an oval rather than the rectangle Controller.
* Modifies the View to be an oval rather than the underlying
* rectangle Controller.
*/
@Override
public void paintThumb(Graphics graphic) {
@ -673,8 +666,7 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie
//Change the thumb view from the rectangle
//controller to an oval.
graphic.setColor(config.getThumbColor());
Dimension thumbDimension = config.getThumbDimension();
graphic.setColor(thumbColor);
graphic.fillOval(thumb.x, thumb.y, thumbDimension.width, thumbDimension.height);
//Preserve the graphics original color
@ -697,12 +689,12 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie
Color original = graphic.getColor();
//Paint the seen side
graphic.setColor(config.getSeenTrackColor());
graphic.setColor(trackSeen);
graphic.drawLine(track.x, track.y + track.height / 2,
thumbX, thumbY + track.height / 2);
//Paint the unseen side
graphic.setColor(config.getUnseenTrackColor());
graphic.setColor(trackUnseen);
graphic.drawLine(thumbX, thumbY + track.height / 2,
track.x + track.width, track.y + track.height / 2);
@ -712,7 +704,26 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie
@Override
protected TrackListener createTrackListener(JSlider slider) {
return new CustomTrackListener();
/**
* This track listener will force the thumb to be snapped to the mouse
* location. This makes grabbing and dragging the JSlider much easier.
* Using the default track listener, the user would have to click
* exactly on the slider thumb to drag it. Now the thumb positions
* itself under the mouse so that it can always be dragged.
*/
return new TrackListener() {
@Override
public void mousePressed(MouseEvent e) {
if (!slider.isEnabled() || !SwingUtilities.isLeftMouseButton(e)) {
return;
}
//Snap the thumb to position of the mouse
scrollDueToClickInTrack(0);
//Handle the event as normal.
super.mousePressed(e);
}
};
}
@Override
@ -726,7 +737,7 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie
int value = this.valueForXPosition(mousePosition.x);
//Lock the slider down, which is a shared resource.
//The VideoPanelUpdater (dedicated thread) keeps the
//The VideoPanelUpdater keeps the
//slider in sync with the video position, so without
//proper locking our change could be overwritten.
sliderLock.acquireUninterruptibly();
@ -749,43 +760,6 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie
super.update(graphic, component);
}
/**
* This track listener will force the thumb to be snapped to the mouse
* location. This makes grabbing and dragging the JSlider much easier.
* Using the default track listener, the user would have to click
* exactly on the slider thumb to drag it. Now the thumb positions
* itself under the mouse so that it can always be dragged.
*/
private class CustomTrackListener extends CircularJSliderUI.TrackListener {
@Override
public void mousePressed(MouseEvent e) {
if (!slider.isEnabled() || !SwingUtilities.isLeftMouseButton(e)) {
return;
}
//Snap the thumb to position of the mouse
scrollDueToClickInTrack(0);
//Pause the video for convenience
gstPlayBin.pause();
//Handle the event as normal.
super.mousePressed(e);
}
@Override
public void mouseReleased(MouseEvent e) {
if (!slider.isEnabled() || !SwingUtilities.isLeftMouseButton(e)) {
return;
}
super.mouseReleased(e);
//Unpause once the mouse has been released.
gstPlayBin.play();
}
}
}
/**
@ -821,7 +795,7 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie
);
videoPanelLayout.setVerticalGroup(
videoPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 131, Short.MAX_VALUE)
.addGap(0, 117, Short.MAX_VALUE)
);
progressSlider.setValue(0);
@ -829,13 +803,17 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie
progressSlider.setDoubleBuffered(true);
progressSlider.setMinimumSize(new java.awt.Dimension(36, 21));
progressSlider.setPreferredSize(new java.awt.Dimension(200, 21));
progressSlider.setUI(new CircularJSliderUI(progressSlider, new CircularJSliderConfiguration(new Dimension(18,18))));
progressSlider.setUI(new CircularJSliderUI(progressSlider, new Dimension(18,18)));
org.openide.awt.Mnemonics.setLocalizedText(progressLabel, org.openide.util.NbBundle.getMessage(MediaPlayerPanel.class, "MediaPlayerPanel.progressLabel.text")); // NOI18N
buttonPanel.setLayout(new java.awt.GridBagLayout());
playButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/contentviewers/images/Play-arrow-01.png"))); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(playButton, org.openide.util.NbBundle.getMessage(MediaPlayerPanel.class, "MediaPlayerPanel.playButton.text")); // NOI18N
playButton.setMaximumSize(new java.awt.Dimension(53, 29));
playButton.setMinimumSize(new java.awt.Dimension(53, 29));
playButton.setPreferredSize(new java.awt.Dimension(49, 29));
playButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
playButtonActionPerformed(evt);
@ -849,6 +827,7 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie
gridBagConstraints.insets = new java.awt.Insets(5, 6, 0, 0);
buttonPanel.add(playButton, gridBagConstraints);
fastForwardButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/contentviewers/images/Fast-forward-01.png"))); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(fastForwardButton, org.openide.util.NbBundle.getMessage(MediaPlayerPanel.class, "MediaPlayerPanel.fastForwardButton.text")); // NOI18N
fastForwardButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
@ -862,6 +841,7 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie
gridBagConstraints.insets = new java.awt.Insets(5, 6, 0, 0);
buttonPanel.add(fastForwardButton, gridBagConstraints);
rewindButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/contentviewers/images/Fast-rewind-01.png"))); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(rewindButton, org.openide.util.NbBundle.getMessage(MediaPlayerPanel.class, "MediaPlayerPanel.rewindButton.text")); // NOI18N
rewindButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
@ -877,6 +857,9 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie
org.openide.awt.Mnemonics.setLocalizedText(VolumeIcon, org.openide.util.NbBundle.getMessage(MediaPlayerPanel.class, "MediaPlayerPanel.VolumeIcon.text")); // NOI18N
VolumeIcon.setHorizontalTextPosition(javax.swing.SwingConstants.LEFT);
VolumeIcon.setMaximumSize(new java.awt.Dimension(34, 29));
VolumeIcon.setMinimumSize(new java.awt.Dimension(34, 29));
VolumeIcon.setPreferredSize(new java.awt.Dimension(34, 19));
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 3;
gridBagConstraints.gridy = 0;
@ -891,9 +874,11 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie
audioSlider.setMinorTickSpacing(5);
audioSlider.setToolTipText(org.openide.util.NbBundle.getMessage(MediaPlayerPanel.class, "MediaPlayerPanel.audioSlider.toolTipText")); // NOI18N
audioSlider.setValue(25);
audioSlider.setMinimumSize(new java.awt.Dimension(200, 21));
audioSlider.setPreferredSize(new java.awt.Dimension(200, 21));
audioSlider.setUI(new CircularJSliderUI(audioSlider, new CircularJSliderConfiguration(new Dimension(15,15))));
audioSlider.setMaximumSize(new java.awt.Dimension(32767, 19));
audioSlider.setMinimumSize(new java.awt.Dimension(200, 19));
audioSlider.setPreferredSize(new java.awt.Dimension(200, 30));
audioSlider.setRequestFocusEnabled(false);
audioSlider.setUI(new CircularJSliderUI(audioSlider, new Dimension(15,15)));
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 4;
gridBagConstraints.gridy = 0;
@ -909,9 +894,10 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie
playBackSpeedComboBox.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "0.25x", "0.50x", "0.75x", "1x", "1.25x", "1.50x", "1.75x", "2x" }));
playBackSpeedComboBox.setSelectedIndex(3);
playBackSpeedComboBox.setMaximumSize(new java.awt.Dimension(53, 23));
playBackSpeedComboBox.setMinimumSize(new java.awt.Dimension(53, 23));
playBackSpeedComboBox.setPreferredSize(new java.awt.Dimension(53, 23));
playBackSpeedComboBox.setMaximumSize(new java.awt.Dimension(53, 29));
playBackSpeedComboBox.setMinimumSize(new java.awt.Dimension(53, 29));
playBackSpeedComboBox.setPreferredSize(new java.awt.Dimension(53, 29));
playBackSpeedComboBox.setRequestFocusEnabled(false);
playBackSpeedComboBox.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
playBackSpeedComboBoxActionPerformed(evt);
@ -919,13 +905,16 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie
});
org.openide.awt.Mnemonics.setLocalizedText(playBackSpeedLabel, org.openide.util.NbBundle.getMessage(MediaPlayerPanel.class, "MediaPlayerPanel.playBackSpeedLabel.text")); // NOI18N
playBackSpeedLabel.setMaximumSize(new java.awt.Dimension(34, 19));
playBackSpeedLabel.setMinimumSize(new java.awt.Dimension(34, 19));
playBackSpeedLabel.setPreferredSize(new java.awt.Dimension(34, 19));
javax.swing.GroupLayout playBackPanelLayout = new javax.swing.GroupLayout(playBackPanel);
playBackPanel.setLayout(playBackPanelLayout);
playBackPanelLayout.setHorizontalGroup(
playBackPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(playBackPanelLayout.createSequentialGroup()
.addComponent(playBackSpeedLabel)
.addComponent(playBackSpeedLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(playBackSpeedComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(13, 13, 13))
@ -933,11 +922,13 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie
playBackPanelLayout.setVerticalGroup(
playBackPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(playBackPanelLayout.createSequentialGroup()
.addGap(6, 6, 6)
.addGroup(playBackPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(playBackSpeedComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(playBackSpeedLabel))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGap(7, 7, 7)
.addGroup(playBackPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(playBackPanelLayout.createSequentialGroup()
.addGap(2, 2, 2)
.addComponent(playBackSpeedLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addComponent(playBackSpeedComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(10, 10, 10))
);
javax.swing.GroupLayout controlPanelLayout = new javax.swing.GroupLayout(controlPanel);
@ -969,7 +960,7 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie
.addGap(5, 5, 5)
.addGroup(controlPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(buttonPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(playBackPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE))
.addComponent(playBackPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGap(14, 14, 14)
.addComponent(infoLabel))
);
@ -1013,13 +1004,21 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie
long currentTime = gstPlayBin.queryPosition(TimeUnit.NANOSECONDS);
//Skip 30 seconds.
long fastForwardDelta = TimeUnit.NANOSECONDS.convert(SKIP_IN_SECONDS, TimeUnit.SECONDS);
//Ignore fast forward requests if there are less than 30 seconds left.
if (currentTime + fastForwardDelta >= duration) {
//Don't allow skipping within 2 seconds of video ending. Skipping right to
//the end causes undefined behavior for some gstreamer plugins.
long twoSecondsInNano = TimeUnit.NANOSECONDS.convert(2, TimeUnit.SECONDS);
if((duration - currentTime) <= twoSecondsInNano) {
return;
}
long newTime;
if (currentTime + fastForwardDelta >= duration) {
//If there are less than 30 seconds left, only fast forward to the midpoint.
newTime = currentTime + (duration - currentTime)/2;
} else {
newTime = currentTime + fastForwardDelta;
}
long newTime = currentTime + fastForwardDelta;
double playBackRate = getPlayBackRate();
gstPlayBin.seek(playBackRate,
Format.TIME,

View File

@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2017-2019 Basis Technology Corp.
* Copyright 2017-2020 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -72,10 +72,10 @@ import static org.sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE.TSK_TEX
import org.sleuthkit.datamodel.Content;
import org.sleuthkit.datamodel.SleuthkitCase;
import org.sleuthkit.datamodel.TskCoreException;
import org.sleuthkit.datamodel.blackboardutils.FileAttachment;
import org.sleuthkit.datamodel.blackboardutils.MessageAttachments;
import org.sleuthkit.datamodel.blackboardutils.Attachment;
import org.sleuthkit.datamodel.blackboardutils.URLAttachment;
import org.sleuthkit.datamodel.blackboardutils.attributes.MessageAttachments;
import org.sleuthkit.datamodel.blackboardutils.attributes.MessageAttachments.FileAttachment;
import org.sleuthkit.datamodel.blackboardutils.attributes.MessageAttachments.Attachment;
import org.sleuthkit.datamodel.blackboardutils.attributes.MessageAttachments.URLAttachment;
/**
* Shows SMS/MMS/EMail messages

Binary file not shown.

After

Width:  |  Height:  |  Size: 415 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 436 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 247 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 418 B

View File

@ -3,7 +3,7 @@
<name unique="geolocation"/>
<kind type="editor"/>
<state type="separated"/>
<bounds x="76" y="68" width="500" height="500"/>
<bounds x="76" y="68" width="800" height="500"/>
<frame state="0"/>
<empty-behavior permanent="false"/>

View File

@ -341,9 +341,9 @@
<attr name="instanceCreate" methodvalue="org.sleuthkit.autopsy.report.modules.stix.STIXReportModule.getDefault"/>
<attr name="position" intvalue="910"/>
</file>
<file name="org-sleuthkit-autopsy-report-modules-caseuco-CaseUcoReport.instance">
<file name="org-sleuthkit-autopsy-report-modules-caseuco-CaseUcoReportModule.instance">
<attr name="instanceOf" stringvalue="org.sleuthkit.autopsy.report.GeneralReportModule"/>
<attr name="instanceCreate" methodvalue="org.sleuthkit.autopsy.report.modules.caseuco.CaseUcoReport.getDefault"/>
<attr name="instanceCreate" methodvalue="org.sleuthkit.autopsy.report.modules.caseuco.CaseUcoReportModule.getDefault"/>
<attr name="position" intvalue="911"/>
</file>
<!--<folder name="JavaHelp">

View File

@ -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.

View File

@ -21,6 +21,7 @@ package org.sleuthkit.autopsy.coreutils;
import java.io.File;
import java.io.IOException;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
@ -286,6 +287,16 @@ public final class AppSQLiteDB {
}
}
/**
* Returns connection meta data.
*
* @return DatabaseMetaData
* @throws SQLException
*/
public DatabaseMetaData getConnectionMetadata() throws SQLException {
return connection.getMetaData();
}
/**
* Searches for a meta file associated with the give SQLite database. If
* found, it copies this file into the temp directory of the current case.

View File

@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2011 Basis Technology Corp.
* Copyright 2012-2020 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -23,6 +23,7 @@ import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.file.Paths;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
@ -30,47 +31,57 @@ import java.util.Set;
import java.util.logging.Level;
/**
* This class contains the framework to read, add, update, and remove from the
* property files located at %USERDIR%/Config/x.properties
* Provides utility methods for creating, updating, and deleting Java properties
* files with paths such as %USERDIR%/Config/[module name].properties, where
* "module name" is intended to be a module name and the properties file is
* intended to be a settings file for the module.
*
* Very coarse-grained thread safety is provided by these utilities if all
* modules confine themselves to their use when manipulating their settings
* files, with the consequence of serializing all such operations across the
* entire application.
*
* TODO (JIRA-5964): The error handling in this class is not consistent with
* Autopsy error handling policy.
*/
public class ModuleSettings {
// The directory where the properties file is located
private final static String moduleDirPath = PlatformUtil.getUserConfigDirectory();
private final static Logger logger = Logger.getLogger(ModuleSettings.class.getName());
private final static String MODULE_DIR_PATH = PlatformUtil.getUserConfigDirectory();
private final static String SETTINGS_FILE_EXT = ".properties";
/*
* These SHOULD NOT be public and DO NOT belong in this file. They are being
* retained only for the sake of backwards compatibility.
*/
public static final String DEFAULT_CONTEXT = "GeneralContext"; //NON-NLS
public static final String MAIN_SETTINGS = "Case"; //NON-NLS
public static final String CURRENT_CASE_TYPE = "Current_Case_Type"; //NON-NLS
/**
* the constructor
*/
private ModuleSettings() {
}
/**
* Makes a new config file of the specified name. Do not include the
* extension.
* Makes a new settings file for a module.
*
* @param moduleName - The name of the config file to make
* @param moduleName The module name.
*
* @return True if successfully created, false if already exists or an error
* is thrown.
* @return True if the settings file was created, false if the file already
* existed or could not be created.
*/
public static boolean makeConfigFile(String moduleName) {
public static synchronized boolean makeConfigFile(String moduleName) {
if (!configExists(moduleName)) {
File propPath = new File(moduleDirPath + File.separator + moduleName + ".properties");
File propPath = new File(getSettingsFilePath(moduleName));
File parent = new File(propPath.getParent());
if (!parent.exists()) {
parent.mkdirs();
}
Properties props = new Properties();
try {
propPath.createNewFile();
FileOutputStream fos = new FileOutputStream(propPath);
props.store(fos, "");
fos.close();
} catch (IOException e) {
Logger.getLogger(ModuleSettings.class.getName()).log(Level.WARNING, "Was not able to create a new properties file.", e); //NON-NLS
try (FileOutputStream fos = new FileOutputStream(propPath)) {
props.store(fos, "Created module settings file");
}
} catch (IOException ex) {
logger.log(Level.SEVERE, String.format("Failed to create module settings file at %s)", propPath), ex); //NON-NLS
return false;
}
return true;
@ -79,213 +90,217 @@ public class ModuleSettings {
}
/**
* Determines if a given properties file exists or not.
* Indicates whether or not a settings file exists for a given module.
*
* @param moduleName - The name of the config file to evaluate
* @param moduleName The module name.
*
* @return true if the config exists, false otherwise.
* @return True or false.
*/
public static boolean configExists(String moduleName) {
File f = new File(moduleDirPath + File.separator + moduleName + ".properties");
return f.exists();
public static synchronized boolean configExists(String moduleName) {
return new File(getSettingsFilePath(moduleName)).exists();
}
public static boolean settingExists(String moduleName, String settingName) {
/**
* Determines whether or not a given setting exists in the settings file for
* a module.
*
* @param moduleName The module name.
* @param settingName The name of the setting (property).
*
* @return True if the setting file exists, can be read, and contains the
* specified setting (property), false otherwise.
*/
public static synchronized boolean settingExists(String moduleName, String settingName) {
if (!configExists(moduleName)) {
return false;
}
try {
Properties props = fetchProperties(moduleName);
return (props.getProperty(settingName) != null);
} catch (IOException e) {
} catch (IOException ex) {
logger.log(Level.SEVERE, String.format("Failed to get %s setting from module settings file at %s)", settingName, getSettingsFilePath(moduleName)), ex); //NON-NLS
return false;
}
}
/**
* Returns the path of the given properties file.
* Constructs a settings file path for a given module.
*
* @param moduleName - The name of the config file to evaluate
* @param moduleName The module name.
*
* @return The path of the given config file. Returns null if the config
* file doesn't exist.
* @return The settings file path as a string.
*/
private static String getPropertyPath(String moduleName) {
if (configExists(moduleName)) {
return moduleDirPath + File.separator + moduleName + ".properties"; //NON-NLS
}
return null;
private static String getSettingsFilePath(String moduleName) {
return Paths.get(MODULE_DIR_PATH, moduleName + SETTINGS_FILE_EXT).toString();
}
/**
* Returns the given properties file's setting as specific by settingName.
* Gets the value of a setting (property) from a module settings file.
*
* @param moduleName - The name of the config file to read from.
* @param settingName - The setting name to retrieve.
* NOTE: If the settings file does not already exist, it is created.
*
* @return - the value associated with the setting.
* @param moduleName The module name.
* @param settingName The setting name.
*
* @throws IOException
* @return The value of the setting or null if the file cannot be read or
* the setting is not found.
*/
public static String getConfigSetting(String moduleName, String settingName) {
public static synchronized String getConfigSetting(String moduleName, String settingName) {
if (!configExists(moduleName)) {
makeConfigFile(moduleName);
Logger.getLogger(ModuleSettings.class.getName()).log(Level.INFO, "File did not exist. Created file [" + moduleName + ".properties]"); //NON-NLS NON-NLS
}
try {
Properties props = fetchProperties(moduleName);
return props.getProperty(settingName);
} catch (IOException e) {
Logger.getLogger(ModuleSettings.class.getName()).log(Level.WARNING, "Could not read config file [" + moduleName + "]", e); //NON-NLS
} catch (IOException ex) {
logger.log(Level.SEVERE, String.format("Failed to get %s setting from module settings file at %s)", settingName, getSettingsFilePath(moduleName)), ex); //NON-NLS
return null;
}
}
/**
* Returns the given properties file's map of settings.
* Gets the settings (properties) from a module settings file.
*
* @param moduleName - the name of the config file to read from.
* NOTE: If the settings file does not already exist, it is created.
*
* @return - the map of all key:value pairs representing the settings of the
* config.
* @param moduleName The module name.
*
* @throws IOException
* @return A mapping of setting names to setting values from the settings
* file, may be empty.
*/
public static Map< String, String> getConfigSettings(String moduleName) {
public static synchronized Map<String, String> getConfigSettings(String moduleName) {
if (!configExists(moduleName)) {
makeConfigFile(moduleName);
Logger.getLogger(ModuleSettings.class.getName()).log(Level.INFO, "File did not exist. Created file [" + moduleName + ".properties]"); //NON-NLS NON-NLS
}
try {
Properties props = fetchProperties(moduleName);
Set<String> keys = props.stringPropertyNames();
Map<String, String> map = new HashMap<String, String>();
Map<String, String> map = new HashMap<>();
for (String s : keys) {
map.put(s, props.getProperty(s));
}
return map;
} catch (IOException e) {
Logger.getLogger(ModuleSettings.class.getName()).log(Level.WARNING, "Could not read config file [" + moduleName + "]", e); //NON-NLS
} catch (IOException ex) {
logger.log(Level.SEVERE, String.format("Failed to get settings from module settings file at %s)", getSettingsFilePath(moduleName)), ex); //NON-NLS
return null;
}
}
/**
* Sets the given properties file to the given setting map.
* Adds a mapping of setting name to setting values to a module settings
* file.
*
* @param moduleName - The name of the module to be written to.
* @param settings - The mapping of all key:value pairs of settings to add
* to the config.
* NOTE: If the settings file does not already exist, it is created.
*
* @param moduleName The module name.
* @param settings The module settings.
*/
public static synchronized void setConfigSettings(String moduleName, Map<String, String> settings) {
if (!configExists(moduleName)) {
makeConfigFile(moduleName);
Logger.getLogger(ModuleSettings.class.getName()).log(Level.INFO, "File did not exist. Created file [" + moduleName + ".properties]"); //NON-NLS NON-NLS
}
try {
Properties props = fetchProperties(moduleName);
for (Map.Entry<String, String> kvp : settings.entrySet()) {
props.setProperty(kvp.getKey(), kvp.getValue());
}
File path = new File(getPropertyPath(moduleName));
FileOutputStream fos = new FileOutputStream(path);
props.store(fos, "Changed config settings(batch)"); //NON-NLS
fos.close();
} catch (IOException e) {
Logger.getLogger(ModuleSettings.class.getName()).log(Level.WARNING, "Property file exists for [" + moduleName + "] at [" + getPropertyPath(moduleName) + "] but could not be loaded.", e); //NON-NLS NON-NLS NON-NLS
File path = new File(getSettingsFilePath(moduleName));
try (FileOutputStream fos = new FileOutputStream(path)) {
props.store(fos, "Set settings (batch)"); //NON-NLS
}
} catch (IOException ex) {
logger.log(Level.SEVERE, String.format("Error writing to module settings file at %s)", getSettingsFilePath(moduleName)), ex); //NON-NLS
}
}
/**
* Sets the given properties file to the given settings.
* Sets the value of a setting (property) in a module settings file.
*
* @param moduleName - The name of the module to be written to.
* @param settingName - The name of the setting to be modified.
* @param settingVal - the value to set the setting to.
* NOTE: If the settings file does not already exist, it is created.
*
* @param moduleName The module name.
* @param settingName The setting name.
* @param settingVal The setting value.
*/
public static synchronized void setConfigSetting(String moduleName, String settingName, String settingVal) {
if (!configExists(moduleName)) {
makeConfigFile(moduleName);
Logger.getLogger(ModuleSettings.class.getName()).log(Level.INFO, "File did not exist. Created file [" + moduleName + ".properties]"); //NON-NLS NON-NLS
}
try {
Properties props = fetchProperties(moduleName);
props.setProperty(settingName, settingVal);
File path = new File(getPropertyPath(moduleName));
FileOutputStream fos = new FileOutputStream(path);
props.store(fos, "Changed config settings(single)"); //NON-NLS
fos.close();
} catch (IOException e) {
Logger.getLogger(ModuleSettings.class.getName()).log(Level.WARNING, "Property file exists for [" + moduleName + "] at [" + getPropertyPath(moduleName) + "] but could not be loaded.", e); //NON-NLS NON-NLS NON-NLS
}
}
/**
* Removes the given key from the given properties file.
*
* @param moduleName - The name of the properties file to be modified.
* @param key - the name of the key to remove.
*/
public static synchronized void removeProperty(String moduleName, String key) {
try {
if (getConfigSetting(moduleName, key) != null) {
Properties props = fetchProperties(moduleName);
props.remove(key);
File path = new File(getPropertyPath(moduleName));
FileOutputStream fos = new FileOutputStream(path);
props.store(fos, "Removed " + key); //NON-NLS
fos.close();
File path = new File(getSettingsFilePath(moduleName));
try (FileOutputStream fos = new FileOutputStream(path)) {
props.store(fos, "Set " + settingName); //NON-NLS
}
} catch (IOException e) {
Logger.getLogger(ModuleSettings.class.getName()).log(Level.WARNING, "Could not remove property from file, file not found", e); //NON-NLS
} catch (IOException ex) {
logger.log(Level.SEVERE, String.format("Error writing %s setting to module settings file at %s)", settingName, getSettingsFilePath(moduleName)), ex); //NON-NLS
}
}
/**
* Returns the properties file as specified by moduleName.
* Removes a setting (property) in a module settings file.
*
* @param moduleName
*
* @return Properties file as specified by moduleName.
*
* @throws IOException
* @param moduleName The module name.
* @param settingName The setting name.
*/
private static Properties fetchProperties(String moduleName) throws IOException {
InputStream inputStream = new FileInputStream(getPropertyPath(moduleName));
Properties props = new Properties();
props.load(inputStream);
inputStream.close();
public static synchronized void removeProperty(String moduleName, String settingName) {
try {
if (getConfigSetting(moduleName, settingName) != null) {
Properties props = fetchProperties(moduleName);
props.remove(settingName);
File path = new File(getSettingsFilePath(moduleName));
try (FileOutputStream fos = new FileOutputStream(path)) {
props.store(fos, "Removed " + settingName); //NON-NLS
}
}
} catch (IOException ex) {
logger.log(Level.SEVERE, String.format("Error removing %s setting from module settings file at %s)", settingName, getSettingsFilePath(moduleName)), ex); //NON-NLS
}
}
/**
* Gets the contents of a module settings file as a Properties object.
*
* @param moduleName The module name.
*
* @return The Properties object.
*
* @throws IOException If there is a problem reading the settings file.
*/
private static synchronized Properties fetchProperties(String moduleName) throws IOException {
Properties props;
try (InputStream inputStream = new FileInputStream(getSettingsFilePath(moduleName))) {
props = new Properties();
props.load(inputStream);
}
return props;
}
/**
* Gets the property file as specified.
* Gets a File object for a module settings (properties) file.
*
* @param moduleName
* @param moduleName The module name.
*
* @return A new file handle, returns null if the file does not exist.
* @return The File object or null if the file does not exist.
*/
public static File getPropertyFile(String moduleName) {
String path = getPropertyPath(moduleName);
if (path == null) {
return null;
} else {
return new File(getPropertyPath(moduleName));
public static synchronized File getPropertyFile(String moduleName) {
File configFile = null;
if (configExists(moduleName)) {
configFile = new File(getSettingsFilePath(moduleName));
}
return configFile;
}
/**
* Private constructor to prevent instantiation of this utility class.
*/
private ModuleSettings() {
}
}

View File

@ -0,0 +1,121 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2020-2020 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.sleuthkit.autopsy.coreutils.textutils;
import com.ethteck.decodetect.core.Decodetect;
import com.ethteck.decodetect.core.DecodetectResult;
import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.Charset;
import java.nio.charset.CharsetDecoder;
import java.nio.charset.CharsetEncoder;
import java.util.List;
import org.apache.tika.parser.txt.CharsetDetector;
import org.apache.tika.parser.txt.CharsetMatch;
import org.sleuthkit.datamodel.AbstractFile;
import org.sleuthkit.datamodel.ReadContentInputStream;
import org.sleuthkit.datamodel.TskCoreException;
/**
* Utilities for working with text file encodings.
*/
public class EncodingUtils {
// This value will be used as a threshold for determining which encoding
// detection library to use. If CharsetDetector's own confidence is at least
// MIN_MATCH_CONFIDENCE, CharsetDetector's result will be used for decoding.
// Otherwise, Decodetect will be used.
//
// Note: We initially used a confidence of 35, but it was causing some
// Chrome Cache files to get flagged as UTF-16 with confidence 40.
// These files had a small amount of binary data and then ASCII.
static final private int MIN_CHARSETDETECT_MATCH_CONFIDENCE = 41;
// This value determines whether we will consider Decodetect's top-scoring
// result a legitimate match or if we will disregard its findings.
//
// Possible values are 0 to 1, inclusive.
static final private double MIN_DECODETECT_MATCH_CONFIDENCE = 0.4;
/*
* The char set returned if the algorithm fails to detect the
* encoding of the file.
*/
public static final Charset UNKNOWN_CHARSET = new Charset("unknown", null) {
@Override
public boolean contains(Charset cs) {
return false;
}
@Override
public CharsetDecoder newDecoder() {
return null;
}
@Override
public CharsetEncoder newEncoder() {
return null;
}
};
/**
* Returns the encoding of the file.
*
* @return Detected encoding or UNKNOWN_CHARSET.
*/
public static Charset getEncoding(AbstractFile file) throws TskCoreException, IOException {
// Encoding detection is hard. We use several libraries since the data passed in is often messy.
// First try CharsetDetector (from Tika / ICU4J).
// It is a rule-based detection approach.
try (InputStream stream = new BufferedInputStream(new ReadContentInputStream(file))) {
CharsetDetector detector = new CharsetDetector();
detector.setText(stream);
CharsetMatch tikaResult = detector.detect();
if (tikaResult != null && tikaResult.getConfidence() >= MIN_CHARSETDETECT_MATCH_CONFIDENCE) {
String tikaCharSet = tikaResult.getName();
//Check if the nio package has support for the charset determined by Tika.
if(Charset.isSupported(tikaCharSet)) {
return Charset.forName(tikaCharSet);
}
}
}
// If that did not work, then use DecoDetect, which is statistical
// We needed this for some Japanese text files that were incorrectly detected by CharsetDetector (with low confidence)
// This will not always work with messy data that combines some binary and some ASCII.
int maxBytes = 100000;
int numBytes = maxBytes;
if (file.getSize() < maxBytes) {
numBytes = (int) file.getSize();
}
byte[] targetArray = new byte[numBytes];
file.read(targetArray, 0, numBytes);
List<DecodetectResult> results = Decodetect.DECODETECT.getResults(targetArray);
if (!results.isEmpty()) {
DecodetectResult topResult = results.get(0);
if (topResult.getConfidence() >= MIN_DECODETECT_MATCH_CONFIDENCE) {
return topResult.getEncoding();
}
}
return UNKNOWN_CHARSET;
}
}

View File

@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2011-2019 Basis Technology Corp.
* Copyright 2011-2020 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -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
@ -94,6 +94,16 @@ public abstract class AbstractAbstractFileNode<T extends AbstractFile> extends A
IngestManager.getInstance().addIngestModuleEventListener(INGEST_MODULE_EVENTS_OF_INTEREST, weakPcl);
}
}
try {
//See JIRA-5971
//Attempt to cache file path during construction of this UI component.
this.content.getUniquePath();
} catch (TskCoreException ex) {
logger.log(Level.SEVERE, String.format("Failed attempt to cache the "
+ "unique path of the abstract file instance. Name: %s (objID=%d)",
this.content.getName(), this.content.getId()), ex);
}
if (UserPreferences.displayTranslatedFileNames()) {
backgroundTasksPool.submit(new TranslationTask(
@ -329,7 +339,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 +415,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 +548,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;
}

View File

@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2017-2019 Basis Technology Corp.
* Copyright 2017-2020 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -49,9 +49,9 @@ import org.sleuthkit.autopsy.directorytree.ViewContextAction;
import org.sleuthkit.autopsy.timeline.actions.ViewFileInTimelineAction;
import org.sleuthkit.datamodel.AbstractFile;
import org.sleuthkit.datamodel.TskException;
import org.sleuthkit.datamodel.blackboardutils.Attachment;
import org.sleuthkit.datamodel.blackboardutils.FileAttachment;
import org.sleuthkit.datamodel.blackboardutils.URLAttachment;
import org.sleuthkit.datamodel.blackboardutils.attributes.MessageAttachments.Attachment;
import org.sleuthkit.datamodel.blackboardutils.attributes.MessageAttachments.FileAttachment;
import org.sleuthkit.datamodel.blackboardutils.attributes.MessageAttachments.URLAttachment;
/**
* Node for a message attachment.

View File

@ -286,8 +286,14 @@ public abstract class BaseChildFactory<T extends Content> extends ChildFactory.D
* If pageSize is set split keys into pages, otherwise create a
* single page containing all keys.
*/
if (keys.isEmpty()) {
pages.clear();
if (keys.isEmpty() && !pages.isEmpty()) {
/**
* If we previously had keys (i.e. pages is not empty) and now
* we don't have keys, reset pages to an empty list.
* Cannot use a call to List.clear() here because the call to
* Lists.partition() below returns an unmodifiable list.
*/
pages = new ArrayList<>();
} else {
pages = Lists.partition(keys, pageSize > 0 ? pageSize : keys.size());
}

View File

@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2011-2019 Basis Technology Corp.
* Copyright 2011-2020 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -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
@ -194,6 +194,16 @@ public class BlackboardArtifactNode extends AbstractContentNode<BlackboardArtifa
for (Content lookupContent : this.getLookup().lookupAll(Content.class)) {
if ((lookupContent != null) && (!(lookupContent instanceof BlackboardArtifact))) {
this.associated = lookupContent;
try {
//See JIRA-5971
//Attempt to cache file path during construction of this UI component.
this.associated.getUniquePath();
} catch (TskCoreException ex) {
logger.log(Level.SEVERE, String.format("Failed attempt to cache the "
+ "unique path of the associated content instance. Name: %s (objID=%d)",
this.associated.getName(), this.associated.getId()), ex);
}
break;
}
}
@ -312,7 +322,11 @@ public class BlackboardArtifactNode extends AbstractContentNode<BlackboardArtifa
}
if (displayName.isEmpty() && artifact != null) {
displayName = artifact.getName();
try {
displayName = Case.getCurrentCaseThrows().getSleuthkitCase().getAbstractFileById(this.artifact.getObjectID()).getName();
} catch (TskCoreException | NoCurrentCaseException ex) {
displayName = artifact.getName();
}
}
this.setDisplayName(displayName);
@ -366,7 +380,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
@ -591,8 +605,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;
}
@ -775,12 +789,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);
@ -837,7 +851,9 @@ public class BlackboardArtifactNode extends AbstractContentNode<BlackboardArtifa
|| attributeTypeID == ATTRIBUTE_TYPE.TSK_TAGGED_ARTIFACT.getTypeID()
|| attributeTypeID == ATTRIBUTE_TYPE.TSK_ASSOCIATED_ARTIFACT.getTypeID()
|| attributeTypeID == ATTRIBUTE_TYPE.TSK_SET_NAME.getTypeID()
|| attributeTypeID == ATTRIBUTE_TYPE.TSK_KEYWORD_SEARCH_TYPE.getTypeID()) {
|| attributeTypeID == ATTRIBUTE_TYPE.TSK_KEYWORD_SEARCH_TYPE.getTypeID()
|| attribute.getValueType() == BlackboardAttribute.TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE.JSON) {
continue;
} else if (artifact.getArtifactTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_EMAIL_MSG.getTypeID()) {
addEmailMsgProperty(map, attribute);
} else if (attribute.getAttributeType().getValueType() == BlackboardAttribute.TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE.DATETIME) {

View File

@ -304,9 +304,6 @@ OpenReportAction.actionPerformed.ReportFileOpenPermissionDeniedMessage=Permissio
PoolNode.createSheet.name.desc=no description
PoolNode.createSheet.name.displayName=Name
PoolNode.createSheet.name.name=Name
PoolNode.createSheet.offset.desc=no description
PoolNode.createSheet.offset.displayName=Starting offset
PoolNode.createSheet.offset.name=Starting offset
PoolNode.createSheet.type.desc=no description
PoolNode.createSheet.type.displayName=Type
PoolNode.createSheet.type.name=Type

View File

@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2012-2019 Basis Technology Corp.
* Copyright 2012-2020 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -521,7 +521,11 @@ public class EmailExtracted implements AutopsyVisitableItem {
if (skCase != null) {
emailResults.getArtifactIds(accountName, folderName).forEach((id) -> {
try {
keys.add(skCase.getBlackboardArtifact(id));
BlackboardArtifact art = skCase.getBlackboardArtifact(id);
//Cache attributes while we are off the EDT.
//See JIRA-5969
art.getAttributes();
keys.add(art);
} catch (TskCoreException ex) {
logger.log(Level.WARNING, "Error getting mail messages keys", ex); //NON-NLS
}

View File

@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2011-2019 Basis Technology Corp.
* Copyright 2011-2020 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -98,6 +98,7 @@ public class ExtractedContent implements AutopsyVisitableItem {
return skCase;
}
@SuppressWarnings("deprecation")
static String getIconFilePath(int typeID) {
String filePath = "org/sleuthkit/autopsy/images/"; //NON-NLS
if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_BOOKMARK.getTypeID()) {
@ -508,9 +509,18 @@ public class ExtractedContent implements AutopsyVisitableItem {
protected List<BlackboardArtifact> makeKeys() {
if (skCase != null) {
try {
return (filteringDSObjId > 0)
? blackboard.getArtifacts(type.getTypeID(), filteringDSObjId)
: skCase.getBlackboardArtifacts(type.getTypeID());
List<BlackboardArtifact> arts;
if(filteringDSObjId > 0) {
arts = blackboard.getArtifacts(type.getTypeID(), filteringDSObjId);
} else {
arts = skCase.getBlackboardArtifacts(type.getTypeID());
}
for(BlackboardArtifact art: arts) {
//Cache attributes while we are off the EDT.
//See JIRA-5969
art.getAttributes();
}
return arts;
} catch (TskCoreException ex) {
Logger.getLogger(ArtifactFactory.class.getName()).log(Level.SEVERE, "Couldn't get blackboard artifacts from database", ex); //NON-NLS
}

View File

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

View File

@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2011-2019 Basis Technology Corp.
* Copyright 2011-2020 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -413,6 +413,9 @@ public class HashsetHits implements AutopsyVisitableItem {
try {
if (!artifactHits.containsKey(id)) {
BlackboardArtifact art = skCase.getBlackboardArtifact(id);
//Cache attributes while we are off the EDT.
//See JIRA-5969
art.getAttributes();
artifactHits.put(id, art);
}
} catch (TskCoreException ex) {

View File

@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2011-2019 Basis Technology Corp.
* Copyright 2011-2020 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -480,6 +480,9 @@ public class InterestingHits implements AutopsyVisitableItem {
try {
if (!artifactHits.containsKey(id)) {
BlackboardArtifact art = skCase.getBlackboardArtifact(id);
//Cache attributes while we are off the EDT.
//See JIRA-5969
art.getAttributes();
artifactHits.put(id, art);
}
} catch (TskCoreException ex) {

View File

@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2011-2019 Basis Technology Corp.
* Copyright 2011-2020 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -926,6 +926,9 @@ public class KeywordHits implements AutopsyVisitableItem {
try {
if (!artifactHits.containsKey(id)) {
BlackboardArtifact art = skCase.getBlackboardArtifact(id);
//Cache attributes while we are off the EDT.
//See JIRA-5969
art.getAttributes();
artifactHits.put(id, art);
}
} catch (TskCoreException ex) {

View File

@ -64,3 +64,9 @@ ResultsPanel.resultsSplitPane.toolTipText=
FileSearchPanel.stepTwoLabel.text=Step 2: Filter which images to show
FileSearchPanel.stepThreeLabel.text=Step 3: Choose display settings
DiscoveryTopComponent.stepOneLabel.text=Step 1: Pick File Type
DiscoveryTopComponent.documentsButton.text=Documents
DocumentPanel.countLabel.toolTipText=
DocumentPanel.fileSizeLabel.toolTipText=
DocumentPanel.documentType.text=
DocumentPanel.isDeletedLabel.toolTipText=
ImageThumbnailPanel.isDeletedLabel.toolTipText=

View File

@ -6,6 +6,17 @@ DataSourceModuleWrapper.fileTypeModule.text=File Type Identification module was
# {0} - dataSourceName
DataSourceModuleWrapper.hashModule.text=Hash Lookup module was not run on data source: {0}\n
DiscoveryTopComponent.name=\ File Discovery
DiscoveryUiUtility.bytes.text=bytes
DiscoveryUiUtility.gigaBytes.text=GB
DiscoveryUiUtility.kiloBytes.text=KB
DiscoveryUiUtility.megaBytes.text=MB
# {0} - fileSize
# {1} - units
DiscoveryUiUtility.sizeLabel.text=Size: {0} {1}
DiscoveryUiUtility.terraBytes.text=TB
# {0} - extension
DocumentPanel.documentType.extension.text=Extension: {0}
DocumentWrapper.previewInitialValue=Preview not generated yet.
FileGroup.groupSortingAlgorithm.groupName.text=Group Name
FileGroup.groupSortingAlgorithm.groupSize.text=Group Size
# {0} - Data source name
@ -162,17 +173,9 @@ FileSorter.SortingMethod.fullPath.displayName=Full Path
FileSorter.SortingMethod.keywordlist.displayName=Keyword List Names
GroupsListPanel.noResults.message.text=No results were found for the selected filters.
GroupsListPanel.noResults.title.text=No results found
ImageThumbnailPanel.bytes.text=bytes
# {0} - numberOfInstances
ImageThumbnailPanel.countLabel.text=Number of Instances: {0}
ImageThumbnailPanel.gigaBytes.text=GB
ImageThumbnailPanel.isDeleted.text=All instances of file are deleted.
ImageThumbnailPanel.kiloBytes.text=KB
ImageThumbnailPanel.megaBytes.text=MB
# {0} - fileSize
# {1} - units
ImageThumbnailPanel.sizeLabel.text=Size: {0} {1}
ImageThumbnailPanel.terraBytes.text=TB
OpenFileDiscoveryAction.resultsIncomplete.text=Results may be incomplete
ResultFile.score.interestingResult.description=At least one instance of the file has an interesting result associated with it.
ResultFile.score.notableFile.description=At least one instance of the file was recognized as notable.
@ -182,6 +185,8 @@ ResultFile.score.taggedFile.description=At least one instance of the file has be
# {1} - totalPages
ResultsPanel.currentPage.displayValue=Page: {0} of {1}
ResultsPanel.currentPageLabel.text=Page: -
ResultsPanel.documentPreviewWorker.noBytes=No bytes read for document, unable to display preview.
ResultsPanel.documentPreviewWorker.noPreview=No preview available.
# {0} - selectedPage
# {1} - maxPage
ResultsPanel.invalidPageNumber.message=The selected page number {0} does not exist. Please select a value from 1 to {1}.
@ -203,6 +208,12 @@ ResultsPanel.resultsSplitPane.toolTipText=
FileSearchPanel.stepTwoLabel.text=Step 2: Filter which images to show
FileSearchPanel.stepThreeLabel.text=Step 3: Choose display settings
DiscoveryTopComponent.stepOneLabel.text=Step 1: Pick File Type
DiscoveryTopComponent.documentsButton.text=Documents
DocumentPanel.countLabel.toolTipText=
DocumentPanel.fileSizeLabel.toolTipText=
DocumentPanel.documentType.text=
DocumentPanel.isDeletedLabel.toolTipText=
ImageThumbnailPanel.isDeletedLabel.toolTipText=
ResultsPanel.viewFileInDir.name=View File in Directory
VideoThumbnailPanel.bytes.text=bytes
# {0} - numberOfInstances

View File

@ -16,7 +16,7 @@
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
<AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,3,32,0,0,4,-80"/>
<AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,3,-124,0,0,5,120"/>
</AuxValues>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
@ -90,29 +90,29 @@
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace pref="486" max="32767" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Group type="102" alignment="1" attributes="0">
<Component id="imagesButton" min="-2" pref="110" max="-2" attributes="0"/>
<EmptySpace pref="414" max="32767" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="imagesButton" linkSize="3" min="-2" pref="110" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="videosButton" min="-2" pref="110" max="-2" attributes="0"/>
<Component id="videosButton" linkSize="3" min="-2" pref="110" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="documentsButton" linkSize="3" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="1" attributes="0">
<Component id="filler1" min="-2" max="-2" attributes="0"/>
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
<Component id="stepOneLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="62" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="119" max="-2" attributes="0"/>
</Group>
</Group>
<Component id="toolBar" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="486" max="32767" attributes="0"/>
<EmptySpace pref="413" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="toolBar" alignment="1" max="32767" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace min="-2" pref="4" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="stepOneLabel" max="32767" attributes="0"/>
@ -120,27 +120,16 @@
</Group>
<EmptySpace max="32767" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="videosButton" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="imagesButton" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="videosButton" linkSize="5" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="imagesButton" linkSize="5" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="documentsButton" linkSize="5" alignment="3" min="-2" pref="43" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" pref="5" max="-2" attributes="0"/>
<EmptySpace min="5" pref="5" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Container class="javax.swing.JToolBar" name="toolBar">
<Properties>
<Property name="floatable" type="boolean" value="false"/>
<Property name="rollover" type="boolean" value="true"/>
</Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_VariableLocal" type="java.lang.Boolean" value="true"/>
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="0"/>
</AuxValues>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBoxLayout"/>
</Container>
<Component class="javax.swing.JButton" name="imagesButton">
<Properties>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
@ -212,13 +201,13 @@
<Component class="javax.swing.Box$Filler" name="filler1">
<Properties>
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[62, 32767]"/>
<Dimension value="[119, 32767]"/>
</Property>
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[62, 0]"/>
<Dimension value="[119, 0]"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[62, 0]"/>
<Dimension value="[119, 0]"/>
</Property>
</Properties>
<AuxValues>
@ -227,6 +216,26 @@
<AuxValue name="classDetails" type="java.lang.String" value="Box.Filler.HorizontalStrut"/>
</AuxValues>
</Component>
<Component class="javax.swing.JButton" name="documentsButton">
<Properties>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/org/sleuthkit/autopsy/images/documents-icon.png"/>
</Property>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/filequery/Bundle.properties" key="DiscoveryTopComponent.documentsButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
<Property name="disabledIcon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/org/sleuthkit/autopsy/images/documents-icon.png"/>
</Property>
<Property name="disabledSelectedIcon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/org/sleuthkit/autopsy/images/documents-icon.png"/>
</Property>
<Property name="focusable" type="boolean" value="false"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="documentsButtonActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Container>
</SubComponents>

View File

@ -34,7 +34,6 @@ import org.sleuthkit.autopsy.corecomponents.DataContentPanel;
import org.sleuthkit.autopsy.corecomponents.TableFilterNode;
import org.sleuthkit.autopsy.coreutils.ThreadConfined;
import org.sleuthkit.autopsy.datamodel.FileNode;
import org.sleuthkit.autopsy.filequery.FileSearchData.FileType;
import org.sleuthkit.datamodel.AbstractFile;
/**
@ -120,6 +119,9 @@ public final class DiscoveryTopComponent extends TopComponent {
videosButton.setSelected(false);
videosButton.setEnabled(true);
videosButton.setBackground(UNSELECTED_COLOR);
documentsButton.setSelected(false);
documentsButton.setEnabled(true);
documentsButton.setBackground(UNSELECTED_COLOR);
fileSearchPanel.setSelectedType(FileSearchData.FileType.IMAGE);
}
@ -156,11 +158,11 @@ public final class DiscoveryTopComponent extends TopComponent {
leftSplitPane = new javax.swing.JSplitPane();
rightSplitPane = new javax.swing.JSplitPane();
javax.swing.JPanel toolBarPanel = new javax.swing.JPanel();
javax.swing.JToolBar toolBar = new javax.swing.JToolBar();
imagesButton = new javax.swing.JButton();
javax.swing.JLabel stepOneLabel = new javax.swing.JLabel();
videosButton = new javax.swing.JButton();
javax.swing.Box.Filler filler1 = new javax.swing.Box.Filler(new java.awt.Dimension(62, 0), new java.awt.Dimension(62, 0), new java.awt.Dimension(62, 32767));
javax.swing.Box.Filler filler1 = new javax.swing.Box.Filler(new java.awt.Dimension(119, 0), new java.awt.Dimension(119, 0), new java.awt.Dimension(119, 32767));
documentsButton = new javax.swing.JButton();
setPreferredSize(new java.awt.Dimension(1400, 900));
setLayout(new java.awt.BorderLayout());
@ -181,9 +183,6 @@ public final class DiscoveryTopComponent extends TopComponent {
add(mainSplitPane, java.awt.BorderLayout.CENTER);
toolBar.setFloatable(false);
toolBar.setRollover(true);
imagesButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/images/pictures-icon.png"))); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(imagesButton, org.openide.util.NbBundle.getMessage(DiscoveryTopComponent.class, "DiscoveryTopComponent.imagesButton.text")); // NOI18N
imagesButton.setDisabledIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/images/pictures-icon.png"))); // NOI18N
@ -215,28 +214,42 @@ public final class DiscoveryTopComponent extends TopComponent {
}
});
documentsButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/images/documents-icon.png"))); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(documentsButton, org.openide.util.NbBundle.getMessage(DiscoveryTopComponent.class, "DiscoveryTopComponent.documentsButton.text")); // NOI18N
documentsButton.setDisabledIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/images/documents-icon.png"))); // NOI18N
documentsButton.setDisabledSelectedIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/images/documents-icon.png"))); // NOI18N
documentsButton.setFocusable(false);
documentsButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
documentsButtonActionPerformed(evt);
}
});
javax.swing.GroupLayout toolBarPanelLayout = new javax.swing.GroupLayout(toolBarPanel);
toolBarPanel.setLayout(toolBarPanelLayout);
toolBarPanelLayout.setHorizontalGroup(
toolBarPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(toolBarPanelLayout.createSequentialGroup()
.addContainerGap(486, Short.MAX_VALUE)
.addGroup(toolBarPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, toolBarPanelLayout.createSequentialGroup()
.addContainerGap(414, Short.MAX_VALUE)
.addGroup(toolBarPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(toolBarPanelLayout.createSequentialGroup()
.addComponent(imagesButton, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(videosButton, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(videosButton, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(documentsButton))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, toolBarPanelLayout.createSequentialGroup()
.addComponent(filler1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, 0)
.addComponent(stepOneLabel)
.addGap(62, 62, 62)))
.addComponent(toolBar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(486, Short.MAX_VALUE))
.addGap(119, 119, 119)))
.addContainerGap(413, Short.MAX_VALUE))
);
toolBarPanelLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {documentsButton, imagesButton, videosButton});
toolBarPanelLayout.setVerticalGroup(
toolBarPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(toolBar, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(toolBarPanelLayout.createSequentialGroup()
.addGap(4, 4, 4)
.addGroup(toolBarPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
@ -245,10 +258,13 @@ public final class DiscoveryTopComponent extends TopComponent {
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(toolBarPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(videosButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(imagesButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(imagesButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(documentsButton, javax.swing.GroupLayout.PREFERRED_SIZE, 43, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(5, 5, 5))
);
toolBarPanelLayout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {documentsButton, imagesButton, videosButton});
add(toolBarPanel, java.awt.BorderLayout.PAGE_START);
}// </editor-fold>//GEN-END:initComponents
@ -261,6 +277,9 @@ public final class DiscoveryTopComponent extends TopComponent {
videosButton.setSelected(false);
videosButton.setEnabled(true);
videosButton.setBackground(UNSELECTED_COLOR);
documentsButton.setSelected(false);
documentsButton.setEnabled(true);
documentsButton.setBackground(UNSELECTED_COLOR);
fileSearchPanel.setSelectedType(FileSearchData.FileType.IMAGE);
}//GEN-LAST:event_imagesButtonActionPerformed
@ -273,9 +292,27 @@ public final class DiscoveryTopComponent extends TopComponent {
videosButton.setEnabled(false);
videosButton.setBackground(SELECTED_COLOR);
videosButton.setForeground(Color.BLACK);
documentsButton.setSelected(false);
documentsButton.setEnabled(true);
documentsButton.setBackground(UNSELECTED_COLOR);
fileSearchPanel.setSelectedType(FileSearchData.FileType.VIDEO);
}//GEN-LAST:event_videosButtonActionPerformed
private void documentsButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_documentsButtonActionPerformed
resetTopComponent();
documentsButton.setSelected(true);
documentsButton.setEnabled(false);
documentsButton.setBackground(SELECTED_COLOR);
documentsButton.setForeground(Color.BLACK);
videosButton.setSelected(false);
videosButton.setEnabled(true);
videosButton.setBackground(UNSELECTED_COLOR);
imagesButton.setSelected(false);
imagesButton.setEnabled(true);
imagesButton.setBackground(UNSELECTED_COLOR);
fileSearchPanel.setSelectedType(FileSearchData.FileType.DOCUMENTS);
}//GEN-LAST:event_documentsButtonActionPerformed
/**
* Update the user interface in response to a search being cancelled.
*
@ -284,11 +321,25 @@ public final class DiscoveryTopComponent extends TopComponent {
@Subscribe
void handleSearchCancelledEvent(DiscoveryEventUtils.SearchCancelledEvent searchCancelledEvent) {
SwingUtilities.invokeLater(() -> {
if (fileSearchPanel.getSelectedType() == FileType.VIDEO) {
imagesButton.setEnabled(true);
} else if (fileSearchPanel.getSelectedType() == FileType.IMAGE) {
videosButton.setEnabled(true);
if (null != fileSearchPanel.getSelectedType()) {
switch (fileSearchPanel.getSelectedType()) {
case VIDEO:
imagesButton.setEnabled(true);
documentsButton.setEnabled(true);
break;
case IMAGE:
videosButton.setEnabled(true);
documentsButton.setEnabled(true);
break;
case DOCUMENTS:
videosButton.setEnabled(true);
imagesButton.setEnabled(true);
break;
default:
break;
}
}
});
}
@ -300,10 +351,23 @@ public final class DiscoveryTopComponent extends TopComponent {
@Subscribe
void handleSearchCompletedEvent(DiscoveryEventUtils.SearchCompleteEvent searchCompletedEvent) {
SwingUtilities.invokeLater(() -> {
if (fileSearchPanel.getSelectedType() == FileType.VIDEO) {
imagesButton.setEnabled(true);
} else if (fileSearchPanel.getSelectedType() == FileType.IMAGE) {
videosButton.setEnabled(true);
if (null != fileSearchPanel.getSelectedType()) {
switch (fileSearchPanel.getSelectedType()) {
case VIDEO:
imagesButton.setEnabled(true);
documentsButton.setEnabled(true);
break;
case IMAGE:
videosButton.setEnabled(true);
documentsButton.setEnabled(true);
break;
case DOCUMENTS:
videosButton.setEnabled(true);
imagesButton.setEnabled(true);
break;
default:
break;
}
}
});
}
@ -329,10 +393,12 @@ public final class DiscoveryTopComponent extends TopComponent {
SwingUtilities.invokeLater(() -> {
imagesButton.setEnabled(false);
videosButton.setEnabled(false);
documentsButton.setEnabled(false);
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton documentsButton;
private javax.swing.JButton imagesButton;
private javax.swing.JSplitPane leftSplitPane;
private javax.swing.JSplitPane rightSplitPane;

View File

@ -0,0 +1,154 @@
/*
* Autopsy
*
* Copyright 2020 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.sleuthkit.autopsy.filequery;
import java.awt.Component;
import java.awt.Point;
import javax.swing.ImageIcon;
import javax.swing.JComponent;
import org.openide.util.ImageUtilities;
import org.openide.util.NbBundle;
/**
* Utility class for the various user interface elements used by File Discovery.
*/
final class DiscoveryUiUtils {
private static final int BYTE_UNIT_CONVERSION = 1000;
private static final int ICON_SIZE = 16;
private static final String RED_CIRCLE_ICON_PATH = "org/sleuthkit/autopsy/images/red-circle-exclamation.png";
private static final String YELLOW_CIRCLE_ICON_PATH = "org/sleuthkit/autopsy/images/yellow-circle-yield.png";
private static final String DELETE_ICON_PATH = "/org/sleuthkit/autopsy/images/file-icon-deleted.png";
private static final ImageIcon INTERESTING_SCORE_ICON = new ImageIcon(ImageUtilities.loadImage(YELLOW_CIRCLE_ICON_PATH, false));
private static final ImageIcon NOTABLE_SCORE_ICON = new ImageIcon(ImageUtilities.loadImage(RED_CIRCLE_ICON_PATH, false));
private static final ImageIcon DELETED_ICON = new ImageIcon(ImageUtilities.loadImage(DELETE_ICON_PATH, false));
@NbBundle.Messages({"# {0} - fileSize",
"# {1} - units",
"DiscoveryUiUtility.sizeLabel.text=Size: {0} {1}",
"DiscoveryUiUtility.bytes.text=bytes",
"DiscoveryUiUtility.kiloBytes.text=KB",
"DiscoveryUiUtility.megaBytes.text=MB",
"DiscoveryUiUtility.gigaBytes.text=GB",
"DiscoveryUiUtility.terraBytes.text=TB"})
/**
* Convert a size in bytes to a string with representing the size in the
* largest units which represent the value as being greater than or equal to
* one. Result will be rounded down to the nearest whole number of those
* units.
*
* @param bytes Size in bytes.
*/
static String getFileSizeString(long bytes) {
long size = bytes;
int unitsSwitchValue = 0;
while (size > BYTE_UNIT_CONVERSION && unitsSwitchValue < 4) {
size /= BYTE_UNIT_CONVERSION;
unitsSwitchValue++;
}
String units;
switch (unitsSwitchValue) {
case 1:
units = Bundle.DiscoveryUiUtility_kiloBytes_text();
break;
case 2:
units = Bundle.DiscoveryUiUtility_megaBytes_text();
break;
case 3:
units = Bundle.DiscoveryUiUtility_gigaBytes_text();
break;
case 4:
units = Bundle.DiscoveryUiUtility_terraBytes_text();
break;
default:
units = Bundle.DiscoveryUiUtility_bytes_text();
break;
}
return Bundle.DiscoveryUiUtility_sizeLabel_text(size, units);
}
/**
* Helper method to see if point is on the icon.
*
* @param comp The component to check if the cursor is over the icon of
* @param point The point the cursor is at.
*
* @return True if the point is over the icon, false otherwise.
*/
static boolean isPointOnIcon(Component comp, Point point) {
return comp instanceof JComponent && point.x >= comp.getX() && point.x <= comp.getX() + ICON_SIZE && point.y >= comp.getY() && point.y <= comp.getY() + ICON_SIZE;
}
/**
* Method to set the icon and tool tip text for a label to show deleted
* status.
*
* @param isDeleted True if the label should reflect deleted status,
* false otherwise.
* @param isDeletedLabel The label to set the icon and tooltip for.
*/
static void setDeletedIcon(boolean isDeleted, javax.swing.JLabel isDeletedLabel) {
if (isDeleted) {
isDeletedLabel.setIcon(DELETED_ICON);
isDeletedLabel.setToolTipText(Bundle.ImageThumbnailPanel_isDeleted_text());
} else {
isDeletedLabel.setIcon(null);
isDeletedLabel.setToolTipText(null);
}
}
/**
* Method to set the icon and tool tip text for a label to show the score.
*
* @param resultFile The result file which the label should reflect the
* score of.
* @param scoreLabel The label to set the icon and tooltip for.
*/
static void setScoreIcon(ResultFile resultFile, javax.swing.JLabel scoreLabel) {
switch (resultFile.getScore()) {
case NOTABLE_SCORE:
scoreLabel.setIcon(NOTABLE_SCORE_ICON);
break;
case INTERESTING_SCORE:
scoreLabel.setIcon(INTERESTING_SCORE_ICON);
break;
case NO_SCORE: // empty case - this is interpreted as an intentional fall-through
default:
scoreLabel.setIcon(null);
break;
}
scoreLabel.setToolTipText(resultFile.getScoreDescription());
}
/**
* Get the size of the icons used by the UI.
*
* @return
*/
static int getIconSize() {
return ICON_SIZE;
}
/**
* Private constructor for DiscoveryUiUtils utility class.
*/
private DiscoveryUiUtils() {
//private constructor in a utility class intentionally left blank
}
}

View File

@ -0,0 +1,163 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.5" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.EtchedBorderInfo">
<EtchetBorder/>
</Border>
</Property>
</Properties>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="countLabel" min="-2" pref="530" max="-2" attributes="0"/>
<EmptySpace pref="81" max="32767" attributes="0"/>
<Component id="isDeletedLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" max="-2" attributes="0"/>
<Component id="scoreLabel" min="-2" max="-2" attributes="0"/>
</Group>
<Component id="fileSizeLabel" alignment="1" max="32767" attributes="0"/>
<Component id="previewScrollPane" max="32767" attributes="0"/>
<Component id="documentType" alignment="0" max="32767" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="documentType" min="-2" pref="16" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="previewScrollPane" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="fileSizeLabel" min="-2" pref="16" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="scoreLabel" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="isDeletedLabel" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="countLabel" alignment="1" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="countLabel">
<Properties>
<Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/filequery/Bundle.properties" key="DocumentPanel.countLabel.toolTipText" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[159, 12]"/>
</Property>
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[159, 12]"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[159, 12]"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="isDeletedLabel">
<Properties>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/org/sleuthkit/autopsy/images/file-icon-deleted.png"/>
</Property>
<Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/filequery/Bundle.properties" key="DocumentPanel.isDeletedLabel.toolTipText" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
<Connection code="new Dimension(org.sleuthkit.autopsy.filequery.DiscoveryUiUtils.getIconSize(),org.sleuthkit.autopsy.filequery.DiscoveryUiUtils.getIconSize())" type="code"/>
</Property>
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
<Connection code="new Dimension(org.sleuthkit.autopsy.filequery.DiscoveryUiUtils.getIconSize(),org.sleuthkit.autopsy.filequery.DiscoveryUiUtils.getIconSize())" type="code"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
<Connection code="new Dimension(org.sleuthkit.autopsy.filequery.DiscoveryUiUtils.getIconSize(),org.sleuthkit.autopsy.filequery.DiscoveryUiUtils.getIconSize())" type="code"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="scoreLabel">
<Properties>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/org/sleuthkit/autopsy/images/red-circle-exclamation.png"/>
</Property>
<Property name="toolTipText" type="java.lang.String" value=""/>
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
<Connection code="new Dimension(org.sleuthkit.autopsy.filequery.DiscoveryUiUtils.getIconSize(),org.sleuthkit.autopsy.filequery.DiscoveryUiUtils.getIconSize())" type="code"/>
</Property>
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
<Connection code="new Dimension(org.sleuthkit.autopsy.filequery.DiscoveryUiUtils.getIconSize(),org.sleuthkit.autopsy.filequery.DiscoveryUiUtils.getIconSize())" type="code"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
<Connection code="new Dimension(org.sleuthkit.autopsy.filequery.DiscoveryUiUtils.getIconSize(),org.sleuthkit.autopsy.filequery.DiscoveryUiUtils.getIconSize())" type="code"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="fileSizeLabel">
<Properties>
<Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/filequery/Bundle.properties" key="DocumentPanel.fileSizeLabel.toolTipText" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="documentType">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/filequery/Bundle.properties" key="DocumentPanel.documentType.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Container class="javax.swing.JScrollPane" name="previewScrollPane">
<Properties>
<Property name="verticalScrollBarPolicy" type="int" value="21"/>
</Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_VariableLocal" type="java.lang.Boolean" value="true"/>
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="0"/>
<AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
</AuxValues>
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
<SubComponents>
<Component class="javax.swing.JTextArea" name="previewTextArea">
<Properties>
<Property name="editable" type="boolean" value="false"/>
<Property name="columns" type="int" value="20"/>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Tahoma" size="11" style="0"/>
</Property>
<Property name="lineWrap" type="boolean" value="true"/>
<Property name="rows" type="int" value="5"/>
<Property name="wrapStyleWord" type="boolean" value="true"/>
<Property name="enabled" type="boolean" value="false"/>
<Property name="focusable" type="boolean" value="false"/>
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[164, 94]"/>
</Property>
</Properties>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Form>

View File

@ -0,0 +1,180 @@
/*
* Autopsy
*
* Copyright 2020 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.sleuthkit.autopsy.filequery;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Point;
import java.awt.event.MouseEvent;
import javax.swing.JComponent;
import javax.swing.JList;
import javax.swing.ListCellRenderer;
import org.openide.util.NbBundle.Messages;
/**
* Class which displays a preview and details about a document.
*/
public class DocumentPanel extends javax.swing.JPanel implements ListCellRenderer<DocumentWrapper> {
private static final long serialVersionUID = 1L;
private static final Color SELECTION_COLOR = new Color(0, 120, 215);
/**
* Creates new form DocumentPanel
*/
public DocumentPanel() {
initComponents();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
countLabel = new javax.swing.JLabel();
isDeletedLabel = new javax.swing.JLabel();
scoreLabel = new javax.swing.JLabel();
fileSizeLabel = new javax.swing.JLabel();
documentType = new javax.swing.JLabel();
javax.swing.JScrollPane previewScrollPane = new javax.swing.JScrollPane();
previewTextArea = new javax.swing.JTextArea();
setBorder(javax.swing.BorderFactory.createEtchedBorder());
countLabel.setToolTipText(org.openide.util.NbBundle.getMessage(DocumentPanel.class, "DocumentPanel.countLabel.toolTipText")); // NOI18N
countLabel.setMaximumSize(new java.awt.Dimension(159, 12));
countLabel.setMinimumSize(new java.awt.Dimension(159, 12));
countLabel.setPreferredSize(new java.awt.Dimension(159, 12));
isDeletedLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/images/file-icon-deleted.png"))); // NOI18N
isDeletedLabel.setToolTipText(org.openide.util.NbBundle.getMessage(DocumentPanel.class, "DocumentPanel.isDeletedLabel.toolTipText")); // NOI18N
isDeletedLabel.setMaximumSize(new Dimension(org.sleuthkit.autopsy.filequery.DiscoveryUiUtils.getIconSize(),org.sleuthkit.autopsy.filequery.DiscoveryUiUtils.getIconSize()));
isDeletedLabel.setMinimumSize(new Dimension(org.sleuthkit.autopsy.filequery.DiscoveryUiUtils.getIconSize(),org.sleuthkit.autopsy.filequery.DiscoveryUiUtils.getIconSize()));
isDeletedLabel.setPreferredSize(new Dimension(org.sleuthkit.autopsy.filequery.DiscoveryUiUtils.getIconSize(),org.sleuthkit.autopsy.filequery.DiscoveryUiUtils.getIconSize()));
scoreLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/images/red-circle-exclamation.png"))); // NOI18N
scoreLabel.setToolTipText("");
scoreLabel.setMaximumSize(new Dimension(org.sleuthkit.autopsy.filequery.DiscoveryUiUtils.getIconSize(),org.sleuthkit.autopsy.filequery.DiscoveryUiUtils.getIconSize()));
scoreLabel.setMinimumSize(new Dimension(org.sleuthkit.autopsy.filequery.DiscoveryUiUtils.getIconSize(),org.sleuthkit.autopsy.filequery.DiscoveryUiUtils.getIconSize()));
scoreLabel.setPreferredSize(new Dimension(org.sleuthkit.autopsy.filequery.DiscoveryUiUtils.getIconSize(),org.sleuthkit.autopsy.filequery.DiscoveryUiUtils.getIconSize()));
fileSizeLabel.setToolTipText(org.openide.util.NbBundle.getMessage(DocumentPanel.class, "DocumentPanel.fileSizeLabel.toolTipText")); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(documentType, org.openide.util.NbBundle.getMessage(DocumentPanel.class, "DocumentPanel.documentType.text")); // NOI18N
previewScrollPane.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
previewTextArea.setEditable(false);
previewTextArea.setColumns(20);
previewTextArea.setFont(new java.awt.Font("Tahoma", 0, 11)); // NOI18N
previewTextArea.setLineWrap(true);
previewTextArea.setRows(5);
previewTextArea.setWrapStyleWord(true);
previewTextArea.setEnabled(false);
previewTextArea.setFocusable(false);
previewTextArea.setMaximumSize(new java.awt.Dimension(164, 94));
previewScrollPane.setViewportView(previewTextArea);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(countLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 530, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 81, Short.MAX_VALUE)
.addComponent(isDeletedLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(scoreLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(fileSizeLabel, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(previewScrollPane)
.addComponent(documentType, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap()
.addComponent(documentType, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(previewScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(fileSizeLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(scoreLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(isDeletedLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(countLabel, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap())
);
}// </editor-fold>//GEN-END:initComponents
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel countLabel;
private javax.swing.JLabel documentType;
private javax.swing.JLabel fileSizeLabel;
private javax.swing.JLabel isDeletedLabel;
private javax.swing.JTextArea previewTextArea;
private javax.swing.JLabel scoreLabel;
// End of variables declaration//GEN-END:variables
@Messages({"# {0} - extension",
"DocumentPanel.documentType.extension.text=Extension: {0}"})
@Override
public Component getListCellRendererComponent(JList<? extends DocumentWrapper> list, DocumentWrapper value, int index, boolean isSelected, boolean cellHasFocus) {
fileSizeLabel.setText(DiscoveryUiUtils.getFileSizeString(value.getResultFile().getFirstInstance().getSize()));
countLabel.setText(Bundle.ImageThumbnailPanel_countLabel_text(value.getResultFile().getAllInstances().size()));
documentType.setText(Bundle.DocumentPanel_documentType_extension_text(value.getResultFile().getFirstInstance().getNameExtension())); //WJS-TODO fill this in with a document type instead of just DOCUMENT
previewTextArea.setText(value.getPreview());
previewTextArea.setCaretPosition(0);
DiscoveryUiUtils.setDeletedIcon(value.getResultFile().isDeleted(), isDeletedLabel);
DiscoveryUiUtils.setScoreIcon(value.getResultFile(), scoreLabel);
setBackground(isSelected ? SELECTION_COLOR : list.getBackground());
return this;
}
@Override
public String getToolTipText(MouseEvent event) {
if (event != null) {
//gets tooltip of internal panel item mouse is over
Point point = event.getPoint();
for (Component comp : getComponents()) {
if (DiscoveryUiUtils.isPointOnIcon(comp, point)) {
String toolTip = ((JComponent) comp).getToolTipText();
if (toolTip == null || toolTip.isEmpty()) {
return null;
} else {
return toolTip;
}
}
}
}
return null;
}
}

Some files were not shown because too many files have changed in this diff Show More