Simplify add image wizard

This commit is contained in:
Dick Fickling 2012-01-09 12:49:46 -05:00
parent 99390e0d91
commit ac714e1b58
12 changed files with 275 additions and 337 deletions

View File

@ -59,7 +59,7 @@ public final class AddImageAction extends CallableSystemAction implements Presen
// <TYPE>: <DESCRIPTION>
// String: time zone that the image is from
static final String TIMEZONE_PROP = "timeZone";
// String[]: task to clean up the database file if wizard errors/is cancelled after it is created
// String[]: array of paths to each image selected
static final String IMGPATHS_PROP = "imgPaths";
// CleanupTask: task to clean up the database file if wizard errors/is cancelled after it is created
static final String IMAGECLEANUPTASK_PROP = "finalFileCleanup";
@ -69,6 +69,8 @@ public final class AddImageAction extends CallableSystemAction implements Presen
static final String PROCESS_PROP = "process";
// boolean: whether or not to index the image in Solr
static final String SOLR_PROP = "indexInSolr";
// boolean: whether or not to lookup files in the hashDB
static final String LOOKUPFILES_PROP = "lookupFiles";
private WizardDescriptor wizardDescriptor;
@ -117,56 +119,12 @@ public final class AddImageAction extends CallableSystemAction implements Presen
dialog.setVisible(true);
dialog.toFront();
boolean cancelled = wizardDescriptor.getValue() != WizardDescriptor.FINISH_OPTION;
// @@@ Why don't we commit and revert in the same general area????
if (!cancelled) {
// commit anything
try {
commitImage(wizardDescriptor);
} catch (Exception ex) {
// Log error/display warning
Logger logger = Logger.getLogger(AddImageAction.class.getName());
logger.log(Level.SEVERE, "Error adding image to case.", ex);
}
}
// Do any cleanup that needs to happen (potentially: stopping the
//add-image process, reverting an image)
runCleanupTasks();
}
/**
* Commit the finished AddImageProcess, and cancel the CleanupTask that
* would have reverted it.
* @param settings property set to get AddImageProcess and CleanupTask from
* @throws Exception if commit or adding the image to the case failed
*/
private void commitImage(WizardDescriptor settings) throws Exception {
String[] imgPaths = (String[]) settings.getProperty(AddImageAction.IMGPATHS_PROP);
String timezone = settings.getProperty(AddImageAction.TIMEZONE_PROP).toString();
boolean indexImage = (Boolean) settings.getProperty(AddImageAction.SOLR_PROP);
AddImageProcess process = (AddImageProcess) settings.getProperty(PROCESS_PROP);
try {
long imageId = process.commit();
Image newImage = Case.getCurrentCase().addImage(imgPaths, imageId, timezone);
if (indexImage) {
// Must use a Lookup here to prevent a circular dependency
// between Case and KeywordSearch...
Lookup.getDefault().lookup(IndexImageTask.class).runTask(newImage);
}
} finally {
// Can't bail and revert image add after commit, so disable image cleanup
// task
CleanupTask cleanupImage = (CleanupTask) settings.getProperty(IMAGECLEANUPTASK_PROP);
cleanupImage.disable();
}
}
/**
* Closes the current dialog and wizard, and opens a new one. Used in the
* "Add another image" action on the last panel
@ -192,19 +150,6 @@ public final class AddImageAction extends CallableSystemAction implements Presen
void runTask(Image newImage);
}
/**
* Closes the current dialog and wizard and indexes the newly added image.
* Used in the "Index for keyword search" action on the last panel
*/
public void indexImage() {
// Simulate clicking finish for the current dialog
wizardDescriptor.setValue(WizardDescriptor.FINISH_OPTION);
wizardDescriptor.putProperty(SOLR_PROP, true);
dialog.setVisible(false);
}
/**
* This method does nothing. Use the "actionPerformed(ActionEvent e)" instead of this method.
*/

View File

