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";
136 preferences.addPreferenceChangeListener(listener);
140 preferences.removePreferenceChangeListener(listener);
144 return preferences.getBoolean(KEEP_PREFERRED_VIEWER,
false);
148 preferences.putBoolean(KEEP_PREFERRED_VIEWER, value);
152 return preferences.getBoolean(HIDE_KNOWN_FILES_IN_DATA_SRCS_TREE,
false);
156 preferences.putBoolean(HIDE_KNOWN_FILES_IN_DATA_SRCS_TREE, value);
160 return preferences.getBoolean(HIDE_KNOWN_FILES_IN_VIEWS_TREE,
true);
164 preferences.putBoolean(HIDE_KNOWN_FILES_IN_VIEWS_TREE, value);
168 return preferences.getBoolean(HIDE_SLACK_FILES_IN_DATA_SRCS_TREE,
true);
172 preferences.putBoolean(HIDE_SLACK_FILES_IN_DATA_SRCS_TREE, value);
176 return preferences.getBoolean(HIDE_SLACK_FILES_IN_VIEWS_TREE,
true);
180 preferences.putBoolean(HIDE_SLACK_FILES_IN_VIEWS_TREE, value);
184 return preferences.getBoolean(DISPLAY_TIMES_IN_LOCAL_TIME,
true);
188 preferences.putBoolean(DISPLAY_TIMES_IN_LOCAL_TIME, value);
192 return preferences.get(TIME_ZONE_FOR_DISPLAYS, TimeZone.GMT_ZONE.getID());
196 preferences.put(TIME_ZONE_FOR_DISPLAYS, timeZone);
200 return preferences.getInt(NUMBER_OF_FILE_INGEST_THREADS, 2);
204 preferences.putInt(NUMBER_OF_FILE_INGEST_THREADS, value);
209 return preferences.getBoolean(GROUP_ITEMS_IN_TREE_BY_DATASOURCE,
false);
214 preferences.putBoolean(GROUP_ITEMS_IN_TREE_BY_DATASOURCE, value);
224 return preferences.getBoolean(SHOW_ONLY_CURRENT_USER_TAGS,
false);
234 preferences.putBoolean(SHOW_ONLY_CURRENT_USER_TAGS, value);
245 return preferences.getBoolean(HIDE_SCO_COLUMNS,
false);
256 preferences.putBoolean(HIDE_SCO_COLUMNS, value);
260 preferences.putBoolean(DISPLAY_TRANSLATED_NAMES, value);
264 return preferences.getBoolean(DISPLAY_TRANSLATED_NAMES,
false);
277 dbType = DbType.valueOf(preferences.get(EXTERNAL_DATABASE_TYPE,
"POSTGRESQL"));
278 }
catch (Exception ex) {
279 dbType = DbType.SQLITE;
282 return new CaseDbConnectionInfo(
283 preferences.get(EXTERNAL_DATABASE_HOSTNAME_OR_IP,
""),
284 preferences.get(EXTERNAL_DATABASE_PORTNUMBER,
"5432"),
285 preferences.get(EXTERNAL_DATABASE_USER,
""),
289 throw new UserPreferencesException(
"Failure converting password hex text to text.", ex);
302 preferences.put(EXTERNAL_DATABASE_HOSTNAME_OR_IP, connectionInfo.getHost());
303 preferences.put(EXTERNAL_DATABASE_PORTNUMBER, connectionInfo.getPort());
304 preferences.put(EXTERNAL_DATABASE_USER, connectionInfo.getUserName());
310 preferences.put(EXTERNAL_DATABASE_TYPE, connectionInfo.getDbType().toString());
314 preferences.putBoolean(IS_MULTI_USER_MODE_ENABLED, enabled);
318 return preferences.getBoolean(IS_MULTI_USER_MODE_ENABLED,
false);
322 return preferences.get(INDEXING_SERVER_HOST,
"");
326 preferences.put(INDEXING_SERVER_HOST, hostName);
330 return preferences.get(INDEXING_SERVER_PORT,
"8983");
334 preferences.putInt(INDEXING_SERVER_PORT, port);
338 preferences.put(TEXT_TRANSLATOR_NAME, textTranslatorName);
342 return preferences.get(TEXT_TRANSLATOR_NAME, null);
353 preferences.put(MESSAGE_SERVICE_HOST, info.getHost());
354 preferences.put(MESSAGE_SERVICE_PORT, Integer.toString(info.getPort()));
355 preferences.put(MESSAGE_SERVICE_USER, info.getUserName());
373 port = Integer.parseInt(preferences.get(MESSAGE_SERVICE_PORT, DEFAULT_PORT_STRING));
374 }
catch (NumberFormatException ex) {
381 preferences.get(MESSAGE_SERVICE_HOST,
""),
383 preferences.get(MESSAGE_SERVICE_USER,
""),
386 throw new UserPreferencesException(
"Failed to convert password hex text to text.", ex);
396 int timeOut = preferences.getInt(PROCESS_TIME_OUT_HOURS, DEFAULT_PROCESS_TIMEOUT_HR);
412 preferences.putInt(PROCESS_TIME_OUT_HOURS, value);
423 boolean enabled = preferences.getBoolean(PROCESS_TIME_OUT_ENABLED,
false);
435 preferences.putBoolean(PROCESS_TIME_OUT_ENABLED, enabled);
453 preferences.put(APP_NAME, name);
462 return preferences.getInt(MAX_NUM_OF_LOG_FILE, LOG_FILE_NUM_INT);
480 preferences.putInt(MAX_NUM_OF_LOG_FILE, count);
489 return preferences.getInt(SOLR_MAX_JVM_SIZE, 512);
498 preferences.putInt(SOLR_MAX_JVM_SIZE, maxSize);
507 return preferences.getInt(RESULTS_TABLE_PAGE_SIZE, 10_000);
516 preferences.putInt(RESULTS_TABLE_PAGE_SIZE, pageSize);
525 preferences.put(EXTERNAL_HEX_EDITOR_PATH, executablePath);
535 return preferences.get(EXTERNAL_HEX_EDITOR_PATH, Paths.get(
"C:",
"Program Files",
"HxD",
"HxD.exe").toString());
static final String HIDE_SLACK_FILES_IN_VIEWS_TREE
static int getDefaultLogFileCount()
static void setGroupItemsInTreeByDatasource(boolean value)
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 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 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 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 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 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 void setHideSlackFilesInDataSourcesTree(boolean value)
static void setHideKnownFilesInDataSourcesTree(boolean value)
static void setIndexingServerPort(int port)
static String getConfigSetting(String moduleName, String settingName)
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 boolean hideKnownFilesInDataSourcesTree()
static String getTimeZoneForDisplays()
static void setExternalHexEditorPath(String executablePath)
static final String MESSAGE_SERVICE_USER
static void addChangeListener(PreferenceChangeListener listener)
static final String EXTERNAL_DATABASE_TYPE
static final String INDEXING_SERVER_PORT
static void setShowOnlyCurrentUserTags(boolean value)
static String convertTextToHexText(String property)
static SelectedMode getMode()
static String getIndexingServerHost()
static final String TIME_ZONE_FOR_DISPLAYS
static boolean settingExists(String moduleName, String settingName)
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)