Autopsy  4.21.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
MultiUserSettingsPanel.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2013-2018 Basis Technology Corp.
5  * Contact: carrier <at> sleuthkit <dot> org
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19 package org.sleuthkit.autopsy.corecomponents;
20 
21 import java.awt.Color;
22 import java.util.ArrayList;
23 import java.util.Collection;
24 import javax.swing.JTextField;
25 import javax.swing.event.DocumentEvent;
26 import javax.swing.event.DocumentListener;
27 import org.openide.util.NbBundle;
28 import org.sleuthkit.datamodel.CaseDbConnectionInfo;
29 import org.sleuthkit.datamodel.TskData.DbType;
34 import java.awt.Cursor;
35 import java.beans.PropertyChangeEvent;
36 import java.io.IOException;
37 import java.util.EnumSet;
38 import java.util.logging.Level;
39 import javax.swing.ImageIcon;
40 import javax.swing.JOptionPane;
41 import javax.swing.SwingUtilities;
42 import org.openide.util.ImageUtilities;
43 import org.openide.util.Lookup;
44 import org.openide.util.NbBundle.Messages;
52 import org.sleuthkit.datamodel.SleuthkitCase;
53 import org.sleuthkit.datamodel.TskCoreException;
54 
58 @SuppressWarnings("PMD.SingularField") // UI widgets cause lots of false positives
59 public final class MultiUserSettingsPanel extends javax.swing.JPanel {
60 
61  private static final String HOST_NAME_OR_IP_PROMPT = NbBundle.getMessage(MultiUserSettingsPanel.class, "MultiUserSettingsPanel.tbDbHostname.toolTipText");
62  private static final String PORT_PROMPT = NbBundle.getMessage(MultiUserSettingsPanel.class, "MultiUserSettingsPanel.tbDbPort.toolTipText");
63  private static final String USER_NAME_PROMPT = NbBundle.getMessage(MultiUserSettingsPanel.class, "MultiUserSettingsPanel.tbDbUsername.toolTipText");
64  private static final String PASSWORD_PROMPT = NbBundle.getMessage(MultiUserSettingsPanel.class, "MultiUserSettingsPanel.tbDbPassword.toolTipText");
65  private static final String USER_NAME_PROMPT_OPT = NbBundle.getMessage(MultiUserSettingsPanel.class, "MultiUserSettingsPanel.tbMsgUsername.toolTipText");
66  private static final String PASSWORD_PROMPT_OPT = NbBundle.getMessage(MultiUserSettingsPanel.class, "MultiUserSettingsPanel.tbMsgPassword.toolTipText");
67  private static final String INCOMPLETE_SETTINGS_MSG = NbBundle.getMessage(MultiUserSettingsPanel.class, "MultiUserSettingsPanel.validationErrMsg.incomplete");
68  private static final String INVALID_DB_PORT_MSG = NbBundle.getMessage(MultiUserSettingsPanel.class, "MultiUserSettingsPanel.validationErrMsg.invalidDatabasePort");
69  private static final String INVALID_MESSAGE_SERVICE_PORT_MSG = NbBundle.getMessage(MultiUserSettingsPanel.class, "MultiUserSettingsPanel.validationErrMsg.invalidMessageServicePort");
70  private static final String INVALID_INDEXING_SERVER_PORT_MSG = NbBundle.getMessage(MultiUserSettingsPanel.class, "MultiUserSettingsPanel.validationErrMsg.invalidIndexingServerPort");
71  private static final String INVALID_SOLR4_SERVER_PORT_MSG = NbBundle.getMessage(MultiUserSettingsPanel.class, "MultiUserSettingsPanel.validationErrMsg.invalidSolr4ServerPort");
72  private static final String SOLR_SERVER_NOT_CONFIGURED_MSG = NbBundle.getMessage(MultiUserSettingsPanel.class, "MultiUserSettingsPanel.validationErrMsg.solrNotConfigured");
73  private static final String INVALID_ZK_SERVER_HOST_MSG = NbBundle.getMessage(MultiUserSettingsPanel.class, "MultiUserSettingsPanel.validationErrMsg.invalidZkServerHostName");
74  private static final String INVALID_ZK_SERVER_PORT_MSG = NbBundle.getMessage(MultiUserSettingsPanel.class, "MultiUserSettingsPanel.validationErrMsg.invalidZkServerPort");
75  private static final String SOLR8_HOST_NAME_OR_IP_PROMPT = NbBundle.getMessage(MultiUserSettingsPanel.class, "MultiUserSettingsPanel.tbSolr8Hostname.toolTipText");
76  private static final String SOLR8_PORT_PROMPT = NbBundle.getMessage(MultiUserSettingsPanel.class, "MultiUserSettingsPanel.tbSolr8Port.toolTipText");
77  private static final String SOLR4_HOST_NAME_OR_IP_PROMPT = NbBundle.getMessage(MultiUserSettingsPanel.class, "MultiUserSettingsPanel.tbSolr4Hostname.toolTipText");
78  private static final String SOLR4_PORT_PROMPT = NbBundle.getMessage(MultiUserSettingsPanel.class, "MultiUserSettingsPanel.tbSolr4Port.toolTipText");
79  private static final String ZK_HOST_NAME_OR_IP_PROMPT = NbBundle.getMessage(MultiUserSettingsPanel.class, "MultiUserSettingsPanel.tbZkHostname.toolTipText");
80  private static final String ZK_PORT_PROMPT = NbBundle.getMessage(MultiUserSettingsPanel.class, "MultiUserSettingsPanel.tbZkPort.toolTipText");
81 
82  private static final long serialVersionUID = 1L;
84  private final Collection<JTextField> textBoxes = new ArrayList<>();
85  private final TextBoxChangedListener textBoxChangedListener;
86  private static final Logger logger = Logger.getLogger(MultiUserSettingsPanel.class.getName());
87  private final ImageIcon goodIcon;
88  private final ImageIcon badIcon;
89  private static final boolean isWindowsOS = PlatformUtil.isWindowsOS();
90 
97  initComponents();
98  controller = theController;
99  setSize(555, 600);
100 
104  Collection<TextPrompt> textPrompts = new ArrayList<>();
105  textPrompts.add(new TextPrompt(HOST_NAME_OR_IP_PROMPT, tbDbHostname));
106  textPrompts.add(new TextPrompt(PORT_PROMPT, tbDbPort));
107  textPrompts.add(new TextPrompt(USER_NAME_PROMPT, tbDbUsername));
108  textPrompts.add(new TextPrompt(PASSWORD_PROMPT, tbDbPassword));
109  textPrompts.add(new TextPrompt(HOST_NAME_OR_IP_PROMPT, tbMsgHostname));
110  textPrompts.add(new TextPrompt(PORT_PROMPT, tbMsgPort));
111  textPrompts.add(new TextPrompt(USER_NAME_PROMPT_OPT, tbMsgUsername));
112  textPrompts.add(new TextPrompt(PASSWORD_PROMPT_OPT, tbMsgPassword));
113  textPrompts.add(new TextPrompt(SOLR8_HOST_NAME_OR_IP_PROMPT, tbSolr8Hostname));
114  textPrompts.add(new TextPrompt(SOLR8_PORT_PROMPT, tbSolr8Port));
115  textPrompts.add(new TextPrompt(SOLR4_HOST_NAME_OR_IP_PROMPT, tbSolr4Hostname));
116  textPrompts.add(new TextPrompt(SOLR4_PORT_PROMPT, tbSolr4Port));
117  textPrompts.add(new TextPrompt(ZK_HOST_NAME_OR_IP_PROMPT, tbZkHostname));
118  textPrompts.add(new TextPrompt(ZK_PORT_PROMPT, tbZkPort));
119  configureTextPrompts(textPrompts);
120 
121  /*
122  * Set each textbox with a "statusIcon" property enabling the
123  * DocumentListeners to know which icon to erase when changes are made
124  */
125  tbDbHostname.getDocument().putProperty("statusIcon", lbTestDatabase);
126  tbDbPort.getDocument().putProperty("statusIcon", lbTestDatabase);
127  tbDbUsername.getDocument().putProperty("statusIcon", lbTestDatabase);
128  tbDbPassword.getDocument().putProperty("statusIcon", lbTestDatabase);
129 
130  tbSolr8Hostname.getDocument().putProperty("statusIcon", lbTestSolr8);
131  tbSolr8Port.getDocument().putProperty("statusIcon", lbTestSolr8);
132  tbSolr4Hostname.getDocument().putProperty("statusIcon", lbTestSolr4);
133  tbSolr4Port.getDocument().putProperty("statusIcon", lbTestSolr4);
134  tbZkHostname.getDocument().putProperty("statusIcon", lbTestZK);
135  tbZkPort.getDocument().putProperty("statusIcon", lbTestZK);
136 
137  tbMsgHostname.getDocument().putProperty("statusIcon", lbTestMessageService);
138  tbMsgPort.getDocument().putProperty("statusIcon", lbTestMessageService);
139  tbMsgUsername.getDocument().putProperty("statusIcon", lbTestMessageService);
140  tbMsgPassword.getDocument().putProperty("statusIcon", lbTestMessageService);
141 
143  textBoxChangedListener = new TextBoxChangedListener();
144  textBoxes.add(tbDbHostname);
145  textBoxes.add(tbDbPort);
146  textBoxes.add(tbDbUsername);
147  textBoxes.add(tbDbPassword);
148  textBoxes.add(tbMsgHostname);
149  textBoxes.add(tbMsgPort);
150  textBoxes.add(tbMsgUsername);
151  textBoxes.add(tbMsgPassword);
152  textBoxes.add(tbSolr8Hostname);
153  textBoxes.add(tbSolr8Port);
154  textBoxes.add(tbSolr4Hostname);
155  textBoxes.add(tbSolr4Port);
156  textBoxes.add(tbZkHostname);
157  textBoxes.add(tbZkPort);
158 
159  // as the user enters Solr 8 settings, we fill in the ZK settings with the embedded Solr 8 ZK connection info.
160  tbSolr8Hostname.getDocument().addDocumentListener(new MyDocumentListener());
161 
162  addDocumentListeners(textBoxes, textBoxChangedListener);
163  goodIcon = new ImageIcon(ImageUtilities.loadImage("org/sleuthkit/autopsy/images/good.png", false));
164  badIcon = new ImageIcon(ImageUtilities.loadImage("org/sleuthkit/autopsy/images/bad.png", false));
165  enableMultiUserComponents(textBoxes, cbEnableMultiUser.isSelected());
166 
167  Case.addEventTypeSubscriber(EnumSet.of(Case.Events.CURRENT_CASE), (PropertyChangeEvent evt) -> {
168  //disable when case is open, enable when case is closed
169  load(evt.getNewValue() != null);
170  });
171  }
172 
179  private static void configureTextPrompts(Collection<TextPrompt> textPrompts) {
180  float alpha = 0.9f; // Mostly opaque
181  for (TextPrompt textPrompt : textPrompts) {
182  textPrompt.setForeground(Color.LIGHT_GRAY);
183  textPrompt.changeAlpha(alpha);
184  }
185  }
186 
193  private static void addDocumentListeners(Collection<JTextField> textFields, TextBoxChangedListener listener) {
194  for (JTextField textField : textFields) {
195  textField.getDocument().addDocumentListener(listener);
196  }
197  }
198 
204  @SuppressWarnings("unchecked")
205  // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
206  private void initComponents() {
207 
208  jScrollPane = new javax.swing.JScrollPane();
209  pnOverallPanel = new javax.swing.JPanel();
210  pnDatabaseSettings = new javax.swing.JPanel();
211  tbDbHostname = new javax.swing.JTextField();
212  tbDbPort = new javax.swing.JTextField();
213  tbDbUsername = new javax.swing.JTextField();
214  tbDbPassword = new javax.swing.JPasswordField();
215  lbDatabaseSettings = new javax.swing.JLabel();
216  bnTestDatabase = new javax.swing.JButton();
217  lbTestDatabase = new javax.swing.JLabel();
218  lbTestDbWarning = new javax.swing.JLabel();
219  pnSolrSettings = new javax.swing.JPanel();
220  lbSolr8Settings = new javax.swing.JLabel();
221  tbSolr8Hostname = new javax.swing.JTextField();
222  tbSolr8Port = new javax.swing.JTextField();
223  bnTestSolr8 = new javax.swing.JButton();
224  lbTestSolr8 = new javax.swing.JLabel();
225  lbWarning = new javax.swing.JLabel();
226  tbSolr4Hostname = new javax.swing.JTextField();
227  tbSolr4Port = new javax.swing.JTextField();
228  lbSolr4Settings = new javax.swing.JLabel();
229  lbZkSettings = new javax.swing.JLabel();
230  tbZkHostname = new javax.swing.JTextField();
231  tbZkPort = new javax.swing.JTextField();
232  lbSolrNote1 = new javax.swing.JLabel();
233  lbSolrNote2 = new javax.swing.JLabel();
234  bnTestSolr4 = new javax.swing.JButton();
235  lbTestSolr4 = new javax.swing.JLabel();
236  lbTestZK = new javax.swing.JLabel();
237  bnTestZK = new javax.swing.JButton();
238  pnMessagingSettings = new javax.swing.JPanel();
239  lbMessageServiceSettings = new javax.swing.JLabel();
240  tbMsgHostname = new javax.swing.JTextField();
241  tbMsgUsername = new javax.swing.JTextField();
242  tbMsgPort = new javax.swing.JTextField();
243  tbMsgPassword = new javax.swing.JPasswordField();
244  bnTestMessageService = new javax.swing.JButton();
245  lbTestMessageService = new javax.swing.JLabel();
246  lbTestMessageWarning = new javax.swing.JLabel();
247  cbEnableMultiUser = new javax.swing.JCheckBox();
248  tbOops = new javax.swing.JTextField();
249 
250  pnDatabaseSettings.setBorder(javax.swing.BorderFactory.createEtchedBorder());
251 
252  tbDbHostname.setFont(tbDbHostname.getFont().deriveFont(tbDbHostname.getFont().getSize()+1f));
253  tbDbHostname.setText(org.openide.util.NbBundle.getMessage(MultiUserSettingsPanel.class, "MultiUserSettingsPanel.tbDbHostname.text")); // NOI18N
254  tbDbHostname.setToolTipText(org.openide.util.NbBundle.getMessage(MultiUserSettingsPanel.class, "MultiUserSettingsPanel.tbDbHostname.toolTipText")); // NOI18N
255 
256  tbDbPort.setFont(tbDbPort.getFont().deriveFont(tbDbPort.getFont().getSize()+1f));
257  tbDbPort.setText(org.openide.util.NbBundle.getMessage(MultiUserSettingsPanel.class, "MultiUserSettingsPanel.tbDbPort.text")); // NOI18N
258  tbDbPort.setToolTipText(org.openide.util.NbBundle.getMessage(MultiUserSettingsPanel.class, "MultiUserSettingsPanel.tbDbPort.toolTipText")); // NOI18N
259 
260  tbDbUsername.setFont(tbDbUsername.getFont().deriveFont(tbDbUsername.getFont().getSize()+1f));
261  tbDbUsername.setText(org.openide.util.NbBundle.getMessage(MultiUserSettingsPanel.class, "MultiUserSettingsPanel.tbDbUsername.text")); // NOI18N
262  tbDbUsername.setToolTipText(org.openide.util.NbBundle.getMessage(MultiUserSettingsPanel.class, "MultiUserSettingsPanel.tbDbUsername.toolTipText")); // NOI18N
263 
264  tbDbPassword.setFont(tbDbPassword.getFont().deriveFont(tbDbPassword.getFont().getSize()+1f));
265  tbDbPassword.setText(org.openide.util.NbBundle.getMessage(MultiUserSettingsPanel.class, "MultiUserSettingsPanel.tbDbPassword.text")); // NOI18N
266  tbDbPassword.setToolTipText(org.openide.util.NbBundle.getMessage(MultiUserSettingsPanel.class, "MultiUserSettingsPanel.tbDbPassword.toolTipText")); // NOI18N
267 
268  lbDatabaseSettings.setFont(lbDatabaseSettings.getFont().deriveFont(lbDatabaseSettings.getFont().getSize()+1f));
269  org.openide.awt.Mnemonics.setLocalizedText(lbDatabaseSettings, org.openide.util.NbBundle.getMessage(MultiUserSettingsPanel.class, "MultiUserSettingsPanel.lbDatabaseSettings.text")); // NOI18N
270  lbDatabaseSettings.setVerticalAlignment(javax.swing.SwingConstants.TOP);
271 
272  org.openide.awt.Mnemonics.setLocalizedText(bnTestDatabase, org.openide.util.NbBundle.getMessage(MultiUserSettingsPanel.class, "MultiUserSettingsPanel.bnTestDatabase.text")); // NOI18N
273  bnTestDatabase.addActionListener(new java.awt.event.ActionListener() {
274  public void actionPerformed(java.awt.event.ActionEvent evt) {
275  bnTestDatabaseActionPerformed(evt);
276  }
277  });
278 
279  org.openide.awt.Mnemonics.setLocalizedText(lbTestDatabase, org.openide.util.NbBundle.getMessage(MultiUserSettingsPanel.class, "MultiUserSettingsPanel.lbTestDatabase.text")); // NOI18N
280  lbTestDatabase.setAutoscrolls(true);
281 
282  lbTestDbWarning.setForeground(new java.awt.Color(255, 0, 0));
283  org.openide.awt.Mnemonics.setLocalizedText(lbTestDbWarning, org.openide.util.NbBundle.getMessage(MultiUserSettingsPanel.class, "MultiUserSettingsPanel.lbTestDbWarning.text")); // NOI18N
284 
285  javax.swing.GroupLayout pnDatabaseSettingsLayout = new javax.swing.GroupLayout(pnDatabaseSettings);
286  pnDatabaseSettings.setLayout(pnDatabaseSettingsLayout);
287  pnDatabaseSettingsLayout.setHorizontalGroup(
288  pnDatabaseSettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
289  .addGroup(pnDatabaseSettingsLayout.createSequentialGroup()
290  .addContainerGap()
291  .addGroup(pnDatabaseSettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
292  .addComponent(tbDbHostname)
293  .addGroup(pnDatabaseSettingsLayout.createSequentialGroup()
294  .addComponent(lbDatabaseSettings)
295  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 231, Short.MAX_VALUE)
296  .addComponent(bnTestDatabase)
297  .addGap(18, 18, 18)
298  .addComponent(lbTestDatabase, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE))
299  .addComponent(tbDbPort)
300  .addComponent(tbDbUsername)
301  .addComponent(tbDbPassword)
302  .addGroup(pnDatabaseSettingsLayout.createSequentialGroup()
303  .addComponent(lbTestDbWarning)
304  .addGap(0, 0, Short.MAX_VALUE)))
305  .addContainerGap())
306  );
307  pnDatabaseSettingsLayout.setVerticalGroup(
308  pnDatabaseSettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
309  .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pnDatabaseSettingsLayout.createSequentialGroup()
310  .addContainerGap()
311  .addGroup(pnDatabaseSettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
312  .addComponent(bnTestDatabase)
313  .addComponent(lbTestDatabase, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
314  .addComponent(lbDatabaseSettings, javax.swing.GroupLayout.Alignment.TRAILING))
315  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
316  .addComponent(tbDbHostname, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
317  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
318  .addComponent(tbDbPort, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
319  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
320  .addComponent(tbDbUsername, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
321  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
322  .addComponent(tbDbPassword, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
323  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
324  .addComponent(lbTestDbWarning, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE)
325  .addContainerGap())
326  );
327 
328  pnSolrSettings.setBorder(javax.swing.BorderFactory.createEtchedBorder());
329 
330  lbSolr8Settings.setFont(lbSolr8Settings.getFont().deriveFont(lbSolr8Settings.getFont().getSize()+1f));
331  org.openide.awt.Mnemonics.setLocalizedText(lbSolr8Settings, org.openide.util.NbBundle.getMessage(MultiUserSettingsPanel.class, "MultiUserSettingsPanel.lbSolr8Settings.text")); // NOI18N
332 
333  tbSolr8Hostname.setFont(tbSolr8Hostname.getFont().deriveFont(tbSolr8Hostname.getFont().getSize()+1f));
334  tbSolr8Hostname.setToolTipText(org.openide.util.NbBundle.getMessage(MultiUserSettingsPanel.class, "MultiUserSettingsPanel.tbSolr8Hostname.toolTipText")); // NOI18N
335 
336  tbSolr8Port.setFont(tbSolr8Port.getFont().deriveFont(tbSolr8Port.getFont().getSize()+1f));
337  tbSolr8Port.setToolTipText(org.openide.util.NbBundle.getMessage(MultiUserSettingsPanel.class, "MultiUserSettingsPanel.tbSolr8Port.toolTipText")); // NOI18N
338 
339  org.openide.awt.Mnemonics.setLocalizedText(bnTestSolr8, org.openide.util.NbBundle.getMessage(MultiUserSettingsPanel.class, "MultiUserSettingsPanel.bnTestSolr8.text")); // NOI18N
340  bnTestSolr8.addActionListener(new java.awt.event.ActionListener() {
341  public void actionPerformed(java.awt.event.ActionEvent evt) {
342  bnTestSolr8ActionPerformed(evt);
343  }
344  });
345 
346  org.openide.awt.Mnemonics.setLocalizedText(lbTestSolr8, org.openide.util.NbBundle.getMessage(MultiUserSettingsPanel.class, "MultiUserSettingsPanel.lbTestSolr8.text")); // NOI18N
347 
348  lbWarning.setForeground(new java.awt.Color(255, 0, 0));
349  org.openide.awt.Mnemonics.setLocalizedText(lbWarning, org.openide.util.NbBundle.getMessage(MultiUserSettingsPanel.class, "MultiUserSettingsPanel.lbWarning.text")); // NOI18N
350 
351  tbSolr4Hostname.setFont(tbSolr4Hostname.getFont().deriveFont(tbSolr4Hostname.getFont().getSize()+1f));
352  tbSolr4Hostname.setToolTipText(org.openide.util.NbBundle.getMessage(MultiUserSettingsPanel.class, "MultiUserSettingsPanel.tbSolr4Hostname.toolTipText")); // NOI18N
353 
354  tbSolr4Port.setFont(tbSolr4Port.getFont().deriveFont(tbSolr4Port.getFont().getSize()+1f));
355  tbSolr4Port.setToolTipText(org.openide.util.NbBundle.getMessage(MultiUserSettingsPanel.class, "MultiUserSettingsPanel.tbSolr4Port.toolTipText")); // NOI18N
356 
357  lbSolr4Settings.setFont(lbSolr4Settings.getFont().deriveFont(lbSolr4Settings.getFont().getSize()+1f));
358  org.openide.awt.Mnemonics.setLocalizedText(lbSolr4Settings, org.openide.util.NbBundle.getMessage(MultiUserSettingsPanel.class, "MultiUserSettingsPanel.lbSolr4Settings.text")); // NOI18N
359 
360  lbZkSettings.setFont(lbZkSettings.getFont().deriveFont(lbZkSettings.getFont().getSize()+1f));
361  org.openide.awt.Mnemonics.setLocalizedText(lbZkSettings, org.openide.util.NbBundle.getMessage(MultiUserSettingsPanel.class, "MultiUserSettingsPanel.lbZkSettings.text")); // NOI18N
362 
363  tbZkHostname.setFont(tbZkHostname.getFont().deriveFont(tbZkHostname.getFont().getSize()+1f));
364  tbZkHostname.setToolTipText(org.openide.util.NbBundle.getMessage(MultiUserSettingsPanel.class, "MultiUserSettingsPanel.tbZkHostname.toolTipText")); // NOI18N
365 
366  tbZkPort.setFont(tbZkPort.getFont().deriveFont(tbZkPort.getFont().getSize()+1f));
367  tbZkPort.setToolTipText(org.openide.util.NbBundle.getMessage(MultiUserSettingsPanel.class, "MultiUserSettingsPanel.tbZkPort.toolTipText")); // NOI18N
368 
369  lbSolrNote1.setFont(lbSolrNote1.getFont().deriveFont(lbSolrNote1.getFont().getSize()+1f));
370  lbSolrNote1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/corecomponents/warning16.png"))); // NOI18N
371  org.openide.awt.Mnemonics.setLocalizedText(lbSolrNote1, org.openide.util.NbBundle.getMessage(MultiUserSettingsPanel.class, "MultiUserSettingsPanel.lbSolrNote1.text")); // NOI18N
372 
373  lbSolrNote2.setFont(lbSolrNote2.getFont().deriveFont(lbSolrNote2.getFont().getSize()+1f));
374  org.openide.awt.Mnemonics.setLocalizedText(lbSolrNote2, org.openide.util.NbBundle.getMessage(MultiUserSettingsPanel.class, "MultiUserSettingsPanel.lbSolrNote2.text")); // NOI18N
375 
376  org.openide.awt.Mnemonics.setLocalizedText(bnTestSolr4, org.openide.util.NbBundle.getMessage(MultiUserSettingsPanel.class, "MultiUserSettingsPanel.bnTestSolr4.text")); // NOI18N
377  bnTestSolr4.addActionListener(new java.awt.event.ActionListener() {
378  public void actionPerformed(java.awt.event.ActionEvent evt) {
379  bnTestSolr4ActionPerformed(evt);
380  }
381  });
382 
383  org.openide.awt.Mnemonics.setLocalizedText(lbTestSolr4, org.openide.util.NbBundle.getMessage(MultiUserSettingsPanel.class, "MultiUserSettingsPanel.lbTestSolr4.text")); // NOI18N
384 
385  org.openide.awt.Mnemonics.setLocalizedText(lbTestZK, org.openide.util.NbBundle.getMessage(MultiUserSettingsPanel.class, "MultiUserSettingsPanel.lbTestZK.text")); // NOI18N
386 
387  org.openide.awt.Mnemonics.setLocalizedText(bnTestZK, org.openide.util.NbBundle.getMessage(MultiUserSettingsPanel.class, "MultiUserSettingsPanel.bnTestZK.text")); // NOI18N
388  bnTestZK.addActionListener(new java.awt.event.ActionListener() {
389  public void actionPerformed(java.awt.event.ActionEvent evt) {
390  bnTestZKActionPerformed(evt);
391  }
392  });
393 
394  javax.swing.GroupLayout pnSolrSettingsLayout = new javax.swing.GroupLayout(pnSolrSettings);
395  pnSolrSettings.setLayout(pnSolrSettingsLayout);
396  pnSolrSettingsLayout.setHorizontalGroup(
397  pnSolrSettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
398  .addGroup(pnSolrSettingsLayout.createSequentialGroup()
399  .addContainerGap()
400  .addGroup(pnSolrSettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
401  .addGroup(pnSolrSettingsLayout.createSequentialGroup()
402  .addComponent(lbSolr4Settings)
403  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
404  .addComponent(bnTestSolr4)
405  .addGap(18, 18, 18)
406  .addComponent(lbTestSolr4, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE))
407  .addComponent(tbSolr8Hostname)
408  .addComponent(tbSolr8Port)
409  .addComponent(tbSolr4Hostname)
410  .addComponent(tbSolr4Port)
411  .addComponent(tbZkHostname)
412  .addComponent(tbZkPort)
413  .addGroup(pnSolrSettingsLayout.createSequentialGroup()
414  .addComponent(lbZkSettings)
415  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 164, Short.MAX_VALUE)
416  .addComponent(bnTestZK)
417  .addGap(18, 18, 18)
418  .addComponent(lbTestZK, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE))
419  .addGroup(pnSolrSettingsLayout.createSequentialGroup()
420  .addComponent(lbSolr8Settings)
421  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
422  .addComponent(bnTestSolr8)
423  .addGap(18, 18, 18)
424  .addComponent(lbTestSolr8, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE))
425  .addGroup(pnSolrSettingsLayout.createSequentialGroup()
426  .addGroup(pnSolrSettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
427  .addComponent(lbSolrNote1)
428  .addComponent(lbSolrNote2)
429  .addComponent(lbWarning))
430  .addGap(0, 0, Short.MAX_VALUE)))
431  .addContainerGap())
432  );
433  pnSolrSettingsLayout.setVerticalGroup(
434  pnSolrSettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
435  .addGroup(pnSolrSettingsLayout.createSequentialGroup()
436  .addGap(8, 8, 8)
437  .addComponent(lbSolrNote1)
438  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
439  .addGroup(pnSolrSettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
440  .addGroup(pnSolrSettingsLayout.createSequentialGroup()
441  .addComponent(lbSolrNote2)
442  .addGap(28, 28, 28)
443  .addComponent(lbSolr8Settings))
444  .addGroup(pnSolrSettingsLayout.createSequentialGroup()
445  .addComponent(lbTestSolr8, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
446  .addGap(5, 5, 5))
447  .addComponent(bnTestSolr8))
448  .addGap(6, 6, 6)
449  .addComponent(tbSolr8Hostname, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
450  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
451  .addComponent(tbSolr8Port, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
452  .addGap(18, 18, 18)
453  .addGroup(pnSolrSettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
454  .addGroup(pnSolrSettingsLayout.createSequentialGroup()
455  .addGroup(pnSolrSettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
456  .addComponent(lbSolr4Settings, javax.swing.GroupLayout.PREFERRED_SIZE, 21, javax.swing.GroupLayout.PREFERRED_SIZE)
457  .addComponent(bnTestSolr4))
458  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
459  .addComponent(tbSolr4Hostname, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
460  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
461  .addComponent(tbSolr4Port, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
462  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
463  .addGroup(pnSolrSettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
464  .addGroup(pnSolrSettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
465  .addComponent(lbZkSettings)
466  .addComponent(bnTestZK))
467  .addComponent(lbTestZK, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE))
468  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
469  .addComponent(tbZkHostname, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
470  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
471  .addComponent(tbZkPort, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
472  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
473  .addComponent(lbWarning, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE))
474  .addGroup(pnSolrSettingsLayout.createSequentialGroup()
475  .addComponent(lbTestSolr4, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
476  .addGap(0, 0, Short.MAX_VALUE)))
477  .addContainerGap())
478  );
479 
480  tbSolr4Port.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(MultiUserSettingsPanel.class, "MultiUserSettingsPanel.tbSolr4Port.toolTipText")); // NOI18N
481 
482  pnMessagingSettings.setBorder(javax.swing.BorderFactory.createEtchedBorder());
483 
484  lbMessageServiceSettings.setFont(lbMessageServiceSettings.getFont().deriveFont((float)12));
485  org.openide.awt.Mnemonics.setLocalizedText(lbMessageServiceSettings, org.openide.util.NbBundle.getMessage(MultiUserSettingsPanel.class, "MultiUserSettingsPanel.lbMessageServiceSettings.text")); // NOI18N
486 
487  tbMsgHostname.setFont(tbMsgHostname.getFont().deriveFont(tbMsgHostname.getFont().getSize()+1f));
488  tbMsgHostname.setText(org.openide.util.NbBundle.getMessage(MultiUserSettingsPanel.class, "MultiUserSettingsPanel.tbMsgHostname.text")); // NOI18N
489  tbMsgHostname.setToolTipText(org.openide.util.NbBundle.getMessage(MultiUserSettingsPanel.class, "MultiUserSettingsPanel.tbMsgHostname.toolTipText")); // NOI18N
490 
491  tbMsgUsername.setFont(tbMsgUsername.getFont().deriveFont(tbMsgUsername.getFont().getSize()+1f));
492  tbMsgUsername.setText(org.openide.util.NbBundle.getMessage(MultiUserSettingsPanel.class, "MultiUserSettingsPanel.tbMsgUsername.text")); // NOI18N
493  tbMsgUsername.setToolTipText(org.openide.util.NbBundle.getMessage(MultiUserSettingsPanel.class, "MultiUserSettingsPanel.tbMsgUsername.toolTipText")); // NOI18N
494 
495  tbMsgPort.setFont(tbMsgPort.getFont().deriveFont(tbMsgPort.getFont().getSize()+1f));
496  tbMsgPort.setText(org.openide.util.NbBundle.getMessage(MultiUserSettingsPanel.class, "MultiUserSettingsPanel.tbMsgPort.text")); // NOI18N
497  tbMsgPort.setToolTipText(org.openide.util.NbBundle.getMessage(MultiUserSettingsPanel.class, "MultiUserSettingsPanel.tbMsgPort.toolTipText")); // NOI18N
498 
499  tbMsgPassword.setFont(tbMsgPassword.getFont().deriveFont(tbMsgPassword.getFont().getSize()+1f));
500  tbMsgPassword.setText(org.openide.util.NbBundle.getMessage(MultiUserSettingsPanel.class, "MultiUserSettingsPanel.tbMsgPassword.text")); // NOI18N
501  tbMsgPassword.setToolTipText(org.openide.util.NbBundle.getMessage(MultiUserSettingsPanel.class, "MultiUserSettingsPanel.tbMsgPassword.toolTipText")); // NOI18N
502 
503  org.openide.awt.Mnemonics.setLocalizedText(bnTestMessageService, org.openide.util.NbBundle.getMessage(MultiUserSettingsPanel.class, "MultiUserSettingsPanel.bnTestMessageService.text")); // NOI18N
504  bnTestMessageService.addActionListener(new java.awt.event.ActionListener() {
505  public void actionPerformed(java.awt.event.ActionEvent evt) {
506  bnTestMessageServiceActionPerformed(evt);
507  }
508  });
509 
510  org.openide.awt.Mnemonics.setLocalizedText(lbTestMessageService, org.openide.util.NbBundle.getMessage(MultiUserSettingsPanel.class, "MultiUserSettingsPanel.lbTestMessageService.text")); // NOI18N
511 
512  lbTestMessageWarning.setForeground(new java.awt.Color(255, 0, 0));
513  org.openide.awt.Mnemonics.setLocalizedText(lbTestMessageWarning, org.openide.util.NbBundle.getMessage(MultiUserSettingsPanel.class, "MultiUserSettingsPanel.lbTestMessageWarning.text")); // NOI18N
514 
515  javax.swing.GroupLayout pnMessagingSettingsLayout = new javax.swing.GroupLayout(pnMessagingSettings);
516  pnMessagingSettings.setLayout(pnMessagingSettingsLayout);
517  pnMessagingSettingsLayout.setHorizontalGroup(
518  pnMessagingSettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
519  .addGroup(pnMessagingSettingsLayout.createSequentialGroup()
520  .addContainerGap()
521  .addGroup(pnMessagingSettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
522  .addComponent(tbMsgHostname)
523  .addGroup(pnMessagingSettingsLayout.createSequentialGroup()
524  .addComponent(lbMessageServiceSettings)
525  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
526  .addComponent(bnTestMessageService)
527  .addGap(18, 18, 18)
528  .addComponent(lbTestMessageService, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE))
529  .addComponent(tbMsgPort)
530  .addComponent(tbMsgUsername)
531  .addComponent(tbMsgPassword)
532  .addGroup(pnMessagingSettingsLayout.createSequentialGroup()
533  .addComponent(lbTestMessageWarning)
534  .addGap(0, 0, Short.MAX_VALUE)))
535  .addContainerGap())
536  );
537  pnMessagingSettingsLayout.setVerticalGroup(
538  pnMessagingSettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
539  .addGroup(pnMessagingSettingsLayout.createSequentialGroup()
540  .addContainerGap()
541  .addGroup(pnMessagingSettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
542  .addGroup(pnMessagingSettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
543  .addComponent(bnTestMessageService)
544  .addComponent(lbMessageServiceSettings))
545  .addComponent(lbTestMessageService, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE))
546  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
547  .addComponent(tbMsgHostname, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
548  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
549  .addComponent(tbMsgPort, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
550  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
551  .addComponent(tbMsgUsername, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
552  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
553  .addComponent(tbMsgPassword, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
554  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
555  .addComponent(lbTestMessageWarning, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE)
556  .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
557  );
558 
559  org.openide.awt.Mnemonics.setLocalizedText(cbEnableMultiUser, org.openide.util.NbBundle.getMessage(MultiUserSettingsPanel.class, "MultiUserSettingsPanel.cbEnableMultiUser.text")); // NOI18N
560  cbEnableMultiUser.addItemListener(new java.awt.event.ItemListener() {
561  public void itemStateChanged(java.awt.event.ItemEvent evt) {
562  cbEnableMultiUserItemStateChanged(evt);
563  }
564  });
565 
566  tbOops.setEditable(false);
567  tbOops.setFont(tbOops.getFont().deriveFont(tbOops.getFont().getStyle() | java.awt.Font.BOLD, tbOops.getFont().getSize()+1));
568  tbOops.setForeground(new java.awt.Color(255, 0, 0));
569  tbOops.setText(org.openide.util.NbBundle.getMessage(MultiUserSettingsPanel.class, "MultiUserSettingsPanel.tbOops.text")); // NOI18N
570  tbOops.setBorder(null);
571 
572  javax.swing.GroupLayout pnOverallPanelLayout = new javax.swing.GroupLayout(pnOverallPanel);
573  pnOverallPanel.setLayout(pnOverallPanelLayout);
574  pnOverallPanelLayout.setHorizontalGroup(
575  pnOverallPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
576  .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pnOverallPanelLayout.createSequentialGroup()
577  .addContainerGap()
578  .addGroup(pnOverallPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
579  .addGroup(pnOverallPanelLayout.createSequentialGroup()
580  .addComponent(cbEnableMultiUser)
581  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
582  .addComponent(tbOops))
583  .addComponent(pnDatabaseSettings, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
584  .addComponent(pnMessagingSettings, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
585  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
586  .addComponent(pnSolrSettings, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
587  .addGap(39, 39, 39))
588  );
589  pnOverallPanelLayout.setVerticalGroup(
590  pnOverallPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
591  .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pnOverallPanelLayout.createSequentialGroup()
592  .addGroup(pnOverallPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
593  .addComponent(tbOops, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
594  .addComponent(cbEnableMultiUser))
595  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
596  .addGroup(pnOverallPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
597  .addGroup(pnOverallPanelLayout.createSequentialGroup()
598  .addComponent(pnDatabaseSettings, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
599  .addGap(18, 18, 18)
600  .addComponent(pnMessagingSettings, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
601  .addComponent(pnSolrSettings, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
602  .addContainerGap(234, Short.MAX_VALUE))
603  );
604 
605  jScrollPane.setViewportView(pnOverallPanel);
606 
607  javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
608  this.setLayout(layout);
609  layout.setHorizontalGroup(
610  layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
611  .addComponent(jScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 1250, Short.MAX_VALUE)
612  );
613  layout.setVerticalGroup(
614  layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
615  .addGroup(layout.createSequentialGroup()
616  .addContainerGap()
617  .addComponent(jScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 695, Short.MAX_VALUE)
618  .addContainerGap())
619  );
620  }// </editor-fold>//GEN-END:initComponents
621 
628  private static void enableMultiUserComponents(Collection<JTextField> textFields, boolean enabled) {
629  for (JTextField textField : textFields) {
630  textField.setEnabled(enabled);
631  }
632  }
633 
634  private void cbEnableMultiUserItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_cbEnableMultiUserItemStateChanged
635  if (!cbEnableMultiUser.isSelected()) {
636  tbOops.setText("");
637  bnTestDatabase.setEnabled(false);
638  lbTestDatabase.setIcon(null);
639  bnTestSolr8.setEnabled(false);
640  lbTestSolr8.setIcon(null);
641  bnTestSolr4.setEnabled(false);
642  lbTestSolr4.setIcon(null);
643  bnTestZK.setEnabled(false);
644  lbTestZK.setIcon(null);
645  bnTestMessageService.setEnabled(false);
646  lbTestMessageService.setIcon(null);
647  lbTestDbWarning.setText("");
648  lbWarning.setText("");
649  lbTestMessageWarning.setText("");
650  }
651  enableMultiUserComponents(textBoxes, cbEnableMultiUser.isSelected());
652  controller.changed();
653  }//GEN-LAST:event_cbEnableMultiUserItemStateChanged
654 
655  private void bnTestDatabaseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bnTestDatabaseActionPerformed
656  lbTestDatabase.setIcon(null);
657  lbTestDatabase.paintImmediately(lbTestDatabase.getVisibleRect());
658  lbTestDbWarning.setText("");
659  lbTestDbWarning.paintImmediately(lbTestDbWarning.getVisibleRect());
660  setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
661  try {
662  CaseDbConnectionInfo info = new CaseDbConnectionInfo(
663  this.tbDbHostname.getText().trim(),
664  this.tbDbPort.getText().trim(),
665  this.tbDbUsername.getText().trim(),
666  new String(this.tbDbPassword.getPassword()),
667  DbType.POSTGRESQL);
668 
669  SleuthkitCase.tryConnect(info);
670  lbTestDatabase.setIcon(goodIcon);
671  lbTestDbWarning.setText("");
672  } catch (TskCoreException ex) {
673  lbTestDatabase.setIcon(badIcon);
674  lbTestDbWarning.setText(ex.getMessage());
675  } finally {
676  setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
677  }
678  }//GEN-LAST:event_bnTestDatabaseActionPerformed
679 
680  private void bnTestMessageServiceActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bnTestMessageServiceActionPerformed
681  lbTestMessageService.setIcon(null);
682  lbTestMessageService.paintImmediately(lbTestMessageService.getVisibleRect());
683  lbTestMessageWarning.setText("");
684  lbTestMessageWarning.paintImmediately(lbTestMessageWarning.getVisibleRect());
685  setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
686 
687  int port;
688  try {
689  port = Integer.parseInt(this.tbMsgPort.getText().trim());
690  } catch (NumberFormatException ex) {
691  lbTestMessageService.setIcon(badIcon);
692  lbTestMessageWarning.setText(NbBundle.getMessage(MultiUserSettingsPanel.class, "MultiUserSettingsPanel.InvalidPortNumber"));
693  return;
694  }
695 
697  this.tbMsgHostname.getText().trim(),
698  port,
699  this.tbMsgUsername.getText().trim(),
700  new String(this.tbMsgPassword.getPassword()));
701  try {
702  info.tryConnect();
703  lbTestMessageService.setIcon(goodIcon);
704  lbTestMessageWarning.setText("");
705  } catch (MessageServiceException ex) {
706  lbTestMessageService.setIcon(badIcon);
707  lbTestMessageWarning.setText(ex.getMessage());
708  } finally {
709  setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
710  }
711  }//GEN-LAST:event_bnTestMessageServiceActionPerformed
712 
713  private void bnTestSolr8ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bnTestSolr8ActionPerformed
714  lbTestSolr8.setIcon(null);
715  lbTestSolr8.paintImmediately(lbTestSolr8.getVisibleRect());
716  lbWarning.setText("");
717  lbWarning.paintImmediately(lbWarning.getVisibleRect());
718  setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
719 
720  KeywordSearchService kwsService = Lookup.getDefault().lookup(KeywordSearchService.class);
721  try {
722  if (kwsService != null) {
723  // test Solr 8 connectivity
724  if (tbSolr8Port.getText().trim().isEmpty() || tbSolr8Hostname.getText().trim().isEmpty()) {
725  lbTestSolr8.setIcon(badIcon);
726  lbWarning.setText(NbBundle.getMessage(MultiUserSettingsPanel.class, "MultiUserSettingsPanel.Solr8ConnectionInfoMissing.error"));
727  return;
728  }
729  int port = Integer.parseInt(tbSolr8Port.getText().trim());
730  kwsService.tryConnect(tbSolr8Hostname.getText().trim(), port);
731  lbTestSolr8.setIcon(goodIcon);
732  lbWarning.setText("");
733  } else {
734  lbTestSolr8.setIcon(badIcon);
735  lbWarning.setText(NbBundle.getMessage(MultiUserSettingsPanel.class, "MultiUserSettingsPanel.KeywordSearchNull"));
736  }
737  } catch (NumberFormatException ex) {
738  lbTestSolr8.setIcon(badIcon);
739  lbWarning.setText(NbBundle.getMessage(MultiUserSettingsPanel.class, "MultiUserSettingsPanel.InvalidPortNumber"));
740  } catch (KeywordSearchServiceException ex) {
741  lbTestSolr8.setIcon(badIcon);
742  lbWarning.setText(ex.getMessage());
743  } finally {
744  setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
745  }
746  }//GEN-LAST:event_bnTestSolr8ActionPerformed
747 
748  private void bnTestSolr4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bnTestSolr4ActionPerformed
749  lbTestSolr4.setIcon(null);
750  lbTestSolr4.paintImmediately(lbTestSolr4.getVisibleRect());
751  lbWarning.setText("");
752  lbWarning.paintImmediately(lbWarning.getVisibleRect());
753  setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
754 
755  KeywordSearchService kwsService = Lookup.getDefault().lookup(KeywordSearchService.class);
756  try {
757  if (kwsService != null) {
758  // test Solr 4 conenctivity
759  if (tbSolr4Port.getText().trim().isEmpty() || tbSolr4Hostname.getText().trim().isEmpty()) {
760  lbTestSolr4.setIcon(badIcon);
761  lbWarning.setText(NbBundle.getMessage(MultiUserSettingsPanel.class, "MultiUserSettingsPanel.Solr4ConnectionInfoMissing.error"));
762  return;
763  }
764  int port = Integer.parseInt(tbSolr4Port.getText().trim());
765  kwsService.tryConnect(tbSolr4Hostname.getText().trim(), port);
766  lbTestSolr4.setIcon(goodIcon);
767  lbWarning.setText("");
768  } else {
769  lbTestSolr4.setIcon(badIcon);
770  lbWarning.setText(NbBundle.getMessage(MultiUserSettingsPanel.class, "MultiUserSettingsPanel.KeywordSearchNull"));
771  }
772  } catch (NumberFormatException ex) {
773  lbTestSolr4.setIcon(badIcon);
774  lbWarning.setText(NbBundle.getMessage(MultiUserSettingsPanel.class, "MultiUserSettingsPanel.InvalidPortNumber"));
775  } catch (KeywordSearchServiceException ex) {
776  lbTestSolr4.setIcon(badIcon);
777  lbWarning.setText(ex.getMessage());
778  } finally {
779  setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
780  }
781  }//GEN-LAST:event_bnTestSolr4ActionPerformed
782 
783  private void bnTestZKActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bnTestZKActionPerformed
784  lbTestZK.setIcon(null);
785  lbTestZK.paintImmediately(lbTestZK.getVisibleRect());
786  lbWarning.setText("");
787  lbWarning.paintImmediately(lbWarning.getVisibleRect());
788  setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
789 
790  try {
791  // test ZooKeeper connectivity (ZK settings are mandatory)
792  if (tbZkPort.getText().trim().isEmpty() || tbZkHostname.getText().trim().isEmpty()) {
793  lbTestZK.setIcon(badIcon);
794  lbWarning.setText(NbBundle.getMessage(MultiUserSettingsPanel.class, "MultiUserSettingsPanel.UnableToConnectToZK"));
795  return;
796  }
797 
798  if (false == CoordinationServiceUtils.isZooKeeperAccessible(tbZkHostname.getText().trim(), tbZkPort.getText().trim())) {
799  lbTestZK.setIcon(badIcon);
800  lbWarning.setText(NbBundle.getMessage(MultiUserSettingsPanel.class, "MultiUserSettingsPanel.UnableToConnectToZK"));
801  return;
802  }
803 
804  lbTestZK.setIcon(goodIcon);
805  lbWarning.setText("");
806  } catch (NumberFormatException ex) {
807  lbTestZK.setIcon(badIcon);
808  lbWarning.setText(NbBundle.getMessage(MultiUserSettingsPanel.class, "MultiUserSettingsPanel.InvalidPortNumber"));
809  } catch (InterruptedException | IOException ex) {
810  // ZK exceptions
811  lbTestZK.setIcon(badIcon);
812  lbWarning.setText(ex.getMessage());
813  } finally {
814  setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
815  }
816  }//GEN-LAST:event_bnTestZKActionPerformed
817 
818  @Messages({
819  "MultiUserSettingsPanel_Close_Case_To_Modify=Close case to modfy settings"
820  })
821 
822  void load(boolean caseOpen) {
823  lbTestDatabase.setIcon(null);
824  lbTestSolr8.setIcon(null);
825  lbTestSolr4.setIcon(null);
826  lbTestZK.setIcon(null);
827  lbTestMessageService.setIcon(null);
828  lbTestDbWarning.setText("");
829  lbWarning.setText("");
830  lbTestMessageWarning.setText("");
831 
832  try {
833  CaseDbConnectionInfo dbInfo = UserPreferences.getDatabaseConnectionInfo();
834  tbDbHostname.setText(dbInfo.getHost().trim());
835  tbDbPort.setText(dbInfo.getPort().trim());
836  tbDbUsername.setText(dbInfo.getUserName().trim());
837  tbDbPassword.setText(dbInfo.getPassword());
838  } catch (UserPreferencesException ex) {
839  logger.log(Level.SEVERE, "Error accessing case database connection info", ex); //NON-NLS
840  }
841 
842  try {
843  MessageServiceConnectionInfo msgServiceInfo = UserPreferences.getMessageServiceConnectionInfo();
844  tbMsgHostname.setText(msgServiceInfo.getHost().trim());
845  tbMsgPort.setText(Integer.toString(msgServiceInfo.getPort()));
846  tbMsgUsername.setText(msgServiceInfo.getUserName().trim());
847  tbMsgPassword.setText(msgServiceInfo.getPassword());
848  } catch (UserPreferencesException ex) {
849  logger.log(Level.SEVERE, "Error accessing case database connection info", ex); //NON-NLS
850  }
851 
852  populateSolrAndZkSettings();
853 
854  bnTestDatabase.setEnabled(false);
855  bnTestSolr8.setEnabled(false);
856  bnTestSolr4.setEnabled(false);
857  bnTestZK.setEnabled(false);
858  bnTestMessageService.setEnabled(false);
859 
860  cbEnableMultiUser.setSelected(UserPreferences.getIsMultiUserModeEnabled());
861 
862  // When a case is open, prevent the user from changing
863  // multi-user settings.
864  cbEnableMultiUser.setEnabled(UserPreferences.isMultiUserSupported() && !caseOpen);
865  enableMultiUserComponents(textBoxes, cbEnableMultiUser.isSelected() && !caseOpen);
866 
867  this.valid(caseOpen); // trigger validation to enable buttons based on current settings
868  }
869 
870  private void populateSolrAndZkSettings() {
871 
872  String indexingServerHost = UserPreferences.getIndexingServerHost().trim();
873  if (!indexingServerHost.isEmpty()) {
874  tbSolr8Hostname.setText(indexingServerHost);
875  }
876  String indexingServerPort = UserPreferences.getIndexingServerPort().trim();
877  if (portNumberIsValid(indexingServerPort)) {
878  tbSolr8Port.setText(indexingServerPort);
879  }
880 
881  String solr4ServerHost = UserPreferences.getSolr4ServerHost().trim();
882  if (!solr4ServerHost.isEmpty()) {
883  tbSolr4Hostname.setText(solr4ServerHost);
884  }
885  String solr4ServerPort = UserPreferences.getSolr4ServerPort().trim();
886  if (portNumberIsValid(solr4ServerPort)) {
887  tbSolr4Port.setText(solr4ServerPort);
888  }
889 
890  // if there are existing valid ZK settings, use those
891  String zkServerPort = UserPreferences.getZkServerPort().trim();
892  if (portNumberIsValid(zkServerPort)) {
893  tbZkPort.setText(zkServerPort); // gets default ZK port, which is Solr port number + 1000
894  }
895  String zkServerHost = UserPreferences.getZkServerHost().trim();
896  if (!zkServerHost.isEmpty()) {
897  tbZkHostname.setText(zkServerHost);
898  return;
899  }
900 
901  // If there are no previous Solr 4 settings, use Solr 8 settings
902  // to fill in the ZK settings with the embedded Solr 8 ZK connection info.
903  if (solr4ServerHost.isEmpty() && !indexingServerHost.isEmpty()) {
904  tbZkHostname.setText(indexingServerHost);
905  tbZkPort.setText(zkServerPort); // gets default ZK port, which is Solr port number + 1000
906  return;
907  }
908 
909  // If there are existing Solr 4 settings and no Solr 8 settings,
910  // pre-populate the ZK settings with the Solr 4 embedded ZK settings.
911  if (!solr4ServerHost.isEmpty() && indexingServerHost.isEmpty()) {
912  tbZkHostname.setText(solr4ServerHost);
913  tbZkPort.setText(zkServerPort); // gets default ZK port, which is Solr port number + 1000
914  return;
915  }
916  }
917 
924  private boolean databaseFieldsArePopulated() {
925  return !tbDbHostname.getText().trim().isEmpty()
926  && !tbDbPort.getText().trim().isEmpty()
927  && !tbDbUsername.getText().trim().isEmpty()
928  && tbDbPassword.getPassword().length != 0;
929  }
930 
937  private boolean solr4FieldsArePopulated() {
938 
939  // check if Solr 4 settings are set
940  if (!tbSolr4Hostname.getText().trim().isEmpty()
941  && !tbSolr4Port.getText().trim().isEmpty()) {
942  return true;
943  } else {
944  return false;
945  }
946  }
947 
954  private boolean solr8FieldsArePopulated() {
955 
956  // check if Solr 8 settings are set
957  if (!tbSolr8Hostname.getText().trim().isEmpty()
958  && !tbSolr8Port.getText().trim().isEmpty()) {
959  return true;
960  } else {
961  return false;
962  }
963  }
964 
971  private boolean ZooKeeperFieldsArePopulated() {
972  // check if ZK settings are set
973  return (!tbZkHostname.getText().trim().isEmpty()
974  && !tbZkPort.getText().trim().isEmpty());
975  }
976 
984 
985  if ((tbMsgHostname.getText().trim().isEmpty())
986  || (tbMsgPort.getText().trim().isEmpty())) {
987  return false;
988  }
989 
990  // user name and pw are optional, but make sure they are both set or both empty
991  boolean isUserSet = (tbMsgUsername.getText().trim().isEmpty() == false);
992  boolean isPwSet = (tbMsgPassword.getPassword().length != 0);
993  return (isUserSet == isPwSet);
994  }
995 
996  void store() {
997  boolean prevSelected = UserPreferences.getIsMultiUserModeEnabled();
998  CaseDbConnectionInfo prevConn = null;
999  try {
1001  } catch (UserPreferencesException ex) {
1002  logger.log(Level.SEVERE, "There was an error while fetching previous connection settings while trying to save", ex); //NON-NLS
1003  }
1004 
1005  boolean multiUserCasesEnabled = cbEnableMultiUser.isSelected();
1006  UserPreferences.setIsMultiUserModeEnabled(multiUserCasesEnabled);
1007 
1008  CaseDbConnectionInfo info = null;
1009 
1010  if (multiUserCasesEnabled == true) {
1011 
1012  // Check if aplication restart is required.
1013  boolean needsRestart = false;
1014  // don't check if entring multi user data for the first time
1015  if (prevSelected == true) {
1016  needsRestart = isRestartRequired();
1017  }
1018 
1019  /*
1020  * Currently only supporting multi-user cases with PostgreSQL case
1021  * databases.
1022  */
1023  DbType dbType = DbType.POSTGRESQL;
1024  info = new CaseDbConnectionInfo(
1025  tbDbHostname.getText().trim(),
1026  tbDbPort.getText().trim(),
1027  tbDbUsername.getText().trim(),
1028  new String(tbDbPassword.getPassword()),
1029  dbType);
1030  try {
1031  UserPreferences.setDatabaseConnectionInfo(info);
1032  } catch (UserPreferencesException ex) {
1033  logger.log(Level.SEVERE, "Error saving case database connection info", ex); //NON-NLS
1034  }
1035 
1036  int msgServicePort = 0;
1037  try {
1038  msgServicePort = Integer.parseInt(this.tbMsgPort.getText().trim());
1039  } catch (NumberFormatException ex) {
1040  logger.log(Level.SEVERE, "Could not parse messaging service port setting", ex);
1041  }
1042 
1043  MessageServiceConnectionInfo msgServiceInfo = new MessageServiceConnectionInfo(
1044  tbMsgHostname.getText().trim(),
1045  msgServicePort,
1046  tbMsgUsername.getText().trim(),
1047  new String(tbMsgPassword.getPassword()));
1048 
1049  try {
1050  UserPreferences.setMessageServiceConnectionInfo(msgServiceInfo);
1051  } catch (UserPreferencesException ex) {
1052  logger.log(Level.SEVERE, "Error saving messaging service connection info", ex); //NON-NLS
1053  }
1054 
1055  UserPreferences.setIndexingServerHost(tbSolr8Hostname.getText().trim());
1056  String solr8port = tbSolr8Port.getText().trim();
1057  if (!solr8port.isEmpty()) {
1058  UserPreferences.setIndexingServerPort(Integer.parseInt(solr8port));
1059  }
1060  UserPreferences.setSolr4ServerHost(tbSolr4Hostname.getText().trim());
1061  UserPreferences.setSolr4ServerPort(tbSolr4Port.getText().trim());
1062  UserPreferences.setZkServerHost(tbZkHostname.getText().trim());
1063  UserPreferences.setZkServerPort(tbZkPort.getText().trim());
1064 
1065  if (needsRestart) {
1066  SwingUtilities.invokeLater(() -> {
1067  JOptionPane.showMessageDialog(this,
1068  NbBundle.getMessage(MultiUserSettingsPanel.class, "MultiUserSettingsPanel.MustRestart"),
1069  NbBundle.getMessage(MultiUserSettingsPanel.class, "MultiUserSettingsPanel.restartRequiredLabel.text"),
1070  JOptionPane.WARNING_MESSAGE);
1071  });
1072  }
1073  }
1074 
1075  // trigger changes to whether or not user can use multi user settings for central repository
1076  if (prevSelected != multiUserCasesEnabled || !areCaseDbConnectionEqual(prevConn, info)) {
1077  GlobalSettingsPanel.onMultiUserChange(this, prevSelected, multiUserCasesEnabled);
1078  }
1079  }
1080 
1081  private boolean isRestartRequired() {
1082  // if ZK was previously configured
1083  if (!UserPreferences.getZkServerHost().isEmpty()) {
1084  // Restart is required any time ZK info has changed
1085  if (!(tbZkHostname.getText().trim().equalsIgnoreCase(UserPreferences.getZkServerHost()))
1086  || !(tbZkPort.getText().trim().equals(UserPreferences.getZkServerPort()))) {
1087  return true;
1088  }
1089  }
1090  return false;
1091  }
1092 
1093  private static boolean arePropsEqual(Object a, Object b) {
1094  if (a == null || b == null) {
1095  return (a == null && b == null);
1096  } else {
1097  return a.equals(b);
1098  }
1099  }
1100 
1101  private static boolean areCaseDbConnectionEqual(CaseDbConnectionInfo a, CaseDbConnectionInfo b) {
1102  if (a == null || b == null) {
1103  return (a == null && b == null);
1104  }
1105 
1106  return arePropsEqual(a.getDbType(), b.getDbType())
1107  && arePropsEqual(a.getHost(), b.getHost())
1108  && arePropsEqual(a.getPassword(), b.getPassword())
1109  && arePropsEqual(a.getPort(), b.getPort())
1110  && arePropsEqual(a.getUserName(), b.getUserName());
1111  }
1112 
1118  boolean valid(boolean caseOpen) {
1119  if(caseOpen) {
1120  tbOops.setText(Bundle.MultiUserSettingsPanel_Close_Case_To_Modify());
1121  } else {
1122  tbOops.setText("");
1123  }
1124 
1125  if (cbEnableMultiUser.isSelected()) {
1126  return checkFieldsAndEnableButtons(caseOpen)
1127  && databaseSettingsAreValid()
1128  && indexingServerSettingsAreValid()
1129  && messageServiceSettingsAreValid();
1130  } else {
1131  return true;
1132  }
1133  }
1134 
1141  boolean checkFieldsAndEnableButtons(boolean caseOpen) {
1142  boolean result = true;
1143 
1144  boolean dbPopulated = databaseFieldsArePopulated();
1145  boolean solr4Populated = solr4FieldsArePopulated();
1146  boolean solr8Populated = solr8FieldsArePopulated();
1147  boolean zkPopulated = ZooKeeperFieldsArePopulated();
1148  boolean messageServicePopulated = messageServiceFieldsArePopulated();
1149 
1150  // PostgreSQL Database
1151  bnTestDatabase.setEnabled(dbPopulated && !caseOpen);
1152 
1153  // Solr Indexing
1154  bnTestSolr8.setEnabled(solr8Populated && !caseOpen);
1155  bnTestSolr4.setEnabled(solr4Populated && !caseOpen);
1156  bnTestZK.setEnabled(zkPopulated && !caseOpen);
1157 
1158  // ActiveMQ Messaging
1159  bnTestMessageService.setEnabled(messageServicePopulated && !caseOpen);
1160 
1161  if (dbPopulated && messageServicePopulated && zkPopulated && (solr8Populated || solr4Populated)) {
1162  result = true;
1163  } else {
1164  // We don't even have everything filled out
1165  result = false;
1166  tbOops.setText(INCOMPLETE_SETTINGS_MSG);
1167  }
1168  return result;
1169  }
1170 
1176  boolean databaseSettingsAreValid() {
1177  if (portNumberIsValid(tbDbPort.getText().trim())) {
1178  return true;
1179  } else {
1180  tbOops.setText(INVALID_DB_PORT_MSG);
1181  return false;
1182  }
1183  }
1184 
1190  boolean messageServiceSettingsAreValid() {
1191  if (!portNumberIsValid(tbMsgPort.getText().trim())) {
1192  tbOops.setText(INVALID_MESSAGE_SERVICE_PORT_MSG);
1193  return false;
1194  }
1195 
1196  return true;
1197  }
1198 
1204  boolean indexingServerSettingsAreValid() {
1205 
1206  String solr8Port = tbSolr8Port.getText().trim();
1207  if (!solr8Port.isEmpty() && !portNumberIsValid(solr8Port)) {
1208  // if the port is specified, it has to be valid
1209  tbOops.setText(INVALID_INDEXING_SERVER_PORT_MSG);
1210  return false;
1211  }
1212 
1213  String solr4Port = tbSolr4Port.getText().trim();
1214  if (!solr4Port.isEmpty() && !portNumberIsValid(solr4Port)) {
1215  // if the port is specified, it has to be valid
1216  tbOops.setText(INVALID_SOLR4_SERVER_PORT_MSG);
1217  return false;
1218  }
1219 
1220  // either Solr 8 or/and Solr 4 seetings must be specified
1221  boolean solrConfigured = false;
1222 
1223  // check if Solr 8 settings are set
1224  if (!tbSolr8Hostname.getText().trim().isEmpty()
1225  && !tbSolr8Port.getText().trim().isEmpty()) {
1226  solrConfigured = true;
1227  }
1228 
1229  // check if Solr 4 settings are set
1230  if (!tbSolr4Hostname.getText().trim().isEmpty()
1231  && !tbSolr4Port.getText().trim().isEmpty()) {
1232  solrConfigured = true;
1233  }
1234 
1235  if (!solrConfigured) {
1236  tbOops.setText(SOLR_SERVER_NOT_CONFIGURED_MSG);
1237  return false;
1238  }
1239 
1240  // ZK settings are mandatory
1241  if (tbZkHostname.getText().trim().isEmpty()) {
1242  tbOops.setText(INVALID_ZK_SERVER_HOST_MSG);
1243  return false;
1244  }
1245 
1246  // ZK settings are mandatory
1247  String zkPort = tbZkPort.getText().trim();
1248  if (zkPort.isEmpty() || !portNumberIsValid(zkPort)) {
1249  // if the port is specified, it has to be valid
1250  tbOops.setText(INVALID_ZK_SERVER_PORT_MSG);
1251  return false;
1252  }
1253 
1254  return true;
1255  }
1256 
1265  private static boolean portNumberIsValid(String portNumber) {
1266  try {
1267  int value = Integer.parseInt(portNumber);
1268  if (value < 0 || value > 65535) { // invalid port numbers
1269  return false;
1270  }
1271  } catch (NumberFormatException detailsNotImportant) {
1272  return false;
1273  }
1274  return true;
1275  }
1276 
1277  // Variables declaration - do not modify//GEN-BEGIN:variables
1278  private javax.swing.JButton bnTestDatabase;
1279  private javax.swing.JButton bnTestMessageService;
1280  private javax.swing.JButton bnTestSolr4;
1281  private javax.swing.JButton bnTestSolr8;
1282  private javax.swing.JButton bnTestZK;
1283  private javax.swing.JCheckBox cbEnableMultiUser;
1284  private javax.swing.JScrollPane jScrollPane;
1285  private javax.swing.JLabel lbDatabaseSettings;
1286  private javax.swing.JLabel lbMessageServiceSettings;
1287  private javax.swing.JLabel lbSolr4Settings;
1288  private javax.swing.JLabel lbSolr8Settings;
1289  private javax.swing.JLabel lbSolrNote1;
1290  private javax.swing.JLabel lbSolrNote2;
1291  private javax.swing.JLabel lbTestDatabase;
1292  private javax.swing.JLabel lbTestDbWarning;
1293  private javax.swing.JLabel lbTestMessageService;
1294  private javax.swing.JLabel lbTestMessageWarning;
1295  private javax.swing.JLabel lbTestSolr4;
1296  private javax.swing.JLabel lbTestSolr8;
1297  private javax.swing.JLabel lbTestZK;
1298  private javax.swing.JLabel lbWarning;
1299  private javax.swing.JLabel lbZkSettings;
1300  private javax.swing.JPanel pnDatabaseSettings;
1301  private javax.swing.JPanel pnMessagingSettings;
1302  private javax.swing.JPanel pnOverallPanel;
1303  private javax.swing.JPanel pnSolrSettings;
1304  private javax.swing.JTextField tbDbHostname;
1305  private javax.swing.JPasswordField tbDbPassword;
1306  private javax.swing.JTextField tbDbPort;
1307  private javax.swing.JTextField tbDbUsername;
1308  private javax.swing.JTextField tbMsgHostname;
1309  private javax.swing.JPasswordField tbMsgPassword;
1310  private javax.swing.JTextField tbMsgPort;
1311  private javax.swing.JTextField tbMsgUsername;
1312  private javax.swing.JTextField tbOops;
1313  private javax.swing.JTextField tbSolr4Hostname;
1314  private javax.swing.JTextField tbSolr4Port;
1315  private javax.swing.JTextField tbSolr8Hostname;
1316  private javax.swing.JTextField tbSolr8Port;
1317  private javax.swing.JTextField tbZkHostname;
1318  private javax.swing.JTextField tbZkPort;
1319  // End of variables declaration//GEN-END:variables
1320 
1325  class TextBoxChangedListener implements DocumentListener {
1326 
1327  @Override
1328  public void changedUpdate(DocumentEvent e) {
1329  Object statusIcon = e.getDocument().getProperty("statusIcon");
1330  if (statusIcon != null) {
1331  ((javax.swing.JLabel) statusIcon).setIcon(null);
1332  }
1333  controller.changed();
1334  }
1335 
1336  @Override
1337  public void insertUpdate(DocumentEvent e) {
1338  Object statusIcon = e.getDocument().getProperty("statusIcon");
1339  if (statusIcon != null) {
1340  ((javax.swing.JLabel) statusIcon).setIcon(null);
1341  }
1342  controller.changed();
1343  }
1344 
1345  @Override
1346  public void removeUpdate(DocumentEvent e) {
1347  Object statusIcon = e.getDocument().getProperty("statusIcon");
1348  if (statusIcon != null) {
1349  ((javax.swing.JLabel) statusIcon).setIcon(null);
1350  }
1351  controller.changed();
1352  }
1353  }
1354 
1355  private class MyDocumentListener implements DocumentListener {
1356 
1357  @Override
1358  public void changedUpdate(DocumentEvent e) {
1359  tbZkHostname.setText(tbSolr8Hostname.getText().trim());
1360  }
1361 
1362  @Override
1363  public void removeUpdate(DocumentEvent e) {
1364  tbZkHostname.setText(tbSolr8Hostname.getText().trim());
1365  }
1366 
1367  @Override
1368  public void insertUpdate(DocumentEvent e) {
1369  tbZkHostname.setText(tbSolr8Hostname.getText().trim());
1370  }
1371  };
1372 }
static void configureTextPrompts(Collection< TextPrompt > textPrompts)
static boolean areCaseDbConnectionEqual(CaseDbConnectionInfo a, CaseDbConnectionInfo b)
static CaseDbConnectionInfo getDatabaseConnectionInfo()
MultiUserSettingsPanel(MultiUserSettingsPanelController theController)
synchronized static Logger getLogger(String name)
Definition: Logger.java:124
static void addEventTypeSubscriber(Set< Events > eventTypes, PropertyChangeListener subscriber)
Definition: Case.java:708
static void enableMultiUserComponents(Collection< JTextField > textFields, boolean enabled)
void bnTestMessageServiceActionPerformed(java.awt.event.ActionEvent evt)
static void addDocumentListeners(Collection< JTextField > textFields, TextBoxChangedListener listener)

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