@ -23,6 +23,16 @@
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="imgPathLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="imgPathTextField" max="32767" attributes="1"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="imgPathBrowserButton" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="lookupFilesCheckBox" min="-2" max="-2" attributes="0"/>
<Component id="imgTypeLabel" alignment="0" min="-2" max="-2" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="10" pref="10" max="10" attributes="0"/>
@ -33,13 +43,6 @@
</Group>
</Group>
<Component id="multipleSelectLabel" alignment="0" min="-2" max="-2" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<Component id="imgPathLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="imgPathTextField" pref="415" max="32767" attributes="1"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="imgPathBrowserButton" min="-2" max="-2" attributes="0"/>
</Group>
<Component id="imgInfoLabel" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="jLabel1" alignment="0" min="-2" max="-2" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
@ -47,6 +50,14 @@
<EmptySpace min="-2" pref="10" max="-2" attributes="0"/>
<Component id="timeZoneComboBox" min="-2" pref="315" max="-2" attributes="0"/>
</Group>
<Component id="indexImageCheckbox" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="1" attributes="0">
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
<Component id="jLabel2" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
@ -73,12 +84,18 @@
</Group>
<EmptySpace max="-2" attributes="0"/>
<Component id="multipleSelectLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Group type="103" groupAlignment="1" attributes="0">
<Component id="timeZoneLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="timeZoneComboBox" min="-2" max="-2" attributes="0"/>
<Component id="timeZoneLabel" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace pref="26" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="lookupFilesCheckBox" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="indexImageCheckbox" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="jLabel2" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
</Group>
@ -201,5 +218,26 @@
</Property>
</Properties>
</Component>
<Component class="javax.swing.JCheckBox" name="lookupFilesCheckBox">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/casemodule/Bundle.properties" key="AddImageVisualPanel1.lookupFilesCheckBox.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel2">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/casemodule/Bundle.properties" key="AddImageVisualPanel1.jLabel2.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JCheckBox" name="indexImageCheckbox">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/casemodule/Bundle.properties" key="AddImageVisualPanel1.indexImageCheckbox.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
</SubComponents>
</Form>

View File

