Autopsy  4.19.3
Graphical digital forensics platform for The Sleuth Kit and other tools.
Public Member Functions | Static Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | List of all members
org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoDbManager Class Reference

Public Member Functions

 CentralRepoDbManager ()
 
void clearStatus ()
 
boolean createDb () throws CentralRepoException
 
PostgresCentralRepoSettings getDbSettingsMultiUser ()
 
PostgresCentralRepoSettings getDbSettingsPostgres ()
 
SqliteCentralRepoSettings getDbSettingsSqlite ()
 
CentralRepoDbChoice getSelectedDbChoice ()
 
DatabaseTestResult getStatus ()
 
void saveNewCentralRepo () throws CentralRepoException
 
void setSelctedDbChoice (CentralRepoDbChoice newSelected)
 
void setupDefaultSqliteDb () throws CentralRepoException
 
void setupPostgresDb (CentralRepoDbChoice choice) throws CentralRepoException
 
boolean testDatabaseSettingsAreValid (String tbDbHostname, String tbDbPort, String tbDbUsername, String tfDatabasePath, String jpDbPassword) throws CentralRepoException, NumberFormatException
 
DatabaseTestResult testStatus ()
 
boolean wasConfigurationChanged ()
 

Static Public Member Functions

static void addPropertyChangeListener (PropertyChangeListener listener)
 
static void disableDueToFailure ()
 
static CentralRepoDbChoice getSavedDbChoice ()
 
static boolean isDisabledDueToFailure ()
 
static boolean isPostgresMultiuserAllowed ()
 
static void removePropertyChangeListener (PropertyChangeListener listener)
 
static CentralRepoDbChoice saveDbChoice (CentralRepoDbChoice choice)
 
static CentralRepoDbChoice saveDbChoice (CentralRepoDbChoice choice, boolean clearDisabledDueToError)
 
static void upgradeDatabase () throws CentralRepoException
 

Private Member Functions

RdbmsCentralRepoFactory getDbFactory () throws CentralRepoException
 
CentralRepoDbConnectivityManager getSelectedSettings () throws CentralRepoException
 

Static Private Member Functions

static CentralRepoDbChoice fromKey (String keyName)
 
static CoordinationService.Lock obtainCentralRepoLock (CentralRepository db) throws CentralRepoException
 
static CentralRepository obtainCentralRepository () throws CentralRepoException
 
static void onUpgradeError (String message, String desc, Exception innerException) throws CentralRepoException
 
static void setDisabledDueToFailure (boolean disabledDueToFailure)
 
static void updatedDbSchema (CentralRepository db, CoordinationService.Lock lock) throws CentralRepoException
 

Private Attributes

boolean configurationChanged = false
 
final PostgresCentralRepoSettings dbSettingsMultiUser
 
final PostgresCentralRepoSettings dbSettingsPostgres
 
final SqliteCentralRepoSettings dbSettingsSqlite
 
CentralRepoDbChoice selectedDbChoice
 
DatabaseTestResult testingStatus
 

Static Private Attributes

static final String CENTRAL_REPO_DB_NAME = "central_repository"
 
static final String CENTRAL_REPOSITORY_SETTINGS_KEY = CentralRepoSettings.getInstance().getModuleSettingsKey()
 
static final String DB_SELECTED_PLATFORM_KEY = "db.selectedPlatform"
 
static final Object dbChoiceLock = new Object()
 
static final String DISABLED_DUE_TO_FAILURE_KEY = "disabledDueToFailure"
 
static final Object disabledDueToFailureLock = new Object()
 
static final Logger logger = Logger.getLogger(CentralRepoDbManager.class.getName())
 
static final PropertyChangeSupport propertyChangeSupport = new PropertyChangeSupport(CentralRepoDbManager.class)
 
static volatile CentralRepoDbChoice savedChoice = null
 

Detailed Description

This class contains business logic for saving and validating settings for central repository.

Definition at line 37 of file CentralRepoDbManager.java.

Constructor & Destructor Documentation

org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoDbManager.CentralRepoDbManager ( )

Member Function Documentation

static void org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoDbManager.addPropertyChangeListener ( PropertyChangeListener  listener)
static

This method adds a property change listener. NOTE: currently only listening for changes in currently saved db choice and disabling due to failure.

Parameters
listenerThe listener for the event.

Definition at line 173 of file CentralRepoDbManager.java.

Referenced by org.sleuthkit.autopsy.centralrepository.optionspanel.GlobalSettingsPanel.setupSettingsChangeListeners().

void org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoDbManager.clearStatus ( )
boolean org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoDbManager.createDb ( ) throws CentralRepoException
static void org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoDbManager.disableDueToFailure ( )
static

This method disables the central repository and indicates through a flag that this was due to a failure during database setup. This is used when re-enabling multi-user as a flag to determine whether or not CR should be re-enabled.

Definition at line 131 of file CentralRepoDbManager.java.

