module config updates

This commit is contained in:
Greg DiCristofaro 2022-06-08 13:37:15 -04:00
parent 2b46b377ff
commit b7af4b771c
13 changed files with 102 additions and 115 deletions

View File

@ -28,11 +28,10 @@ import org.openide.WizardDescriptor;
import org.openide.util.HelpCtx; import org.openide.util.HelpCtx;
import org.openide.util.NbBundle.Messages; import org.openide.util.NbBundle.Messages;
import org.openide.windows.WindowManager; import org.openide.windows.WindowManager;
import org.sleuthkit.autopsy.core.configpath.SharedConfigPath; import org.sleuthkit.autopsy.ingest.profile.IngestProfilePaths;
import org.sleuthkit.autopsy.coreutils.ModuleSettings; import org.sleuthkit.autopsy.coreutils.ModuleSettings;
import org.sleuthkit.autopsy.ingest.IngestJobSettings; import org.sleuthkit.autopsy.ingest.IngestJobSettings;
import org.sleuthkit.autopsy.ingest.IngestJobSettingsPanel; import org.sleuthkit.autopsy.ingest.IngestJobSettingsPanel;
import org.sleuthkit.autopsy.ingest.IngestProfiles;
import org.sleuthkit.autopsy.ingest.runIngestModuleWizard.IngestProfileSelectionWizardPanel; import org.sleuthkit.autopsy.ingest.runIngestModuleWizard.IngestProfileSelectionWizardPanel;
import org.sleuthkit.autopsy.ingest.runIngestModuleWizard.ShortcutWizardDescriptorPanel; import org.sleuthkit.autopsy.ingest.runIngestModuleWizard.ShortcutWizardDescriptorPanel;
@ -192,7 +191,7 @@ class AddImageWizardIngestConfigPanel extends ShortcutWizardDescriptorPanel {
//Because this panel kicks off ingest during the wizard we need to //Because this panel kicks off ingest during the wizard we need to
//swap out the ingestJobSettings for the ones of the chosen profile before //swap out the ingestJobSettings for the ones of the chosen profile before
//use prefix to specify correct execution context for profiles. //use prefix to specify correct execution context for profiles.
IngestJobSettings ingestJobSettings = new IngestJobSettings(SharedConfigPath.getInstance().getIngestProfilePrefix() + lastProfileUsed); IngestJobSettings ingestJobSettings = new IngestJobSettings(IngestProfilePaths.getInstance().getIngestProfilePrefix() + lastProfileUsed);
progressPanel.setIngestJobSettings(ingestJobSettings); //prepare ingest for being started progressPanel.setIngestJobSettings(ingestJobSettings); //prepare ingest for being started
} }
} }

View File