@ -23,6 +23,7 @@ import java.io.File;
import java.util.Calendar;
import java.util.SimpleTimeZone;
import java.util.TimeZone;
import javax.swing.JCheckBox;
import javax.swing.event.DocumentEvent;
import javax.swing.filechooser.FileFilter;
import javax.swing.JFileChooser;
@ -108,6 +109,22 @@ final class AddImageVisualPanel1 extends JPanel implements DocumentListener {
return this.imgPathTextField;
}
public JCheckBox getLookupFilesCheckbox() {
return this.lookupFilesCheckBox;
}
public Boolean getLookupFilesCheckboxChecked() {
return this.lookupFilesCheckBox.isSelected();
}
public JCheckBox getIndexImageCheckbox() {
return this.indexImageCheckbox;
}
public Boolean getIndexImageCheckboxChecked() {
return this.indexImageCheckbox.isSelected();
}
/**
* Gets the type of the image that's selected.
*
@ -201,6 +218,9 @@ final class AddImageVisualPanel1 extends JPanel implements DocumentListener {
jLabel1 = new javax.swing.JLabel();
timeZoneComboBox = new javax.swing.JComboBox();
timeZoneLabel = new javax.swing.JLabel();
lookupFilesCheckBox = new javax.swing.JCheckBox();
jLabel2 = new javax.swing.JLabel();
indexImageCheckbox = new javax.swing.JCheckBox();
org.openide.awt.Mnemonics.setLocalizedText(rawSingle, org.openide.util.NbBundle.getMessage(AddImageVisualPanel1.class, "AddImageVisualPanel1.rawSingle.text")); // NOI18N
rawSingle.setRequestFocusEnabled(false);
@ -241,7 +261,7 @@ final class AddImageVisualPanel1 extends JPanel implements DocumentListener {
}
});
imgInfoLabel.setFont(new java.awt.Font("Tahoma", 1, 14));
imgInfoLabel.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(imgInfoLabel, org.openide.util.NbBundle.getMessage(AddImageVisualPanel1.class, "AddImageVisualPanel1.imgInfoLabel.text")); // NOI18N
jLabel1.setForeground(new java.awt.Color(255, 0, 51));
@ -251,6 +271,12 @@ final class AddImageVisualPanel1 extends JPanel implements DocumentListener {
org.openide.awt.Mnemonics.setLocalizedText(timeZoneLabel, org.openide.util.NbBundle.getMessage(AddImageVisualPanel1.class, "AddImageVisualPanel1.timeZoneLabel.text")); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(lookupFilesCheckBox, org.openide.util.NbBundle.getMessage(AddImageVisualPanel1.class, "AddImageVisualPanel1.lookupFilesCheckBox.text")); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(jLabel2, org.openide.util.NbBundle.getMessage(AddImageVisualPanel1.class, "AddImageVisualPanel1.jLabel2.text")); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(indexImageCheckbox, org.openide.util.NbBundle.getMessage(AddImageVisualPanel1.class, "AddImageVisualPanel1.indexImageCheckbox.text")); // NOI18N
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
@ -258,6 +284,15 @@ final class AddImageVisualPanel1 extends JPanel implements DocumentListener {
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(imgPathLabel)
.addGap(18, 18, 18)
.addComponent(imgPathTextField)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(imgPathBrowserButton))
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(lookupFilesCheckBox)
.addComponent(imgTypeLabel)
.addGroup(layout.createSequentialGroup()
.addGap(10, 10, 10)
@ -266,18 +301,17 @@ final class AddImageVisualPanel1 extends JPanel implements DocumentListener {
.addComponent(rawSingle)
.addComponent(encase)))
.addComponent(multipleSelectLabel)
.addGroup(layout.createSequentialGroup()
.addComponent(imgPathLabel)
.addGap(18, 18, 18)
.addComponent(imgPathTextField, javax.swing.GroupLayout.DEFAULT_SIZE, 415, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(imgPathBrowserButton))
.addComponent(imgInfoLabel)
.addComponent(jLabel1)
.addGroup(layout.createSequentialGroup()
.addComponent(timeZoneLabel)
.addGap(10, 10, 10)
.addComponent(timeZoneComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 315, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addComponent(timeZoneComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 315, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(indexImageCheckbox))
.addGap(0, 0, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap())
);
layout.setVerticalGroup(
@ -300,11 +334,17 @@ final class AddImageVisualPanel1 extends JPanel implements DocumentListener {
.addComponent(imgPathBrowserButton))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(multipleSelectLabel)
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(timeZoneLabel)
.addComponent(timeZoneComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 26, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(timeZoneComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(timeZoneLabel))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(lookupFilesCheckBox)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(indexImageCheckbox)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel1)
.addContainerGap())
);
@ -399,7 +439,10 @@ final class AddImageVisualPanel1 extends JPanel implements DocumentListener {
private javax.swing.JLabel imgPathLabel;
private static javax.swing.JTextField imgPathTextField;
private javax.swing.JLabel imgTypeLabel;
private javax.swing.JCheckBox indexImageCheckbox;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JCheckBox lookupFilesCheckBox;
private javax.swing.JLabel multipleSelectLabel;
private static javax.swing.JRadioButton rawSingle;
private javax.swing.JRadioButton rawSplit;

View File

@ -1,4 +1,4 @@
<?xml version="1.1" encoding="UTF-8" ?>
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<AuxValues>
@ -19,21 +19,16 @@
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="crDbLabel" alignment="0" min="-2" max="-2" attributes="0"/>
<Group type="102" alignment="1" attributes="0">
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="crDbButton" min="-2" max="-2" attributes="0"/>
<EmptySpace min="189" pref="189" max="189" attributes="0"/>
</Group>
<Component id="jLabel5" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="crDbProgressBar" alignment="0" pref="292" max="32767" attributes="1"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Component id="progressLabel" pref="272" max="32767" attributes="0"/>
</Group>
<Component id="crDbLabel" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="jLabel1" alignment="0" min="-2" pref="552" max="-2" attributes="1"/>
<Component id="lookupFilesCheckBox" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="jLabel5" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
<Component id="crDbProgressBar" alignment="0" pref="568" max="32767" attributes="1"/>
<Component id="progressLabel" alignment="0" pref="568" max="32767" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
@ -46,22 +41,12 @@
<Component id="crDbLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="lookupFilesCheckBox" min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace min="-2" pref="80" max="-2" attributes="0"/>
<Component id="progressLabel" min="-2" pref="12" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="crDbButton" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="30" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="jLabel5" min="-2" pref="14" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="crDbProgressBar" min="-2" pref="24" max="-2" attributes="1"/>
</Group>
</Group>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="progressLabel" min="-2" pref="12" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
@ -94,16 +79,6 @@
</Property>
</Properties>
</Component>
<Component class="javax.swing.JButton" name="crDbButton">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/casemodule/Bundle.properties" key="AddImageVisualPanel2.crDbButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="crDbButtonActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="jLabel1">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
@ -111,12 +86,5 @@
</Property>
</Properties>
</Component>
<Component class="javax.swing.JCheckBox" name="lookupFilesCheckBox">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/casemodule/Bundle.properties" key="AddImageVisualPanel2.lookupFilesCheckBox.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
</SubComponents>
</Form>

View File

@ -48,10 +48,6 @@ final class AddImageVisualPanel2 extends JPanel {
return "Create Database";
}
public JButton getCrDbButton() {
return this.crDbButton;
}
public JProgressBar getCrDbProgressBar() {
return this.crDbProgressBar;
}
@ -60,10 +56,6 @@ final class AddImageVisualPanel2 extends JPanel {
return this.progressLabel;
}
public JCheckBox getLookupFilesCheckbox() {
return this.lookupFilesCheckBox;
}
/**
* Changes the progress bar text and color.
*
@ -89,28 +81,17 @@ final class AddImageVisualPanel2 extends JPanel {
jLabel5 = new javax.swing.JLabel();
crDbLabel = new javax.swing.JLabel();
progressLabel = new javax.swing.JLabel();
crDbButton = new javax.swing.JButton();
jLabel1 = new javax.swing.JLabel();
lookupFilesCheckBox = new javax.swing.JCheckBox();
org.openide.awt.Mnemonics.setLocalizedText(jLabel5, org.openide.util.NbBundle.getMessage(AddImageVisualPanel2.class, "AddImageVisualPanel2.jLabel5.text")); // NOI18N
crDbLabel.setFont(new java.awt.Font("Tahoma", 1, 14));
crDbLabel.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(crDbLabel, org.openide.util.NbBundle.getMessage(AddImageVisualPanel2.class, "AddImageVisualPanel2.crDbLabel.text")); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(progressLabel, org.openide.util.NbBundle.getMessage(AddImageVisualPanel2.class, "AddImageVisualPanel2.progressLabel.text")); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(crDbButton, org.openide.util.NbBundle.getMessage(AddImageVisualPanel2.class, "AddImageVisualPanel2.crDbButton.text")); // NOI18N
crDbButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
crDbButtonActionPerformed(evt);
}
});
org.openide.awt.Mnemonics.setLocalizedText(jLabel1, org.openide.util.NbBundle.getMessage(AddImageVisualPanel2.class, "AddImageVisualPanel2.jLabel1.text")); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(lookupFilesCheckBox, org.openide.util.NbBundle.getMessage(AddImageVisualPanel2.class, "AddImageVisualPanel2.lookupFilesCheckBox.text")); // NOI18N
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
@ -121,20 +102,12 @@ final class AddImageVisualPanel2 extends JPanel {
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(crDbLabel)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(crDbButton)
.addGap(189, 189, 189))
.addComponent(jLabel5)
.addComponent(crDbProgressBar, javax.swing.GroupLayout.DEFAULT_SIZE, 292, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(progressLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 272, Short.MAX_VALUE))
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 552, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 552, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel5))
.addGap(0, 0, Short.MAX_VALUE))
.addComponent(crDbProgressBar, javax.swing.GroupLayout.DEFAULT_SIZE, 568, Short.MAX_VALUE)
.addComponent(progressLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 568, Short.MAX_VALUE))
.addContainerGap())
.addGroup(layout.createSequentialGroup()
.addComponent(lookupFilesCheckBox)
.addContainerGap(407, Short.MAX_VALUE))))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
@ -143,39 +116,21 @@ final class AddImageVisualPanel2 extends JPanel {
.addComponent(crDbLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(lookupFilesCheckBox)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(80, 80, 80)
.addComponent(progressLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 12, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(crDbButton)
.addGap(30, 30, 30)
.addGap(18, 18, 18)
.addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(crDbProgressBar, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(18, 18, 18)
.addComponent(crDbProgressBar, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(progressLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 12, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
}// </editor-fold>//GEN-END:initComponents
/**
* When the "Create Database" button is press. It starts the database
* creation process, disables the "Create Database" and "Back" button, and
* sets the progress bar text.
*
* @param evt the action event
*/
private void crDbButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_crDbButtonActionPerformed
}//GEN-LAST:event_crDbButtonActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton crDbButton;
private javax.swing.JLabel crDbLabel;
private javax.swing.JProgressBar crDbProgressBar;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel5;
private javax.swing.JCheckBox lookupFilesCheckBox;
private javax.swing.JLabel progressLabel;
// End of variables declaration//GEN-END:variables
}