References org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoDbManager.setDisabledDueToFailure(), and org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoDbUtil.setUseCentralRepo().

static CentralRepoDbChoice org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoDbManager.fromKey ( String  keyName)
staticprivate
RdbmsCentralRepoFactory org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoDbManager.getDbFactory ( ) throws CentralRepoException
private
PostgresCentralRepoSettings org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoDbManager.getDbSettingsMultiUser ( )

This method retrieves the current multi-user database settings.

Returns
The current multi-user database settings.

Definition at line 337 of file CentralRepoDbManager.java.

References org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoDbManager.dbSettingsMultiUser.

PostgresCentralRepoSettings org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoDbManager.getDbSettingsPostgres ( )
SqliteCentralRepoSettings org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoDbManager.getDbSettingsSqlite ( )
static CentralRepoDbChoice org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoDbManager.getSavedDbChoice ( )
static

This method loads the selectedPlatform boolean from the config file if it is set.

Definition at line 114 of file CentralRepoDbManager.java.

References org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoDbManager.dbChoiceLock, org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoDbManager.fromKey(), org.sleuthkit.autopsy.coreutils.ModuleSettings.getConfigSetting(), and org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoDbManager.savedChoice.

Referenced by org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoDbManager.CentralRepoDbManager(), org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepository.getInstance(), org.sleuthkit.autopsy.centralrepository.datamodel.PostgresCentralRepoSettings.getLoaderFromSaved(), org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepository.isEnabled(), org.sleuthkit.autopsy.centralrepository.optionspanel.GlobalSettingsPanel.load(), org.sleuthkit.autopsy.centralrepository.optionspanel.GlobalSettingsPanel.onMultiUserChange(), org.sleuthkit.autopsy.centralrepository.ingestmodule.CentralRepoDataArtifactIngestModule.startUp(), org.sleuthkit.autopsy.centralrepository.optionspanel.GlobalSettingsPanel.testCurrentConfiguration(), org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoDbUpgrader15To16.upgradeSchema(), org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoDbUpgrader14To15.upgradeSchema(), and org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoDbUpgrader13To14.upgradeSchema().

CentralRepoDbChoice org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoDbManager.getSelectedDbChoice ( )
CentralRepoDbConnectivityManager org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoDbManager.getSelectedSettings ( ) throws CentralRepoException
private
DatabaseTestResult org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoDbManager.getStatus ( )

This method retrieves the current status. Note: this could be a dirty value if testing of the connection has not been performed.

Returns
The current status of the database connection.

Definition at line 556 of file CentralRepoDbManager.java.

References org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoDbManager.testingStatus.

Referenced by org.sleuthkit.autopsy.centralrepository.optionspanel.EamDbSettingsDialog.promptTestStatusWarnings().

static boolean org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoDbManager.isDisabledDueToFailure ( )
static

This method retrieves setting whether or not the repository has been disabled due to a database setup issue; this is used when re-enabling multi-user as a flag to determine whether or not CR should be re-enabled.

Returns
Whether or not the repository has been disabled due to a database setup issue.

Definition at line 160 of file CentralRepoDbManager.java.

References org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoDbManager.disabledDueToFailureLock, and org.sleuthkit.autopsy.coreutils.ModuleSettings.getConfigSetting().

Referenced by org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoDbManager.setDisabledDueToFailure().

static boolean org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoDbManager.isPostgresMultiuserAllowed ( )
static
static CoordinationService.Lock org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoDbManager.obtainCentralRepoLock ( CentralRepository  db) throws CentralRepoException
staticprivate

This method obtains a central repository lock.

Parameters
dbThe database connection.
Returns
The lock if acquired.
Exceptions
CentralRepoException

Definition at line 226 of file CentralRepoDbManager.java.

References org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoDbManager.onUpgradeError().

Referenced by org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoDbManager.upgradeDatabase().

static CentralRepository org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoDbManager.obtainCentralRepository ( ) throws CentralRepoException
staticprivate
static void org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoDbManager.onUpgradeError ( String  message,
String  desc,
Exception  innerException 
) throws CentralRepoException
staticprivate
static void org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoDbManager.removePropertyChangeListener ( PropertyChangeListener  listener)
static

This method removes a propert change listener.

Parameters
listenerThe listener to remove.

Definition at line 182 of file CentralRepoDbManager.java.

Referenced by org.sleuthkit.autopsy.centralrepository.optionspanel.GlobalSettingsPanel.setupSettingsChangeListeners().

static CentralRepoDbChoice org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoDbManager.saveDbChoice ( CentralRepoDbChoice  choice)
static

This saves the currently selected database choice and clears any disabledDueToFailure flag.

Parameters
choiceThe choice to save.
Returns
The newly saved choice.

Definition at line 61 of file CentralRepoDbManager.java.

Referenced by org.sleuthkit.autopsy.centralrepository.optionspanel.GlobalSettingsPanel.onMultiUserChange(), org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoDbManager.onUpgradeError(), and org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoDbManager.saveNewCentralRepo().

