mirror of
https://github.com/elisspace/autopsy.git
synced 2026-09-02 22:55:50 +00:00
Merge pull request #5625 from rcordovano/central-repo-class-renamimg
Rename RelationalDbCentralRepo to RdbmsCentralRepo
This commit is contained in:
@@ -30,7 +30,7 @@ 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.RelationalDbCentralRepo.SOFTWARE_CR_DB_SCHEMA_VERSION;
|
||||
import static org.sleuthkit.autopsy.centralrepository.datamodel.RdbmsCentralRepo.SOFTWARE_CR_DB_SCHEMA_VERSION;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -135,8 +135,8 @@ public class CentralRepoDbUtil {
|
||||
*/
|
||||
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 = '" + RelationalDbCentralRepo.SCHEMA_MAJOR_VERSION_KEY + "'");
|
||||
statement.execute("UPDATE db_info SET value = '" + SOFTWARE_CR_DB_SCHEMA_VERSION.getMinor() + "' WHERE name = '" + RelationalDbCentralRepo.SCHEMA_MINOR_VERSION_KEY + "'");
|
||||
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 + "'");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ import org.sleuthkit.autopsy.coreutils.Logger;
|
||||
/**
|
||||
* Central Repository database implementation using Postgres as a backend
|
||||
*/
|
||||
final class PostgresCentralRepo extends RelationalDbCentralRepo {
|
||||
final class PostgresCentralRepo extends RdbmsCentralRepo {
|
||||
|
||||
private final static Logger LOGGER = Logger.getLogger(PostgresCentralRepo.class.getName());
|
||||
|
||||
|
||||
@@ -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.RelationalDbCentralRepo.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
|
||||
@@ -92,15 +92,15 @@ public final class PostgresCentralRepoSettings {
|
||||
try {
|
||||
String bulkThresholdString = ModuleSettings.getConfigSetting("CentralRepository", "db.postgresql.bulkThreshold"); // NON-NLS
|
||||
if (bulkThresholdString == null || bulkThresholdString.isEmpty()) {
|
||||
this.bulkThreshold = RelationalDbCentralRepo.DEFAULT_BULK_THRESHHOLD;
|
||||
this.bulkThreshold = RdbmsCentralRepo.DEFAULT_BULK_THRESHHOLD;
|
||||
} else {
|
||||
this.bulkThreshold = Integer.parseInt(bulkThresholdString);
|
||||
if (getBulkThreshold() <= 0) {
|
||||
this.bulkThreshold = RelationalDbCentralRepo.DEFAULT_BULK_THRESHHOLD;
|
||||
this.bulkThreshold = RdbmsCentralRepo.DEFAULT_BULK_THRESHHOLD;
|
||||
}
|
||||
}
|
||||
} catch (NumberFormatException ex) {
|
||||
this.bulkThreshold = RelationalDbCentralRepo.DEFAULT_BULK_THRESHHOLD;
|
||||
this.bulkThreshold = RdbmsCentralRepo.DEFAULT_BULK_THRESHHOLD;
|
||||
}
|
||||
|
||||
userName = ModuleSettings.getConfigSetting("CentralRepository", "db.postgresql.user"); // NON-NLS
|
||||
@@ -420,10 +420,10 @@ public final class PostgresCentralRepoSettings {
|
||||
* 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 ('" + RelationalDbCentralRepo.SCHEMA_MAJOR_VERSION_KEY + "', '" + SOFTWARE_CR_DB_SCHEMA_VERSION.getMajor() + "')");
|
||||
stmt.execute("INSERT INTO db_info (name, value) VALUES ('" + RelationalDbCentralRepo.SCHEMA_MINOR_VERSION_KEY + "', '" + SOFTWARE_CR_DB_SCHEMA_VERSION.getMinor() + "')");
|
||||
stmt.execute("INSERT INTO db_info (name, value) VALUES ('" + RelationalDbCentralRepo.CREATION_SCHEMA_MAJOR_VERSION_KEY + "', '" + SOFTWARE_CR_DB_SCHEMA_VERSION.getMajor() + "')");
|
||||
stmt.execute("INSERT INTO db_info (name, value) VALUES ('" + RelationalDbCentralRepo.CREATION_SCHEMA_MINOR_VERSION_KEY + "', '" + SOFTWARE_CR_DB_SCHEMA_VERSION.getMinor() + "')");
|
||||
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();
|
||||
|
||||
@@ -55,9 +55,9 @@ import org.sleuthkit.datamodel.TskData;
|
||||
* Generic JDBC methods
|
||||
*
|
||||
*/
|
||||
abstract class RelationalDbCentralRepo implements CentralRepository {
|
||||
abstract class RdbmsCentralRepo implements CentralRepository {
|
||||
|
||||
private final static Logger logger = Logger.getLogger(RelationalDbCentralRepo.class.getName());
|
||||
private final static Logger logger = Logger.getLogger(RdbmsCentralRepo.class.getName());
|
||||
static final String SCHEMA_MAJOR_VERSION_KEY = "SCHEMA_VERSION";
|
||||
static final String SCHEMA_MINOR_VERSION_KEY = "SCHEMA_MINOR_VERSION";
|
||||
static final String CREATION_SCHEMA_MAJOR_VERSION_KEY = "CREATION_SCHEMA_MAJOR_VERSION";
|
||||
@@ -96,7 +96,7 @@ abstract class RelationalDbCentralRepo implements CentralRepository {
|
||||
*
|
||||
* @throws UnknownHostException, EamDbException
|
||||
*/
|
||||
protected RelationalDbCentralRepo() throws CentralRepoException {
|
||||
protected RdbmsCentralRepo() throws CentralRepoException {
|
||||
bulkArtifactsCount = 0;
|
||||
bulkArtifacts = new HashMap<>();
|
||||
|
||||
@@ -3331,7 +3331,7 @@ abstract class RelationalDbCentralRepo implements CentralRepository {
|
||||
selectedPlatform = CentralRepoPlatforms.getSelectedPlatform();
|
||||
int minorVersion = 0;
|
||||
String minorVersionStr = null;
|
||||
resultSet = statement.executeQuery("SELECT value FROM db_info WHERE name='" + RelationalDbCentralRepo.SCHEMA_MINOR_VERSION_KEY + "'");
|
||||
resultSet = statement.executeQuery("SELECT value FROM db_info WHERE name='" + RdbmsCentralRepo.SCHEMA_MINOR_VERSION_KEY + "'");
|
||||
if (resultSet.next()) {
|
||||
minorVersionStr = resultSet.getString("value");
|
||||
try {
|
||||
@@ -3345,7 +3345,7 @@ abstract class RelationalDbCentralRepo implements CentralRepository {
|
||||
|
||||
int majorVersion = 0;
|
||||
String majorVersionStr = null;
|
||||
resultSet = statement.executeQuery("SELECT value FROM db_info WHERE name='" + RelationalDbCentralRepo.SCHEMA_MAJOR_VERSION_KEY + "'");
|
||||
resultSet = statement.executeQuery("SELECT value FROM db_info WHERE name='" + RdbmsCentralRepo.SCHEMA_MAJOR_VERSION_KEY + "'");
|
||||
if (resultSet.next()) {
|
||||
majorVersionStr = resultSet.getString("value");
|
||||
try {
|
||||
@@ -3541,14 +3541,14 @@ abstract class RelationalDbCentralRepo implements CentralRepository {
|
||||
* indicate that it is unknown.
|
||||
*/
|
||||
String creationMajorVer;
|
||||
resultSet = statement.executeQuery("SELECT value FROM db_info WHERE name = '" + RelationalDbCentralRepo.CREATION_SCHEMA_MAJOR_VERSION_KEY + "'");
|
||||
resultSet = statement.executeQuery("SELECT value FROM db_info WHERE name = '" + RdbmsCentralRepo.CREATION_SCHEMA_MAJOR_VERSION_KEY + "'");
|
||||
if (resultSet.next()) {
|
||||
creationMajorVer = resultSet.getString("value");
|
||||
} else {
|
||||
creationMajorVer = "0";
|
||||
}
|
||||
String creationMinorVer;
|
||||
resultSet = statement.executeQuery("SELECT value FROM db_info WHERE name = '" + RelationalDbCentralRepo.CREATION_SCHEMA_MINOR_VERSION_KEY + "'");
|
||||
resultSet = statement.executeQuery("SELECT value FROM db_info WHERE name = '" + RdbmsCentralRepo.CREATION_SCHEMA_MINOR_VERSION_KEY + "'");
|
||||
if (resultSet.next()) {
|
||||
creationMinorVer = resultSet.getString("value");
|
||||
} else {
|
||||
@@ -3560,10 +3560,10 @@ abstract class RelationalDbCentralRepo implements CentralRepository {
|
||||
} else {
|
||||
statement.execute("CREATE TABLE db_info (id INTEGER PRIMARY KEY, name TEXT UNIQUE NOT NULL, value TEXT NOT NULL)");
|
||||
}
|
||||
statement.execute("INSERT INTO db_info (name, value) VALUES ('" + RelationalDbCentralRepo.SCHEMA_MAJOR_VERSION_KEY + "','" + majorVersionStr + "')");
|
||||
statement.execute("INSERT INTO db_info (name, value) VALUES ('" + RelationalDbCentralRepo.SCHEMA_MINOR_VERSION_KEY + "','" + minorVersionStr + "')");
|
||||
statement.execute("INSERT INTO db_info (name, value) VALUES ('" + RelationalDbCentralRepo.CREATION_SCHEMA_MAJOR_VERSION_KEY + "','" + creationMajorVer + "')");
|
||||
statement.execute("INSERT INTO db_info (name, value) VALUES ('" + RelationalDbCentralRepo.CREATION_SCHEMA_MINOR_VERSION_KEY + "','" + creationMinorVer + "')");
|
||||
statement.execute("INSERT INTO db_info (name, value) VALUES ('" + RdbmsCentralRepo.SCHEMA_MAJOR_VERSION_KEY + "','" + majorVersionStr + "')");
|
||||
statement.execute("INSERT INTO db_info (name, value) VALUES ('" + RdbmsCentralRepo.SCHEMA_MINOR_VERSION_KEY + "','" + minorVersionStr + "')");
|
||||
statement.execute("INSERT INTO db_info (name, value) VALUES ('" + RdbmsCentralRepo.CREATION_SCHEMA_MAJOR_VERSION_KEY + "','" + creationMajorVer + "')");
|
||||
statement.execute("INSERT INTO db_info (name, value) VALUES ('" + RdbmsCentralRepo.CREATION_SCHEMA_MINOR_VERSION_KEY + "','" + creationMinorVer + "')");
|
||||
}
|
||||
/*
|
||||
* Update to 1.3
|
||||
@@ -39,7 +39,7 @@ import org.sleuthkit.autopsy.coordinationservice.CoordinationService;
|
||||
* AbstractSqlEamDb that read or write to the database should be overriden here
|
||||
* and use appropriate locking.
|
||||
*/
|
||||
final class SqliteCentralRepo extends RelationalDbCentralRepo {
|
||||
final class SqliteCentralRepo extends RdbmsCentralRepo {
|
||||
|
||||
private final static Logger LOGGER = Logger.getLogger(SqliteCentralRepo.class.getName());
|
||||
|
||||
|
||||
@@ -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.RelationalDbCentralRepo.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
|
||||
@@ -78,15 +78,15 @@ public final class SqliteCentralRepoSettings {
|
||||
try {
|
||||
String bulkThresholdString = ModuleSettings.getConfigSetting("CentralRepository", "db.sqlite.bulkThreshold"); // NON-NLS
|
||||
if (bulkThresholdString == null || bulkThresholdString.isEmpty()) {
|
||||
this.bulkThreshold = RelationalDbCentralRepo.DEFAULT_BULK_THRESHHOLD;
|
||||
this.bulkThreshold = RdbmsCentralRepo.DEFAULT_BULK_THRESHHOLD;
|
||||
} else {
|
||||
this.bulkThreshold = Integer.parseInt(bulkThresholdString);
|
||||
if (getBulkThreshold() <= 0) {
|
||||
this.bulkThreshold = RelationalDbCentralRepo.DEFAULT_BULK_THRESHHOLD;
|
||||
this.bulkThreshold = RdbmsCentralRepo.DEFAULT_BULK_THRESHHOLD;
|
||||
}
|
||||
}
|
||||
} catch (NumberFormatException ex) {
|
||||
this.bulkThreshold = RelationalDbCentralRepo.DEFAULT_BULK_THRESHHOLD;
|
||||
this.bulkThreshold = RdbmsCentralRepo.DEFAULT_BULK_THRESHHOLD;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -369,10 +369,10 @@ public final class SqliteCentralRepoSettings {
|
||||
* 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 ('" + RelationalDbCentralRepo.SCHEMA_MAJOR_VERSION_KEY + "', '" + SOFTWARE_CR_DB_SCHEMA_VERSION.getMajor() + "')");
|
||||
stmt.execute("INSERT INTO db_info (name, value) VALUES ('" + RelationalDbCentralRepo.SCHEMA_MINOR_VERSION_KEY + "', '" + SOFTWARE_CR_DB_SCHEMA_VERSION.getMinor() + "')");
|
||||
stmt.execute("INSERT INTO db_info (name, value) VALUES ('" + RelationalDbCentralRepo.CREATION_SCHEMA_MAJOR_VERSION_KEY + "', '" + SOFTWARE_CR_DB_SCHEMA_VERSION.getMajor() + "')");
|
||||
stmt.execute("INSERT INTO db_info (name, value) VALUES ('" + RelationalDbCentralRepo.CREATION_SCHEMA_MINOR_VERSION_KEY + "', '" + SOFTWARE_CR_DB_SCHEMA_VERSION.getMinor() + "')");
|
||||
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();
|
||||
|
||||
Reference in New Issue
Block a user