Autopsy  4.8.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
EamDb.java
Go to the documentation of this file.
1 /*
2  * Central Repository
3  *
4  * Copyright 2015-2018 Basis Technology Corp.
5  * Contact: carrier <at> sleuthkit <dot> org
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19 package org.sleuthkit.autopsy.centralrepository.datamodel;
20 
21 import java.sql.SQLException;
22 import java.util.List;
23 import java.util.Set;
24 import org.sleuthkit.datamodel.TskData;
27 import org.sleuthkit.datamodel.CaseDbSchemaVersionNumber;
28 
32 public interface EamDb {
33 
34  public static final int SCHEMA_VERSION = 1;
35  public static final CaseDbSchemaVersionNumber CURRENT_DB_SCHEMA_VERSION
36  = new CaseDbSchemaVersionNumber(1, 1);
37 
38 
46  static EamDb getInstance() throws EamDbException {
47 
48  EamDbPlatformEnum selectedPlatform = EamDbPlatformEnum.DISABLED;
49  if (EamDbUtil.useCentralRepo()) {
50  selectedPlatform = EamDbPlatformEnum.getSelectedPlatform();
51  }
52  switch (selectedPlatform) {
53  case POSTGRESQL:
54  return PostgresEamDb.getInstance();
55 
56  case SQLITE:
57  return SqliteEamDb.getInstance();
58  default:
59  return null;
60  }
61  }
62 
72  void shutdownConnections() throws EamDbException;
73 
82  void updateSettings();
83 
87  void saveSettings();
88 
92  void reset() throws EamDbException;
93 
99  static boolean isEnabled() {
100  return EamDbUtil.useCentralRepo()
102  }
103 
112  public void newDbInfo(String name, String value) throws EamDbException;
113 
123  public String getDbInfo(String name) throws EamDbException;
124 
133  public void updateDbInfo(String name, String value) throws EamDbException;
134 
142  CorrelationCase newCase(CorrelationCase eamCase) throws EamDbException;
143 
149  CorrelationCase newCase(Case autopsyCase) throws EamDbException;
150 
156  void updateCase(CorrelationCase eamCase) throws EamDbException;
157 
167  CorrelationCase getCase(Case autopsyCase) throws EamDbException;
168 
176  CorrelationCase getCaseByUUID(String caseUUID) throws EamDbException;
177 
185  CorrelationCase getCaseById(int caseId) throws EamDbException;
191  List<CorrelationCase> getCases() throws EamDbException;
192 
198  void newDataSource(CorrelationDataSource eamDataSource) throws EamDbException;
199 
209  CorrelationDataSource getDataSource(CorrelationCase correlationCase, String dataSourceDeviceId) throws EamDbException;
210 
211 
221  CorrelationDataSource getDataSourceById(CorrelationCase correlationCase, int dataSourceId) throws EamDbException;
222 
228  List<CorrelationDataSource> getDataSources() throws EamDbException;
229 
236  void addArtifactInstance(CorrelationAttributeInstance eamArtifact) throws EamDbException;
237 
248 
260  List<CorrelationAttributeInstance> getArtifactInstancesByPath(CorrelationAttributeInstance.Type aType, String filePath) throws EamDbException;
261 
272  Long getCountArtifactInstancesByTypeValue(CorrelationAttributeInstance.Type aType, String value) throws EamDbException, CorrelationAttributeNormalizationException;
273 
281  int getFrequencyPercentage(CorrelationAttributeInstance corAttr) throws EamDbException, CorrelationAttributeNormalizationException;
282 
293  Long getCountUniqueCaseDataSourceTuplesHavingTypeValue(CorrelationAttributeInstance.Type aType, String value) throws EamDbException, CorrelationAttributeNormalizationException;
294 
300  Long getCountUniqueDataSources() throws EamDbException;
301 
313  Long getCountArtifactInstancesByCaseDataSource(String caseUUID, String dataSourceID) throws EamDbException;
314 
322  void addAttributeInstanceBulk(CorrelationAttributeInstance eamArtifact) throws EamDbException;
323 
328  void commitAttributeInstancesBulk() throws EamDbException;
329 
333  void bulkInsertCases(List<CorrelationCase> cases) throws EamDbException;
334 
344  void updateAttributeInstanceComment(CorrelationAttributeInstance eamArtifact) throws EamDbException;
345 
361  CorrelationDataSource correlationDataSource, String value, String filePath) throws EamDbException, CorrelationAttributeNormalizationException;
362 
370  void setAttributeInstanceKnownStatus(CorrelationAttributeInstance eamArtifact, TskData.FileKnown knownStatus) throws EamDbException;
371 
381  List<CorrelationAttributeInstance> getArtifactInstancesKnownBad(CorrelationAttributeInstance.Type aType, String value) throws EamDbException, CorrelationAttributeNormalizationException;
382 
400  Long getCountArtifactInstancesKnownBad(CorrelationAttributeInstance.Type aType, String value) throws EamDbException, CorrelationAttributeNormalizationException;
401 
414  List<String> getListCasesHavingArtifactInstancesKnownBad(CorrelationAttributeInstance.Type aType, String value) throws EamDbException, CorrelationAttributeNormalizationException;
415 
423  public void deleteReferenceSet(int referenceSetID) throws EamDbException;
424 
438  public boolean referenceSetIsValid(int referenceSetID, String referenceSetName, String version) throws EamDbException;
439 
452  public boolean referenceSetExists(String referenceSetName, String version) throws EamDbException;
453 
465  public boolean isFileHashInReferenceSet(String hash, int referenceSetID) throws EamDbException, CorrelationAttributeNormalizationException;
466 
476  public boolean isValueInReferenceSet(String value, int referenceSetID, int correlationTypeID) throws EamDbException, CorrelationAttributeNormalizationException;
477 
486  boolean isArtifactKnownBadByReference(CorrelationAttributeInstance.Type aType, String value) throws EamDbException, CorrelationAttributeNormalizationException;
487 
497  EamOrganization newOrganization(EamOrganization eamOrg) throws EamDbException;
498 
506  List<EamOrganization> getOrganizations() throws EamDbException;
507 
517  EamOrganization getOrganizationByID(int orgID) throws EamDbException;
518 
528  EamOrganization getReferenceSetOrganization(int referenceSetID) throws EamDbException;
529 
538  void updateOrganization(EamOrganization updatedOrganization) throws EamDbException;
539 
547  void deleteOrganization(EamOrganization organizationToDelete) throws EamDbException;
548 
558  int newReferenceSet(EamGlobalSet eamGlobalSet) throws EamDbException;
559 
569  EamGlobalSet getReferenceSetByID(int globalSetID) throws EamDbException;
570 
580  List<EamGlobalSet> getAllReferenceSets(CorrelationAttributeInstance.Type correlationType) throws EamDbException;
581 
591  void addReferenceInstance(EamGlobalFileInstance eamGlobalFileInstance, CorrelationAttributeInstance.Type correlationType) throws EamDbException;
592 
602  void bulkInsertReferenceTypeEntries(Set<EamGlobalFileInstance> globalInstances, CorrelationAttributeInstance.Type contentType) throws EamDbException;
603 
614  List<EamGlobalFileInstance> getReferenceInstancesByTypeValue(CorrelationAttributeInstance.Type aType, String aValue) throws EamDbException, CorrelationAttributeNormalizationException;
615 
625  int newCorrelationType(CorrelationAttributeInstance.Type newType) throws EamDbException;
626 
636  List<CorrelationAttributeInstance.Type> getDefinedCorrelationTypes() throws EamDbException;
637 
647  List<CorrelationAttributeInstance.Type> getEnabledCorrelationTypes() throws EamDbException;
648 
658  List<CorrelationAttributeInstance.Type> getSupportedCorrelationTypes() throws EamDbException;
659 
667  void updateCorrelationType(CorrelationAttributeInstance.Type aType) throws EamDbException;
668 
678  CorrelationAttributeInstance.Type getCorrelationTypeById(int typeId) throws EamDbException;
679 
685  public void upgradeSchema() throws EamDbException, SQLException;
686 
698  public CoordinationService.Lock getExclusiveMultiUserDbLock() throws EamDbException;
699 
707  void processInstanceTable(CorrelationAttributeInstance.Type type, InstanceTableCallback instanceTableCallback) throws EamDbException;
708 
717  void processInstanceTableWhere(CorrelationAttributeInstance.Type type, String whereClause, InstanceTableCallback instanceTableCallback) throws EamDbException;
718 
719 }
CorrelationDataSource getDataSource(CorrelationCase correlationCase, String dataSourceDeviceId)
CorrelationCase getCaseByUUID(String caseUUID)
int getFrequencyPercentage(CorrelationAttributeInstance corAttr)
List< CorrelationAttributeInstance > getArtifactInstancesKnownBad(CorrelationAttributeInstance.Type aType, String value)
Long getCountArtifactInstancesKnownBad(CorrelationAttributeInstance.Type aType, String value)
List< String > getListCasesHavingArtifactInstancesKnownBad(CorrelationAttributeInstance.Type aType, String value)
Long getCountArtifactInstancesByTypeValue(CorrelationAttributeInstance.Type aType, String value)
void processInstanceTable(CorrelationAttributeInstance.Type type, InstanceTableCallback instanceTableCallback)
CorrelationCase newCase(CorrelationCase eamCase)
boolean isFileHashInReferenceSet(String hash, int referenceSetID)
boolean isValueInReferenceSet(String value, int referenceSetID, int correlationTypeID)
void bulkInsertReferenceTypeEntries(Set< EamGlobalFileInstance > globalInstances, CorrelationAttributeInstance.Type contentType)
List< CorrelationAttributeInstance > getArtifactInstancesByTypeValue(CorrelationAttributeInstance.Type aType, String value)
void updateOrganization(EamOrganization updatedOrganization)
boolean isArtifactKnownBadByReference(CorrelationAttributeInstance.Type aType, String value)
List< CorrelationAttributeInstance.Type > getDefinedCorrelationTypes()
void addReferenceInstance(EamGlobalFileInstance eamGlobalFileInstance, CorrelationAttributeInstance.Type correlationType)
CorrelationDataSource getDataSourceById(CorrelationCase correlationCase, int dataSourceId)
void addAttributeInstanceBulk(CorrelationAttributeInstance eamArtifact)
Long getCountUniqueCaseDataSourceTuplesHavingTypeValue(CorrelationAttributeInstance.Type aType, String value)
void setAttributeInstanceKnownStatus(CorrelationAttributeInstance eamArtifact, TskData.FileKnown knownStatus)
CorrelationAttributeInstance getCorrelationAttributeInstance(CorrelationAttributeInstance.Type type, CorrelationCase correlationCase, CorrelationDataSource correlationDataSource, String value, String filePath)
CorrelationAttributeInstance.Type getCorrelationTypeById(int typeId)
List< EamGlobalSet > getAllReferenceSets(CorrelationAttributeInstance.Type correlationType)
Long getCountArtifactInstancesByCaseDataSource(String caseUUID, String dataSourceID)
boolean referenceSetExists(String referenceSetName, String version)
List< EamGlobalFileInstance > getReferenceInstancesByTypeValue(CorrelationAttributeInstance.Type aType, String aValue)
static final CaseDbSchemaVersionNumber CURRENT_DB_SCHEMA_VERSION
Definition: EamDb.java:36
EamOrganization newOrganization(EamOrganization eamOrg)
void bulkInsertCases(List< CorrelationCase > cases)
List< CorrelationAttributeInstance.Type > getSupportedCorrelationTypes()
boolean referenceSetIsValid(int referenceSetID, String referenceSetName, String version)
void deleteOrganization(EamOrganization organizationToDelete)
int newCorrelationType(CorrelationAttributeInstance.Type newType)
List< CorrelationAttributeInstance.Type > getEnabledCorrelationTypes()
EamOrganization getReferenceSetOrganization(int referenceSetID)
void processInstanceTableWhere(CorrelationAttributeInstance.Type type, String whereClause, InstanceTableCallback instanceTableCallback)
List< CorrelationAttributeInstance > getArtifactInstancesByPath(CorrelationAttributeInstance.Type aType, String filePath)
void newDataSource(CorrelationDataSource eamDataSource)
void addArtifactInstance(CorrelationAttributeInstance eamArtifact)
void updateAttributeInstanceComment(CorrelationAttributeInstance eamArtifact)
void updateCorrelationType(CorrelationAttributeInstance.Type aType)

Copyright © 2012-2018 Basis Technology. Generated on: Thu Oct 4 2018
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.