View File

@ -1,4 +1,4 @@
<?xml version="1.1" encoding="UTF-8" ?>
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.4" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<AuxValues>
@ -18,30 +18,13 @@
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="crDbLabel" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="jLabel1" alignment="0" min="-2" pref="549" max="-2" attributes="0"/>
<Component id="addImgButton" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="jLabel2" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="418" max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="indexImgButton" alignment="0" min="-2" max="-2" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<Component id="addImgButton" min="-2" max="-2" attributes="0"/>
<EmptySpace min="64" pref="64" max="64" attributes="0"/>
</Group>
</Group>
<EmptySpace pref="368" max="32767" attributes="0"/>
</Group>
</Group>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
@ -51,13 +34,9 @@
<Component id="crDbLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jLabel2" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="addImgButton" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="indexImgButton" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<EmptySpace pref="31" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
@ -90,22 +69,5 @@
</Property>
</Properties>
</Component>
<Component class="javax.swing.JButton" name="indexImgButton">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/casemodule/Bundle.properties" key="AddImageVisualPanel3.indexImgButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="indexImgButtonActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="jLabel2">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/casemodule/Bundle.properties" key="AddImageVisualPanel3.jLabel2.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
</SubComponents>
</Form>

View File

@ -57,8 +57,6 @@ final class AddImageVisualPanel3 extends JPanel {
addImgButton = new javax.swing.JButton();
crDbLabel = new javax.swing.JLabel();
jLabel1 = new javax.swing.JLabel();
indexImgButton = new javax.swing.JButton();
jLabel2 = new javax.swing.JLabel();
org.openide.awt.Mnemonics.setLocalizedText(addImgButton, org.openide.util.NbBundle.getMessage(AddImageVisualPanel3.class, "AddImageVisualPanel3.addImgButton.text")); // NOI18N
addImgButton.addActionListener(new java.awt.event.ActionListener() {
@ -72,37 +70,17 @@ final class AddImageVisualPanel3 extends JPanel {
org.openide.awt.Mnemonics.setLocalizedText(jLabel1, org.openide.util.NbBundle.getMessage(AddImageVisualPanel3.class, "AddImageVisualPanel3.jLabel1.text")); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(indexImgButton, org.openide.util.NbBundle.getMessage(AddImageVisualPanel3.class, "AddImageVisualPanel3.indexImgButton.text")); // NOI18N
indexImgButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
indexImgButtonActionPerformed(evt);
}
});
org.openide.awt.Mnemonics.setLocalizedText(jLabel2, org.openide.util.NbBundle.getMessage(AddImageVisualPanel3.class, "AddImageVisualPanel3.jLabel2.text")); // NOI18N
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()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(crDbLabel)
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 549, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 549, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(addImgButton))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel2)
.addContainerGap(418, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(indexImgButton)
.addGroup(layout.createSequentialGroup()
.addComponent(addImgButton)
.addGap(64, 64, 64)))
.addContainerGap(368, Short.MAX_VALUE))))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
@ -111,13 +89,9 @@ final class AddImageVisualPanel3 extends JPanel {
.addComponent(crDbLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel2)
.addGap(18, 18, 18)
.addComponent(addImgButton)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(indexImgButton)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap(31, Short.MAX_VALUE))
);
}// </editor-fold>//GEN-END:initComponents
@ -132,17 +106,9 @@ final class AddImageVisualPanel3 extends JPanel {
act.restart();
}//GEN-LAST:event_addImgButtonActionPerformed
private void indexImgButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_indexImgButtonActionPerformed
// finish wizard and index image
AddImageAction act = Lookup.getDefault().lookup(AddImageAction.class);
act.indexImage();
}//GEN-LAST:event_indexImgButtonActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton addImgButton;
private javax.swing.JLabel crDbLabel;
private javax.swing.JButton indexImgButton;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
// End of variables declaration//GEN-END:variables
}

