19 package org.sleuthkit.autopsy.core;
22 import java.util.prefs.BackingStoreException;
24 import java.util.prefs.PreferenceChangeListener;
25 import java.util.prefs.Preferences;
26 import org.openide.util.NbPreferences;
27 import org.python.icu.util.TimeZone;
69 private static final String
APP_NAME =
"AppName";
71 private static final String
MODE =
"AutopsyMode";
133 preferences.addPreferenceChangeListener(listener);
137 preferences.removePreferenceChangeListener(listener);
141 return preferences.getBoolean(KEEP_PREFERRED_VIEWER,
false);
145 preferences.putBoolean(KEEP_PREFERRED_VIEWER, value);
149 return preferences.getBoolean(HIDE_KNOWN_FILES_IN_DATA_SRCS_TREE,
false);
153 preferences.putBoolean(HIDE_KNOWN_FILES_IN_DATA_SRCS_TREE, value);
157 return preferences.getBoolean(HIDE_KNOWN_FILES_IN_VIEWS_TREE,
true);
161 preferences.putBoolean(HIDE_KNOWN_FILES_IN_VIEWS_TREE, value);
165 return preferences.getBoolean(HIDE_SLACK_FILES_IN_DATA_SRCS_TREE,
true);
169 preferences.putBoolean(HIDE_SLACK_FILES_IN_DATA_SRCS_TREE, value);
173 return preferences.getBoolean(HIDE_SLACK_FILES_IN_VIEWS_TREE,
true);
177 preferences.putBoolean(HIDE_SLACK_FILES_IN_VIEWS_TREE, value);
181 return preferences.getBoolean(DISPLAY_TIMES_IN_LOCAL_TIME,
true);
185 preferences.putBoolean(DISPLAY_TIMES_IN_LOCAL_TIME, value);
189 return preferences.get(TIME_ZONE_FOR_DISPLAYS, TimeZone.GMT_ZONE.getID());
193 preferences.put(TIME_ZONE_FOR_DISPLAYS, timeZone);
197 return preferences.getInt(NUMBER_OF_FILE_INGEST_THREADS, 2);
201 preferences.putInt(NUMBER_OF_FILE_INGEST_THREADS, value);
206 return preferences.getBoolean(GROUP_ITEMS_IN_TREE_BY_DATASOURCE,
false);
211 preferences.putBoolean(GROUP_ITEMS_IN_TREE_BY_DATASOURCE, value);
221 return preferences.getBoolean(SHOW_ONLY_CURRENT_USER_TAGS,
false);
232 preferences.putBoolean(SHOW_ONLY_CURRENT_USER_TAGS, value);
244 return preferences.getBoolean(HIDE_CENTRAL_REPO_COMMENTS_AND_OCCURRENCES,
false);
256 preferences.putBoolean(HIDE_CENTRAL_REPO_COMMENTS_AND_OCCURRENCES, 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);
345 preferences.put(MESSAGE_SERVICE_HOST, info.getHost());
346 preferences.put(MESSAGE_SERVICE_PORT, Integer.toString(info.getPort()));
347 preferences.put(MESSAGE_SERVICE_USER, info.getUserName());
365 port = Integer.parseInt(preferences.get(MESSAGE_SERVICE_PORT, DEFAULT_PORT_STRING));
366 }
catch (NumberFormatException ex) {
373 preferences.get(MESSAGE_SERVICE_HOST,
""),
375 preferences.get(MESSAGE_SERVICE_USER,
""),
378 throw new UserPreferencesException(
"Failed to convert password hex text to text.", ex);
388 int timeOut = preferences.getInt(PROCESS_TIME_OUT_HOURS, DEFAULT_PROCESS_TIMEOUT_HR);
404 preferences.putInt(PROCESS_TIME_OUT_HOURS, value);
415 boolean enabled = preferences.getBoolean(PROCESS_TIME_OUT_ENABLED,
false);
427 preferences.putBoolean(PROCESS_TIME_OUT_ENABLED, enabled);
445 preferences.put(APP_NAME, name);
454 return preferences.getInt(MAX_NUM_OF_LOG_FILE, LOG_FILE_NUM_INT);
472 preferences.putInt(MAX_NUM_OF_LOG_FILE, count);
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 int getProcessTimeOutHrs()
static boolean hideSlackFilesInDataSourcesTree()
static final int DEFAULT_PROCESS_TIMEOUT_HR
static String getIndexingServerPort()
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 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 setIsTimeOutEnabled(boolean enabled)
static final String HIDE_KNOWN_FILES_IN_DATA_SRCS_TREE
static void setIsMultiUserModeEnabled(boolean enabled)
static final String SETTINGS_PROPERTIES
static final boolean IS_WINDOWS_OS
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 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 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 void setHideCentralRepoCommentsAndOccurrences(boolean value)
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 boolean hideKnownFilesInDataSourcesTree()
static String getTimeZoneForDisplays()
static final String MESSAGE_SERVICE_USER
static boolean hideCentralRepoCommentsAndOccurrences()
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 final String HIDE_CENTRAL_REPO_COMMENTS_AND_OCCURRENCES
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)