19 package org.sleuthkit.autopsy.centralrepository.eventlisteners;
22 import java.io.IOException;
23 import java.lang.reflect.InvocationTargetException;
24 import java.nio.file.Paths;
26 import java.util.logging.Level;
27 import javax.swing.JOptionPane;
28 import javax.swing.SwingUtilities;
29 import org.apache.commons.io.FileUtils;
30 import org.openide.modules.ModuleInstall;
31 import org.openide.util.NbBundle;
66 if (instance == null) {
117 if (!newSettingsFile.exists() && legacySettingsFile.exists()) {
120 File prevDirCheck =
new File(prevPath);
122 if (!prevDirCheck.isAbsolute()) {
128 && Paths.get(LEGACY_DEFAULT_DB_PARENT_PATH).toAbsolutePath().toString().equals(Paths.get(prevPath).toAbsolutePath().toString())) {
130 File prevDir =
new File(prevPath);
132 if (prevDir.exists() && prevDir.isDirectory()) {
135 for (File childFile : prevDir.listFiles((dir, name) -> name.startsWith(prevDbName))) {
138 }
catch (IOException ex) {
139 logger.log(Level.SEVERE,
"There was an error upgrading settings.", ex);
162 String initializedStr = centralRepoSettings.get(
"initialized");
165 boolean initialized = Boolean.parseBoolean(initializedStr);
169 boolean prevRepo = Boolean.parseBoolean(centralRepoSettings.get(
"db.useCentralRepo"));
194 logger.log(Level.SEVERE,
"There was an error while initializing the central repository database", ex);
208 @NbBundle.Messages({
"Installer.centralRepoUpgradeFailed.title=Central repository disabled"})
212 SwingUtilities.invokeAndWait(() -> {
213 JOptionPane.showMessageDialog(null,
215 NbBundle.getMessage(this.getClass(),
"Installer.centralRepoUpgradeFailed.title"),
216 JOptionPane.ERROR_MESSAGE);
218 }
catch (InterruptedException | InvocationTargetException e) {
219 logger.log(Level.WARNING, e.getMessage(), e);
void setupDefaultSqliteDb()
String getDatabaseNameKey()
String getDefaultDbPath()
static final long serialVersionUID
static boolean runningWithGUI
static final String LEGACY_MODULE_SETTINGS_KEY
static final Logger logger
static final String LEGACY_DEFAULT_FOLDER
static Installer instance
void setupDefaultCentralRepository()
static boolean getIsMultiUserModeEnabled()
static final String LEGACY_DEFAULT_DB_PARENT_PATH
static synchronized Installer getDefault()
static synchronized void setConfigSetting(String moduleName, String settingName, String settingVal)
void doMessageBoxIfRunningInGUI(CentralRepoException ex)
String getDatabasePathKey()
static synchronized void setConfigSettings(String moduleName, Map< String, String > settings)
String getModuleSettingsKey()
String getSettingsFilePath(String moduleName)
void upgradeSettingsPath()
synchronized static Logger getLogger(String name)
static CentralRepoSettings getInstance()
static synchronized Map< String, String > getConfigSettings(String moduleName)
void setupPostgresDb(CentralRepoDbChoice choice)