UI side of collab. Includes some stubs and TODOs for the db connection side

This commit is contained in:
Karl Mortensen 2015-03-30 11:12:22 -04:00
parent e71c920bdd
commit 849975c696
11 changed files with 756 additions and 329 deletions

View File

@ -38,7 +38,6 @@ import java.util.TimeZone;
import java.util.logging.Level;
import javax.swing.JOptionPane;
import javax.swing.SwingUtilities;
import org.openide.util.Exceptions;
import org.openide.util.Lookup;
import org.openide.util.NbBundle;
@ -46,6 +45,7 @@ import org.openide.util.actions.CallableSystemAction;
import org.openide.util.actions.SystemAction;
import org.openide.windows.WindowManager;
import org.sleuthkit.autopsy.casemodule.services.Services;
import org.sleuthkit.autopsy.core.UserPreferences;
import org.sleuthkit.autopsy.corecomponentinterfaces.CoreComponentControl;
import org.sleuthkit.autopsy.coreutils.FileUtil;
import org.sleuthkit.autopsy.coreutils.Logger;
@ -73,7 +73,7 @@ public class Case implements SleuthkitCase.ErrorObserver {
public static final String propStartup = "LBL_StartupDialog"; //NON-NLS
// pcs is initialized in CaseListener constructor
private static final PropertyChangeSupport pcs = new PropertyChangeSupport(Case.class);
/**
* Events that the case module will fire. Event listeners can get the event
* name by using String returned by toString() method on a specific event.
@ -150,6 +150,17 @@ public class Case implements SleuthkitCase.ErrorObserver {
return (otherName == null) ? false : caseName.equals(otherName);
}
public static CaseType fromString(String text) {
if (text != null) {
for (CaseType c : CaseType.values()) {
if (text.equalsIgnoreCase(c.caseName)) {
return c;
}
}
}
return null;
}
@Override
public String toString() {
return caseName;
@ -169,6 +180,7 @@ public class Case implements SleuthkitCase.ErrorObserver {
static final String CASE_EXTENSION = "aut"; //NON-NLS
static final String CASE_DOT_EXTENSION = "." + CASE_EXTENSION;
private CaseType caseType;
private boolean isRemote=false;
// we cache if the case has data in it yet since a few places ask for it and we dont' need to keep going to DB
private boolean hasData = false;
@ -176,7 +188,7 @@ public class Case implements SleuthkitCase.ErrorObserver {
/**
* Constructor for the Case class
*/
private Case(String name, String number, String examiner, String configFilePath, XMLCaseManagement xmlcm, SleuthkitCase db) {
private Case(String name, String number, String examiner, String configFilePath, XMLCaseManagement xmlcm, SleuthkitCase db, boolean isRemote) {
this.name = name;
this.number = number;
this.examiner = examiner;
@ -184,6 +196,7 @@ public class Case implements SleuthkitCase.ErrorObserver {
this.xmlcm = xmlcm;
this.db = db;
this.services = new Services(db);
this.isRemote = isRemote;
db.addErrorObserver(this);
}
@ -305,6 +318,7 @@ public class Case implements SleuthkitCase.ErrorObserver {
public static void create(String caseDir, String caseName, String caseNumber, String examiner, CaseType caseType) throws CaseActionException {
logger.log(Level.INFO, "Creating new case.\ncaseDir: {0}\ncaseName: {1}", new Object[]{caseDir, caseName}); //NON-NLS
boolean isRemote=false;
// create case directory if it doesn't already exist.
if (new File(caseDir).exists() == false) {
Case.createCaseDirectory(caseDir);
@ -318,9 +332,11 @@ public class Case implements SleuthkitCase.ErrorObserver {
// figure out the database name
if (caseType == CaseType.LOCAL) {
dbName = caseDir + File.separator + "autopsy.db"; //NON-NLS
isRemote=false;
} else if (caseType == CaseType.SHARED) {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd_HHmmss");
dbName = caseName + "_" + dateFormat.format(new Date());
isRemote=true;
}
xmlcm.create(caseDir, caseName, examiner, caseNumber, caseType, dbName); // create a new XML config file
@ -329,15 +345,14 @@ public class Case implements SleuthkitCase.ErrorObserver {
SleuthkitCase db = null;
try {
db = SleuthkitCase.newCase(dbName); /// KDM
db = SleuthkitCase.newCase(dbName); /// KDM this is where newcasewizardpanel2 calls.
} catch (TskCoreException ex) {
logger.log(Level.SEVERE, "Error creating a case: " + caseName + " in dir " + caseDir, ex); //NON-NLS
throw new CaseActionException(
NbBundle.getMessage(Case.class, "Case.create.exception.msg", caseName, caseDir), ex);
}
Case newCase = new Case(caseName, caseNumber, examiner, configFilePath, xmlcm, db);
Case newCase = new Case(caseName, caseNumber, examiner, configFilePath, xmlcm, db, isRemote);
changeCase(newCase);
}
@ -350,7 +365,7 @@ public class Case implements SleuthkitCase.ErrorObserver {
*/
public static void open(String configFilePath) throws CaseActionException {
logger.log(Level.INFO, "Opening case.\nconfigFilePath: {0}", configFilePath); //NON-NLS
boolean isRemote=false;
try {
XMLCaseManagement xmlcm = new XMLCaseManagement();
@ -360,25 +375,43 @@ public class Case implements SleuthkitCase.ErrorObserver {
String caseName = xmlcm.getCaseName();
String caseNumber = xmlcm.getCaseNumber();
String examiner = xmlcm.getCaseExaminer();
// if the caseName is "", case / config file can't be opened
if (caseName.equals("")) {
throw new CaseActionException(NbBundle.getMessage(Case.class, "Case.open.exception.blankCase.msg"));
}
CaseType caseType = xmlcm.getCaseType();
String caseDir = xmlcm.getCaseDirectory();
String dbPath = caseDir + File.separator + "autopsy.db"; //NON-NLS
SleuthkitCase db = SleuthkitCase.openCase(dbPath); // KDM
if (null != db.getBackupDatabasePath()) {
JOptionPane.showMessageDialog(null,
NbBundle.getMessage(Case.class, "Case.open.msgDlg.updated.msg",
db.getBackupDatabasePath()),
NbBundle.getMessage(Case.class, "Case.open.msgDlg.updated.title"),
JOptionPane.INFORMATION_MESSAGE);
SleuthkitCase db;
if (caseType == CaseType.LOCAL) {
// if the caseName is "", case / config file can't be opened
isRemote=false;
if (caseName.equals("")) {
throw new CaseActionException(NbBundle.getMessage(Case.class, "Case.open.exception.blankCase.msg"));
}
String dbPath = caseDir + File.separator + "autopsy.db"; //NON-NLS
db = SleuthkitCase.openCase(dbPath); // KDM
if (null != db.getBackupDatabasePath()) {
JOptionPane.showMessageDialog(null,
NbBundle.getMessage(Case.class, "Case.open.msgDlg.updated.msg",
db.getBackupDatabasePath()),
NbBundle.getMessage(Case.class, "Case.open.msgDlg.updated.title"),
JOptionPane.INFORMATION_MESSAGE);
}
}
else {
isRemote=true;
CaseDbConnectionInfo info = UserPreferences.getDatabaseConnectionInfo();
db = SleuthkitCase.openCase(xmlcm.getDatabaseName(), info); // KDM
if (null != db.getBackupDatabasePath()) {
JOptionPane.showMessageDialog(null,
NbBundle.getMessage(Case.class, "Case.open.msgDlg.updated.msg",
db.getBackupDatabasePath()),
NbBundle.getMessage(Case.class, "Case.open.msgDlg.updated.title"),
JOptionPane.INFORMATION_MESSAGE);
}
}
checkImagesExist(db);
Case openedCase = new Case(caseName, caseNumber, examiner, configFilePath, xmlcm, db);
Case openedCase = new Case(caseName, caseNumber, examiner, configFilePath, xmlcm, db, isRemote);
changeCase(openedCase);
@ -1227,4 +1260,12 @@ public class Case implements SleuthkitCase.ErrorObserver {
}
return hasData;
}
/**
* Returns true if the case is a remote case, false otherwise
* @return
*/
public boolean isRemote() {
return isRemote;
}
}

View File

@ -29,6 +29,7 @@ import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import org.sleuthkit.autopsy.casemodule.Case.CaseType;
import org.sleuthkit.autopsy.core.UserPreferences;
import org.sleuthkit.datamodel.CaseDbConnectionInfo;
/**
* The wizard panel for the new case creation.
@ -45,19 +46,34 @@ final class NewCaseVisualPanel1 extends JPanel implements DocumentListener {
this.wizPanel = wizPanel;
caseNameTextField.getDocument().addDocumentListener(this);
caseParentDirTextField.getDocument().addDocumentListener(this);
boolean databaseConnectionSettingsOkay = true; /// KDM this becomes a static call in the TSK code.
// if we cannot connect to the shared database, don't present the option
// but do not change the setting stored in the preferences file
if (true == databaseConnectionSettingsOkay) {
if (UserPreferences.newCaseType() == CaseType.LOCAL.ordinal()) {
rbLocalCase.setSelected(true);
} else {
rbSharedCase.setSelected(true);
}
} else {
CaseDbConnectionInfo info = UserPreferences.getDatabaseConnectionInfo();
/// KDM TODO: When we have a way to validate that we can actually talk to the remote DB (settings are correct), use it.
/// The following will be set true or false depending upon if we can talk to it.
boolean remoteDatabaseConnectionSettingsOkay = true;
if (info.getDbType() == CaseDbConnectionInfo.DbType.UNKNOWN) {
rbLocalCase.setSelected(true);
rbLocalCase.setEnabled(false);
rbLocalCase.setVisible(false);
rbSharedCase.setEnabled(false);
rbSharedCase.setVisible(false);
} else {
// if we cannot connect to the shared database, don't present the option
// but do not change the setting stored in the preferences file
rbLocalCase.setEnabled(true);
rbSharedCase.setEnabled(true);
rbLocalCase.setVisible(true);
rbSharedCase.setVisible(true);
if (true == remoteDatabaseConnectionSettingsOkay) {
if (UserPreferences.newCaseType() == CaseType.LOCAL.ordinal()) {
rbLocalCase.setSelected(true);
} else {
rbSharedCase.setSelected(true);
}
} else {
rbLocalCase.setSelected(true);
rbLocalCase.setEnabled(false);
rbSharedCase.setEnabled(false);
}
}
}

View File

@ -33,7 +33,6 @@ import org.openide.DialogDisplayer;
import org.openide.NotifyDescriptor;
import org.openide.WizardDescriptor;
import org.openide.WizardValidationException;
import org.openide.util.Exceptions;
import org.openide.util.HelpCtx;
import org.sleuthkit.autopsy.casemodule.Case.CaseType;
import org.sleuthkit.autopsy.core.UserPreferences;

View File

@ -29,7 +29,6 @@ import javax.xml.parsers.*;
import javax.xml.transform.*;
import javax.xml.transform.dom.*;
import javax.xml.transform.stream.*;
import org.openide.util.Exceptions;
import org.openide.util.NbBundle;
import org.sleuthkit.autopsy.casemodule.Case.CaseType;
import org.sleuthkit.autopsy.coreutils.Logger;
@ -202,14 +201,46 @@ import org.xml.sax.SAXException;
caseType = givenCaseType; // change this to change the xml file if needed
}
/**
* Gets the case Type from the document handler.
* Defaults to local if it can't figure it out.
* @return caseType from the document handler
*/
public CaseType getCaseType() {
try {
if (doc == null) {
return CaseType.LOCAL;
} else {
Element nameElement = (Element) getCaseElement().getElementsByTagName(CASE_TYPE).item(0);
return CaseType.fromString(nameElement.getTextContent());
}
} catch (Exception ex) {
return CaseType.LOCAL;
}
}
/**
* Sets the database name internally (on local variable in this class)
*
* @param givenDbName the new db name
*/
private void setDbName(String givenDbName) {
private void setDatabaseName(String givenDbName) {
dbName= givenDbName; // change this to change the xml file if needed
}
/**
* Gets the database name from the document handler
*
* @return the database name
*/
public String getDatabaseName() {
if (doc == null) {
return "";
} else {
Element nameElement = (Element) getCaseElement().getElementsByTagName(DATABASE_NAME).item(0);
return nameElement.getTextContent();
}
}
/**
* Sets the examiner name internally (on local variable in this class)
@ -478,7 +509,7 @@ import org.xml.sax.SAXException;
setExaminer(examiner);
setNumber(caseNumber);
setCaseType(caseType);
setDbName(dbName);
setDatabaseName(dbName);
DocumentBuilder docBuilder;
DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();

View File

@ -21,6 +21,8 @@ package org.sleuthkit.autopsy.core;
import java.util.prefs.PreferenceChangeListener;
import java.util.prefs.Preferences;
import org.openide.util.NbPreferences;
import org.sleuthkit.datamodel.CaseDbConnectionInfo;
import org.sleuthkit.datamodel.CaseDbConnectionInfo.DbType;
/**
* Provides convenient access to a Preferences node for user preferences with
@ -39,6 +41,7 @@ public final class UserPreferences {
public static final String EXTERNAL_DATABASE_NAME = "ExternalDatabaseName"; //NON-NLS
public static final String EXTERNAL_DATABASE_USER = "ExternalDatabaseUsername"; //NON-NLS
public static final String EXTERNAL_DATABASE_PASSWORD = "ExternalDatabasePassword"; //NON-NLS
public static final String EXTERNAL_DATABASE_TYPE = "ExternalDatabaseType"; //NON-NLS
public static final String NEW_CASE_TYPE = "NewCaseType"; //NON-NLS
// Prevent instantiation.
@ -93,46 +96,29 @@ public final class UserPreferences {
preferences.putInt(NUMBER_OF_FILE_INGEST_THREADS, value);
}
public static String hostNameOrIp() {
return preferences.get(EXTERNAL_DATABASE_HOSTNAME_OR_IP, "");
public static CaseDbConnectionInfo getDatabaseConnectionInfo() {
DbType dbType;
try {
dbType = DbType.valueOf(preferences.get(EXTERNAL_DATABASE_TYPE, "UNKOWN"));
} catch (Exception ex) {
dbType = DbType.UNKNOWN;
}
return new CaseDbConnectionInfo(
preferences.get(EXTERNAL_DATABASE_HOSTNAME_OR_IP, ""),
preferences.get(EXTERNAL_DATABASE_PORTNUMBER, ""),
preferences.get(EXTERNAL_DATABASE_USER, ""),
preferences.get(EXTERNAL_DATABASE_PASSWORD, ""),
dbType);
}
public static void setHostNameOrIp(String value) {
preferences.put(EXTERNAL_DATABASE_HOSTNAME_OR_IP, value);
public static void setDatabaseConnectionInfo(CaseDbConnectionInfo connectionInfo) {
preferences.put(EXTERNAL_DATABASE_HOSTNAME_OR_IP, connectionInfo.getHost());
preferences.put(EXTERNAL_DATABASE_PORTNUMBER, connectionInfo.getPort());
preferences.put(EXTERNAL_DATABASE_USER, connectionInfo.getUserName());
preferences.put(EXTERNAL_DATABASE_PASSWORD, connectionInfo.getPassword());
preferences.put(EXTERNAL_DATABASE_TYPE, connectionInfo.getDbType().toString());
}
public static String portNumber() {
return preferences.get(EXTERNAL_DATABASE_PORTNUMBER, "");
}
public static void setPortNumber(String value) {
preferences.put(EXTERNAL_DATABASE_PORTNUMBER, value);
}
public static String databaseName() {
return preferences.get(EXTERNAL_DATABASE_NAME, "");
}
public static void setDatabaseName(String value) {
preferences.put(EXTERNAL_DATABASE_NAME, value);
}
public static String userName() {
return preferences.get(EXTERNAL_DATABASE_USER, "");
}
public static void setUserName(String value) {
preferences.put(EXTERNAL_DATABASE_USER, value);
}
public static String password() {
return preferences.get(EXTERNAL_DATABASE_PASSWORD, "");
}
public static void setPassword(String value) {
preferences.put(EXTERNAL_DATABASE_PASSWORD, value);
}
public static int newCaseType() {
return preferences.getInt(NEW_CASE_TYPE, 0);
}

View File

@ -0,0 +1,166 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.5" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="jPanel1" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="67" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" max="-2" attributes="0"/>
<Component id="jPanel1" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="133" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Container class="javax.swing.JPanel" name="jPanel1">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.EtchedBorderInfo">
<EtchetBorder/>
</Border>
</Property>
</Properties>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Component id="cbExternalDbEnabled" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="50" max="32767" attributes="0"/>
<Component id="lbOops" min="-2" pref="232" max="-2" attributes="0"/>
</Group>
<Component id="tbHostnameOrIp" alignment="0" max="32767" attributes="0"/>
<Component id="tbPortNumber" alignment="0" max="32767" attributes="0"/>
<Component id="tbUsername" alignment="0" max="32767" attributes="0"/>
<Component id="tbPassword" alignment="0" max="32767" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<EmptySpace min="-2" pref="6" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="cbExternalDbEnabled" min="-2" max="-2" attributes="0"/>
<Component id="lbOops" max="32767" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Component id="tbHostnameOrIp" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="tbPortNumber" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="tbUsername" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="tbPassword" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JTextField" name="tbHostnameOrIp">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Tahoma" size="12" style="0"/>
</Property>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/corecomponents/Bundle.properties" key="AutopsyDatabasePanel.tbHostnameOrIp.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
<Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/corecomponents/Bundle.properties" key="AutopsyDatabasePanel.tbHostnameOrIp.toolTipText" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="tbPortNumber">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Tahoma" size="12" style="0"/>
</Property>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/corecomponents/Bundle.properties" key="AutopsyDatabasePanel.tbPortNumber.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
<Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/corecomponents/Bundle.properties" key="AutopsyDatabasePanel.tbPortNumber.toolTipText" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="tbUsername">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Tahoma" size="12" style="0"/>
</Property>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/corecomponents/Bundle.properties" key="AutopsyDatabasePanel.tbUsername.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
<Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/corecomponents/Bundle.properties" key="AutopsyDatabasePanel.tbUsername.toolTipText" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JPasswordField" name="tbPassword">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Tahoma" size="12" style="0"/>
</Property>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/corecomponents/Bundle.properties" key="AutopsyDatabasePanel.tbPassword.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
<Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/corecomponents/Bundle.properties" key="AutopsyDatabasePanel.tbPassword.toolTipText" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JCheckBox" name="cbExternalDbEnabled">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/corecomponents/Bundle.properties" key="AutopsyDatabasePanel.cbExternalDbEnabled.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
<Events>
<EventHandler event="itemStateChanged" listener="java.awt.event.ItemListener" parameters="java.awt.event.ItemEvent" handler="cbExternalDbEnabledItemStateChanged"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="lbOops">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Tahoma" size="12" style="1"/>
</Property>
<Property name="foreground" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="0" green="0" red="ff" type="rgb"/>
</Property>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/corecomponents/Bundle.properties" key="AutopsyDatabasePanel.lbOops.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Form>

View File

@ -0,0 +1,269 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package org.sleuthkit.autopsy.corecomponents;
import java.awt.Color;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import org.sleuthkit.datamodel.CaseDbConnectionInfo;
import org.sleuthkit.datamodel.CaseDbConnectionInfo.DbType;
import org.sleuthkit.autopsy.core.UserPreferences;
public class AutopsyDatabasePanel extends javax.swing.JPanel {
private AutopsyDatabasePanelController controller;
private TextBoxChangedListener textBoxChangedListener;
/**
* Creates new form AutopsyDatabasePanel
*/
public AutopsyDatabasePanel(AutopsyDatabasePanelController theController) {
initComponents();
controller = theController;
TextPrompt tpHostnameOrIp = new TextPrompt("Hostname or IP Address", tbHostnameOrIp);
TextPrompt tpPortNumber = new TextPrompt("Port Number", tbPortNumber);
TextPrompt tpUsername = new TextPrompt("User Name", tbUsername);
TextPrompt tpPassword = new TextPrompt("Password", tbPassword);
tpHostnameOrIp.setForeground(Color.LIGHT_GRAY);
tpPortNumber.setForeground(Color.LIGHT_GRAY);
tpUsername.setForeground(Color.LIGHT_GRAY);
tpPassword.setForeground(Color.LIGHT_GRAY);
float alpha = 0.9f; // Mostly opaque
tpHostnameOrIp.changeAlpha(alpha);
tpPortNumber.changeAlpha(alpha);
tpUsername.changeAlpha(alpha);
tpPassword.changeAlpha(alpha);
setNetworkDbEnabled(cbExternalDbEnabled.isSelected());
/// Register for notifications when the text boxes get updated
textBoxChangedListener = new TextBoxChangedListener();
tbHostnameOrIp.getDocument().addDocumentListener(textBoxChangedListener);
tbPortNumber.getDocument().addDocumentListener(textBoxChangedListener);
tbUsername.getDocument().addDocumentListener(textBoxChangedListener);
tbPassword.getDocument().addDocumentListener(textBoxChangedListener);
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jPanel1 = new javax.swing.JPanel();
tbHostnameOrIp = new javax.swing.JTextField();
tbPortNumber = new javax.swing.JTextField();
tbUsername = new javax.swing.JTextField();
tbPassword = new javax.swing.JPasswordField();
cbExternalDbEnabled = new javax.swing.JCheckBox();
lbOops = new javax.swing.JLabel();
jPanel1.setBorder(javax.swing.BorderFactory.createEtchedBorder());
tbHostnameOrIp.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
tbHostnameOrIp.setText(org.openide.util.NbBundle.getMessage(AutopsyDatabasePanel.class, "AutopsyDatabasePanel.tbHostnameOrIp.text")); // NOI18N
tbHostnameOrIp.setToolTipText(org.openide.util.NbBundle.getMessage(AutopsyDatabasePanel.class, "AutopsyDatabasePanel.tbHostnameOrIp.toolTipText")); // NOI18N
tbPortNumber.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
tbPortNumber.setText(org.openide.util.NbBundle.getMessage(AutopsyDatabasePanel.class, "AutopsyDatabasePanel.tbPortNumber.text")); // NOI18N
tbPortNumber.setToolTipText(org.openide.util.NbBundle.getMessage(AutopsyDatabasePanel.class, "AutopsyDatabasePanel.tbPortNumber.toolTipText")); // NOI18N
tbUsername.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
tbUsername.setText(org.openide.util.NbBundle.getMessage(AutopsyDatabasePanel.class, "AutopsyDatabasePanel.tbUsername.text")); // NOI18N
tbUsername.setToolTipText(org.openide.util.NbBundle.getMessage(AutopsyDatabasePanel.class, "AutopsyDatabasePanel.tbUsername.toolTipText")); // NOI18N
tbPassword.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
tbPassword.setText(org.openide.util.NbBundle.getMessage(AutopsyDatabasePanel.class, "AutopsyDatabasePanel.tbPassword.text")); // NOI18N
tbPassword.setToolTipText(org.openide.util.NbBundle.getMessage(AutopsyDatabasePanel.class, "AutopsyDatabasePanel.tbPassword.toolTipText")); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(cbExternalDbEnabled, org.openide.util.NbBundle.getMessage(AutopsyDatabasePanel.class, "AutopsyDatabasePanel.cbExternalDbEnabled.text")); // NOI18N
cbExternalDbEnabled.addItemListener(new java.awt.event.ItemListener() {
public void itemStateChanged(java.awt.event.ItemEvent evt) {
cbExternalDbEnabledItemStateChanged(evt);
}
});
lbOops.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
lbOops.setForeground(new java.awt.Color(255, 0, 0));
org.openide.awt.Mnemonics.setLocalizedText(lbOops, org.openide.util.NbBundle.getMessage(AutopsyDatabasePanel.class, "AutopsyDatabasePanel.lbOops.text")); // NOI18N
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(cbExternalDbEnabled)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 50, Short.MAX_VALUE)
.addComponent(lbOops, javax.swing.GroupLayout.PREFERRED_SIZE, 232, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(tbHostnameOrIp)
.addComponent(tbPortNumber)
.addComponent(tbUsername)
.addComponent(tbPassword))
.addContainerGap())
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
.addGap(6, 6, 6)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(cbExternalDbEnabled)
.addComponent(lbOops, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(tbHostnameOrIp, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(tbPortNumber, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(tbUsername, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(tbPassword, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(67, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(133, Short.MAX_VALUE))
);
}// </editor-fold>//GEN-END:initComponents
/**
* Enables/disables the network database settings, based upon input provided
*
* @param enabled true means enable, false means disable
*/
private void setNetworkDbEnabled(boolean enabled) {
tbHostnameOrIp.setEnabled(enabled);
tbPortNumber.setEnabled(enabled);
tbUsername.setEnabled(enabled);
tbPassword.setEnabled(enabled);
}
private void cbExternalDbEnabledItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_cbExternalDbEnabledItemStateChanged
setNetworkDbEnabled(cbExternalDbEnabled.isSelected());
controller.changed();
}//GEN-LAST:event_cbExternalDbEnabledItemStateChanged
void load() {
CaseDbConnectionInfo info = UserPreferences.getDatabaseConnectionInfo();
tbHostnameOrIp.setText(info.getHost());
tbPortNumber.setText(info.getPort());
tbUsername.setText(info.getUserName());
tbPassword.setText(info.getPassword());
if (info.getDbType() == DbType.UNKNOWN) {
cbExternalDbEnabled.setSelected(false);
} else {
cbExternalDbEnabled.setSelected(true);
}
}
void store() {
DbType dbType = DbType.UNKNOWN;
if (cbExternalDbEnabled.isSelected()) {
dbType = DbType.POSTGRESQL;
}
CaseDbConnectionInfo info = new CaseDbConnectionInfo(
tbHostnameOrIp.getText(),
tbPortNumber.getText(),
tbUsername.getText(),
new String(tbPassword.getPassword()),
dbType);
UserPreferences.setDatabaseConnectionInfo(info);
}
/**
* Validates that the form is filled out correctly for our usage.
*
* @return true if it's okay, false otherwise.
*/
boolean valid() {
boolean result = false;
String text = "";
if (cbExternalDbEnabled.isSelected()) {
try {
if (tbHostnameOrIp.getText().isEmpty()
|| tbPortNumber.getText().isEmpty()
|| tbUsername.getText().isEmpty()
|| tbPassword.getPassword().length == 0) {
// We don't even have everything filled out
result = false;
text = "Fill in all values";
} else {
int value = Integer.parseInt(tbPortNumber.getText());
if (value < 0 || value > 65535) { // valid port numbers
result = false; /// port number is invalid
text = "Invalid port number";
} else {
result = true;
}
}
} catch (Exception ex) {
result = false;
text = "Invalid port number";
}
} else {
result = true;
}
lbOops.setText(text);
return result;
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JCheckBox cbExternalDbEnabled;
private javax.swing.JPanel jPanel1;
private javax.swing.JLabel lbOops;
private javax.swing.JTextField tbHostnameOrIp;
private javax.swing.JPasswordField tbPassword;
private javax.swing.JTextField tbPortNumber;
private javax.swing.JTextField tbUsername;
// End of variables declaration//GEN-END:variables
/**
* Used to listen for changes in text boxes. It lets the panel know things
* have been updated and that validation needs to happen.
*/
class TextBoxChangedListener implements DocumentListener {
@Override
public void changedUpdate(DocumentEvent e) {
controller.changed();
}
@Override
public void insertUpdate(DocumentEvent e) {
controller.changed();
}
@Override
public void removeUpdate(DocumentEvent e) {
controller.changed();
}
}
}

View File

@ -0,0 +1,130 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2013-2014 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.sleuthkit.autopsy.corecomponents;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import javax.swing.JComponent;
import org.netbeans.spi.options.OptionsPanelController;
import org.openide.util.HelpCtx;
import org.openide.util.Lookup;
import org.openide.util.NbBundle;
import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil;
import java.util.logging.Level;
import org.sleuthkit.autopsy.coreutils.Logger;
@OptionsPanelController.TopLevelRegistration(categoryName = "#OptionsCategory_Name_Database_Settings",
iconBase = "org/sleuthkit/autopsy/modules/hashdatabase/options_icon.png",
position = 2,
keywords = "#OptionsCategory_Keywords_Database_Options",
keywordsCategory = "Database")
public final class AutopsyDatabasePanelController extends OptionsPanelController {
private AutopsyDatabasePanel panel;
private final PropertyChangeSupport pcs = new PropertyChangeSupport(this);
private boolean changed;
private static final Logger logger = Logger.getLogger(AutopsyDatabasePanelController.class.getName());
@Override
public void update() {
getPanel().load();
changed = false;
}
@Override
public void applyChanges() {
getPanel().store();
changed = false;
}
@Override
public void cancel() {
}
@Override
public boolean isValid() {
return getPanel().valid();
}
@Override
public boolean isChanged() {
return changed;
}
@Override
public HelpCtx getHelpCtx() {
return null;
}
@Override
public JComponent getComponent(Lookup masterLookup) {
return getPanel();
}
@Override
public void addPropertyChangeListener(PropertyChangeListener l) {
if (pcs.getPropertyChangeListeners().length == 0) {
pcs.addPropertyChangeListener(l);
}
}
@Override
public void removePropertyChangeListener(PropertyChangeListener l) {
/**
* Note the NetBeans Framework does not appear to call this at all We
* are using NetBeans 7.3.1 Build 201306052037. Perhaps in a future
* version of the Framework this will be resolved, but for now, simply
* don't unregister anything and add one time only in the
* addPropertyChangeListener() method above.
*/
}
private AutopsyDatabasePanel getPanel() {
if (panel == null) {
panel = new AutopsyDatabasePanel(this);
}
return panel;
}
void changed() {
if (!changed) {
changed = true;
try {
pcs.firePropertyChange(OptionsPanelController.PROP_CHANGED, false, true);
} catch (Exception e) {
logger.log(Level.SEVERE, "GeneralOptionsPanelController listener threw exception", e); //NON-NLS
MessageNotifyUtil.Notify.show(
NbBundle.getMessage(this.getClass(), "GeneralOptionsPanelController.moduleErr"),
NbBundle.getMessage(this.getClass(), "GeneralOptionsPanelController.moduleErr.msg"),
MessageNotifyUtil.MessageType.ERROR);
}
}
try {
pcs.firePropertyChange(OptionsPanelController.PROP_VALID, null, null);
} catch (Exception e) {
logger.log(Level.SEVERE, "GeneralOptionsPanelController listener threw exception", e); //NON-NLS
MessageNotifyUtil.Notify.show(
NbBundle.getMessage(this.getClass(), "GeneralOptionsPanelController.moduleErr"),
NbBundle.getMessage(this.getClass(), "GeneralOptionsPanelController.moduleErr.msg"),
MessageNotifyUtil.MessageType.ERROR);
}
}
}

View File

@ -27,6 +27,21 @@
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace min="10" pref="10" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="keepCurrentViewerRB" min="-2" max="-2" attributes="0"/>
<Component id="useBestViewerRB" min="-2" max="-2" attributes="0"/>
<Component id="dataSourcesHideKnownCB" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="viewsHideKnownCB" alignment="0" min="-2" max="-2" attributes="0"/>
<Group type="102" attributes="0">
<Component id="numberOfFileIngestThreadsComboBox" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="restartRequiredLabel" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</Group>
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jLabelHideKnownFiles" alignment="0" min="-2" max="-2" attributes="0"/>
@ -40,31 +55,9 @@
</Group>
<Component id="jLabelSelectFile" min="-2" max="-2" attributes="0"/>
<Component id="jLabelNumThreads" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="jLabel1" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="32767" attributes="0"/>
</Group>
<Group type="102" attributes="0">
<EmptySpace min="10" pref="10" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Component id="numberOfFileIngestThreadsComboBox" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="restartRequiredLabel" pref="529" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="keepCurrentViewerRB" min="-2" max="-2" attributes="0"/>
<Component id="useBestViewerRB" min="-2" max="-2" attributes="0"/>
<Component id="dataSourcesHideKnownCB" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="viewsHideKnownCB" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="jPanel1" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
</Group>
</Group>
</Group>
</Group>
</Group>
@ -96,11 +89,7 @@
<Component id="numberOfFileIngestThreadsComboBox" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="restartRequiredLabel" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="4" max="-2" attributes="0"/>
<Component id="jPanel1" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="47" max="32767" attributes="0"/>
<EmptySpace pref="155" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
@ -216,105 +205,5 @@
</Property>
</Properties>
</Component>
<Container class="javax.swing.JPanel" name="jPanel1">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.EtchedBorderInfo">
<EtchetBorder/>
</Border>
</Property>
</Properties>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="tbHostnameOrIp" max="32767" attributes="0"/>
<Component id="tbPortNumber" alignment="0" max="32767" attributes="0"/>
<Component id="tbDatabaseName" alignment="0" max="32767" attributes="0"/>
<Component id="tbUsername" max="32767" attributes="0"/>
<Component id="tbPassword" alignment="0" pref="316" max="32767" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<EmptySpace max="32767" attributes="0"/>
<Component id="tbHostnameOrIp" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="tbPortNumber" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="tbDatabaseName" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="tbUsername" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="tbPassword" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JTextField" name="tbHostnameOrIp">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/corecomponents/Bundle.properties" key="AutopsyOptionsPanel.tbHostnameOrIp.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
<Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/corecomponents/Bundle.properties" key="AutopsyOptionsPanel.tbHostnameOrIp.toolTipText" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="tbPortNumber">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/corecomponents/Bundle.properties" key="AutopsyOptionsPanel.tbPortNumber.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
<Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/corecomponents/Bundle.properties" key="AutopsyOptionsPanel.tbPortNumber.toolTipText" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="tbDatabaseName">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/corecomponents/Bundle.properties" key="AutopsyOptionsPanel.tbDatabaseName.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
<Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/corecomponents/Bundle.properties" key="AutopsyOptionsPanel.tbDatabaseName.toolTipText" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="tbUsername">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/corecomponents/Bundle.properties" key="AutopsyOptionsPanel.tbUsername.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
<Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/corecomponents/Bundle.properties" key="AutopsyOptionsPanel.tbUsername.toolTipText" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JPasswordField" name="tbPassword">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/corecomponents/Bundle.properties" key="AutopsyOptionsPanel.tbPassword.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
</SubComponents>
</Container>
<Component class="javax.swing.JLabel" name="jLabel1">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/corecomponents/Bundle.properties" key="AutopsyOptionsPanel.jLabel1.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
</SubComponents>
</Form>

View File

@ -18,7 +18,6 @@
*/
package org.sleuthkit.autopsy.corecomponents;
import java.awt.Color;
import javax.swing.DefaultComboBoxModel;
import org.openide.util.NbBundle;
import org.sleuthkit.autopsy.core.UserPreferences;
@ -68,28 +67,8 @@ final class AutopsyOptionsPanel extends javax.swing.JPanel {
recommendedFileIngestThreadCount = 1;
}
numberOfFileIngestThreadsComboBox.setModel(new DefaultComboBoxModel<>(fileIngestThreadCountChoices));
restartRequiredLabel.setText(NbBundle.getMessage(AutopsyOptionsPanel.class, "AutopsyOptionsPanel.restartRequiredLabel.text", recommendedFileIngestThreadCount));
TextPrompt tpHostnameOrIp = new TextPrompt("Hostname or IP Address", tbHostnameOrIp);
TextPrompt tpPortNumber = new TextPrompt("Port Number", tbPortNumber);
TextPrompt tpDatabaseName = new TextPrompt("Database Name", tbDatabaseName);
TextPrompt tpUsername = new TextPrompt("User Name", tbUsername);
TextPrompt tpPassword = new TextPrompt("Password", tbPassword);
tpHostnameOrIp.setForeground(Color.LIGHT_GRAY);
tpPortNumber.setForeground(Color.LIGHT_GRAY);
tpDatabaseName.setForeground(Color.LIGHT_GRAY);
tpUsername.setForeground(Color.LIGHT_GRAY);
tpPassword.setForeground(Color.LIGHT_GRAY);
float alpha=0.9f; // Mostly opaque
tpHostnameOrIp.changeAlpha(alpha);
tpPortNumber.changeAlpha(alpha);
tpDatabaseName.changeAlpha(alpha);
tpUsername.changeAlpha(alpha);
tpPassword.changeAlpha(alpha);
// TODO listen to changes in form fields and call controller.changed()
restartRequiredLabel.setText(NbBundle.getMessage(AutopsyOptionsPanel.class, "AutopsyOptionsPanel.restartRequiredLabel.text", recommendedFileIngestThreadCount));
// TODO listen to changes in form fields and call controller.changed()
}
void load() {
@ -101,12 +80,7 @@ final class AutopsyOptionsPanel extends javax.swing.JPanel {
boolean useLocalTime = UserPreferences.displayTimesInLocalTime();
useLocalTimeRB.setSelected(useLocalTime);
useGMTTimeRB.setSelected(!useLocalTime);
numberOfFileIngestThreadsComboBox.setSelectedItem(UserPreferences.numberOfFileIngestThreads());
tbHostnameOrIp.setText(UserPreferences.hostNameOrIp());
tbPortNumber.setText(UserPreferences.portNumber());
tbDatabaseName.setText(UserPreferences.databaseName());
tbUsername.setText(UserPreferences.userName());
tbPassword.setText(UserPreferences.password());
numberOfFileIngestThreadsComboBox.setSelectedItem(UserPreferences.numberOfFileIngestThreads());
}
void store() {
@ -115,11 +89,6 @@ final class AutopsyOptionsPanel extends javax.swing.JPanel {
UserPreferences.setHideKnownFilesInViewsTree(viewsHideKnownCB.isSelected());
UserPreferences.setDisplayTimesInLocalTime(useLocalTimeRB.isSelected());
UserPreferences.setNumberOfFileIngestThreads((Integer) numberOfFileIngestThreadsComboBox.getSelectedItem());
UserPreferences.setHostNameOrIp(tbHostnameOrIp.getText());
UserPreferences.setPortNumber(tbPortNumber.getText());
UserPreferences.setDatabaseName(tbDatabaseName.getText());
UserPreferences.setUserName(tbUsername.getText());
UserPreferences.setPassword(new String(tbPassword.getPassword()));
}
boolean valid() {
@ -149,13 +118,6 @@ final class AutopsyOptionsPanel extends javax.swing.JPanel {
jLabelNumThreads = new javax.swing.JLabel();
numberOfFileIngestThreadsComboBox = new javax.swing.JComboBox<Integer>();
restartRequiredLabel = new javax.swing.JLabel();
jPanel1 = new javax.swing.JPanel();
tbHostnameOrIp = new javax.swing.JTextField();
tbPortNumber = new javax.swing.JTextField();
tbDatabaseName = new javax.swing.JTextField();
tbUsername = new javax.swing.JTextField();
tbPassword = new javax.swing.JPasswordField();
jLabel1 = new javax.swing.JLabel();
buttonGroup1.add(useBestViewerRB);
useBestViewerRB.setSelected(true);
@ -188,54 +150,6 @@ final class AutopsyOptionsPanel extends javax.swing.JPanel {
restartRequiredLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/corecomponents/warning16.png"))); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(restartRequiredLabel, org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class, "AutopsyOptionsPanel.restartRequiredLabel.text")); // NOI18N
jPanel1.setBorder(javax.swing.BorderFactory.createEtchedBorder());
tbHostnameOrIp.setText(org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class, "AutopsyOptionsPanel.tbHostnameOrIp.text")); // NOI18N
tbHostnameOrIp.setToolTipText(org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class, "AutopsyOptionsPanel.tbHostnameOrIp.toolTipText")); // NOI18N
tbPortNumber.setText(org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class, "AutopsyOptionsPanel.tbPortNumber.text")); // NOI18N
tbPortNumber.setToolTipText(org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class, "AutopsyOptionsPanel.tbPortNumber.toolTipText")); // NOI18N
tbDatabaseName.setText(org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class, "AutopsyOptionsPanel.tbDatabaseName.text")); // NOI18N
tbDatabaseName.setToolTipText(org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class, "AutopsyOptionsPanel.tbDatabaseName.toolTipText")); // NOI18N
tbUsername.setText(org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class, "AutopsyOptionsPanel.tbUsername.text")); // NOI18N
tbUsername.setToolTipText(org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class, "AutopsyOptionsPanel.tbUsername.toolTipText")); // NOI18N
tbPassword.setText(org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class, "AutopsyOptionsPanel.tbPassword.text")); // NOI18N
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(tbHostnameOrIp)
.addComponent(tbPortNumber)
.addComponent(tbDatabaseName)
.addComponent(tbUsername)
.addComponent(tbPassword, javax.swing.GroupLayout.DEFAULT_SIZE, 316, Short.MAX_VALUE))
.addContainerGap())
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(tbHostnameOrIp, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(tbPortNumber, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(tbDatabaseName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(tbUsername, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(tbPassword, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
);
org.openide.awt.Mnemonics.setLocalizedText(jLabel1, org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class, "AutopsyOptionsPanel.jLabel1.text")); // NOI18N
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
@ -243,6 +157,18 @@ final class AutopsyOptionsPanel extends javax.swing.JPanel {
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(10, 10, 10)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(keepCurrentViewerRB)
.addComponent(useBestViewerRB)
.addComponent(dataSourcesHideKnownCB)
.addComponent(viewsHideKnownCB)
.addGroup(layout.createSequentialGroup()
.addComponent(numberOfFileIngestThreadsComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(restartRequiredLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addContainerGap())))
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabelHideKnownFiles)
@ -253,25 +179,8 @@ final class AutopsyOptionsPanel extends javax.swing.JPanel {
.addComponent(useLocalTimeRB)
.addComponent(useGMTTimeRB)))
.addComponent(jLabelSelectFile)
.addComponent(jLabelNumThreads)
.addComponent(jLabel1))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addGap(10, 10, 10)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(numberOfFileIngestThreadsComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(restartRequiredLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 529, Short.MAX_VALUE)
.addContainerGap())
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(keepCurrentViewerRB)
.addComponent(useBestViewerRB)
.addComponent(dataSourcesHideKnownCB)
.addComponent(viewsHideKnownCB)
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(0, 0, Short.MAX_VALUE))))))
.addComponent(jLabelNumThreads))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
@ -299,11 +208,7 @@ final class AutopsyOptionsPanel extends javax.swing.JPanel {
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(numberOfFileIngestThreadsComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(restartRequiredLabel))
.addGap(18, 18, 18)
.addComponent(jLabel1)
.addGap(4, 4, 4)
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(47, Short.MAX_VALUE))
.addContainerGap(155, Short.MAX_VALUE))
);
}// </editor-fold>//GEN-END:initComponents
@ -312,20 +217,13 @@ final class AutopsyOptionsPanel extends javax.swing.JPanel {
private javax.swing.ButtonGroup buttonGroup3;
private javax.swing.ButtonGroup buttonGroupProcTimeOut;
private javax.swing.JCheckBox dataSourcesHideKnownCB;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabelHideKnownFiles;
private javax.swing.JLabel jLabelNumThreads;
private javax.swing.JLabel jLabelSelectFile;
private javax.swing.JLabel jLabelTimeDisplay;
private javax.swing.JPanel jPanel1;
private javax.swing.JRadioButton keepCurrentViewerRB;
private javax.swing.JComboBox<Integer> numberOfFileIngestThreadsComboBox;
private javax.swing.JLabel restartRequiredLabel;
private javax.swing.JTextField tbDatabaseName;
private javax.swing.JTextField tbHostnameOrIp;
private javax.swing.JPasswordField tbPassword;
private javax.swing.JTextField tbPortNumber;
private javax.swing.JTextField tbUsername;
private javax.swing.JRadioButton useBestViewerRB;
private javax.swing.JRadioButton useGMTTimeRB;
private javax.swing.JRadioButton useLocalTimeRB;

View File

@ -137,7 +137,7 @@ AutopsyOptionsPanel.useGMTTimeRB.text=Use GMT
AutopsyOptionsPanel.useLocalTimeRB.text=Use local time zone
AutopsyOptionsPanel.keepCurrentViewerRB.toolTipText=For example, stay in Hex view when a JPEG is selected.
AutopsyOptionsPanel.keepCurrentViewerRB.text=Stay on the same file viewer
AutopsyOptionsPanel.restartRequiredLabel.text=For this computer, a maximum of {0} file ingest threads should be used. Restart required to take effect.
AutopsyOptionsPanel.restartRequiredLabel.text=For this computer, a maximum of {0} file ingest threads should be used. Application restart required to take effect.
AutopsyOptionsPanel.jLabelSelectFile.text=When selecting a file:
AutopsyOptionsPanel.jLabelHideKnownFiles.text=Hide known files (i.e. those in the NIST NSRL) in the:
AutopsyOptionsPanel.jLabelTimeDisplay.text=When displaying times:
@ -145,13 +145,15 @@ AutopsyOptionsPanel.jLabelNumThreads.text=Number of threads to use for file inge
FXVideoPanel.progress.bufferingCancelled=media buffering was canceled
FXVideoPanel.progress.bufferingInterrupted=media buffering was interrupted
FXVideoPanel.progress.errorWritingVideoToDisk=Error writing video to disk
AutopsyOptionsPanel.tbDatabaseName.text=
AutopsyOptionsPanel.tbPortNumber.text=
AutopsyOptionsPanel.tbHostnameOrIp.text=
AutopsyOptionsPanel.tbUsername.text=
AutopsyOptionsPanel.jLabel1.text=External Database Settings
AutopsyOptionsPanel.tbUsername.toolTipText=User Name
AutopsyOptionsPanel.tbDatabaseName.toolTipText=Database Name
AutopsyOptionsPanel.tbPortNumber.toolTipText=Port Number
AutopsyOptionsPanel.tbHostnameOrIp.toolTipText=Hostname or IP Address
AutopsyOptionsPanel.tbPassword.text=
OptionsCategory_Name_Database_Settings=External Database
OptionsCategory_Keywords_Database_Options=Database Options
AutopsyDatabasePanel.tbPassword.toolTipText=Enter the password here
AutopsyDatabasePanel.tbPassword.text=
AutopsyDatabasePanel.tbUsername.toolTipText=User Name
AutopsyDatabasePanel.tbUsername.text=
AutopsyDatabasePanel.tbPortNumber.toolTipText=Port Number
AutopsyDatabasePanel.tbPortNumber.text=
AutopsyDatabasePanel.tbHostnameOrIp.toolTipText=Hostname or IP Address
AutopsyDatabasePanel.tbHostnameOrIp.text=
AutopsyDatabasePanel.cbExternalDbEnabled.text=Use External Database
AutopsyDatabasePanel.lbOops.text=