@ -18,8 +18,9 @@
*/ */
package org.sleuthkit.autopsy.centralrepository; package org.sleuthkit.autopsy.centralrepository;
import java.io.File;
import java.nio.file.Paths; import java.nio.file.Paths;
import org.sleuthkit.autopsy.core.configpath.SharedConfigPath; import org.sleuthkit.autopsy.coreutils.PlatformUtil;
/** /**
* Location for central repo settings and paths. * Location for central repo settings and paths.
@ -38,13 +39,13 @@ public class CentralRepoSettings {
private static final String CENTRAL_REPOSITORY_FOLDER = "CentralRepository"; private static final String CENTRAL_REPOSITORY_FOLDER = "CentralRepository";
private static final String CENTRAL_REPOSITORY_SETTINGS_NAME = "CentralRepository"; private static final String CENTRAL_REPOSITORY_SETTINGS_NAME = "CentralRepository";
private static final String CENTRAL_REPO_BASE_PATH = Paths.get( private static final String CENTRAL_REPO_BASE_PATH = Paths.get(
SharedConfigPath.getInstance().getSharedConfigPath(), PlatformUtil.getModuleConfigDirectory(),
CENTRAL_REPOSITORY_FOLDER).toString(); 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_PARENT_PATH = Paths.get(CENTRAL_REPO_BASE_PATH, "LocalDatabase").toString();
private static final String DEFAULT_DB_NAME = "central_repository.db"; private static final String DEFAULT_DB_NAME = "central_repository.db";
private static final String MODULE_SETTINGS_KEY = Paths.get( private static final String MODULE_SETTINGS_KEY = Paths.get(
SharedConfigPath.getInstance().getSharedConfigFolder(), Paths.get(PlatformUtil.getUserConfigDirectory()).relativize(Paths.get(PlatformUtil.getModuleConfigDirectory())).toString(),
CENTRAL_REPOSITORY_FOLDER, CENTRAL_REPOSITORY_FOLDER,
CENTRAL_REPOSITORY_SETTINGS_NAME).toString(); CENTRAL_REPOSITORY_SETTINGS_NAME).toString();

View File

@ -32,11 +32,9 @@ import org.openide.util.NbBundle;
import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoDbChoice; import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoDbChoice;
import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoDbManager; import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoDbManager;
import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoException; import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoException;
import org.sleuthkit.autopsy.centralrepository.datamodel.SqliteCentralRepoSettings;
import org.sleuthkit.autopsy.centralrepository.CentralRepoSettings; import org.sleuthkit.autopsy.centralrepository.CentralRepoSettings;
import org.sleuthkit.autopsy.core.RuntimeProperties; import org.sleuthkit.autopsy.core.RuntimeProperties;
import org.sleuthkit.autopsy.core.UserPreferences; import org.sleuthkit.autopsy.core.UserPreferences;
import org.sleuthkit.autopsy.core.configpath.SharedConfigPath;
import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.coreutils.ModuleSettings; import org.sleuthkit.autopsy.coreutils.ModuleSettings;
import org.sleuthkit.autopsy.coreutils.PlatformUtil; import org.sleuthkit.autopsy.coreutils.PlatformUtil;
@ -94,13 +92,27 @@ public class Installer extends ModuleInstall {
upgradeSettingsPath(); upgradeSettingsPath();
setupDefaultCentralRepository(); setupDefaultCentralRepository();
} }
/**
* Path to module settings path.
*
* @param moduleName The full name of the module provided to ModuleSettings.
*
* @return The path on disk for that object. NOTE: This must be in sync with
* ModuleSettings.
*/
private String getSettingsFilePath(String moduleName) {
return Paths.get(PlatformUtil.getUserConfigDirectory(), moduleName + ".properties").toString();
}
/** /**
* Copies settings to new path location. * Copies settings to new path location.
*/ */
private void upgradeSettingsPath() { private void upgradeSettingsPath() {
File newSettingsFile = new File(SharedConfigPath.getInstance().getSettingsFilePath(CentralRepoSettings.getInstance().getModuleSettingsKey())); File newSettingsFile = new File(getSettingsFilePath(CentralRepoSettings.getInstance().getModuleSettingsKey()));
File legacySettingsFile = new File(SharedConfigPath.getInstance().getSettingsFilePath(LEGACY_MODULE_SETTINGS_KEY)); File legacySettingsFile = new File(getSettingsFilePath(LEGACY_MODULE_SETTINGS_KEY));
// new config has not been created, but legacy has, copy it. // new config has not been created, but legacy has, copy it.
if (!newSettingsFile.exists() && legacySettingsFile.exists()) { if (!newSettingsFile.exists() && legacySettingsFile.exists()) {
Map<String, String> prevSettings = ModuleSettings.getConfigSettings(LEGACY_MODULE_SETTINGS_KEY); Map<String, String> prevSettings = ModuleSettings.getConfigSettings(LEGACY_MODULE_SETTINGS_KEY);

View File

@ -30,12 +30,10 @@ import java.util.prefs.BackingStoreException;
import org.sleuthkit.autopsy.events.MessageServiceConnectionInfo; import org.sleuthkit.autopsy.events.MessageServiceConnectionInfo;
import java.util.prefs.PreferenceChangeListener; import java.util.prefs.PreferenceChangeListener;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.tuple.Pair;
import org.apache.commons.lang3.tuple.Triple; import org.apache.commons.lang3.tuple.Triple;
import org.openide.util.Lookup; import org.openide.util.Lookup;
import org.python.icu.util.TimeZone; import org.python.icu.util.TimeZone;
import org.sleuthkit.autopsy.appservices.AutopsyService; import org.sleuthkit.autopsy.appservices.AutopsyService;
import org.sleuthkit.autopsy.core.configpath.SharedConfigPath;
import org.sleuthkit.autopsy.machinesettings.UserMachinePreferences; import org.sleuthkit.autopsy.machinesettings.UserMachinePreferences;
import org.sleuthkit.autopsy.coreutils.ModuleSettings; import org.sleuthkit.autopsy.coreutils.ModuleSettings;
import org.sleuthkit.autopsy.coreutils.PlatformUtil; import org.sleuthkit.autopsy.coreutils.PlatformUtil;
@ -71,7 +69,7 @@ public final class UserPreferences {
* @return The path to the preference file. * @return The path to the preference file.
*/ */
private static String getSharedPreferencePath(String identifier) { private static String getSharedPreferencePath(String identifier) {
return Paths.get(SharedConfigPath.getInstance().getSharedConfigPath(), identifier + ".properties").toString(); return Paths.get(PlatformUtil.getModuleConfigDirectory(), identifier + ".properties").toString();
} }
private static final String VIEW_PREFERENCE_PATH = getSharedPreferencePath("ViewPreferences"); private static final String VIEW_PREFERENCE_PATH = getSharedPreferencePath("ViewPreferences");
@ -88,7 +86,7 @@ public final class UserPreferences {
// perform initial load to ensure disk preferences are loaded // perform initial load to ensure disk preferences are loaded
try { try {
// make shared directory paths if they don't exist. // make shared directory paths if they don't exist.
new File(SharedConfigPath.getInstance().getSharedConfigPath()).mkdirs(); new File(PlatformUtil.getModuleConfigDirectory()).mkdirs();
viewPreferences.load(); viewPreferences.load();
machineSpecificPreferences.load(); machineSpecificPreferences.load();
modePreferences.load(); modePreferences.load();

View File

@ -1,80 +0,0 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2022 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.sleuthkit.autopsy.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 static final String INGEST_PROFILE_PREFIX = "IngestProfiles.";
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;
}
/**
* Path to module settings path.
*
* @param moduleName The full name of the module provided to ModuleSettings.
*
* @return The path on disk for that object. NOTE: This must be in sync with
* ModuleSettings.
*/
public String getSettingsFilePath(String moduleName) {
return Paths.get(PlatformUtil.getUserConfigDirectory(), moduleName + ".properties").toString();
}
/**
* @return The prefix in front of all ingest profiles to differentiate
* between this and other ingest settings (i.e. command line, add
* image ingest wizard, etc.).
*/
public String getIngestProfilePrefix() {
return INGEST_PROFILE_PREFIX;
}
}

View File

@ -230,6 +230,15 @@ public class PlatformUtil {
return Places.getUserDirectory() + File.separator + "config"; //NON-NLS return Places.getUserDirectory() + File.separator + "config"; //NON-NLS
} }
/**
* Get module config directory path
*
* @return Get module config directory path string
*/
public static String getModuleConfigDirectory() {
return Paths.get(getUserConfigDirectory(), "ModuleConfig").toString();
}
/** /**
* Get log directory path * Get log directory path
* *

View File

@ -36,9 +36,9 @@ import java.util.logging.Level;
import org.openide.util.NbBundle; import org.openide.util.NbBundle;
import org.openide.util.io.NbObjectInputStream; import org.openide.util.io.NbObjectInputStream;
import org.openide.util.io.NbObjectOutputStream; import org.openide.util.io.NbObjectOutputStream;
import org.sleuthkit.autopsy.core.configpath.SharedConfigPath;
import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.coreutils.ModuleSettings; 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.FilesSet;
import org.sleuthkit.autopsy.modules.interestingitems.FilesSetsManager; import org.sleuthkit.autopsy.modules.interestingitems.FilesSetsManager;
import org.sleuthkit.autopsy.python.FactoryClassNameNormalizer; import org.sleuthkit.autopsy.python.FactoryClassNameNormalizer;
@ -54,12 +54,12 @@ public final class IngestJobSettings {
private static final String MODULE_SETTINGS_FOLDER_NAME = "IngestSettings"; //NON-NLS private static final String MODULE_SETTINGS_FOLDER_NAME = "IngestSettings"; //NON-NLS
private static final String MODULE_SETTINGS_FOLDER = Paths.get( private static final String MODULE_SETTINGS_FOLDER = Paths.get(
SharedConfigPath.getInstance().getSharedConfigFolder(), Paths.get(PlatformUtil.getUserConfigDirectory()).relativize(Paths.get(PlatformUtil.getModuleConfigDirectory())).toString(),
MODULE_SETTINGS_FOLDER_NAME MODULE_SETTINGS_FOLDER_NAME
).toString(); ).toString();
private static final String MODULE_SETTINGS_FOLDER_PATH = Paths.get( private static final String MODULE_SETTINGS_FOLDER_PATH = Paths.get(
SharedConfigPath.getInstance().getSharedConfigPath(), PlatformUtil.getModuleConfigDirectory(),
IngestJobSettings.MODULE_SETTINGS_FOLDER_NAME IngestJobSettings.MODULE_SETTINGS_FOLDER_NAME
).toAbsolutePath().toString(); ).toAbsolutePath().toString();

View File

@ -18,18 +18,19 @@
*/ */
package org.sleuthkit.autopsy.ingest; package org.sleuthkit.autopsy.ingest;
import com.google.common.annotations.Beta;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.logging.Level; import java.util.logging.Level;
import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
import org.apache.commons.io.FilenameUtils; import org.apache.commons.io.FilenameUtils;
import org.sleuthkit.autopsy.core.configpath.SharedConfigPath; import org.sleuthkit.autopsy.ingest.profile.IngestProfilePaths;
import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.coreutils.ModuleSettings; import org.sleuthkit.autopsy.coreutils.ModuleSettings;
import org.sleuthkit.autopsy.coreutils.PlatformUtil;
/** /**
* Class for managing the access to the * Class for managing the access to the
@ -39,7 +40,7 @@ public final class IngestProfiles {
private static final String PROFILE_NAME_KEY = "Profile_Name"; private static final String PROFILE_NAME_KEY = "Profile_Name";
private static final String PROFILE_DESC_KEY = "Profile_Description"; private static final String PROFILE_DESC_KEY = "Profile_Description";
private static final String PROFILE_FILTER_KEY = "Profile_Filter"; private static final String PROFILE_FILTER_KEY = "Profile_Filter";
private static final String SETTINGS_FILE_PREFIX = SharedConfigPath.getInstance().getIngestProfilePrefix(); private static final String SETTINGS_FILE_PREFIX = IngestProfilePaths.getInstance().getIngestProfilePrefix();
private static final Logger logger = Logger.getLogger(IngestProfiles.class.getName()); private static final Logger logger = Logger.getLogger(IngestProfiles.class.getName());
/** /**
@ -83,10 +84,11 @@ public final class IngestProfiles {
* @return The file location for the root settings of that profile. * @return The file location for the root settings of that profile.
*/ */
private static File getRootSettingsFile(String profileName) { private static File getRootSettingsFile(String profileName) {
return new File( return Paths.get(
SharedConfigPath.getInstance().getSettingsFilePath( PlatformUtil.getUserConfigDirectory(),
IngestJobSettings.getModuleSettingsResource( IngestJobSettings.getModuleSettingsResource(
getExecutionContext(getSanitizedProfile(profileName))))); getExecutionContext(getSanitizedProfile(profileName))) + ".properties"
).toFile();
} }
/** /**

View File

@ -0,0 +1,48 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2022 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.sleuthkit.autopsy.ingest.profile;
/**
* Path information for ingest profiles.
*/
public class IngestProfilePaths {
private static final IngestProfilePaths instance = new IngestProfilePaths();
private static final String INGEST_PROFILE_PREFIX = "IngestProfiles.";
private IngestProfilePaths() {
}
/**
* @return An instance of this class.
*/
public static IngestProfilePaths getInstance() {
return instance;
}
/**
* @return The prefix in front of all ingest profiles to differentiate
* between this and other ingest settings (i.e. command line, add
* image ingest wizard, etc.).
*/
public String getIngestProfilePrefix() {
return INGEST_PROFILE_PREFIX;
}
}

View File

@ -19,7 +19,7 @@
package org.sleuthkit.autopsy.modules.hashdatabase.infrastructure; package org.sleuthkit.autopsy.modules.hashdatabase.infrastructure;
import java.nio.file.Paths; import java.nio.file.Paths;
import org.sleuthkit.autopsy.core.configpath.SharedConfigPath; import org.sleuthkit.autopsy.coreutils.PlatformUtil;
/** /**
* Paths for hash config files. * Paths for hash config files.
@ -31,7 +31,7 @@ public class HashConfigPaths {
private static final String HASHSET_FOLDER = "HashLookup"; private static final String HASHSET_FOLDER = "HashLookup";
private static final String SERIALIZATION_FILE_NAME = "hashLookup.settings"; //NON-NLS 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 HASH_CONFIG_PATH = Paths.get(PlatformUtil.getModuleConfigDirectory(), HASHSET_FOLDER).toAbsolutePath().toString();
private static final String XML_FILE_NAME = "hashsets.xml"; //NON-NLS 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 XML_FILE_PATH = Paths.get(HASH_CONFIG_PATH, XML_FILE_NAME).toAbsolutePath().toString();

View File

@ -30,7 +30,6 @@ import java.util.Map;
import java.util.Observable; import java.util.Observable;
import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
import org.openide.util.NbBundle; import org.openide.util.NbBundle;
import org.sleuthkit.autopsy.core.configpath.SharedConfigPath;
import org.sleuthkit.autopsy.coreutils.PlatformUtil; import org.sleuthkit.autopsy.coreutils.PlatformUtil;
import org.sleuthkit.autopsy.modules.interestingitems.FilesSet.Rule; import org.sleuthkit.autopsy.modules.interestingitems.FilesSet.Rule;
import org.sleuthkit.autopsy.modules.interestingitems.FilesSet.Rule.MetaTypeCondition; import org.sleuthkit.autopsy.modules.interestingitems.FilesSet.Rule.MetaTypeCondition;
@ -51,7 +50,7 @@ public final class FilesSetsManager extends Observable {
private static final String INTERESTING_FILES_SET_DEFS_NAME = "InterestingFileSets.settings"; private static final String INTERESTING_FILES_SET_DEFS_NAME = "InterestingFileSets.settings";
private static final String FILE_INGEST_FILTER_DEFS_NAME = "FileIngestFilterDefs.settings"; private static final String FILE_INGEST_FILTER_DEFS_NAME = "FileIngestFilterDefs.settings";
private static final String LEGACY_SETTINGS_PATH = PlatformUtil.getUserConfigDirectory(); private static final String LEGACY_SETTINGS_PATH = PlatformUtil.getUserConfigDirectory();
private static final String SETTINGS_PATH = SharedConfigPath.getInstance().getSharedConfigPath(); private static final String SETTINGS_PATH = PlatformUtil.getModuleConfigDirectory();
private static final String FILE_FILTER_PATH = Paths.get(SETTINGS_PATH, FILE_INGEST_FILTER_DEFS_NAME).toAbsolutePath().toString(); private static final String FILE_FILTER_PATH = Paths.get(SETTINGS_PATH, FILE_INGEST_FILTER_DEFS_NAME).toAbsolutePath().toString();
private static final String INTERESTING_ITEM_PATH = Paths.get(SETTINGS_PATH, INTERESTING_FILES_SET_DEFS_NAME).toAbsolutePath().toString(); private static final String INTERESTING_ITEM_PATH = Paths.get(SETTINGS_PATH, INTERESTING_FILES_SET_DEFS_NAME).toAbsolutePath().toString();
private static final Object FILE_INGEST_FILTER_LOCK = new Object(); private static final Object FILE_INGEST_FILTER_LOCK = new Object();
@ -138,7 +137,7 @@ public final class FilesSetsManager extends Observable {
*/ */
public Map<String, FilesSet> getCustomFileIngestFilters() throws FilesSetsManagerException { public Map<String, FilesSet> getCustomFileIngestFilters() throws FilesSetsManagerException {
synchronized (FILE_INGEST_FILTER_LOCK) { synchronized (FILE_INGEST_FILTER_LOCK) {
return FileSetsDefinitions.readSerializedDefinitions(SharedConfigPath.getInstance().getSharedConfigPath(), FILE_INGEST_FILTER_DEFS_NAME); return FileSetsDefinitions.readSerializedDefinitions(PlatformUtil.getModuleConfigDirectory(), FILE_INGEST_FILTER_DEFS_NAME);
} }
} }
@ -161,7 +160,7 @@ public final class FilesSetsManager extends Observable {
*/ */
void setCustomFileIngestFilters(Map<String, FilesSet> filesSets) throws FilesSetsManagerException { void setCustomFileIngestFilters(Map<String, FilesSet> filesSets) throws FilesSetsManagerException {
synchronized (FILE_INGEST_FILTER_LOCK) { synchronized (FILE_INGEST_FILTER_LOCK) {
FileSetsDefinitions.writeDefinitionsFile(SharedConfigPath.getInstance().getSharedConfigPath(), FILE_INGEST_FILTER_DEFS_NAME, filesSets); FileSetsDefinitions.writeDefinitionsFile(PlatformUtil.getModuleConfigDirectory(), FILE_INGEST_FILTER_DEFS_NAME, filesSets);
} }
} }
@ -173,7 +172,7 @@ public final class FilesSetsManager extends Observable {
*/ */
public Map<String, FilesSet> getInterestingFilesSets() throws FilesSetsManagerException { public Map<String, FilesSet> getInterestingFilesSets() throws FilesSetsManagerException {
synchronized (INTERESTING_FILES_SET_LOCK) { synchronized (INTERESTING_FILES_SET_LOCK) {
return InterestingItemsFilesSetSettings.readDefinitionsFile(SharedConfigPath.getInstance().getSharedConfigPath(), INTERESTING_FILES_SET_DEFS_NAME, LEGACY_FILES_SET_DEFS_FILE_NAME); return InterestingItemsFilesSetSettings.readDefinitionsFile(PlatformUtil.getModuleConfigDirectory(), INTERESTING_FILES_SET_DEFS_NAME, LEGACY_FILES_SET_DEFS_FILE_NAME);
} }
} }
@ -186,7 +185,7 @@ public final class FilesSetsManager extends Observable {
*/ */
void setInterestingFilesSets(Map<String, FilesSet> filesSets) throws FilesSetsManagerException { void setInterestingFilesSets(Map<String, FilesSet> filesSets) throws FilesSetsManagerException {
synchronized (INTERESTING_FILES_SET_LOCK) { synchronized (INTERESTING_FILES_SET_LOCK) {
InterestingItemsFilesSetSettings.writeDefinitionsFile(SharedConfigPath.getInstance().getSharedConfigPath(), INTERESTING_FILES_SET_DEFS_NAME, filesSets); InterestingItemsFilesSetSettings.writeDefinitionsFile(PlatformUtil.getModuleConfigDirectory(), INTERESTING_FILES_SET_DEFS_NAME, filesSets);
this.setChanged(); this.setChanged();
this.notifyObservers(); this.notifyObservers();
} }

View File

@ -37,7 +37,6 @@ import java.util.logging.Level;
import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
import org.openide.util.io.NbObjectInputStream; import org.openide.util.io.NbObjectInputStream;
import org.openide.util.io.NbObjectOutputStream; import org.openide.util.io.NbObjectOutputStream;
import org.sleuthkit.autopsy.core.configpath.SharedConfigPath;
import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.coreutils.PlatformUtil; import org.sleuthkit.autopsy.coreutils.PlatformUtil;
import org.sleuthkit.autopsy.report.GeneralReportSettings; import org.sleuthkit.autopsy.report.GeneralReportSettings;
@ -58,7 +57,7 @@ final class ReportingConfigLoader {
).toAbsolutePath().toString(); ).toAbsolutePath().toString();
private static final String REPORT_CONFIG_FOLDER_PATH = Paths.get( private static final String REPORT_CONFIG_FOLDER_PATH = Paths.get(
SharedConfigPath.getInstance().getSharedConfigPath(), PlatformUtil.getModuleConfigDirectory(),
ReportingConfigLoader.REPORT_CONFIG_FOLDER ReportingConfigLoader.REPORT_CONFIG_FOLDER
).toAbsolutePath().toString(); ).toAbsolutePath().toString();

View File

@ -87,7 +87,7 @@ public class SharedConfiguration {
private static final String UPLOAD_IN_PROGRESS_FILE = "uploadInProgress"; // NON-NLS private static final String UPLOAD_IN_PROGRESS_FILE = "uploadInProgress"; // NON-NLS
private static final String moduleDirPath = PlatformUtil.getUserConfigDirectory(); private static final String moduleDirPath = PlatformUtil.getUserConfigDirectory();
private static final String SHARED_DIR_PATH = Paths.get(moduleDirPath, "SharableConfig").toAbsolutePath().toString(); private static final String SHARED_DIR_PATH = PlatformUtil.getModuleConfigDirectory();
private static final String INGEST_MODULES_PATH = Paths.get(SHARED_DIR_PATH, "IngestSettings").toString(); private static final String INGEST_MODULES_PATH = Paths.get(SHARED_DIR_PATH, "IngestSettings").toString();
private static final String INGEST_MODULES_REL_PATH = new File(moduleDirPath).toURI().relativize(new File(INGEST_MODULES_PATH).toURI()).getPath(); 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 Logger logger = Logger.getLogger(SharedConfiguration.class.getName());