View File

@ -151,6 +151,8 @@ class AddImageWizardIterator implements WizardDescriptor.Iterator<WizardDescript
if (!hasPrevious()) {
throw new NoSuchElementException();
}
if(index == 2)
index--;
index--;
}

View File

@ -22,15 +22,23 @@ package org.sleuthkit.autopsy.casemodule;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.io.File;
import java.io.IOException;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JCheckBox;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import org.openide.WizardDescriptor;
import org.openide.util.HelpCtx;
import org.openide.util.Lookup;
import org.sleuthkit.autopsy.coreutils.AutopsyPropFile;
import org.sleuthkit.autopsy.coreutils.Log;
import org.sleuthkit.autopsy.hashdatabase.HashDbSettings;
import org.sleuthkit.datamodel.SleuthkitJNI;
import org.sleuthkit.datamodel.SleuthkitJNI.CaseDbHandle.AddImageProcess;
/**
* The "Add Image" wizard panel1 handling the logic of selecting image file(s)
@ -45,6 +53,8 @@ class AddImageWizardPanel1 implements WizardDescriptor.Panel<WizardDescriptor>,
private AddImageVisualPanel1 component;
private boolean isNextEnable = false;
private static final String PROP_LASTIMAGE = "LBL_LastImage_PATH";
// paths to any set hash lookup databases (can be null)
private String NSRLPath, knownBadPath;
/**
* Get the visual component for the panel. In this template, the component
@ -162,8 +172,38 @@ class AddImageWizardPanel1 implements WizardDescriptor.Panel<WizardDescriptor>,
@Override
public void readSettings(WizardDescriptor settings) {
AddImageVisualPanel1 component = getComponent();
// Prepopulate the image directory from the properties file
String lastImageDirectory = AutopsyPropFile.getInstance().getProperty(PROP_LASTIMAGE);
component.getImagePathTextField().setText(lastImageDirectory);
// Load hash database settings, enable or disable the checkbox
this.NSRLPath = null;
this.knownBadPath = null;
try {
HashDbSettings hashDbs = HashDbSettings.getHashDbSettings();
this.NSRLPath = hashDbs.getNSRLDatabasePath();
this.knownBadPath = hashDbs.getKnownBadDatabasePath();
} catch (IOException ex) {
Log.get(AddImageWizardPanel1.class).log(Level.WARNING, "Couldn't get hash database settings.", ex);
}
JCheckBox lookupFilesCheckbox = component.getLookupFilesCheckbox();
lookupFilesCheckbox.setSelected(false);
lookupFilesCheckbox.setEnabled(this.NSRLPath != null || this.knownBadPath != null);
// If there is a process object in the settings, revert it and remove it from the settings
AddImageAction.CleanupTask cleanupTask = (AddImageAction.CleanupTask) settings.getProperty(AddImageAction.IMAGECLEANUPTASK_PROP);
if(cleanupTask != null){
try{
cleanupTask.cleanup();
}catch(Exception ex){
Logger logger = Logger.getLogger(AddImageWizardPanel1.class.getName());
logger.log(Level.WARNING, "Error cleaning up image task", ex);
}finally{
settings.putProperty(AddImageAction.IMAGECLEANUPTASK_PROP, null);
}
}
}
/**
@ -179,6 +219,10 @@ class AddImageWizardPanel1 implements WizardDescriptor.Panel<WizardDescriptor>,
public void storeSettings(WizardDescriptor settings) {
settings.putProperty(AddImageAction.IMGPATHS_PROP, getComponent().getImagePaths());
settings.putProperty(AddImageAction.TIMEZONE_PROP, getComponent().getSelectedTimezone()); // store the timezone
settings.putProperty(AddImageAction.LOOKUPFILES_PROP, getComponent().getLookupFilesCheckboxChecked());
settings.putProperty(AddImageAction.SOLR_PROP, getComponent().getIndexImageCheckboxChecked());
// Store the path to the first image selected into the properties file
String firstImage = getComponent().getImagePaths()[0];
String firstImagePath = firstImage.substring(0, firstImage.lastIndexOf(File.separator)+1);
AutopsyPropFile.getInstance().setProperty(PROP_LASTIMAGE, firstImagePath);

View File

@ -57,6 +57,8 @@ class AddImageWizardPanel2 implements WizardDescriptor.Panel<WizardDescriptor> {
// paths to any set hash lookup databases (can be null)
private String NSRLPath, knownBadPath;
private boolean lookupFilesCheckboxChecked;
// task that will clean up the created database file if the wizard is cancelled before it finishes
private AddImageAction.CleanupTask cleanupImage; // initialized to null in readSettings()
@ -89,7 +91,6 @@ class AddImageWizardPanel2 implements WizardDescriptor.Panel<WizardDescriptor> {
public AddImageVisualPanel2 getComponent() {
if (component == null) {
component = new AddImageVisualPanel2();
component.getCrDbButton().addActionListener(new CrDbButtonListener());
}
return component;
}
@ -122,20 +123,11 @@ class AddImageWizardPanel2 implements WizardDescriptor.Panel<WizardDescriptor> {
return imgAdded;
}
class CrDbButtonListener implements ActionListener {
@Override
public void actionPerformed(ActionEvent e) {
startAddImage();
}
}
/**
* Creates the database and adds the image to the XML configuration file.
*
*/
private void startAddImage() {
component.getCrDbButton().setEnabled(false);
component.getCrDbProgressBar().setIndeterminate(true);
component.changeProgressBarTextAndColor("*Adding the image may take some time for large images.", 0, Color.black);
@ -207,38 +199,11 @@ class AddImageWizardPanel2 implements WizardDescriptor.Panel<WizardDescriptor> {
imgAdded = false;
imgPaths = (String[]) settings.getProperty(AddImageAction.IMGPATHS_PROP);
timeZone = settings.getProperty(AddImageAction.TIMEZONE_PROP).toString();
// If the user went back after the image was processed, it will be replaced so its cleanup task should be executed & removed
AddImageAction.CleanupTask oldImageCleanup = (AddImageAction.CleanupTask) settings.getProperty(AddImageAction.IMAGECLEANUPTASK_PROP);
if (oldImageCleanup != null) {
try {
oldImageCleanup.cleanup();
} catch (Exception ex) {
Logger logger = Logger.getLogger(AddImageWizardPanel2.class.getName());
logger.log(Level.WARNING, "Error removing previously added image", ex);
} finally {
oldImageCleanup.disable();
}
}
lookupFilesCheckboxChecked = (Boolean) settings.getProperty(AddImageAction.LOOKUPFILES_PROP);
component.changeProgressBarTextAndColor("", 0, Color.black);
component.getCrDbButton().setEnabled(true);
// Load hash database settings
this.NSRLPath = null;
this.knownBadPath = null;
try {
HashDbSettings hashDbs = HashDbSettings.getHashDbSettings();
this.NSRLPath = hashDbs.getNSRLDatabasePath();
this.knownBadPath = hashDbs.getKnownBadDatabasePath();
} catch (IOException ex) {
Log.get(AddImageWizardPanel2.class).log(Level.WARNING, "Couldn't get hash database settings.", ex);
}
JCheckBox lookupFilesCheckbox = component.getLookupFilesCheckbox();
lookupFilesCheckbox.setSelected(false);
lookupFilesCheckbox.setEnabled(this.NSRLPath != null || this.knownBadPath != null);
startAddImage();
}
/**
@ -262,7 +227,6 @@ class AddImageWizardPanel2 implements WizardDescriptor.Panel<WizardDescriptor> {
*/
private class AddImgTask extends SwingWorker<Integer, Integer> {
private JProgressBar progressBar;
private JCheckBox lookupFilesCheckbox;
private Case currentCase;
// true if the process was requested to stop
@ -270,7 +234,6 @@ class AddImageWizardPanel2 implements WizardDescriptor.Panel<WizardDescriptor> {
protected AddImgTask() {
this.progressBar = getComponent().getCrDbProgressBar();
this.lookupFilesCheckbox = getComponent().getLookupFilesCheckbox();
currentCase = Case.getCurrentCase();
}
@ -296,7 +259,7 @@ class AddImageWizardPanel2 implements WizardDescriptor.Panel<WizardDescriptor> {
SleuthkitCase skCase = currentCase.getSleuthkitCase();
skCase.clearLookupDatabases();
if (lookupFilesCheckbox.isSelected()) {
if (lookupFilesCheckboxChecked) {
if (NSRLPath != null) {
skCase.setNSRLDatabase(NSRLPath);
}

View File

@ -20,9 +20,14 @@
package org.sleuthkit.autopsy.casemodule;
import java.awt.Component;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.event.ChangeListener;
import org.openide.WizardDescriptor;
import org.openide.util.HelpCtx;
import org.openide.util.Lookup;
import org.sleuthkit.datamodel.Image;
import org.sleuthkit.datamodel.SleuthkitJNI;
/**
* The "Add Image" wizard panel3. No major functionality, just presents the
@ -140,6 +145,19 @@ class AddImageWizardPanel3 implements WizardDescriptor.Panel<WizardDescriptor> {
*/
@Override
public void readSettings(WizardDescriptor settings) {
if ((SleuthkitJNI.CaseDbHandle.AddImageProcess) settings.getProperty(AddImageAction.PROCESS_PROP) != null) {
// commit anything
try {
commitImage(settings);
} catch (Exception ex) {
// Log error/display warning
Logger logger = Logger.getLogger(AddImageAction.class.getName());
logger.log(Level.SEVERE, "Error adding image to case.", ex);
}
}else{
Logger logger = Logger.getLogger(AddImageAction.class.getName());
logger.log(Level.SEVERE, "Missing image process object");
}
}
/**
@ -153,5 +171,40 @@ class AddImageWizardPanel3 implements WizardDescriptor.Panel<WizardDescriptor> {
*/
@Override
public void storeSettings(WizardDescriptor settings) {
// Cancel all cleanup tasks
settings.putProperty(AddImageAction.IMAGECLEANUPTASK_PROP, null);
}
/**
* Commit the finished AddImageProcess, and cancel the CleanupTask that
* would have reverted it.
* @param settings property set to get AddImageProcess and CleanupTask from
* @throws Exception if commit or adding the image to the case failed
*/
private void commitImage(WizardDescriptor settings) throws Exception {
String[] imgPaths = (String[]) settings.getProperty(AddImageAction.IMGPATHS_PROP);
String timezone = settings.getProperty(AddImageAction.TIMEZONE_PROP).toString();
boolean indexImage = (Boolean) settings.getProperty(AddImageAction.SOLR_PROP);
SleuthkitJNI.CaseDbHandle.AddImageProcess process = (SleuthkitJNI.CaseDbHandle.AddImageProcess) settings.getProperty(AddImageAction.PROCESS_PROP);
try {
long imageId = process.commit();
Image newImage = Case.getCurrentCase().addImage(imgPaths, imageId, timezone);
if (indexImage) {
// Must use a Lookup here to prevent a circular dependency
// between Case and KeywordSearch...
Lookup.getDefault().lookup(AddImageAction.IndexImageTask.class).runTask(newImage);
}
} finally {
// Can't bail and revert image add after commit, so disable image cleanup
// task
AddImageAction.CleanupTask cleanupImage = (AddImageAction.CleanupTask) settings.getProperty(AddImageAction.IMAGECLEANUPTASK_PROP);
cleanupImage.disable();
}
}
}

View File

@ -90,12 +90,11 @@ OpenRecentCasePanel.jLabel1.text=Recent Cases
AddImageVisualPanel1.imgInfoLabel.text=Enter Disk Image Information:
AddImageVisualPanel2.crDbLabel.text=Adding Image
AddImageVisualPanel2.jLabel5.text=Processing Image and Adding to Database :
AddImageVisualPanel2.crDbButton.text=Process Image
AddImageVisualPanel2.progressLabel.text=
AddImageVisualPanel2.jLabel1.text=<html> We will now analyze the disk image to extract volume and file system data and populate a local database. This may <br>take a while on large images. </html>
AddImageVisualPanel3.addImgButton.text=Add Another Image
AddImageVisualPanel3.crDbLabel.text=Finish or Add More Images
AddImageVisualPanel3.jLabel1.text=Image successfully processed and added to the case. You can add another image, index the one you just
AddImageVisualPanel3.jLabel1.text=Image successfully processed and added to the case. You can add another image or return to the case.
AddImageVisualPanel1.jLabel1.text=
AddImageVisualPanel1.timeZoneLabel.text=Please select your timezone:
AddImageVisualPanel1.rawSingle.text=Raw Single (*.img, *.dd, etc)
@ -112,7 +111,7 @@ NewJPanel.jLabel5.text=The NSRL index is used to idenify "known" files.
NewJPanel.jFormattedTextField1.text=jFormattedTextField1
NewJPanel.jButton1.text=Rename
NewJPanel.jLabel4.text=Database:
AddImageVisualPanel2.lookupFilesCheckBox.text=Lookup files in hash databases
AddImageVisualPanel2.indexImageCheckBox.text=Index image for keyword search
AddImageVisualPanel3.indexImgButton.text=Index Image for Keyword Search
AddImageVisualPanel3.jLabel2.text=added, or return to the case.
AddImageVisualPanel1.lookupFilesCheckBox.text=Lookup files in hash databases
AddImageVisualPanel1.jLabel2.text=<html> Press 'Next' to analyze the disk image to extract volume and file system data and populate a local database. This may <br>take a while on large images. </html>
AddImageVisualPanel1.indexImageCheckbox.text=Index Image for Keyword Search