19 package org.sleuthkit.autopsy.keywordsearch;
21 import java.util.logging.Level;
22 import org.apache.solr.client.solrj.SolrServerException;
23 import org.openide.modules.ModuleInstall;
24 import org.openide.util.NbBundle;
25 import org.openide.windows.WindowManager;
38 class Installer
extends ModuleInstall {
40 private static final Logger logger = Logger.getLogger(Installer.class.getName());
41 private static final long serialVersionUID = 1L;
44 public void restored() {
46 KeywordSearchSettings.setDefaults();
48 final Server server = KeywordSearch.getServer();
51 }
catch (SolrServerNoPortException ex) {
52 logger.log(Level.SEVERE,
"Failed to start Keyword Search server: ", ex);
53 if (ex.getPortNumber() == server.getLocalSolrServerPort()) {
54 reportPortError(ex.getPortNumber());
56 reportStopPortError(ex.getPortNumber());
58 }
catch (KeywordSearchModuleException | SolrServerException ex) {
59 logger.log(Level.SEVERE,
"Failed to start Keyword Search server: ", ex);
60 reportInitError(ex.getMessage());
65 public boolean closing() {
68 KeywordSearch.getServer().stop();
74 public void uninstalled() {
76 KeywordSearch.getServer().stop();
80 private void reportPortError(
final int curFailPort) {
81 WindowManager.getDefault().invokeWhenUIReady(
new Runnable() {
84 final String msg = NbBundle.getMessage(this.getClass(),
"Installer.reportPortError", curFailPort, Version.getName(), Server.PROPERTIES_CURRENT_SERVER_PORT, Server.PROPERTIES_FILE);
85 MessageNotifyUtil.Notify.error(NbBundle.getMessage(
this.getClass(),
"Installer.errorInitKsmMsg"), msg);
90 private void reportStopPortError(
final int curFailPort) {
91 WindowManager.getDefault().invokeWhenUIReady(
new Runnable() {
94 final String msg = NbBundle.getMessage(this.getClass(),
"Installer.reportStopPortError", curFailPort, Server.PROPERTIES_CURRENT_STOP_PORT, Server.PROPERTIES_FILE);
95 MessageNotifyUtil.Notify.error(NbBundle.getMessage(
this.getClass(),
"Installer.errorInitKsmMsg"), msg);
100 private void reportInitError(
final String msg) {
101 WindowManager.getDefault().invokeWhenUIReady(
new Runnable() {
104 MessageNotifyUtil.Notify.error(NbBundle.getMessage(
this.getClass(),
"Installer.errorInitKsmMsg"), msg);