From c995dec60e544e4a7dc2c925d961311dfbefd32c Mon Sep 17 00:00:00 2001 From: Richard Cordovano Date: Fri, 31 Jan 2020 10:27:48 -0500 Subject: [PATCH] Rename RelationalDbCentralRepo to RdbmsCentralRepo --- .../datamodel/CentralRepoDbUtil.java | 6 ++--- .../datamodel/PostgresCentralRepo.java | 2 +- .../PostgresCentralRepoSettings.java | 16 +++++++------- ...CentralRepo.java => RdbmsCentralRepo.java} | 22 +++++++++---------- .../datamodel/SqliteCentralRepo.java | 2 +- .../datamodel/SqliteCentralRepoSettings.java | 16 +++++++------- 6 files changed, 32 insertions(+), 32 deletions(-) rename Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/{RelationalDbCentralRepo.java => RdbmsCentralRepo.java} (99%) diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/CentralRepoDbUtil.java b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/CentralRepoDbUtil.java index 2d87fc9b74..4ba8ac579e 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/CentralRepoDbUtil.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/CentralRepoDbUtil.java @@ -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 + "'"); } } diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/PostgresCentralRepo.java b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/PostgresCentralRepo.java index 019957c241..42772a9bd3 100755 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/PostgresCentralRepo.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/PostgresCentralRepo.java @@ -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()); diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/PostgresCentralRepoSettings.java b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/PostgresCentralRepoSettings.java index b29d12d450..9b5b013540 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/PostgresCentralRepoSettings.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/PostgresCentralRepoSettings.java @@ -32,7 +32,7 @@ import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.ModuleSettings; import org.sleuthkit.autopsy.coreutils.TextConverter; import org.sleuthkit.autopsy.coreutils.TextConverterException; -import static org.sleuthkit.autopsy.centralrepository.datamodel.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 DEFAULT_CORRELATION_TYPES = CorrelationAttributeInstance.getDefaultCorrelationTypes(); diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/RelationalDbCentralRepo.java b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/RdbmsCentralRepo.java similarity index 99% rename from Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/RelationalDbCentralRepo.java rename to Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/RdbmsCentralRepo.java index e4a8225db4..1a641c5a28 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/RelationalDbCentralRepo.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/RdbmsCentralRepo.java @@ -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 diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/SqliteCentralRepo.java b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/SqliteCentralRepo.java index 27bf860206..17d1393bbf 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/SqliteCentralRepo.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/SqliteCentralRepo.java @@ -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()); diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/SqliteCentralRepoSettings.java b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/SqliteCentralRepoSettings.java index 2efe91d812..3b2a424c4a 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/SqliteCentralRepoSettings.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/SqliteCentralRepoSettings.java @@ -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 DEFAULT_CORRELATION_TYPES = CorrelationAttributeInstance.getDefaultCorrelationTypes();