static CentralRepoDbChoice org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoDbManager.saveDbChoice ( CentralRepoDbChoice  choice,
boolean  clearDisabledDueToError 
)
static
void org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoDbManager.saveNewCentralRepo ( ) throws CentralRepoException
static void org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoDbManager.setDisabledDueToFailure ( boolean  disabledDueToFailure)
staticprivate

This method sets whether or not the repository has been disabled due to a database setup issue; This is used when re-enabling multi-user as a flag to determine whether or not CR should be re-enabled.

Parameters
disabledDueToFailureWhether or not the repository has been disabled due to a database setup issue.

Definition at line 144 of file CentralRepoDbManager.java.

References org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoDbManager.disabledDueToFailureLock, org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoDbManager.isDisabledDueToFailure(), and org.sleuthkit.autopsy.coreutils.ModuleSettings.setConfigSetting().

Referenced by org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoDbManager.disableDueToFailure(), and org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoDbManager.saveDbChoice().

void org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoDbManager.setSelctedDbChoice ( CentralRepoDbChoice  newSelected)

This method sets the currently selected database choice and sets the testing status to untested.

Parameters
newSelectedThe new database choice.

Definition at line 583 of file CentralRepoDbManager.java.

References org.sleuthkit.autopsy.centralrepository.datamodel.DatabaseTestResult.UNTESTED.

Referenced by org.sleuthkit.autopsy.centralrepository.optionspanel.EamDbSettingsDialog.changeDbSelection(), and org.sleuthkit.autopsy.integrationtesting.IntegrationTestService.pushCurrentCrChoice().

void org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoDbManager.setupDefaultSqliteDb ( ) throws CentralRepoException
void org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoDbManager.setupPostgresDb ( CentralRepoDbChoice  choice) throws CentralRepoException
boolean org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoDbManager.testDatabaseSettingsAreValid ( String  tbDbHostname,
String  tbDbPort,
String  tbDbUsername,
String  tfDatabasePath,
String  jpDbPassword 
) throws CentralRepoException, NumberFormatException
DatabaseTestResult org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoDbManager.testStatus ( )
static void org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoDbManager.updatedDbSchema ( CentralRepository  db,
CoordinationService.Lock  lock 
) throws CentralRepoException
staticprivate
static void org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoDbManager.upgradeDatabase ( ) throws CentralRepoException
static
boolean org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoDbManager.wasConfigurationChanged ( )

This method returns if changes to the central repository configuration were successfully applied.

Returns
Returns true if the database configuration was successfully changed false if it was not.

Definition at line 419 of file CentralRepoDbManager.java.

References org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoDbManager.configurationChanged.

Referenced by org.sleuthkit.autopsy.centralrepository.optionspanel.EamDbSettingsDialog.wasConfigurationChanged().

Member Data Documentation

final String org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoDbManager.CENTRAL_REPO_DB_NAME = "central_repository"
staticprivate

Definition at line 41 of file CentralRepoDbManager.java.

final String org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoDbManager.CENTRAL_REPOSITORY_SETTINGS_KEY = CentralRepoSettings.getInstance().getModuleSettingsKey()
staticprivate

Definition at line 42 of file CentralRepoDbManager.java.

boolean org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoDbManager.configurationChanged = false
private
final String org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoDbManager.DB_SELECTED_PLATFORM_KEY = "db.selectedPlatform"
staticprivate

Definition at line 43 of file CentralRepoDbManager.java.

final Object org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoDbManager.dbChoiceLock = new Object()
staticprivate
final PostgresCentralRepoSettings org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoDbManager.dbSettingsMultiUser
private
final PostgresCentralRepoSettings org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoDbManager.dbSettingsPostgres
private
final SqliteCentralRepoSettings org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoDbManager.dbSettingsSqlite
private
final String org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoDbManager.DISABLED_DUE_TO_FAILURE_KEY = "disabledDueToFailure"
staticprivate

Definition at line 44 of file CentralRepoDbManager.java.

final Object org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoDbManager.disabledDueToFailureLock = new Object()
staticprivate
final Logger org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoDbManager.logger = Logger.getLogger(CentralRepoDbManager.class.getName())
staticprivate

Definition at line 39 of file CentralRepoDbManager.java.

final PropertyChangeSupport org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoDbManager.propertyChangeSupport = new PropertyChangeSupport(CentralRepoDbManager.class)
staticprivate

Definition at line 48 of file CentralRepoDbManager.java.

volatile CentralRepoDbChoice org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoDbManager.savedChoice = null
staticprivate
CentralRepoDbChoice org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoDbManager.selectedDbChoice
private
DatabaseTestResult org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoDbManager.testingStatus
private

The documentation for this class was generated from the following file:

Copyright © 2012-2022 Basis Technology. Generated on: Tue Oct 4 2022
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.