19 package org.sleuthkit.autopsy.core;
21 import java.nio.file.Paths;
23 import java.util.prefs.BackingStoreException;
25 import java.util.prefs.PreferenceChangeListener;
26 import java.util.prefs.Preferences;
27 import org.openide.util.NbPreferences;
28 import org.python.icu.util.TimeZone;
69 private static final String
APP_NAME =
"AppName";
71 private static final String
MODE =
"AutopsyMode";
141 preferences.addPreferenceChangeListener(listener);
145 preferences.removePreferenceChangeListener(listener);
149 return preferences.getBoolean(KEEP_PREFERRED_VIEWER,
false);
153 preferences.putBoolean(KEEP_PREFERRED_VIEWER, value);
157 return preferences.getBoolean(HIDE_KNOWN_FILES_IN_DATA_SRCS_TREE,
false);
161 preferences.putBoolean(HIDE_KNOWN_FILES_IN_DATA_SRCS_TREE, value);
165 return preferences.getBoolean(HIDE_KNOWN_FILES_IN_VIEWS_TREE,
true);
169 preferences.putBoolean(HIDE_KNOWN_FILES_IN_VIEWS_TREE, value);
173 return preferences.getBoolean(HIDE_SLACK_FILES_IN_DATA_SRCS_TREE,
true);
177 preferences.putBoolean(HIDE_SLACK_FILES_IN_DATA_SRCS_TREE, value);
181 return preferences.getBoolean(HIDE_SLACK_FILES_IN_VIEWS_TREE,
true);
185 preferences.putBoolean(HIDE_SLACK_FILES_IN_VIEWS_TREE, value);
189 return preferences.getBoolean(DISPLAY_TIMES_IN_LOCAL_TIME,
true);
193 preferences.putBoolean(DISPLAY_TIMES_IN_LOCAL_TIME, value);
197 return preferences.get(TIME_ZONE_FOR_DISPLAYS, TimeZone.GMT_ZONE.getID());
201 preferences.put(TIME_ZONE_FOR_DISPLAYS, timeZone);
205 return preferences.getInt(NUMBER_OF_FILE_INGEST_THREADS, 2);
209 preferences.putInt(NUMBER_OF_FILE_INGEST_THREADS, value);
214 return preferences.getBoolean(GROUP_ITEMS_IN_TREE_BY_DATASOURCE,
false);
219 preferences.putBoolean(GROUP_ITEMS_IN_TREE_BY_DATASOURCE, value);
229 return preferences.getBoolean(SHOW_ONLY_CURRENT_USER_TAGS,
false);
239 preferences.putBoolean(SHOW_ONLY_CURRENT_USER_TAGS, value);
250 return preferences.getBoolean(HIDE_SCO_COLUMNS,
false);
261 preferences.putBoolean(HIDE_SCO_COLUMNS, value);
265 preferences.putBoolean(DISPLAY_TRANSLATED_NAMES, value);
269 return preferences.getBoolean(DISPLAY_TRANSLATED_NAMES, DISPLAY_TRANSLATED_NAMES_DEFAULT);
282 dbType = DbType.valueOf(preferences.get(EXTERNAL_DATABASE_TYPE,
"POSTGRESQL"));
283 }
catch (Exception ex) {
284 dbType = DbType.SQLITE;
287 return new CaseDbConnectionInfo(
288 preferences.get(EXTERNAL_DATABASE_HOSTNAME_OR_IP,
""),
289 preferences.get(EXTERNAL_DATABASE_PORTNUMBER,
"5432"),
290 preferences.get(EXTERNAL_DATABASE_USER,
""),
294 throw new UserPreferencesException(
"Failure converting password hex text to text.", ex);
307 preferences.put(EXTERNAL_DATABASE_HOSTNAME_OR_IP, connectionInfo.getHost());
308 preferences.put(EXTERNAL_DATABASE_PORTNUMBER, connectionInfo.getPort());
309 preferences.put(EXTERNAL_DATABASE_USER, connectionInfo.getUserName());
315 preferences.put(EXTERNAL_DATABASE_TYPE, connectionInfo.getDbType().toString());
319 preferences.putBoolean(IS_MULTI_USER_MODE_ENABLED, enabled);
323 return preferences.getBoolean(IS_MULTI_USER_MODE_ENABLED,
false);
327 return preferences.get(INDEXING_SERVER_HOST,
"");
331 preferences.put(INDEXING_SERVER_HOST, hostName);
335 return preferences.get(INDEXING_SERVER_PORT,
"8983");
339 preferences.putInt(INDEXING_SERVER_PORT, port);
343 preferences.put(TEXT_TRANSLATOR_NAME, textTranslatorName);
347 return preferences.get(TEXT_TRANSLATOR_NAME, null);
358 preferences.put(MESSAGE_SERVICE_HOST, info.getHost());
359 preferences.put(MESSAGE_SERVICE_PORT, Integer.toString(info.getPort()));
360 preferences.put(MESSAGE_SERVICE_USER, info.getUserName());
378 port = Integer.parseInt(preferences.get(MESSAGE_SERVICE_PORT, DEFAULT_PORT_STRING));
379 }
catch (NumberFormatException ex) {
386 preferences.get(MESSAGE_SERVICE_HOST,
""),
388 preferences.get(MESSAGE_SERVICE_USER,
""),
391 throw new UserPreferencesException(
"Failed to convert password hex text to text.", ex);
401 int timeOut = preferences.getInt(PROCESS_TIME_OUT_HOURS, DEFAULT_PROCESS_TIMEOUT_HR);
417 preferences.putInt(PROCESS_TIME_OUT_HOURS, value);
428 boolean enabled = preferences.getBoolean(PROCESS_TIME_OUT_ENABLED,
false);
440 preferences.putBoolean(PROCESS_TIME_OUT_ENABLED, enabled);
458 preferences.put(APP_NAME, name);
467 return preferences.getInt(MAX_NUM_OF_LOG_FILE, LOG_FILE_NUM_INT);
485 preferences.putInt(MAX_NUM_OF_LOG_FILE, count);
494 return preferences.getInt(SOLR_MAX_JVM_SIZE, 512);
503 preferences.putInt(SOLR_MAX_JVM_SIZE, maxSize);
512 return preferences.getInt(RESULTS_TABLE_PAGE_SIZE, 10_000);
521 preferences.putInt(RESULTS_TABLE_PAGE_SIZE, pageSize);
530 preferences.put(EXTERNAL_HEX_EDITOR_PATH, executablePath);
540 return preferences.get(EXTERNAL_HEX_EDITOR_PATH, Paths.get(
"C:",
"Program Files",
"HxD",
"HxD.exe").toString());
549 preferences.putInt(GEO_TILE_OPTION, option);
558 return preferences.getInt(GEO_TILE_OPTION, 0);
567 preferences.put(GEO_OSM_TILE_ZIP_PATH, absolutePath);
577 return preferences.get(GEO_OSM_TILE_ZIP_PATH,
"");
586 preferences.put(GEO_OSM_SERVER_ADDRESS, address);
595 return preferences.get(GEO_OSM_SERVER_ADDRESS,
"");
604 preferences.put(GEO_MBTILES_FILE_PATH, absolutePath);
613 return preferences.get(GEO_MBTILES_FILE_PATH,
"");
static synchronized String getConfigSetting(String moduleName, String settingName)
static final String HIDE_SLACK_FILES_IN_VIEWS_TREE
static int getDefaultLogFileCount()
static void setGroupItemsInTreeByDatasource(boolean value)
static final boolean DISPLAY_TRANSLATED_NAMES_DEFAULT
static String getGeolocationOsmZipPath()
static final String HIDE_KNOWN_FILES_IN_VIEWS_TREE
static void setProcessTimeOutHrs(int value)
static void setKeepPreferredContentViewer(boolean value)
static String getExternalHexEditorPath()
static int getProcessTimeOutHrs()
static String getTextTranslatorName()
static final String HIDE_SCO_COLUMNS
static boolean hideSlackFilesInDataSourcesTree()
static final int DEFAULT_PROCESS_TIMEOUT_HR
static String getIndexingServerPort()
static final String SOLR_MAX_JVM_SIZE
static final String GROUP_ITEMS_IN_TREE_BY_DATASOURCE
static void setNumberOfFileIngestThreads(int value)
static String getAppName()
static void reloadFromStorage()
static void setGeolocationTileOption(int option)
static void setDisplayTimesInLocalTime(boolean value)
static final String EXTERNAL_DATABASE_NAME
static final String EXTERNAL_DATABASE_USER
static int getLogFileCount()
static final String TEXT_TRANSLATOR_NAME
static void setMode(SelectedMode mode)
static final String GEO_OSM_TILE_ZIP_PATH
static boolean groupItemsInTreeByDatasource()
static final String DEFAULT_PORT_STRING
static boolean getIsMultiUserModeEnabled()
static void setHideSlackFilesInViewsTree(boolean value)
static CaseDbConnectionInfo getDatabaseConnectionInfo()
static final String SHOW_ONLY_CURRENT_USER_TAGS
static boolean keepPreferredContentViewer()
static boolean hideKnownFilesInViewsTree()
static void setHideSCOColumns(boolean value)
static void setIsTimeOutEnabled(boolean enabled)
static void setMaxSolrVMSize(int maxSize)
static void setResultsTablePageSize(int pageSize)
static String getGeolocationMBTilesFilePath()
static final String HIDE_KNOWN_FILES_IN_DATA_SRCS_TREE
static int getMaxSolrVMSize()
static final String EXTERNAL_HEX_EDITOR_PATH
static void setIsMultiUserModeEnabled(boolean enabled)
static final String SETTINGS_PROPERTIES
static void removeChangeListener(PreferenceChangeListener listener)
static void setMessageServiceConnectionInfo(MessageServiceConnectionInfo info)
static synchronized boolean settingExists(String moduleName, String settingName)
static final String IS_MULTI_USER_MODE_ENABLED
static final String NUMBER_OF_FILE_INGEST_THREADS
static boolean showOnlyCurrentUserTags()
static void setHideKnownFilesInViewsTree(boolean value)
static boolean getIsTimeOutEnabled()
static int numberOfFileIngestThreads()
static final Preferences preferences
static final String DISPLAY_TIMES_IN_LOCAL_TIME
static void setTextTranslatorName(String textTranslatorName)
static void setAppName(String name)
static boolean displayTranslatedFileNames()
static final int DEFAULT_PORT_INT
static void setDatabaseConnectionInfo(CaseDbConnectionInfo connectionInfo)
static final String EXTERNAL_DATABASE_PORTNUMBER
static final String PROCESS_TIME_OUT_ENABLED
static void setTimeZoneForDisplays(String timeZone)
static final String KEEP_PREFERRED_VIEWER
static synchronized void setConfigSetting(String moduleName, String settingName, String settingVal)
static final String RESULTS_TABLE_PAGE_SIZE
static final String GEO_MBTILES_FILE_PATH
static final String MESSAGE_SERVICE_PORT
static void saveToStorage()
static void setIndexingServerHost(String hostName)
static void setDisplayTranslatedFileNames(boolean value)
static final String DISPLAY_TRANSLATED_NAMES
static final String MESSAGE_SERVICE_PASSWORD
static boolean getHideSCOColumns()
static final String INDEXING_SERVER_HOST
static boolean hideSlackFilesInViewsTree()
static final String HIDE_SLACK_FILES_IN_DATA_SRCS_TREE
static int getGeolocationtTileOption()
static void setHideSlackFilesInDataSourcesTree(boolean value)
static void setHideKnownFilesInDataSourcesTree(boolean value)
static void setIndexingServerPort(int port)
static void setGeolocationOsmZipPath(String absolutePath)
static final String PROCESS_TIME_OUT_HOURS
static void setLogFileCount(int count)
static final int LOG_FILE_NUM_INT
static final String MESSAGE_SERVICE_HOST
static final String APP_NAME
static int getResultsTablePageSize()
static String getGeolocationOsmServerAddress()
static boolean hideKnownFilesInDataSourcesTree()
static String getTimeZoneForDisplays()
static void setExternalHexEditorPath(String executablePath)
static final String MESSAGE_SERVICE_USER
static final String GEO_TILE_OPTION
static void addChangeListener(PreferenceChangeListener listener)
static final String EXTERNAL_DATABASE_TYPE
static void setGeolocationMBTilesFilePath(String absolutePath)
static final String INDEXING_SERVER_PORT
static void setShowOnlyCurrentUserTags(boolean value)
static String convertTextToHexText(String property)
static final String GEO_OSM_SERVER_ADDRESS
static void setGeolocationOsmServerAddress(String address)
static SelectedMode getMode()
static String getIndexingServerHost()
static final String TIME_ZONE_FOR_DISPLAYS
static boolean displayTimesInLocalTime()
static final String EXTERNAL_DATABASE_PASSWORD
static final String MAX_NUM_OF_LOG_FILE
static final String EXTERNAL_DATABASE_HOSTNAME_OR_IP
static MessageServiceConnectionInfo getMessageServiceConnectionInfo()
static String convertHexTextToText(String property)