diff --git a/Core/nbproject/project.xml b/Core/nbproject/project.xml
index 67e71c9b03..be742fc4ac 100644
--- a/Core/nbproject/project.xml
+++ b/Core/nbproject/project.xml
@@ -316,7 +316,6 @@
org.sleuthkit.autopsy.casemodule.multiusercases
org.sleuthkit.autopsy.casemodule.multiusercasesbrowser
org.sleuthkit.autopsy.casemodule.services
- org.sleuthkit.autopsy.centralrepository.settings
org.sleuthkit.autopsy.contentviewers
org.sleuthkit.autopsy.coordinationservice
org.sleuthkit.autopsy.core
@@ -339,16 +338,13 @@
org.sleuthkit.autopsy.modules.encryptiondetection
org.sleuthkit.autopsy.modules.filetypeid
org.sleuthkit.autopsy.modules.hashdatabase
- org.sleuthkit.autopsy.modules.interestingitems
org.sleuthkit.autopsy.modules.vmextractor
- org.sleuthkit.autopsy.modules.yara.rules
org.sleuthkit.autopsy.progress
org.sleuthkit.autopsy.report
org.sleuthkit.autopsy.textextractors
org.sleuthkit.autopsy.textextractors.configs
org.sleuthkit.autopsy.textsummarizer
org.sleuthkit.autopsy.texttranslation
- org.sleuthkit.autopsy.texttranslation.translators.settings
org.sleuthkit.autopsy.url.analytics
org.sleuthkit.datamodel
org.sleuthkit.datamodel.blackboardutils
diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefinition.java b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefinition.java
index 60a38f3a84..24f208f421 100755
--- a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefinition.java
+++ b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefinition.java
@@ -31,7 +31,7 @@ import javax.annotation.concurrent.Immutable;
import org.openide.util.NbBundle.Messages;
import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
-import org.sleuthkit.autopsy.centralrepository.settings.CentralRepoSettings;
+import org.sleuthkit.autopsy.centralrepository.CentralRepoSettings;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.coreutils.ModuleSettings;
import org.sleuthkit.datamodel.TagName;
diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/settings/CentralRepoSettings.java b/Core/src/org/sleuthkit/autopsy/centralrepository/CentralRepoSettings.java
similarity index 82%
rename from Core/src/org/sleuthkit/autopsy/centralrepository/settings/CentralRepoSettings.java
rename to Core/src/org/sleuthkit/autopsy/centralrepository/CentralRepoSettings.java
index 365d4620e2..751d294df6 100644
--- a/Core/src/org/sleuthkit/autopsy/centralrepository/settings/CentralRepoSettings.java
+++ b/Core/src/org/sleuthkit/autopsy/centralrepository/CentralRepoSettings.java
@@ -16,16 +16,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.sleuthkit.autopsy.centralrepository.settings;
+package org.sleuthkit.autopsy.centralrepository;
-import com.google.common.annotations.Beta;
import java.nio.file.Paths;
-import org.sleuthkit.autopsy.coreutils.PlatformUtil;
+import org.sleuthkit.autopsy.core.configpath.SharedConfigPath;
/**
* Location for central repo settings and paths.
*/
-@Beta
public class CentralRepoSettings {
private static final CentralRepoSettings instance = new CentralRepoSettings();
@@ -39,12 +37,21 @@ public class CentralRepoSettings {
private static final String CENTRAL_REPOSITORY_FOLDER = "CentralRepository";
private static final String CENTRAL_REPOSITORY_SETTINGS_NAME = "CentralRepository";
- private static final String CENTRAL_REPO_BASE_PATH = Paths.get(PlatformUtil.getUserConfigDirectory(), CENTRAL_REPOSITORY_FOLDER).toString();
+ private static final String CENTRAL_REPO_BASE_PATH = Paths.get(
+ SharedConfigPath.getInstance().getSharedConfigPath(),
+ CENTRAL_REPOSITORY_FOLDER).toString();
+
private static final String DEFAULT_DB_PARENT_PATH = Paths.get(CENTRAL_REPO_BASE_PATH, "LocalDatabase").toString();
private static final String DEFAULT_DB_NAME = "central_repository.db";
- private static final String MODULE_SETTINGS_KEY = Paths.get(CENTRAL_REPOSITORY_FOLDER, CENTRAL_REPOSITORY_SETTINGS_NAME).toString();
- private static final String MODULE_SETTINGS_PROPERTIES = Paths.get(CENTRAL_REPO_BASE_PATH, CENTRAL_REPOSITORY_SETTINGS_NAME + ".properties").toString();
-
+ private static final String MODULE_SETTINGS_KEY = Paths.get(
+ SharedConfigPath.getInstance().getSharedConfigFolder(),
+ CENTRAL_REPOSITORY_FOLDER,
+ CENTRAL_REPOSITORY_SETTINGS_NAME).toString();
+
+ private static final String MODULE_SETTINGS_PROPERTIES = Paths.get(
+ CENTRAL_REPO_BASE_PATH,
+ CENTRAL_REPOSITORY_SETTINGS_NAME + ".properties").toString();
+
/**
* @return The base path for central repository settings.
*/
@@ -59,7 +66,7 @@ public class CentralRepoSettings {
public String getModuleSettingsKey() {
return MODULE_SETTINGS_KEY;
}
-
+
/**
* @return The path to the central repo settings.
*/
diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/CentralRepoDbManager.java b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/CentralRepoDbManager.java
index 95bfeca2b5..3f1e82e464 100755
--- a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/CentralRepoDbManager.java
+++ b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/CentralRepoDbManager.java
@@ -24,7 +24,7 @@ import java.io.File;
import java.sql.SQLException;
import java.util.logging.Level;
import org.openide.util.NbBundle;
-import org.sleuthkit.autopsy.centralrepository.settings.CentralRepoSettings;
+import org.sleuthkit.autopsy.centralrepository.CentralRepoSettings;
import org.sleuthkit.autopsy.coordinationservice.CoordinationService;
import org.sleuthkit.autopsy.core.UserPreferences;
import org.sleuthkit.autopsy.coreutils.Logger;
diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/CentralRepoDbUtil.java b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/CentralRepoDbUtil.java
index 4ff0cb7a2e..410e78e52d 100644
--- a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/CentralRepoDbUtil.java
+++ b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/CentralRepoDbUtil.java
@@ -32,7 +32,7 @@ import org.openide.windows.WindowManager;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.coreutils.ModuleSettings;
import static org.sleuthkit.autopsy.centralrepository.datamodel.RdbmsCentralRepo.SOFTWARE_CR_DB_SCHEMA_VERSION;
-import org.sleuthkit.autopsy.centralrepository.settings.CentralRepoSettings;
+import org.sleuthkit.autopsy.centralrepository.CentralRepoSettings;
/**
*
diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/CentralRepoPostgresSettingsUtil.java b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/CentralRepoPostgresSettingsUtil.java
index bf47d92e35..4cce882453 100644
--- a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/CentralRepoPostgresSettingsUtil.java
+++ b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/CentralRepoPostgresSettingsUtil.java
@@ -25,7 +25,7 @@ package org.sleuthkit.autopsy.centralrepository.datamodel;
import java.util.HashMap;
import java.util.Map;
import java.util.logging.Level;
-import org.sleuthkit.autopsy.centralrepository.settings.CentralRepoSettings;
+import org.sleuthkit.autopsy.centralrepository.CentralRepoSettings;
import org.sleuthkit.autopsy.core.UserPreferences;
import org.sleuthkit.autopsy.core.UserPreferencesException;
import org.sleuthkit.autopsy.coreutils.Logger;
diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/SqliteCentralRepoSettings.java b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/SqliteCentralRepoSettings.java
index 3380e4a1e5..1e824ac333 100644
--- a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/SqliteCentralRepoSettings.java
+++ b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/SqliteCentralRepoSettings.java
@@ -29,7 +29,7 @@ import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.regex.Pattern;
-import org.sleuthkit.autopsy.centralrepository.settings.CentralRepoSettings;
+import org.sleuthkit.autopsy.centralrepository.CentralRepoSettings;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.coreutils.ModuleSettings;
import org.sleuthkit.autopsy.coreutils.PlatformUtil;
@@ -62,22 +62,6 @@ public final class SqliteCentralRepoSettings implements CentralRepoDbConnectivit
private String dbDirectory;
private int bulkThreshold;
- /**
- * @return The settings key for the name of the database.
- */
- public static String getDatabaseNameKey() {
- return DATABASE_NAME;
- }
-
- /**
- * @return The settings key for the parent path of the database.
- */
- public static String getDatabasePathKey() {
- return DATABASE_PATH;
- }
-
-
-
public SqliteCentralRepoSettings() {
loadSettings();
}
diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/eventlisteners/Installer.java b/Core/src/org/sleuthkit/autopsy/centralrepository/eventlisteners/Installer.java
index f5f35ccc0e..04e1defe4d 100644
--- a/Core/src/org/sleuthkit/autopsy/centralrepository/eventlisteners/Installer.java
+++ b/Core/src/org/sleuthkit/autopsy/centralrepository/eventlisteners/Installer.java
@@ -33,7 +33,7 @@ import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoDbChoice;
import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoDbManager;
import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoException;
import org.sleuthkit.autopsy.centralrepository.datamodel.SqliteCentralRepoSettings;
-import org.sleuthkit.autopsy.centralrepository.settings.CentralRepoSettings;
+import org.sleuthkit.autopsy.centralrepository.CentralRepoSettings;
import org.sleuthkit.autopsy.core.RuntimeProperties;
import org.sleuthkit.autopsy.core.UserPreferences;
import org.sleuthkit.autopsy.coreutils.Logger;
@@ -49,7 +49,6 @@ public class Installer extends ModuleInstall {
private static final String LEGACY_DEFAULT_FOLDER = "central_repository";
private static final String LEGACY_DEFAULT_DB_PARENT_PATH = Paths.get(PlatformUtil.getUserDirectory().getAbsolutePath(), LEGACY_DEFAULT_FOLDER).toAbsolutePath().toString();
- //private static final String LEGACY_DEFAULT_DB_NAME = "central_repository.db";
private static final String LEGACY_MODULE_SETTINGS_KEY = "CentralRepository";
private static final Logger logger = Logger.getLogger(Installer.class.getName());
diff --git a/Core/src/org/sleuthkit/autopsy/core/Installer.java b/Core/src/org/sleuthkit/autopsy/core/Installer.java
index b848e19f92..5859021285 100644
--- a/Core/src/org/sleuthkit/autopsy/core/Installer.java
+++ b/Core/src/org/sleuthkit/autopsy/core/Installer.java
@@ -216,7 +216,7 @@ public class Installer extends ModuleInstall {
packageInstallers.add(org.sleuthkit.autopsy.healthmonitor.Installer.getDefault());
packageInstallers.add(org.sleuthkit.autopsy.casemodule.Installer.getDefault());
packageInstallers.add(org.sleuthkit.autopsy.texttranslation.translators.Installer.getDefault());
- packageInstallers.add(org.sleuthkit.autopsy.modules.hashdatabase.installer.Installer.getDefault());
+ packageInstallers.add(org.sleuthkit.autopsy.modules.hashdatabase.infrastructure.Installer.getDefault());
/**
* This is a temporary workaround for the following bug in Tika that
diff --git a/Core/src/org/sleuthkit/autopsy/core/UserPreferences.java b/Core/src/org/sleuthkit/autopsy/core/UserPreferences.java
index 6136ff6594..3310975ac1 100644
--- a/Core/src/org/sleuthkit/autopsy/core/UserPreferences.java
+++ b/Core/src/org/sleuthkit/autopsy/core/UserPreferences.java
@@ -18,7 +18,6 @@
*/
package org.sleuthkit.autopsy.core;
-import com.google.common.annotations.Beta;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
@@ -36,6 +35,7 @@ import org.apache.commons.lang3.tuple.Triple;
import org.openide.util.Lookup;
import org.python.icu.util.TimeZone;
import org.sleuthkit.autopsy.appservices.AutopsyService;
+import org.sleuthkit.autopsy.core.configpath.SharedConfigPath;
import org.sleuthkit.autopsy.machinesettings.UserMachinePreferences;
import org.sleuthkit.autopsy.coreutils.ModuleSettings;
import org.sleuthkit.autopsy.coreutils.PlatformUtil;
@@ -51,7 +51,8 @@ import org.sleuthkit.datamodel.TskData.DbType;
public final class UserPreferences {
/**
- * Returns the path to the preferences for the identifier.
+ * Returns the path to the preferences for the identifier in the user config
+ * directory.
*
* @param identifier The identifier.
*
@@ -61,42 +62,22 @@ public final class UserPreferences {
return Paths.get(PlatformUtil.getUserConfigDirectory(), identifier + ".properties").toString();
}
- private static final String VIEW_PREFERENCE_PATH = getConfigPreferencePath("ViewPreferences");
+ /**
+ * Returns the path to the preferences for the identifier in the shared
+ * preference directory.
+ *
+ * @param identifier The identifier.
+ *
+ * @return The path to the preference file.
+ */
+ private static String getSharedPreferencePath(String identifier) {
+ return Paths.get(SharedConfigPath.getInstance().getSharedConfigPath(), identifier + ".properties").toString();
+ }
+
+ private static final String VIEW_PREFERENCE_PATH = getSharedPreferencePath("ViewPreferences");
private static final String MACHINE_SPECIFIC_PREFERENCE_PATH = getConfigPreferencePath("MachineSpecificPreferences");
private static final String MODE_PREFERENCE_PATH = getConfigPreferencePath("ModePreferences");
- private static final String EXTERNAL_SERVICE_PREFERENCE_PATH = getConfigPreferencePath("ExternalServicePreferences");
-
- /**
- * @return The path to machine specific preferences.
- */
- @Beta
- public static String getMachineSpecificPreferencePath() {
- return MACHINE_SPECIFIC_PREFERENCE_PATH;
- }
-
- /**
- * @return The path to mode preferences.
- */
- @Beta
- public static String getModePreferencePath() {
- return MODE_PREFERENCE_PATH;
- }
-
- /**
- * @return The path to external service preferences.
- */
- @Beta
- public static String getExternalServicePreferencePath() {
- return EXTERNAL_SERVICE_PREFERENCE_PATH;
- }
-
- /**
- * @return The path to view preferences.
- */
- @Beta
- public static String getViewPreferencePath() {
- return VIEW_PREFERENCE_PATH;
- }
+ private static final String EXTERNAL_SERVICE_PREFERENCE_PATH = getSharedPreferencePath("ExternalServicePreferences");
private static final ConfigProperties viewPreferences = new ConfigProperties(VIEW_PREFERENCE_PATH);
private static final ConfigProperties machineSpecificPreferences = new ConfigProperties(MACHINE_SPECIFIC_PREFERENCE_PATH);
diff --git a/Core/src/org/sleuthkit/autopsy/core/configpath/SharedConfigPath.java b/Core/src/org/sleuthkit/autopsy/core/configpath/SharedConfigPath.java
new file mode 100644
index 0000000000..93401b648c
--- /dev/null
+++ b/Core/src/org/sleuthkit/autopsy/core/configpath/SharedConfigPath.java
@@ -0,0 +1,58 @@
+/*
+ * Autopsy Forensic Browser
+ *
+ * Copyright 2022 Basis Technology Corp.
+ * Contact: carrier sleuthkit 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.core.configpath;
+
+import java.nio.file.Paths;
+import org.sleuthkit.autopsy.coreutils.PlatformUtil;
+
+/**
+ * Path to sharable config.
+ */
+public class SharedConfigPath {
+
+ private static final SharedConfigPath instance = new SharedConfigPath();
+
+ private static final String SHARED_FOLDER = "SharableConfig";
+ private static final String SHARED_PATH = Paths.get(PlatformUtil.getUserConfigDirectory(), SHARED_FOLDER).toAbsolutePath().toString();
+
+ private SharedConfigPath() {
+ }
+
+ /**
+ * @return An instance of this class.
+ */
+ public static SharedConfigPath getInstance() {
+ return instance;
+ }
+
+ /**
+ * @return The path to a folder for config items that can be shared between
+ * different instances.
+ */
+ public String getSharedConfigPath() {
+ return SHARED_PATH;
+ }
+
+ /**
+ * @return The folder in user config for shared config.
+ */
+ public String getSharedConfigFolder() {
+ return SHARED_FOLDER;
+ }
+}
diff --git a/Core/src/org/sleuthkit/autopsy/coreutils/ModuleSettings.java b/Core/src/org/sleuthkit/autopsy/coreutils/ModuleSettings.java
index 4dcdaab20b..c20888ff81 100644
--- a/Core/src/org/sleuthkit/autopsy/coreutils/ModuleSettings.java
+++ b/Core/src/org/sleuthkit/autopsy/coreutils/ModuleSettings.java
@@ -18,7 +18,6 @@
*/
package org.sleuthkit.autopsy.coreutils;
-import com.google.common.annotations.Beta;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
@@ -132,8 +131,7 @@ public class ModuleSettings {
*
* @return The settings file path as a string.
*/
- @Beta
- public static String getSettingsFilePath(String moduleName) {
+ static String getSettingsFilePath(String moduleName) {
return Paths.get(MODULE_DIR_PATH, moduleName + SETTINGS_FILE_EXT).toString();
}
diff --git a/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettings.java b/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettings.java
index 5399ff1fb3..96422fcac6 100644
--- a/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettings.java
+++ b/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettings.java
@@ -18,7 +18,6 @@
*/
package org.sleuthkit.autopsy.ingest;
-import com.google.common.annotations.Beta;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
@@ -37,9 +36,9 @@ import java.util.logging.Level;
import org.openide.util.NbBundle;
import org.openide.util.io.NbObjectInputStream;
import org.openide.util.io.NbObjectOutputStream;
+import org.sleuthkit.autopsy.core.configpath.SharedConfigPath;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.coreutils.ModuleSettings;
-import org.sleuthkit.autopsy.coreutils.PlatformUtil;
import org.sleuthkit.autopsy.modules.interestingitems.FilesSet;
import org.sleuthkit.autopsy.modules.interestingitems.FilesSetsManager;
import org.sleuthkit.autopsy.python.FactoryClassNameNormalizer;
@@ -52,8 +51,18 @@ public final class IngestJobSettings {
private static final String ENABLED_MODULES_PROPERTY = "Enabled_Ingest_Modules"; //NON-NLS
private static final String DISABLED_MODULES_PROPERTY = "Disabled_Ingest_Modules"; //NON-NLS
private static final String LAST_FILE_INGEST_FILTER_PROPERTY = "Last_File_Ingest_Filter"; //NON-NLS
- private static final String MODULE_SETTINGS_FOLDER = "IngestSettings"; //NON-NLS
- private static final String MODULE_SETTINGS_FOLDER_PATH = Paths.get(PlatformUtil.getUserConfigDirectory(), IngestJobSettings.MODULE_SETTINGS_FOLDER).toAbsolutePath().toString();
+ private static final String MODULE_SETTINGS_FOLDER_NAME = "IngestSettings"; //NON-NLS
+
+ private static final String MODULE_SETTINGS_FOLDER = Paths.get(
+ SharedConfigPath.getInstance().getSharedConfigFolder(),
+ MODULE_SETTINGS_FOLDER_NAME
+ ).toString();
+
+ private static final String MODULE_SETTINGS_FOLDER_PATH = Paths.get(
+ SharedConfigPath.getInstance().getSharedConfigPath(),
+ IngestJobSettings.MODULE_SETTINGS_FOLDER_NAME
+ ).toAbsolutePath().toString();
+
private static final String MODULE_SETTINGS_FILE_EXT = ".settings"; //NON-NLS
private static final CharSequence PYTHON_CLASS_PROXY_PREFIX = "org.python.proxies.".subSequence(0, "org.python.proxies.".length() - 1); //NON-NLS
private static final Logger logger = Logger.getLogger(IngestJobSettings.class.getName());
@@ -63,29 +72,26 @@ public final class IngestJobSettings {
private String executionContext;
private FilesSet fileFilter;
private String moduleSettingsFolderPath;
-
-
+
/**
* @return The base path to module settings.
*/
- @Beta
- public static String getBaseSettingsPath() {
+ static String getBaseSettingsPath() {
return MODULE_SETTINGS_FOLDER_PATH;
}
-
-
/**
- * Returns the string to use with ModuleSettings for resource identification.
+ * Returns the string to use with ModuleSettings for resource
+ * identification.
+ *
* @param executionContext The execution context.
- * @return
+ *
+ * @return
*/
static String getModuleSettingsResource(String executionContext) {
return Paths.get(MODULE_SETTINGS_FOLDER, executionContext).toString();
}
-
-
/**
* Gets the path to the module settings folder for a given execution
* context.
@@ -95,7 +101,7 @@ public final class IngestJobSettings {
* contexts may have different ingest job settings.
*
* @param executionContext The execution context identifier.
- *
+ *
* @return The path to the module settings folder
*/
static Path getSavedModuleSettingsFolder(String executionContext) {
@@ -518,7 +524,7 @@ public final class IngestJobSettings {
* specified context.
*
* @param context -the execution context (profile name) to check.
- *
+ *
* @return the names of the enabled modules
*/
static List getEnabledModules(String context) {
@@ -597,7 +603,7 @@ public final class IngestJobSettings {
disabledModuleNames.add(moduleName);
}
}
-
+
String ingestModuleResource = getModuleSettingsResource(this.executionContext);
ModuleSettings.setConfigSetting(ingestModuleResource, IngestJobSettings.ENABLED_MODULES_PROPERTY, makeCsvList(enabledModuleNames));
ModuleSettings.setConfigSetting(ingestModuleResource, IngestJobSettings.DISABLED_MODULES_PROPERTY, makeCsvList(disabledModuleNames));
diff --git a/Core/src/org/sleuthkit/autopsy/ingest/IngestProfiles.java b/Core/src/org/sleuthkit/autopsy/ingest/IngestProfiles.java
index 0705fbcc63..6303aebad5 100644
--- a/Core/src/org/sleuthkit/autopsy/ingest/IngestProfiles.java
+++ b/Core/src/org/sleuthkit/autopsy/ingest/IngestProfiles.java
@@ -45,8 +45,7 @@ public final class IngestProfiles {
* @return Prefix to append to an ingest profile name when saving to disk or
* using with ingest job settings.
*/
- @Beta
- public static String getIngestProfilePrefix() {
+ static String getIngestProfilePrefix() {
return SETTINGS_FILE_PREFIX;
}
diff --git a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashLookupSettings.java b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashLookupSettings.java
index 5d45ee385a..747293c50a 100644
--- a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashLookupSettings.java
+++ b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashLookupSettings.java
@@ -18,13 +18,11 @@
*/
package org.sleuthkit.autopsy.modules.hashdatabase;
-import com.google.common.annotations.Beta;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.Serializable;
-import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
@@ -37,7 +35,6 @@ import org.openide.util.io.NbObjectOutputStream;
import org.openide.windows.WindowManager;
import org.sleuthkit.autopsy.core.RuntimeProperties;
import org.sleuthkit.autopsy.coreutils.Logger;
-import org.sleuthkit.autopsy.coreutils.PlatformUtil;
import org.sleuthkit.autopsy.coreutils.XMLUtil;
import org.sleuthkit.autopsy.modules.hashdatabase.HashDbManager.CentralRepoHashSet;
import org.sleuthkit.autopsy.modules.hashdatabase.HashDbManager.SleuthkitHashSet;
@@ -46,16 +43,12 @@ import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
import org.sleuthkit.autopsy.modules.hashdatabase.HashDbManager.HashDb;
+import org.sleuthkit.autopsy.modules.hashdatabase.infrastructure.HashConfigPaths;
/**
* Class to represent the settings to be serialized for hash lookup.
*/
-public final class HashLookupSettings implements Serializable {
-
- private static final String HASHSET_FOLDER = "HashLookup";
- private static final String HASHSET_CONFIG_DIR = Paths.get(PlatformUtil.getUserConfigDirectory(), HASHSET_FOLDER).toAbsolutePath().toString();
- private static final String SERIALIZATION_FILE_NAME = "hashLookup.settings"; //NON-NLS
- private static final String SERIALIZATION_FILE_PATH = Paths.get(HASHSET_CONFIG_DIR, SERIALIZATION_FILE_NAME).toString(); //NON-NLS
+final class HashLookupSettings implements Serializable {
private static final String SET_ELEMENT = "hash_set"; //NON-NLS
private static final String SET_NAME_ATTRIBUTE = "name"; //NON-NLS
private static final String SET_TYPE_ATTRIBUTE = "type"; //NON-NLS
@@ -63,11 +56,6 @@ public final class HashLookupSettings implements Serializable {
private static final String SEND_INGEST_MESSAGES_ATTRIBUTE = "show_inbox_messages"; //NON-NLS
private static final String PATH_ELEMENT = "hash_set_path"; //NON-NLS
private static final String LEGACY_PATH_NUMBER_ATTRIBUTE = "number"; //NON-NLS
- private static final String CONFIG_FILE_NAME = "hashsets.xml"; //NON-NLS
- private static final String CONFIG_FILE_PATH = Paths.get(HASHSET_CONFIG_DIR, CONFIG_FILE_NAME).toString();
- private static final String HASH_DATABASE_DEFAULT_FOLDER = "HashDatabases";
- private static final String HASH_DATABASE_DEFAULT_PATH = Paths.get(HASHSET_CONFIG_DIR, HASH_DATABASE_DEFAULT_FOLDER).toString();
-
private static final Logger logger = Logger.getLogger(HashDbManager.class.getName());
@@ -79,26 +67,23 @@ public final class HashLookupSettings implements Serializable {
/**
* @return The path to the hash db settings file.
*/
- @Beta
- public static String getSettingsPath() {
- return SERIALIZATION_FILE_PATH;
+ static String getSettingsPath() {
+ return HashConfigPaths.getInstance().getSettingsPath();
}
/**
* @return The default database folder path.
*/
- @Beta
- public static String getDefaultDbPath() {
- return HASH_DATABASE_DEFAULT_PATH;
+ static String getDefaultDbPath() {
+ return HashConfigPaths.getInstance().getDefaultDbPath();
}
/**
* @return The base path of the hashset config folder.
*/
- @Beta
- public static String getBaseHashsetConfigPath() {
- return HASHSET_CONFIG_DIR;
+ static String getBaseHashsetConfigPath() {
+ return HashConfigPaths.getInstance().getBasePath();
}
/**
@@ -140,7 +125,7 @@ public final class HashLookupSettings implements Serializable {
* settings.
*/
static HashLookupSettings readSettings() throws HashLookupSettingsException {
- File fileSetFile = new File(SERIALIZATION_FILE_PATH);
+ File fileSetFile = new File(HashConfigPaths.getInstance().getSettingsPath());
if (fileSetFile.exists()) {
return readSerializedSettings();
}
@@ -159,7 +144,7 @@ public final class HashLookupSettings implements Serializable {
*/
private static HashLookupSettings readSerializedSettings() throws HashLookupSettingsException {
try {
- try (NbObjectInputStream in = new NbObjectInputStream(new FileInputStream(SERIALIZATION_FILE_PATH))) {
+ try (NbObjectInputStream in = new NbObjectInputStream(new FileInputStream(HashConfigPaths.getInstance().getSettingsPath()))) {
HashLookupSettings filesSetsSettings = (HashLookupSettings) in.readObject();
/* NOTE: to support JIRA-4177, we need to check if any of the hash
@@ -185,12 +170,12 @@ public final class HashLookupSettings implements Serializable {
* settings
*/
private static HashLookupSettings readXmlSettings() throws HashLookupSettingsException {
- File xmlFile = new File(CONFIG_FILE_PATH);
+ File xmlFile = new File(HashConfigPaths.getInstance().getXmlSettingsPath());
if (xmlFile.exists()) {
boolean updatedSchema = false;
// Open the XML document that implements the configuration file.
- final Document doc = XMLUtil.loadDoc(HashDbManager.class, CONFIG_FILE_PATH);
+ final Document doc = XMLUtil.loadDoc(HashDbManager.class, HashConfigPaths.getInstance().getXmlSettingsPath());
if (doc == null) {
throw new HashLookupSettingsException("Could not open xml document.");
}
@@ -285,13 +270,13 @@ public final class HashLookupSettings implements Serializable {
}
if (updatedSchema) {
- String backupFilePath = CONFIG_FILE_PATH + ".v1_backup"; //NON-NLS
+ String backupFilePath = HashConfigPaths.getInstance().getXmlSettingsPath() + ".v1_backup"; //NON-NLS
String messageBoxTitle = NbBundle.getMessage(HashLookupSettings.class,
"HashDbManager.msgBoxTitle.confFileFmtChanged");
String baseMessage = NbBundle.getMessage(HashLookupSettings.class,
"HashDbManager.baseMessage.updatedFormatHashDbConfig");
try {
- FileUtils.copyFile(new File(CONFIG_FILE_PATH), new File(backupFilePath));
+ FileUtils.copyFile(new File(HashConfigPaths.getInstance().getXmlSettingsPath()), new File(backupFilePath));
logger.log(Level.INFO, "Updated the schema, backup saved at: " + backupFilePath);
if (RuntimeProperties.runningWithGUI()) {
JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(),
@@ -330,7 +315,7 @@ public final class HashLookupSettings implements Serializable {
the current user directory path.
*/
convertPathToPlaceholder(settings);
- try (NbObjectOutputStream out = new NbObjectOutputStream(new FileOutputStream(SERIALIZATION_FILE_PATH))) {
+ try (NbObjectOutputStream out = new NbObjectOutputStream(new FileOutputStream(HashConfigPaths.getInstance().getSettingsPath()))) {
out.writeObject(settings);
// restore the paths, in case they are going to be used somewhere
convertPlaceholderToPath(settings);
@@ -352,9 +337,9 @@ public final class HashLookupSettings implements Serializable {
for (HashDbInfo hashDbInfo : settings.getHashDbInfo()) {
if (hashDbInfo.isFileDatabaseType()) {
String dbPath = hashDbInfo.getPath();
- if (dbPath.startsWith(HASHSET_CONFIG_DIR)) {
+ if (dbPath.startsWith(HashConfigPaths.getInstance().getBasePath())) {
// replace the current user directory with place holder
- String remainingPath = dbPath.substring(HASHSET_CONFIG_DIR.length());
+ String remainingPath = dbPath.substring(HashConfigPaths.getInstance().getBasePath().length());
hashDbInfo.setPath(USER_DIR_PLACEHOLDER + remainingPath);
}
}
@@ -375,7 +360,7 @@ public final class HashLookupSettings implements Serializable {
if (dbPath.startsWith(USER_DIR_PLACEHOLDER)) {
// replace the place holder with current user directory
String remainingPath = dbPath.substring(USER_DIR_PLACEHOLDER.length());
- hashDbInfo.setPath(HASHSET_CONFIG_DIR + remainingPath);
+ hashDbInfo.setPath(HashConfigPaths.getInstance().getBasePath() + remainingPath);
}
}
}
diff --git a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/infrastructure/HashConfigPaths.java b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/infrastructure/HashConfigPaths.java
new file mode 100644
index 0000000000..0e864b9fe6
--- /dev/null
+++ b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/infrastructure/HashConfigPaths.java
@@ -0,0 +1,82 @@
+/*
+ * Autopsy Forensic Browser
+ *
+ * Copyright 2022 Basis Technology Corp.
+ * Contact: carrier sleuthkit 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.modules.hashdatabase.infrastructure;
+
+import java.nio.file.Paths;
+import org.sleuthkit.autopsy.core.configpath.SharedConfigPath;
+
+/**
+ * Paths for hash config files.
+ */
+public class HashConfigPaths {
+
+ private static final HashConfigPaths instance = new HashConfigPaths();
+
+ private static final String HASHSET_FOLDER = "HashLookup";
+ private static final String SERIALIZATION_FILE_NAME = "hashLookup.settings"; //NON-NLS
+
+ private static final String HASH_CONFIG_PATH = Paths.get(SharedConfigPath.getInstance().getSharedConfigPath(), HASHSET_FOLDER).toAbsolutePath().toString();
+
+ private static final String XML_FILE_NAME = "hashsets.xml"; //NON-NLS
+ private static final String XML_FILE_PATH = Paths.get(HASH_CONFIG_PATH, XML_FILE_NAME).toAbsolutePath().toString();
+
+ private static final String HASH_DATABASE_DEFAULT_FOLDER = "HashDatabases";
+ private static final String HASH_DATABASE_DEFAULT_PATH = Paths.get(HASH_CONFIG_PATH, HASH_DATABASE_DEFAULT_FOLDER).toString();
+
+ private static final String SERIALIZATION_FILE_PATH = Paths.get(HASH_CONFIG_PATH, SERIALIZATION_FILE_NAME).toString(); //NON-NLS
+
+
+ private HashConfigPaths() {
+ }
+
+ /**
+ * @return Singleton instance of this class.
+ */
+ public static HashConfigPaths getInstance() {
+ return instance;
+ }
+
+ /**
+ * @return The base path to the config file.
+ */
+ public String getBasePath() {
+ return HASH_CONFIG_PATH;
+ }
+
+ /**
+ * @return The default hash database path.
+ */
+ public String getDefaultDbPath() {
+ return HASH_DATABASE_DEFAULT_PATH;
+ }
+
+ /**
+ * @return The path to the serialized settings file.
+ */
+ public String getSettingsPath() {
+ return SERIALIZATION_FILE_PATH;
+ }
+
+ /**
+ * @return The path to the xml settings file.
+ */
+ public String getXmlSettingsPath() {
+ return XML_FILE_PATH;
+ }
+}
diff --git a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/installer/Installer.java b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/infrastructure/Installer.java
similarity index 78%
rename from Core/src/org/sleuthkit/autopsy/modules/hashdatabase/installer/Installer.java
rename to Core/src/org/sleuthkit/autopsy/modules/hashdatabase/infrastructure/Installer.java
index 0b7363785c..55470e58d8 100644
--- a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/installer/Installer.java
+++ b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/infrastructure/Installer.java
@@ -16,7 +16,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.sleuthkit.autopsy.modules.hashdatabase.installer;
+package org.sleuthkit.autopsy.modules.hashdatabase.infrastructure;
import java.io.File;
import java.io.IOException;
@@ -27,13 +27,13 @@ import org.openide.modules.ModuleInstall;
import org.python.icu.text.MessageFormat;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.coreutils.PlatformUtil;
-import org.sleuthkit.autopsy.modules.hashdatabase.HashLookupSettings;
/**
* Installer for hash databases that copies legacy settings to new location.
*/
public class Installer extends ModuleInstall {
+ private static final String LEGACY_SERIALIZATION_XML_FILE_PATH = Paths.get(PlatformUtil.getUserConfigDirectory(), "hashsets.xml").toString();
private static final String LEGACY_SERIALIZATION_FILE_PATH = Paths.get(PlatformUtil.getUserConfigDirectory(), "hashLookup.settings").toString(); //NON-NLS
private static final String LEGACY_HASH_DATABASE_DEFAULT_PATH = Paths.get(PlatformUtil.getUserConfigDirectory(), "HashDatabases").toString();
@@ -69,19 +69,18 @@ public class Installer extends ModuleInstall {
public void restored() {
// copy user dir hash dbs from legacy to new if old path exists and new does not.
File legacyDbPath = new File(LEGACY_HASH_DATABASE_DEFAULT_PATH);
- File dbPath = new File(HashLookupSettings.getDefaultDbPath());
+ File dbPath = new File(HashConfigPaths.getInstance().getDefaultDbPath());
if (legacyDbPath.exists() && !dbPath.exists()) {
try {
FileUtils.copyDirectory(legacyDbPath, dbPath);
} catch (IOException ex) {
logger.log(Level.WARNING, MessageFormat.format("There was an error copying legacy path hash dbs from {0} to {1}", legacyDbPath, dbPath), ex);
}
-
}
// copy hash db settings to new location.
File legacySettingsFile = new File(LEGACY_SERIALIZATION_FILE_PATH);
- File settingsFile = new File(HashLookupSettings.getSettingsPath());
+ File settingsFile = new File(HashConfigPaths.getInstance().getSettingsPath());
if (legacySettingsFile.exists() && !settingsFile.exists()) {
try {
FileUtils.copyFile(legacySettingsFile, settingsFile);
@@ -89,6 +88,17 @@ public class Installer extends ModuleInstall {
logger.log(Level.WARNING, MessageFormat.format("There was an error copying legacy hash db settings from {0} to {1}", legacySettingsFile, settingsFile), ex);
}
}
+
+ File legacyXmlSettingsFile = new File(LEGACY_SERIALIZATION_XML_FILE_PATH);
+ File xmlSettingsFile = new File(HashConfigPaths.getInstance().getXmlSettingsPath());
+ if (legacyXmlSettingsFile.exists() && !xmlSettingsFile.exists()) {
+ try {
+ FileUtils.copyFile(legacyXmlSettingsFile, xmlSettingsFile);
+ } catch (IOException ex) {
+ logger.log(Level.WARNING, MessageFormat.format("There was an error copying legacy xml hash db settings from {0} to {1}", legacyXmlSettingsFile, xmlSettingsFile), ex);
+ }
+ }
+
}
}
diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetsManager.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetsManager.java
index 0d78bdffb6..a81c81bf06 100644
--- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetsManager.java
+++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetsManager.java
@@ -84,16 +84,14 @@ public final class FilesSetsManager extends Observable {
/**
* @return The path to file filter settings.
*/
- @Beta
- public static String getFileFilterPath() {
+ static String getFileFilterPath() {
return FILE_FILTER_PATH;
}
/**
* @return The path to interesting item settings.
*/
- @Beta
- public static String getInterestingItemPath() {
+ static String getInterestingItemPath() {
return INTERESTING_ITEM_PATH;
}
diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemsFilesSetSettings.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemsFilesSetSettings.java
index e165500132..f081acdf63 100644
--- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemsFilesSetSettings.java
+++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemsFilesSetSettings.java
@@ -89,8 +89,7 @@ class InterestingItemsFilesSetSettings implements Serializable {
private static final String EXTENSION_RULE_TAG = "EXTENSION"; //NON-NLS
private static final String STANDARD_SET = "standardSet";
private static final String VERSION_NUMBER = "versionNumber";
-
-
+
private Map filesSets;
InterestingItemsFilesSetSettings(Map filesSets) {
diff --git a/Core/src/org/sleuthkit/autopsy/modules/leappanalyzers/LeappFileProcessor.java b/Core/src/org/sleuthkit/autopsy/modules/leappanalyzers/LeappFileProcessor.java
index e482c29ebf..1e4e30a944 100644
--- a/Core/src/org/sleuthkit/autopsy/modules/leappanalyzers/LeappFileProcessor.java
+++ b/Core/src/org/sleuthkit/autopsy/modules/leappanalyzers/LeappFileProcessor.java
@@ -29,7 +29,6 @@ import java.io.IOException;
import java.io.UncheckedIOException;
import java.nio.file.Files;
import java.nio.file.Path;
-import java.nio.file.Paths;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
@@ -197,20 +196,6 @@ public final class LeappFileProcessor {
.put("call history.tsv", "calllog")
.build();
- private static final String BASE_FOLDER = "LeappProcessor";
- private static final String BASE_PATH = Paths.get(PlatformUtil.getUserConfigDirectory(), BASE_FOLDER).toString();
-
- /**
- * The path to an xml file config file on disk.
- *
- * @param xmlFileName The xml file name.
- *
- * @return The path to the xml file.
- */
- private static String getXmlPath(String xmlFileName) {
- return Paths.get(BASE_PATH, xmlFileName).toString();
- }
-
private final Blackboard blkBoard;
public LeappFileProcessor(String xmlFile, String moduleName, IngestJobContext context) throws IOException, IngestModuleException, NoCurrentCaseException {
@@ -1093,7 +1078,7 @@ public final class LeappFileProcessor {
private void loadConfigFile() throws IngestModuleException {
Document xmlinput;
try {
- String path = getXmlPath(xmlFile);
+ String path = PlatformUtil.getUserConfigDirectory() + File.separator + xmlFile;
File f = new File(path);
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
@@ -1278,18 +1263,8 @@ public final class LeappFileProcessor {
* @throws org.sleuthkit.autopsy.ingest.IngestModule.IngestModuleException
*/
private void configExtractor() throws IOException {
- File curFileLoc = Paths.get(PlatformUtil.getUserConfigDirectory(), xmlFile).toFile();
- File newFileLoc = new File(getXmlPath(xmlFile));
-
- if (!newFileLoc.exists()) {
- PlatformUtil.extractResourceToUserConfigDir(LeappFileProcessor.class,
- xmlFile, true);
-
- if (curFileLoc.exists()) {
- newFileLoc.getParentFile().mkdirs();
- curFileLoc.renameTo(newFileLoc);
- }
- }
+ PlatformUtil.extractResourceToUserConfigDir(LeappFileProcessor.class,
+ xmlFile, true);
}
private static final Set ALLOWED_EXTENSIONS = new HashSet<>(Arrays.asList("zip", "tar", "tgz"));
diff --git a/Core/src/org/sleuthkit/autopsy/report/ReportingConfigPath.java b/Core/src/org/sleuthkit/autopsy/report/ReportingConfigPath.java
deleted file mode 100644
index 16d03f710f..0000000000
--- a/Core/src/org/sleuthkit/autopsy/report/ReportingConfigPath.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Autopsy Forensic Browser
- *
- * Copyright 2022 Basis Technology Corp.
- * Contact: carrier sleuthkit 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.report;
-
-import org.sleuthkit.autopsy.report.infrastructure.ReportingConfigLoader;
-import com.google.common.annotations.Beta;
-
-/**
- * Paths to report config.
- */
-public class ReportingConfigPath {
-
- /**
- * @return The base path for reports.
- */
- @Beta
- public static String getBaseReportPath() {
- return ReportingConfigLoader.getBaseReportPath();
- }
-}
diff --git a/Core/src/org/sleuthkit/autopsy/report/infrastructure/ReportingConfigLoader.java b/Core/src/org/sleuthkit/autopsy/report/infrastructure/ReportingConfigLoader.java
index def8c24afa..8e06659c01 100755
--- a/Core/src/org/sleuthkit/autopsy/report/infrastructure/ReportingConfigLoader.java
+++ b/Core/src/org/sleuthkit/autopsy/report/infrastructure/ReportingConfigLoader.java
@@ -36,8 +36,8 @@ import java.util.TreeSet;
import java.util.logging.Level;
import org.openide.util.io.NbObjectInputStream;
import org.openide.util.io.NbObjectOutputStream;
+import org.sleuthkit.autopsy.core.configpath.SharedConfigPath;
import org.sleuthkit.autopsy.coreutils.Logger;
-import org.sleuthkit.autopsy.coreutils.PlatformUtil;
import org.sleuthkit.autopsy.report.GeneralReportSettings;
/**
@@ -45,11 +45,15 @@ import org.sleuthkit.autopsy.report.GeneralReportSettings;
* all of the settings that make up a reporting configuration in an atomic,
* thread safe way.
*/
-public final class ReportingConfigLoader {
+final class ReportingConfigLoader {
private static final Logger logger = Logger.getLogger(ReportingConfigLoader.class.getName());
private static final String REPORT_CONFIG_FOLDER = "ReportingConfigs"; //NON-NLS
- private static final String REPORT_CONFIG_FOLDER_PATH = Paths.get(PlatformUtil.getUserConfigDirectory(), ReportingConfigLoader.REPORT_CONFIG_FOLDER).toAbsolutePath().toString();
+ private static final String REPORT_CONFIG_FOLDER_PATH = Paths.get(
+ SharedConfigPath.getInstance().getSharedConfigPath(),
+ ReportingConfigLoader.REPORT_CONFIG_FOLDER
+ ).toAbsolutePath().toString();
+
private static final String REPORT_SETTINGS_FILE_EXTENSION = ".settings";
private static final String TABLE_REPORT_CONFIG_FILE = "TableReportSettings.settings";
private static final String FILE_REPORT_CONFIG_FILE = "FileReportSettings.settings";
@@ -61,13 +65,6 @@ public final class ReportingConfigLoader {
// existing in the configuration file.
private static final List DELETED_REPORT_MODULES = Arrays.asList("org.sleuthkit.autopsy.report.modules.stix.STIXReportModule");
- /**
- * @return The base path for reports.
- */
- public static String getBaseReportPath() {
- return REPORT_CONFIG_FOLDER_PATH;
- }
-
/**
* Deserialize all of the settings that make up a reporting configuration in
* an atomic, thread safe way.
diff --git a/Core/src/org/sleuthkit/autopsy/texttranslation/translators/BingTranslatorSettings.java b/Core/src/org/sleuthkit/autopsy/texttranslation/translators/BingTranslatorSettings.java
index 9a8414d548..c23d2938a9 100644
--- a/Core/src/org/sleuthkit/autopsy/texttranslation/translators/BingTranslatorSettings.java
+++ b/Core/src/org/sleuthkit/autopsy/texttranslation/translators/BingTranslatorSettings.java
@@ -20,7 +20,7 @@ package org.sleuthkit.autopsy.texttranslation.translators;
import org.apache.commons.lang3.StringUtils;
import org.sleuthkit.autopsy.coreutils.ModuleSettings;
-import org.sleuthkit.autopsy.texttranslation.translators.settings.TranslatorSettings;
+import org.sleuthkit.autopsy.texttranslation.translators.TranslatorSettings;
/**
* Class to handle the settings associated with the BingTranslator
diff --git a/Core/src/org/sleuthkit/autopsy/texttranslation/translators/GoogleTranslatorSettings.java b/Core/src/org/sleuthkit/autopsy/texttranslation/translators/GoogleTranslatorSettings.java
index f1d60c9407..55cb8b7e9c 100644
--- a/Core/src/org/sleuthkit/autopsy/texttranslation/translators/GoogleTranslatorSettings.java
+++ b/Core/src/org/sleuthkit/autopsy/texttranslation/translators/GoogleTranslatorSettings.java
@@ -21,7 +21,7 @@ package org.sleuthkit.autopsy.texttranslation.translators;
import com.google.cloud.translate.TranslateOptions;
import org.apache.commons.lang3.StringUtils;
import org.sleuthkit.autopsy.coreutils.ModuleSettings;
-import org.sleuthkit.autopsy.texttranslation.translators.settings.TranslatorSettings;
+import org.sleuthkit.autopsy.texttranslation.translators.TranslatorSettings;
/**
* Class to handle the settings associated with the GoogleTranslator
diff --git a/Core/src/org/sleuthkit/autopsy/texttranslation/translators/settings/TranslatorSettings.java b/Core/src/org/sleuthkit/autopsy/texttranslation/translators/TranslatorSettings.java
similarity index 83%
rename from Core/src/org/sleuthkit/autopsy/texttranslation/translators/settings/TranslatorSettings.java
rename to Core/src/org/sleuthkit/autopsy/texttranslation/translators/TranslatorSettings.java
index 89ed9e2c81..3f17957593 100644
--- a/Core/src/org/sleuthkit/autopsy/texttranslation/translators/settings/TranslatorSettings.java
+++ b/Core/src/org/sleuthkit/autopsy/texttranslation/translators/TranslatorSettings.java
@@ -16,17 +16,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.sleuthkit.autopsy.texttranslation.translators.settings;
+package org.sleuthkit.autopsy.texttranslation.translators;
import java.nio.file.Paths;
import org.sleuthkit.autopsy.coreutils.PlatformUtil;
-import com.google.common.annotations.Beta;
/**
* ModuleSettings keys and paths for translator settings.
*/
- @Beta
-public class TranslatorSettings {
+class TranslatorSettings {
private static final String TRANSLATION_FOLDER = "Translation";
private static final String TRANSLATION_PATH = Paths.get(PlatformUtil.getUserConfigDirectory(), TRANSLATION_FOLDER).toString();
@@ -36,7 +34,7 @@ public class TranslatorSettings {
/**
* @return The singular instance.
*/
- public static TranslatorSettings getInstance() {
+ static TranslatorSettings getInstance() {
return instance;
}
@@ -51,14 +49,14 @@ public class TranslatorSettings {
*
* @return The resource name to use with ModuleSettings.
*/
- public String getModuleSettingsResource(String translationResource) {
+ String getModuleSettingsResource(String translationResource) {
return Paths.get(TRANSLATION_FOLDER, translationResource).toString();
}
/**
* @return The base translation folder.
*/
- public String getBaseTranslationFolder() {
+ String getBaseTranslationFolder() {
return TRANSLATION_PATH;
}
}
diff --git a/Core/test/qa-functional/src/org/sleuthkit/autopsy/centralrepository/datamodel/CentralRepoDatamodelTest.java b/Core/test/qa-functional/src/org/sleuthkit/autopsy/centralrepository/datamodel/CentralRepoDatamodelTest.java
index 4f7395bd4a..d4b188d7db 100755
--- a/Core/test/qa-functional/src/org/sleuthkit/autopsy/centralrepository/datamodel/CentralRepoDatamodelTest.java
+++ b/Core/test/qa-functional/src/org/sleuthkit/autopsy/centralrepository/datamodel/CentralRepoDatamodelTest.java
@@ -43,7 +43,7 @@ import org.sleuthkit.autopsy.casemodule.CaseDetails;
import org.sleuthkit.autopsy.coreutils.ModuleSettings;
import org.sleuthkit.datamodel.TskData;
import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
-import org.sleuthkit.autopsy.centralrepository.settings.CentralRepoSettings;
+import org.sleuthkit.autopsy.centralrepository.CentralRepoSettings;
import org.sleuthkit.autopsy.coreutils.FileUtil;
/**
diff --git a/Experimental/src/org/sleuthkit/autopsy/experimental/configuration/SharedConfiguration.java b/Experimental/src/org/sleuthkit/autopsy/experimental/configuration/SharedConfiguration.java
index 5b56e2b30e..d8c5a56067 100644
--- a/Experimental/src/org/sleuthkit/autopsy/experimental/configuration/SharedConfiguration.java
+++ b/Experimental/src/org/sleuthkit/autopsy/experimental/configuration/SharedConfiguration.java
@@ -38,7 +38,6 @@ import java.util.HashMap;
import java.util.concurrent.TimeUnit;
import java.util.prefs.BackingStoreException;
import org.apache.commons.io.FileUtils;
-import org.sleuthkit.autopsy.centralrepository.settings.CentralRepoSettings;
import org.sleuthkit.autopsy.core.UserPreferences;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.coreutils.PlatformUtil;
@@ -53,8 +52,6 @@ import org.sleuthkit.autopsy.coordinationservice.CoordinationService;
import org.sleuthkit.autopsy.coordinationservice.CoordinationService.CategoryNode;
import org.sleuthkit.autopsy.coordinationservice.CoordinationService.Lock;
import org.sleuthkit.autopsy.coordinationservice.CoordinationService.CoordinationServiceException;
-import org.sleuthkit.autopsy.modules.hashdatabase.HashLookupSettings;
-import org.sleuthkit.autopsy.modules.interestingitems.FilesSetsManager;
/*
* A utility class for loading and saving shared configuration data
@@ -65,8 +62,8 @@ public class SharedConfiguration {
private static final String AUTO_MODE_CONTEXT_FILE = "AutoModeContext.properties"; //NON-NLS
private static final String USER_DEFINED_TYPE_DEFINITIONS_FILE = "UserFileTypeDefinitions.settings"; //NON-NLS
private static final String USER_DEFINED_TYPE_DEFINITIONS_FILE_LEGACY = "UserFileTypeDefinitions.xml"; //NON-NLS
+ private static final String INTERESTING_FILES_SET_DEFS_FILE = "InterestingFileSets.settings"; //NON-NLS
private static final String INTERESTING_FILES_SET_DEFS_FILE_LEGACY = "InterestingFilesSetDefs.xml"; //NON-NLS
-
private static final String KEYWORD_SEARCH_SETTINGS = "keywords.settings"; //NON-NLS
private static final String KEYWORD_SEARCH_SETTINGS_LEGACY = "keywords.xml"; //NON-NLS
private static final String KEYWORD_SEARCH_GENERAL_LEGACY = "KeywordSearch.properties"; //NON-NLS
@@ -77,22 +74,30 @@ public class SharedConfiguration {
private static final String FILE_EXT_MISMATCH_SETTINGS_LEGACY = "mismatch_config.xml"; //NON-NLS
private static final String ANDROID_TRIAGE = "AndroidTriage_Options.properties"; //NON-NLS
private static final String AUTO_INGEST_PROPERTIES = "AutoIngest.properties"; //NON-NLS
-
- private static final String REMOTE_HASH_FOLDER = "hashDb"; //NON-NLS
-
+ private static final String HASHDB_CONFIG_FILE_NAME = "hashLookup.settings"; //NON-NLS
private static final String HASHDB_CONFIG_FILE_NAME_LEGACY = "hashsets.xml"; //NON-NLS
public static final String FILE_EXPORTER_SETTINGS_FILE = "fileexporter.settings"; //NON-NLS
+ private static final String CENTRAL_REPOSITORY_PROPERTIES_FILE = "CentralRepository.properties"; //NON-NLS
private static final String SHARED_CONFIG_VERSIONS = "SharedConfigVersions.txt"; //NON-NLS
// Folders
private static final String AUTO_MODE_FOLDER = "AutoModeContext"; //NON-NLS
+ private static final String REMOTE_HASH_FOLDER = "hashDb"; //NON-NLS
public static final String FILE_EXPORTER_FOLDER = "Automated File Exporter"; //NON-NLS
+
private static final String UPLOAD_IN_PROGRESS_FILE = "uploadInProgress"; // NON-NLS
private static final String moduleDirPath = PlatformUtil.getUserConfigDirectory();
private static final String INGEST_MODULES_PATH = IngestJobSettings.getBaseSettingsPath();
private static final String INGEST_MODULES_REL_PATH = new File(moduleDirPath).toURI().relativize(new File(INGEST_MODULES_PATH).toURI()).getPath();
private static final Logger logger = Logger.getLogger(SharedConfiguration.class.getName());
-
+ private static final String SHARED_DIR_PATH = Paths.get(moduleDirPath, "SharableConfig").toAbsolutePath().toString();
+ private static final String CENTRAL_REPO_DIR_PATH = Paths.get(SHARED_DIR_PATH, "CentralRepository").toAbsolutePath().toString();
+ private static final String VIEW_PREFERENCE_FILE = Paths.get(SHARED_DIR_PATH, "ViewPreferences").toAbsolutePath().toString();
+ private static final String MACHINE_SPECIFIC_PREFERENCE_FILE = Paths.get(moduleDirPath, "MachineSpecificPreferences").toAbsolutePath().toString();
+ private static final String MODE_PREFERENCE_FILE = Paths.get(moduleDirPath, "ModePreferences").toAbsolutePath().toString();
+ private static final String EXTERNAL_SERVICE_PREFERENCE_FILE = Paths.get(moduleDirPath, "ExternalServicePreferences").toAbsolutePath().toString();
+
+
private final UpdateConfigSwingWorker swingWorker;
private UserPreferences.SelectedMode mode;
private String sharedConfigFolder;
@@ -106,6 +111,8 @@ public class SharedConfiguration {
private boolean hideSlackFilesInViews;
private boolean keepPreferredViewer;
+
+
/**
* Exception type thrown by shared configuration.
*/
@@ -444,24 +451,6 @@ public class SharedConfiguration {
File contextProperties = Paths.get(folder.getAbsolutePath(), INGEST_MODULES_REL_PATH, AUTO_MODE_CONTEXT_FILE).toFile();
return contextProperties.exists();
}
-
- /**
- * Copy a local settings file to the remote folder.
- *
- * @param fullLocalPathStr Full local path.
- * @param localFolder Local settings folder
- * @param remoteFolder Shared settings folder
- * @param missingFileOk True if it's not an error if the source file is
- * not found
- *
- * @throws SharedConfigurationException
- */
- private static void copyToRemoteFolder(String fullLocalPathStr, File remoteFolder, boolean missingFileOk) throws SharedConfigurationException {
- Path fullLocalPath = Paths.get(fullLocalPathStr);
- String fileName = fullLocalPath.toFile().getName();
- String parentPath = fullLocalPath.getParent().toString();
- copyToRemoteFolder(fileName, parentPath, remoteFolder, missingFileOk);
- }
/**
* Copy a local settings file to the remote folder.
@@ -502,23 +491,6 @@ public class SharedConfiguration {
throw new SharedConfigurationException(String.format("Failed to copy %s to %s", localFile.getAbsolutePath(), remoteFolder.getAbsolutePath()), ex);
}
}
-
- /**
- * Copy a shared settings file to the local settings folder.
- *
- * @param fullLocalPathStr Full local path.
- * @param remoteFolder Shared settings folder
- * @param missingFileOk True if it's not an error if the source file is
- * not found
- *
- * @throws SharedConfigurationException
- */
- private static void copyToLocalFolder(String fullLocalPathStr, File remoteFolder, boolean missingFileOk) throws SharedConfigurationException {
- Path fullLocalPath = Paths.get(fullLocalPathStr);
- String fileName = fullLocalPath.toFile().getName();
- String parentPath = fullLocalPath.getParent().toString();
- copyToLocalFolder(fileName, parentPath, remoteFolder, missingFileOk);
- }
/**
* Copy a shared settings file to the local settings folder.
@@ -767,7 +739,7 @@ public class SharedConfiguration {
private void uploadInterestingFilesSettings(File remoteFolder) throws SharedConfigurationException {
publishTask("Uploading InterestingFiles module configuration");
copyToRemoteFolder(INTERESTING_FILES_SET_DEFS_FILE_LEGACY, moduleDirPath, remoteFolder, true);
- copyToRemoteFolder(FilesSetsManager.getInstance().getInterestingItemPath(), remoteFolder, true);
+ copyToRemoteFolder(INTERESTING_FILES_SET_DEFS_FILE, SHARED_DIR_PATH, remoteFolder, true);
}
/**
@@ -780,7 +752,7 @@ public class SharedConfiguration {
private void downloadInterestingFilesSettings(File remoteFolder) throws SharedConfigurationException {
publishTask("Downloading InterestingFiles module configuration");
copyToLocalFolder(INTERESTING_FILES_SET_DEFS_FILE_LEGACY, moduleDirPath, remoteFolder, true);
- copyToLocalFolder(FilesSetsManager.getInstance().getInterestingItemPath(), remoteFolder, true);
+ copyToLocalFolder(INTERESTING_FILES_SET_DEFS_FILE, SHARED_DIR_PATH, remoteFolder, true);
}
/**
@@ -903,15 +875,7 @@ public class SharedConfiguration {
*/
private void uploadCentralRepositorySettings(File remoteFolder) throws SharedConfigurationException {
publishTask("Uploading central repository configuration");
-
- // get relative cr path to config path.
- String centralRepoRelPath = new File(moduleDirPath).toURI().relativize(
- new File(CentralRepoSettings.getInstance().getModuleSettingsFile()).getParentFile().toURI()).getPath();
-
- copyToRemoteFolder(
- CentralRepoSettings.getInstance().getModuleSettingsFile(),
- Paths.get(remoteFolder.getAbsolutePath(), centralRepoRelPath).toFile(),
- true);
+ copyToRemoteFolder(CENTRAL_REPOSITORY_PROPERTIES_FILE, CENTRAL_REPO_DIR_PATH, remoteFolder, true);
}
/**
@@ -923,12 +887,7 @@ public class SharedConfiguration {
*/
private void downloadCentralRepositorySettings(File remoteFolder) throws SharedConfigurationException {
publishTask("Downloading central repository configuration");
-
- // get relative cr path to config path.
- String centralRepoRelPath = new File(moduleDirPath).toURI().relativize(
- new File(CentralRepoSettings.getInstance().getModuleSettingsFile()).getParentFile().toURI()).getPath();
-
- copyToLocalFolder(CentralRepoSettings.getInstance().getModuleSettingsFile(), Paths.get(remoteFolder.getAbsolutePath(), centralRepoRelPath).toFile(), true);
+ copyToLocalFolder(CENTRAL_REPOSITORY_PROPERTIES_FILE, CENTRAL_REPO_DIR_PATH, remoteFolder, true);
}
/**
@@ -941,11 +900,11 @@ public class SharedConfiguration {
private void uploadMultiUserAndGeneralSettings(File remoteFolder) throws SharedConfigurationException {
publishTask("Uploading multi user configuration");
- copyToRemoteFolder(UserPreferences.getViewPreferencePath(), remoteFolder, false);
- copyToRemoteFolder(UserPreferences.getMachineSpecificPreferencePath(), remoteFolder, false);
- copyToRemoteFolder(UserPreferences.getModePreferencePath(), remoteFolder, false);
- copyToRemoteFolder(UserPreferences.getExternalServicePreferencePath(), remoteFolder, false);
-
+ copyToRemoteFolder(VIEW_PREFERENCE_FILE, SHARED_DIR_PATH, remoteFolder, false);
+ copyToRemoteFolder(MACHINE_SPECIFIC_PREFERENCE_FILE, moduleDirPath, remoteFolder, false);
+ copyToRemoteFolder(MODE_PREFERENCE_FILE, moduleDirPath, remoteFolder, false);
+ copyToRemoteFolder(EXTERNAL_SERVICE_PREFERENCE_FILE, SHARED_DIR_PATH, remoteFolder, false);
+
copyToRemoteFolder(AUTO_INGEST_PROPERTIES, moduleDirPath, remoteFolder, false);
}
@@ -959,10 +918,10 @@ public class SharedConfiguration {
private void downloadMultiUserAndGeneralSettings(File remoteFolder) throws SharedConfigurationException {
publishTask("Downloading multi user configuration");
- copyToLocalFolder(UserPreferences.getViewPreferencePath(), remoteFolder, false);
- copyToLocalFolder(UserPreferences.getMachineSpecificPreferencePath(), remoteFolder, false);
- copyToLocalFolder(UserPreferences.getModePreferencePath(), remoteFolder, false);
- copyToLocalFolder(UserPreferences.getExternalServicePreferencePath(), remoteFolder, false);
+ copyToLocalFolder(VIEW_PREFERENCE_FILE, SHARED_DIR_PATH, remoteFolder, false);
+ copyToLocalFolder(MACHINE_SPECIFIC_PREFERENCE_FILE, moduleDirPath, remoteFolder, false);
+ copyToLocalFolder(MODE_PREFERENCE_FILE, moduleDirPath, remoteFolder, false);
+ copyToLocalFolder(EXTERNAL_SERVICE_PREFERENCE_FILE, SHARED_DIR_PATH, remoteFolder, false);
copyToLocalFolder(AUTO_INGEST_PROPERTIES, moduleDirPath, remoteFolder, false);
}
@@ -1041,7 +1000,7 @@ public class SharedConfiguration {
Map sharedVersions = readVersionsFromFile(sharedVersionFile);
// Copy the settings file
- copyToRemoteFolder(HashLookupSettings.getSettingsPath(), remoteFolder, true);
+ copyToRemoteFolder(HASHDB_CONFIG_FILE_NAME, SHARED_DIR_PATH, remoteFolder, true);
copyToRemoteFolder(HASHDB_CONFIG_FILE_NAME_LEGACY, moduleDirPath, remoteFolder, true);
// Get the list of databases from the file
@@ -1290,7 +1249,7 @@ public class SharedConfiguration {
}
// Copy the settings filey
- copyToLocalFolder(HashLookupSettings.getSettingsPath(), remoteFolder, true);
+ copyToLocalFolder(HASHDB_CONFIG_FILE_NAME, SHARED_DIR_PATH, remoteFolder, true);
copyToLocalFolder(HASHDB_CONFIG_FILE_NAME_LEGACY, moduleDirPath, remoteFolder, true);
copyToLocalFolder(SHARED_CONFIG_VERSIONS, moduleDirPath, remoteFolder, true);