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;
 
   67     private static final String 
APP_NAME = 
"AppName";
 
   69     private static final String 
MODE = 
"AutopsyMode"; 
 
  127         preferences.addPreferenceChangeListener(listener);
 
  131         preferences.removePreferenceChangeListener(listener);
 
  135         return preferences.getBoolean(KEEP_PREFERRED_VIEWER, 
false);
 
  139         preferences.putBoolean(KEEP_PREFERRED_VIEWER, value);
 
  143         return preferences.getBoolean(HIDE_KNOWN_FILES_IN_DATA_SRCS_TREE, 
false);
 
  147         preferences.putBoolean(HIDE_KNOWN_FILES_IN_DATA_SRCS_TREE, value);
 
  151         return preferences.getBoolean(HIDE_KNOWN_FILES_IN_VIEWS_TREE, 
true);
 
  155         preferences.putBoolean(HIDE_KNOWN_FILES_IN_VIEWS_TREE, value);
 
  159         return preferences.getBoolean(HIDE_SLACK_FILES_IN_DATA_SRCS_TREE, 
true);
 
  163         preferences.putBoolean(HIDE_SLACK_FILES_IN_DATA_SRCS_TREE, value);
 
  167         return preferences.getBoolean(HIDE_SLACK_FILES_IN_VIEWS_TREE, 
true);
 
  171         preferences.putBoolean(HIDE_SLACK_FILES_IN_VIEWS_TREE, value);
 
  175         return preferences.getBoolean(DISPLAY_TIMES_IN_LOCAL_TIME, 
true);
 
  179         preferences.putBoolean(DISPLAY_TIMES_IN_LOCAL_TIME, value);
 
  183         return preferences.getInt(NUMBER_OF_FILE_INGEST_THREADS, 2);
 
  187         preferences.putInt(NUMBER_OF_FILE_INGEST_THREADS, value);
 
  200             dbType = DbType.valueOf(preferences.get(EXTERNAL_DATABASE_TYPE, 
"POSTGRESQL")); 
 
  201         } 
catch (Exception ex) {
 
  202             dbType = DbType.SQLITE;
 
  205             return new CaseDbConnectionInfo(
 
  206                     preferences.get(EXTERNAL_DATABASE_HOSTNAME_OR_IP, 
""),
 
  207                     preferences.get(EXTERNAL_DATABASE_PORTNUMBER, 
"5432"),
 
  208                     preferences.get(EXTERNAL_DATABASE_USER, 
""),
 
  212             throw new UserPreferencesException(
"Failure converting password hex text to text.", ex); 
 
  225         preferences.put(EXTERNAL_DATABASE_HOSTNAME_OR_IP, connectionInfo.getHost());
 
  226         preferences.put(EXTERNAL_DATABASE_PORTNUMBER, connectionInfo.getPort());
 
  227         preferences.put(EXTERNAL_DATABASE_USER, connectionInfo.getUserName());
 
  233         preferences.put(EXTERNAL_DATABASE_TYPE, connectionInfo.getDbType().toString());
 
  237         preferences.putBoolean(IS_MULTI_USER_MODE_ENABLED, enabled);
 
  241         return preferences.getBoolean(IS_MULTI_USER_MODE_ENABLED, 
false);
 
  245         return preferences.get(INDEXING_SERVER_HOST, 
"");
 
  249         preferences.put(INDEXING_SERVER_HOST, hostName);
 
  253         return preferences.get(INDEXING_SERVER_PORT, 
"8983");
 
  257         preferences.putInt(INDEXING_SERVER_PORT, port);
 
  268         preferences.put(MESSAGE_SERVICE_HOST, info.getHost());
 
  269         preferences.put(MESSAGE_SERVICE_PORT, Integer.toString(info.getPort()));
 
  270         preferences.put(MESSAGE_SERVICE_USER, info.getUserName());
 
  288             port = Integer.parseInt(preferences.get(MESSAGE_SERVICE_PORT, DEFAULT_PORT_STRING));
 
  289         } 
catch (NumberFormatException ex) {
 
  296                     preferences.get(MESSAGE_SERVICE_HOST, 
""),
 
  298                     preferences.get(MESSAGE_SERVICE_USER, 
""),
 
  301             throw new UserPreferencesException(
"Failed to convert password hex text to text.", ex);
 
  311         int timeOut = preferences.getInt(PROCESS_TIME_OUT_HOURS, DEFAULT_PROCESS_TIMEOUT_HR);
 
  327         preferences.putInt(PROCESS_TIME_OUT_HOURS, value);
 
  338         boolean enabled = preferences.getBoolean(PROCESS_TIME_OUT_ENABLED, 
false);
 
  350         preferences.putBoolean(PROCESS_TIME_OUT_ENABLED, enabled);
 
  368         preferences.put(APP_NAME, name);
 
  376         return preferences.getInt(MAX_NUM_OF_LOG_FILE, LOG_FILE_NUM_INT);
 
  391         preferences.putInt(MAX_NUM_OF_LOG_FILE, count);
 
static final String HIDE_SLACK_FILES_IN_VIEWS_TREE
 
static int getDefaultLogFileCount()
 
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 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 final String DEFAULT_PORT_STRING
 
static boolean getIsMultiUserModeEnabled()
 
static void setHideSlackFilesInViewsTree(boolean value)
 
static CaseDbConnectionInfo getDatabaseConnectionInfo()
 
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 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 final int DEFAULT_PORT_INT
 
static void setDatabaseConnectionInfo(CaseDbConnectionInfo connectionInfo)
 
static final String EXTERNAL_DATABASE_PORTNUMBER
 
static final String PROCESS_TIME_OUT_ENABLED
 
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 final String MESSAGE_SERVICE_PASSWORD
 
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 final String MESSAGE_SERVICE_USER
 
static void addChangeListener(PreferenceChangeListener listener)
 
static final String EXTERNAL_DATABASE_TYPE
 
static final String INDEXING_SERVER_PORT
 
static String convertTextToHexText(String property)
 
static SelectedMode getMode()
 
static String getIndexingServerHost()
 
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)