19 package org.sleuthkit.autopsy.casemodule;
22 import java.io.IOException;
23 import java.nio.charset.Charset;
24 import java.util.Collection;
25 import java.util.Iterator;
26 import java.util.logging.Level;
27 import javax.swing.SwingUtilities;
28 import org.apache.commons.io.FileUtils;
29 import org.apache.commons.lang3.StringUtils;
30 import org.openide.util.Lookup;
31 import org.openide.util.NbBundle;
58 if (instance == null) {
60 if (instance == null) {
71 "# {0} - autFilePath",
72 "StartupWindowProvider.openCase.noFile=Unable to open previously open case because metadata file not found at: {0}",
73 "# {0} - reOpenFilePath",
74 "StartupWindowProvider.openCase.deleteOpenFailure=Unable to open or delete file containing path {0} to previously open case. The previous case will not be opened.",
75 "# {0} - autFilePath",
76 "StartupWindowProvider.openCase.cantOpen=Unable to open previously open case with metadata file: {0}"})
78 if (startupWindowToUse == null) {
83 if (defaultArg != null) {
88 logger.log(Level.INFO,
"Running from command line");
100 Collection<? extends StartupWindowInterface> startupWindows
103 int windowsCount = startupWindows.size();
104 switch (windowsCount) {
106 startupWindowToUse = startupWindows.iterator().next();
107 logger.log(Level.INFO,
"Will use the default startup window: {0}", startupWindowToUse.toString());
111 Iterator<? extends StartupWindowInterface> it = startupWindows.iterator();
112 while (it.hasNext()) {
115 startupWindowToUse = window;
116 logger.log(Level.INFO,
"Will use the custom startup window: {0}", startupWindowToUse.toString());
124 Iterator<? extends StartupWindowInterface> it = startupWindows.iterator();
125 while (it.hasNext()) {
127 if (!window.getClass().getCanonicalName().startsWith(
"org.sleuthkit.autopsy")) {
128 startupWindowToUse = window;
129 logger.log(Level.INFO,
"Will use the custom startup window: {0}", startupWindowToUse.toString());
137 if (startupWindowToUse == null) {
138 logger.log(Level.SEVERE,
"Unexpected error, no startup window chosen, using the default");
144 if (openPreviousCaseFile.exists()) {
147 String caseFilePath =
"";
148 String unableToOpenMessage = null;
151 Charset encoding = null;
152 caseFilePath = FileUtils.readFileToString(openPreviousCaseFile, encoding);
153 if (
new File(caseFilePath).exists()) {
154 FileUtils.forceDelete(openPreviousCaseFile);
160 unableToOpenMessage = Bundle.StartupWindowProvider_openCase_noFile(caseFilePath);
161 logger.log(Level.WARNING, unableToOpenMessage);
163 }
catch (IOException ex) {
165 logger.log(Level.WARNING, unableToOpenMessage, ex);
167 unableToOpenMessage = Bundle.StartupWindowProvider_openCase_cantOpen(caseFilePath);
168 logger.log(Level.WARNING, unableToOpenMessage, ex);
172 final String message = unableToOpenMessage;
173 SwingUtilities.invokeLater(() -> {
191 NbBundle.getMessage(SolrNotConfiguredDialog.class,
"SolrNotConfiguredDialog.EmptyKeywordSearchHostName"));
193 SolrNotConfiguredDialog dialog =
new SolrNotConfiguredDialog();
194 dialog.setVisible(
true);
209 if (processor != null) {
222 if (processor != null) {
230 if (startupWindowToUse != null) {
231 startupWindowToUse.
open();
237 if (startupWindowToUse != null) {
238 startupWindowToUse.
close();
static boolean runningWithGUI
static void warn(String message)
StartupWindowInterface getStartupWindow()
static volatile StartupWindowProvider instance
static boolean getIsMultiUserModeEnabled()
String getDefaultArgument()
static String getCaseToReopenFilePath()
boolean isRunFromCommandLine()
boolean isRunningFromCommandLine()
String getDefaultArgument()
volatile StartupWindowInterface startupWindowToUse
static void openAsCurrentCase(String caseMetadataFilePath)
static void error(String title, String message)
synchronized static Logger getLogger(String name)
static StartupWindowProvider getInstance()
static String getIndexingServerHost()
static final Logger logger