mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-17 10:17:41 +00:00
Importing dialog cancellation done
This commit is contained in:
parent
6694b05551
commit
d9b605af50
@ -489,7 +489,7 @@ final public class ImportCentralRepoDatabaseDialog extends javax.swing.JDialog {
|
||||
private void okButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_okButtonActionPerformed
|
||||
// Note that the error handlers in this method call return without disposing of the
|
||||
// dialog to allow the user to try again, if desired.
|
||||
String selectedFilePath = tfFilePath.getText();
|
||||
/*String selectedFilePath = tfFilePath.getText();
|
||||
|
||||
// have valid file path
|
||||
if (selectedFilePath.isEmpty()) {
|
||||
@ -517,7 +517,7 @@ final public class ImportCentralRepoDatabaseDialog extends javax.swing.JDialog {
|
||||
|
||||
} finally {
|
||||
dispose();
|
||||
}
|
||||
}*/
|
||||
/*
|
||||
// create global set
|
||||
int globalSetID;
|
||||
|
@ -242,7 +242,13 @@ ImportHashDatabaseDialog.tfDatabaseName.tooltip=Name for this database
|
||||
ImportHashDatabaseDialog.tfDatabaseVersion.tooltip.text=Database Version Number
|
||||
ImportHashDatabaseDialog.tfDatabaseName.tooltip=Name for this database
|
||||
ImportHashDatabaseDialog.tfDatabaseVersion.tooltip.text=Database Version Number
|
||||
ImportCentralRepoDbProgressDialog.jButton1.text=jButton1
|
||||
ImportCentralRepoDbProgressDialog.lbProgress.text=jLabel1
|
||||
ImportCentralRepoDbProgressDialog.lbProgress.text=Starting import...
|
||||
ImportCentralRepoDbProgressDialog.bnOk.text=OK
|
||||
ImportCentralRepoDbProgressDialog.bnCancel.text=Cancel
|
||||
HashLookupSettingsPanel.versionLabel.text_1=Version:
|
||||
HashLookupSettingsPanel.hashDbVersionLabel.text_1=No database selected
|
||||
HashLookupSettingsPanel.orgLabel.text_1=Organization:
|
||||
HashLookupSettingsPanel.hashDbOrgLabel.text_1=No database selected
|
||||
HashLookupSettingsPanel.readOnlyLabel.text_1=Read only:
|
||||
HashLookupSettingsPanel.hashDbReadOnlyLabel.text_1=No database selected
|
||||
ImportCentralRepoDbProgressDialog.jLabel1.text=Importing hash set into the central repository
|
||||
|
@ -329,7 +329,7 @@ public class HashDbManager implements PropertyChangeListener {
|
||||
return db;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
public CentralRepoHashDb importCentralRepoHashSet(String hashSetName, String version, int orgId,
|
||||
boolean searchDuringIngest, boolean sendIngestMessages, HashDb.KnownFilesType knownFilesType,
|
||||
String importFile) throws TskCoreException {
|
||||
@ -415,7 +415,7 @@ public class HashDbManager implements PropertyChangeListener {
|
||||
ex.printStackTrace();
|
||||
throw new TskCoreException(ex.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
synchronized void indexHashDatabase(HashDb hashDb) {
|
||||
hashDb.addPropertyChangeListener(this);
|
||||
@ -703,7 +703,8 @@ public class HashDbManager implements PropertyChangeListener {
|
||||
allDatabasesLoadedCorrectly = false;
|
||||
}
|
||||
} else {
|
||||
addExistingCentralRepoHashSet(hashDbInfo.getHashSetName(), hashDbInfo.getVersion(), hashDbInfo.getCentralRepoIndex(),
|
||||
addExistingCentralRepoHashSet(hashDbInfo.getHashSetName(), hashDbInfo.getVersion(),
|
||||
hashDbInfo.getCentralRepoIndex(),
|
||||
hashDbInfo.getSearchDuringIngest(), hashDbInfo.getSendIngestMessages(), hashDbInfo.getKnownFilesType());
|
||||
}
|
||||
} catch (TskCoreException ex) {
|
||||
@ -1168,6 +1169,7 @@ public class HashDbManager implements PropertyChangeListener {
|
||||
private final HashDb.KnownFilesType knownFilesType;
|
||||
private final int centralRepoIndex;
|
||||
private final String version;
|
||||
private final String orgName = "";
|
||||
private final PropertyChangeSupport propertyChangeSupport = new PropertyChangeSupport(this);
|
||||
|
||||
private CentralRepoHashDb(String hashSetName, String version, int centralRepoIndex,
|
||||
@ -1215,6 +1217,10 @@ public class HashDbManager implements PropertyChangeListener {
|
||||
return version;
|
||||
}
|
||||
|
||||
public String getOrgName(){
|
||||
return "org name";
|
||||
}
|
||||
|
||||
public int getCentralRepoIndex(){
|
||||
return centralRepoIndex;
|
||||
}
|
||||
|
@ -307,6 +307,7 @@ final class HashLookupSettings implements Serializable {
|
||||
private final boolean sendIngestMessages;
|
||||
private final String path;
|
||||
private final String version;
|
||||
private final String orgName;
|
||||
private final int centralRepoIndex;
|
||||
private DatabaseType dbType;
|
||||
|
||||
@ -328,12 +329,14 @@ final class HashLookupSettings implements Serializable {
|
||||
this.path = path;
|
||||
this.centralRepoIndex = -1;
|
||||
this.version = "";
|
||||
this.orgName = "";
|
||||
this.dbType = DatabaseType.FILE;
|
||||
}
|
||||
|
||||
HashDbInfo(String hashSetName, String version, int centralRepoIndex, HashDbManager.HashDb.KnownFilesType knownFilesType, boolean searchDuringIngest, boolean sendIngestMessages){
|
||||
HashDbInfo(String hashSetName, String version, String orgName, int centralRepoIndex, HashDbManager.HashDb.KnownFilesType knownFilesType, boolean searchDuringIngest, boolean sendIngestMessages){
|
||||
this.hashSetName = hashSetName;
|
||||
this.version = version;
|
||||
this.orgName = orgName;
|
||||
this.centralRepoIndex = centralRepoIndex;
|
||||
this.knownFilesType = knownFilesType;
|
||||
this.searchDuringIngest = searchDuringIngest;
|
||||
@ -351,6 +354,7 @@ final class HashLookupSettings implements Serializable {
|
||||
this.sendIngestMessages = fileTypeDb.getSendIngestMessages();
|
||||
this.centralRepoIndex = -1;
|
||||
this.version = "";
|
||||
this.orgName = "";
|
||||
this.dbType = DatabaseType.FILE;
|
||||
if (fileTypeDb.hasIndexOnly()) {
|
||||
this.path = fileTypeDb.getIndexPath();
|
||||
@ -361,6 +365,7 @@ final class HashLookupSettings implements Serializable {
|
||||
HashDbManager.CentralRepoHashDb centralRepoDb = (HashDbManager.CentralRepoHashDb)db;
|
||||
this.hashSetName = centralRepoDb.getHashSetName();
|
||||
this.version = centralRepoDb.getVersion();
|
||||
this.orgName = centralRepoDb.getOrgName();
|
||||
this.knownFilesType = centralRepoDb.getKnownFilesType();
|
||||
this.searchDuringIngest = centralRepoDb.getSearchDuringIngest();
|
||||
this.sendIngestMessages = centralRepoDb.getSendIngestMessages();
|
||||
@ -388,6 +393,14 @@ final class HashLookupSettings implements Serializable {
|
||||
String getVersion(){
|
||||
return version;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the organization name for the hash set
|
||||
* @return org name
|
||||
*/
|
||||
String getOrgName(){
|
||||
return orgName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the known files type setting.
|
||||
|
@ -94,7 +94,7 @@
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace min="1" pref="1" max="-2" attributes="0"/>
|
||||
<Component id="jScrollPane1" min="-2" pref="395" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="informationLabel" max="32767" attributes="0"/>
|
||||
@ -102,29 +102,24 @@
|
||||
</Group>
|
||||
<Group type="102" attributes="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<Component id="optionsLabel" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="optionsSeparator" min="-2" pref="334" max="-2" 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" alignment="0" attributes="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="locationLabel" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="indexButton" alignment="0" min="-2" pref="120" max="-2" attributes="0"/>
|
||||
<Component id="typeLabel" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="indexLabel" alignment="0" min="-2" pref="66" max="-2" attributes="0"/>
|
||||
<Component id="indexPathLabelLabel" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="versionLabel" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="orgLabel" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="readOnlyLabel" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace min="10" pref="10" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="55" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="hashDbTypeLabel" min="-2" pref="225" max="-2" attributes="0"/>
|
||||
<Component id="hashDbLocationLabel" alignment="0" min="-2" pref="225" max="-2" attributes="0"/>
|
||||
<Component id="indexPathLabel" min="-2" pref="225" max="-2" attributes="0"/>
|
||||
<Component id="hashDbIndexStatusLabel" alignment="0" min="-2" pref="225" max="-2" attributes="0"/>
|
||||
<Component id="addHashesToDatabaseButton" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="hashDbVersionLabel" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="hashDbOrgLabel" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="hashDbReadOnlyLabel" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
@ -132,25 +127,48 @@
|
||||
<EmptySpace min="-2" pref="53" max="-2" attributes="0"/>
|
||||
<Component id="hashDbNameLabel" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="indexLabel" alignment="0" min="-2" pref="66" max="-2" attributes="0"/>
|
||||
<Component id="indexPathLabelLabel" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace min="-2" pref="64" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="1" attributes="0">
|
||||
<Component id="indexPathLabel" min="-2" pref="225" max="-2" attributes="0"/>
|
||||
<Component id="hashDbIndexStatusLabel" min="-2" pref="225" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="indexButton" min="-2" pref="120" max="-2" attributes="0"/>
|
||||
<EmptySpace min="10" pref="10" max="-2" attributes="0"/>
|
||||
<Component id="addHashesToDatabaseButton" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</Group>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace min="-2" pref="70" max="-2" attributes="0"/>
|
||||
<Component id="informationSeparator" min="-2" pref="305" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace min="-2" pref="25" max="-2" attributes="0"/>
|
||||
<Component id="sendIngestMessagesCheckBox" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace min="-2" pref="10" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="ingestWarningLabel" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jButton1" min="-2" pref="148" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<Component id="optionsLabel" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="optionsSeparator" min="-2" pref="334" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace min="-2" pref="25" max="-2" attributes="0"/>
|
||||
<Component id="sendIngestMessagesCheckBox" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace min="-2" pref="10" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="ingestWarningLabel" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jButton1" min="-2" pref="148" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</Group>
|
||||
</Group>
|
||||
<EmptySpace min="-2" pref="50" max="-2" attributes="0"/>
|
||||
<EmptySpace min="50" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</Group>
|
||||
@ -202,6 +220,21 @@
|
||||
<Component id="hashDbLocationLabel" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="versionLabel" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="hashDbVersionLabel" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="orgLabel" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="hashDbOrgLabel" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace min="-2" pref="7" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="readOnlyLabel" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="hashDbReadOnlyLabel" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="indexPathLabelLabel" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="indexPathLabel" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
@ -211,12 +244,12 @@
|
||||
<Component id="indexLabel" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="hashDbIndexStatusLabel" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="indexButton" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="addHashesToDatabaseButton" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace type="separate" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="optionsLabel" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="optionsSeparator" alignment="1" min="-2" max="-2" attributes="0"/>
|
||||
@ -597,6 +630,48 @@
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton1ActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="versionLabel">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="org/sleuthkit/autopsy/modules/hashdatabase/Bundle.properties" key="HashLookupSettingsPanel.versionLabel.text_1" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="hashDbVersionLabel">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="org/sleuthkit/autopsy/modules/hashdatabase/Bundle.properties" key="HashLookupSettingsPanel.hashDbVersionLabel.text_1" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="orgLabel">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="org/sleuthkit/autopsy/modules/hashdatabase/Bundle.properties" key="HashLookupSettingsPanel.orgLabel.text_1" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="hashDbOrgLabel">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="org/sleuthkit/autopsy/modules/hashdatabase/Bundle.properties" key="HashLookupSettingsPanel.hashDbOrgLabel.text_1" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="readOnlyLabel">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="org/sleuthkit/autopsy/modules/hashdatabase/Bundle.properties" key="HashLookupSettingsPanel.readOnlyLabel.text_1" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="hashDbReadOnlyLabel">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="org/sleuthkit/autopsy/modules/hashdatabase/Bundle.properties" key="HashLookupSettingsPanel.hashDbReadOnlyLabel.text_1" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
|
@ -27,6 +27,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JTable;
|
||||
import javax.swing.ListSelectionModel;
|
||||
@ -45,6 +46,7 @@ import org.sleuthkit.autopsy.events.AutopsyEvent;
|
||||
import org.sleuthkit.autopsy.ingest.IngestManager;
|
||||
import org.sleuthkit.autopsy.ingest.IngestModuleGlobalSettingsPanel;
|
||||
import org.sleuthkit.autopsy.modules.hashdatabase.HashDbManager.HashDb;
|
||||
import org.sleuthkit.autopsy.modules.hashdatabase.HashDbManager.CentralRepoHashDb;
|
||||
import org.sleuthkit.autopsy.modules.hashdatabase.HashDbManager.HashDb.KnownFilesType;
|
||||
import org.sleuthkit.datamodel.TskCoreException;
|
||||
import org.sleuthkit.autopsy.modules.hashdatabase.HashDbManager.HashDatabase;
|
||||
@ -120,7 +122,11 @@ public final class HashLookupSettingsPanel extends IngestModuleGlobalSettingsPan
|
||||
hashDbNameLabel.setText(NO_SELECTION_TEXT);
|
||||
hashDbTypeLabel.setText(NO_SELECTION_TEXT);
|
||||
hashDbLocationLabel.setText(NO_SELECTION_TEXT);
|
||||
hashDbVersionLabel.setText(NO_SELECTION_TEXT);
|
||||
hashDbOrgLabel.setText(NO_SELECTION_TEXT);
|
||||
hashDbReadOnlyLabel.setText(NO_SELECTION_TEXT);
|
||||
indexPathLabel.setText(NO_SELECTION_TEXT);
|
||||
|
||||
|
||||
// Update indexing components.
|
||||
hashDbIndexStatusLabel.setText(NO_SELECTION_TEXT);
|
||||
@ -144,18 +150,26 @@ public final class HashLookupSettingsPanel extends IngestModuleGlobalSettingsPan
|
||||
ingestWarningLabel.setVisible(ingestIsRunning);
|
||||
}
|
||||
|
||||
@NbBundle.Messages({"HashLookupSettingsPanel.readOnly=Read only",
|
||||
"HashLookupSettingsPanel.editable=Editable",
|
||||
"HashLookupSettingsPanel.updateStatusError=Error reading status",
|
||||
"HashLookupSettingsPanel.notApplicable=N/A",
|
||||
"HashLookupSettingsPanel.centralRepo=Central Repository"
|
||||
})
|
||||
private void updateComponentsForSelection(HashDatabase db) {
|
||||
boolean ingestIsRunning = IngestManager.getInstance().isIngestRunning();
|
||||
|
||||
// Update descriptive labels.
|
||||
hashDbNameLabel.setText(db.getHashSetName());
|
||||
hashDbTypeLabel.setText(db.getKnownFilesType().getDisplayName());
|
||||
|
||||
try {
|
||||
hashDbLocationLabel.setText(shortenPath(db.getDatabasePath()));
|
||||
} catch (TskCoreException ex) {
|
||||
Logger.getLogger(HashLookupSettingsPanel.class.getName()).log(Level.SEVERE, "Error getting database path of " + db.getHashSetName() + " hash database", ex); //NON-NLS
|
||||
hashDbLocationLabel.setText(ERROR_GETTING_PATH_TEXT);
|
||||
hashDbTypeLabel.setText(db.getKnownFilesType().getDisplayName());
|
||||
try{
|
||||
if(db.isUpdateable()){
|
||||
hashDbReadOnlyLabel.setText(Bundle.HashLookupSettingsPanel_editable());
|
||||
} else {
|
||||
hashDbReadOnlyLabel.setText(Bundle.HashLookupSettingsPanel_readOnly());
|
||||
}
|
||||
} catch (TskCoreException ex){
|
||||
hashDbReadOnlyLabel.setText(Bundle.HashLookupSettingsPanel_updateStatusError());
|
||||
}
|
||||
|
||||
try {
|
||||
@ -167,6 +181,21 @@ public final class HashLookupSettingsPanel extends IngestModuleGlobalSettingsPan
|
||||
|
||||
if(db instanceof HashDb){
|
||||
HashDb hashDb = (HashDb)db;
|
||||
|
||||
// Disable the central repo fields
|
||||
hashDbVersionLabel.setText(Bundle.HashLookupSettingsPanel_notApplicable());
|
||||
hashDbOrgLabel.setText(Bundle.HashLookupSettingsPanel_notApplicable());
|
||||
|
||||
// Enable the delete button if ingest is not running
|
||||
deleteDatabaseButton.setEnabled(!ingestIsRunning);
|
||||
|
||||
try {
|
||||
hashDbLocationLabel.setText(shortenPath(db.getDatabasePath()));
|
||||
} catch (TskCoreException ex) {
|
||||
Logger.getLogger(HashLookupSettingsPanel.class.getName()).log(Level.SEVERE, "Error getting database path of " + db.getHashSetName() + " hash database", ex); //NON-NLS
|
||||
hashDbLocationLabel.setText(ERROR_GETTING_PATH_TEXT);
|
||||
}
|
||||
|
||||
try {
|
||||
indexPathLabel.setText(shortenPath(hashDb.getIndexPath()));
|
||||
} catch (TskCoreException ex) {
|
||||
@ -214,6 +243,19 @@ public final class HashLookupSettingsPanel extends IngestModuleGlobalSettingsPan
|
||||
indexButton.setText(NbBundle.getMessage(this.getClass(), "HashDbConfigPanel.indexButtonText.index"));
|
||||
indexButton.setEnabled(false);
|
||||
}
|
||||
} else {
|
||||
|
||||
// Disable the file type fields/buttons
|
||||
indexPathLabel.setText(Bundle.HashLookupSettingsPanel_notApplicable());
|
||||
hashDbIndexStatusLabel.setText(Bundle.HashLookupSettingsPanel_notApplicable());
|
||||
hashDbLocationLabel.setText(Bundle.HashLookupSettingsPanel_centralRepo());
|
||||
indexButton.setEnabled(false);
|
||||
deleteDatabaseButton.setEnabled(false);
|
||||
|
||||
CentralRepoHashDb crDb = (CentralRepoHashDb)db;
|
||||
|
||||
hashDbVersionLabel.setText(crDb.getVersion());
|
||||
hashDbOrgLabel.setText(crDb.getOrgName());
|
||||
}
|
||||
|
||||
// Disable the indexing button if ingest is in progress.
|
||||
@ -230,7 +272,6 @@ public final class HashLookupSettingsPanel extends IngestModuleGlobalSettingsPan
|
||||
// Update database action buttons.
|
||||
createDatabaseButton.setEnabled(true);
|
||||
importDatabaseButton.setEnabled(true);
|
||||
deleteDatabaseButton.setEnabled(!ingestIsRunning);
|
||||
|
||||
// Update ingest in progress warning label.
|
||||
ingestWarningLabel.setVisible(ingestIsRunning);
|
||||
@ -380,7 +421,7 @@ public final class HashLookupSettingsPanel extends IngestModuleGlobalSettingsPan
|
||||
// Give the user a visual indication of any hash sets with a hash
|
||||
// database that needs to be indexed by displaying the hash set name
|
||||
// in red.
|
||||
if (hashSetTableModel.indexExists(row)) {
|
||||
if (hashSetTableModel.isValid(row)) {
|
||||
cellRenderer.setForeground(Color.black);
|
||||
} else {
|
||||
cellRenderer.setForeground(Color.red);
|
||||
@ -437,12 +478,9 @@ public final class HashLookupSettingsPanel extends IngestModuleGlobalSettingsPan
|
||||
return hashSets.get(rowIndex).getHashSetName();
|
||||
}
|
||||
|
||||
private boolean indexExists(int rowIndex) {
|
||||
private boolean isValid(int rowIndex) {
|
||||
try {
|
||||
if(hashSets.get(rowIndex) instanceof HashDb){
|
||||
return ((HashDb)(hashSets.get(rowIndex))).hasIndex();
|
||||
}
|
||||
return false;
|
||||
return hashSets.get(rowIndex).isValid();
|
||||
} catch (TskCoreException ex) {
|
||||
Logger.getLogger(HashSetTableModel.class.getName()).log(Level.SEVERE, "Error getting index info for hash database", ex); //NON-NLS
|
||||
return false;
|
||||
@ -541,6 +579,12 @@ public final class HashLookupSettingsPanel extends IngestModuleGlobalSettingsPan
|
||||
indexPathLabel = new javax.swing.JLabel();
|
||||
addHashesToDatabaseButton = new javax.swing.JButton();
|
||||
jButton1 = new javax.swing.JButton();
|
||||
versionLabel = new javax.swing.JLabel();
|
||||
hashDbVersionLabel = new javax.swing.JLabel();
|
||||
orgLabel = new javax.swing.JLabel();
|
||||
hashDbOrgLabel = new javax.swing.JLabel();
|
||||
readOnlyLabel = new javax.swing.JLabel();
|
||||
hashDbReadOnlyLabel = new javax.swing.JLabel();
|
||||
|
||||
jLabel2.setFont(jLabel2.getFont().deriveFont(jLabel2.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
|
||||
org.openide.awt.Mnemonics.setLocalizedText(jLabel2, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.jLabel2.text")); // NOI18N
|
||||
@ -686,6 +730,18 @@ public final class HashLookupSettingsPanel extends IngestModuleGlobalSettingsPan
|
||||
}
|
||||
});
|
||||
|
||||
org.openide.awt.Mnemonics.setLocalizedText(versionLabel, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.versionLabel.text_1")); // NOI18N
|
||||
|
||||
org.openide.awt.Mnemonics.setLocalizedText(hashDbVersionLabel, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.hashDbVersionLabel.text_1")); // NOI18N
|
||||
|
||||
org.openide.awt.Mnemonics.setLocalizedText(orgLabel, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.orgLabel.text_1")); // NOI18N
|
||||
|
||||
org.openide.awt.Mnemonics.setLocalizedText(hashDbOrgLabel, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.hashDbOrgLabel.text_1")); // NOI18N
|
||||
|
||||
org.openide.awt.Mnemonics.setLocalizedText(readOnlyLabel, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.readOnlyLabel.text_1")); // NOI18N
|
||||
|
||||
org.openide.awt.Mnemonics.setLocalizedText(hashDbReadOnlyLabel, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.hashDbReadOnlyLabel.text_1")); // NOI18N
|
||||
|
||||
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
|
||||
jPanel1.setLayout(jPanel1Layout);
|
||||
jPanel1Layout.setHorizontalGroup(
|
||||
@ -703,43 +759,56 @@ public final class HashLookupSettingsPanel extends IngestModuleGlobalSettingsPan
|
||||
.addGap(309, 309, 309))
|
||||
.addGroup(jPanel1Layout.createSequentialGroup()
|
||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
|
||||
.addComponent(optionsLabel)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(optionsSeparator, javax.swing.GroupLayout.PREFERRED_SIZE, 334, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(jPanel1Layout.createSequentialGroup()
|
||||
.addGap(10, 10, 10)
|
||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel1Layout.createSequentialGroup()
|
||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(locationLabel)
|
||||
.addComponent(indexButton, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(typeLabel)
|
||||
.addComponent(indexLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 66, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(indexPathLabelLabel))
|
||||
.addGap(10, 10, 10)
|
||||
.addComponent(versionLabel)
|
||||
.addComponent(orgLabel)
|
||||
.addComponent(readOnlyLabel))
|
||||
.addGap(55, 55, 55)
|
||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(hashDbTypeLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 225, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(hashDbLocationLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 225, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(indexPathLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 225, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(hashDbIndexStatusLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 225, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(addHashesToDatabaseButton)))
|
||||
.addComponent(hashDbVersionLabel)
|
||||
.addComponent(hashDbOrgLabel)
|
||||
.addComponent(hashDbReadOnlyLabel)))
|
||||
.addGroup(jPanel1Layout.createSequentialGroup()
|
||||
.addComponent(nameLabel)
|
||||
.addGap(53, 53, 53)
|
||||
.addComponent(hashDbNameLabel))))
|
||||
.addComponent(hashDbNameLabel))
|
||||
.addGroup(jPanel1Layout.createSequentialGroup()
|
||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(indexLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 66, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(indexPathLabelLabel))
|
||||
.addGap(64, 64, 64)
|
||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addComponent(indexPathLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 225, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(hashDbIndexStatusLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 225, javax.swing.GroupLayout.PREFERRED_SIZE)))
|
||||
.addGroup(jPanel1Layout.createSequentialGroup()
|
||||
.addComponent(indexButton, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(10, 10, 10)
|
||||
.addComponent(addHashesToDatabaseButton))))
|
||||
.addGroup(jPanel1Layout.createSequentialGroup()
|
||||
.addGap(70, 70, 70)
|
||||
.addComponent(informationSeparator, javax.swing.GroupLayout.PREFERRED_SIZE, 305, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(jPanel1Layout.createSequentialGroup()
|
||||
.addGap(25, 25, 25)
|
||||
.addComponent(sendIngestMessagesCheckBox))
|
||||
.addGroup(jPanel1Layout.createSequentialGroup()
|
||||
.addGap(10, 10, 10)
|
||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(ingestWarningLabel)
|
||||
.addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 148, javax.swing.GroupLayout.PREFERRED_SIZE))))
|
||||
.addGap(50, 50, 50))))
|
||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
|
||||
.addComponent(optionsLabel)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(optionsSeparator, javax.swing.GroupLayout.PREFERRED_SIZE, 334, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(jPanel1Layout.createSequentialGroup()
|
||||
.addGap(25, 25, 25)
|
||||
.addComponent(sendIngestMessagesCheckBox))
|
||||
.addGroup(jPanel1Layout.createSequentialGroup()
|
||||
.addGap(10, 10, 10)
|
||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(ingestWarningLabel)
|
||||
.addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 148, javax.swing.GroupLayout.PREFERRED_SIZE)))))
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
|
||||
.addGroup(jPanel1Layout.createSequentialGroup()
|
||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(hashDatabasesLabel)
|
||||
@ -777,6 +846,18 @@ public final class HashLookupSettingsPanel extends IngestModuleGlobalSettingsPan
|
||||
.addComponent(locationLabel)
|
||||
.addComponent(hashDbLocationLabel))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(versionLabel)
|
||||
.addComponent(hashDbVersionLabel))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(orgLabel)
|
||||
.addComponent(hashDbOrgLabel))
|
||||
.addGap(7, 7, 7)
|
||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(readOnlyLabel)
|
||||
.addComponent(hashDbReadOnlyLabel))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(indexPathLabelLabel)
|
||||
.addComponent(indexPathLabel))
|
||||
@ -784,11 +865,11 @@ public final class HashLookupSettingsPanel extends IngestModuleGlobalSettingsPan
|
||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(indexLabel)
|
||||
.addComponent(hashDbIndexStatusLabel))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(indexButton)
|
||||
.addComponent(addHashesToDatabaseButton))
|
||||
.addGap(18, 18, 18)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(optionsLabel)
|
||||
.addComponent(optionsSeparator, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
@ -946,7 +1027,10 @@ public final class HashLookupSettingsPanel extends IngestModuleGlobalSettingsPan
|
||||
private javax.swing.JLabel hashDbIndexStatusLabel;
|
||||
private javax.swing.JLabel hashDbLocationLabel;
|
||||
private javax.swing.JLabel hashDbNameLabel;
|
||||
private javax.swing.JLabel hashDbOrgLabel;
|
||||
private javax.swing.JLabel hashDbReadOnlyLabel;
|
||||
private javax.swing.JLabel hashDbTypeLabel;
|
||||
private javax.swing.JLabel hashDbVersionLabel;
|
||||
private javax.swing.JTable hashSetTable;
|
||||
private javax.swing.JButton importDatabaseButton;
|
||||
private javax.swing.JButton indexButton;
|
||||
@ -968,7 +1052,10 @@ public final class HashLookupSettingsPanel extends IngestModuleGlobalSettingsPan
|
||||
private javax.swing.JLabel nameLabel;
|
||||
private javax.swing.JLabel optionsLabel;
|
||||
private javax.swing.JSeparator optionsSeparator;
|
||||
private javax.swing.JLabel orgLabel;
|
||||
private javax.swing.JLabel readOnlyLabel;
|
||||
private javax.swing.JCheckBox sendIngestMessagesCheckBox;
|
||||
private javax.swing.JLabel typeLabel;
|
||||
private javax.swing.JLabel versionLabel;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
}
|
||||
|
@ -24,49 +24,45 @@
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace min="-2" pref="27" max="-2" 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="jButton1" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="progressBar" min="-2" pref="346" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace pref="27" max="32767" attributes="0"/>
|
||||
<Group type="102" attributes="0">
|
||||
<Component id="progressBar" max="32767" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="lbProgress" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
<Component id="bnOk" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace type="separate" max="-2" attributes="0"/>
|
||||
<Component id="bnCancel" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="24" max="-2" attributes="0"/>
|
||||
<Group type="102" attributes="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="lbProgress" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace min="0" pref="172" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</Group>
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
<Component id="bnOk" min="-2" pref="65" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="bnCancel" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace min="-2" pref="112" max="-2" attributes="0"/>
|
||||
<Component id="progressBar" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="lbProgress" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace pref="89" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="bnOk" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="bnCancel" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace min="-2" pref="72" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||
<Component id="lbProgress" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="progressBar" min="-2" pref="24" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="bnCancel" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="bnOk" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Component id="jButton1" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="42" max="-2" attributes="0"/>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
@ -81,16 +77,6 @@
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="jButton1">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="org/sleuthkit/autopsy/modules/hashdatabase/Bundle.properties" key="ImportCentralRepoDbProgressDialog.jButton1.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton1ActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="bnOk">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
@ -111,5 +97,12 @@
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="bnCancelActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<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/modules/hashdatabase/Bundle.properties" key="ImportCentralRepoDbProgressDialog.jLabel1.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
|
@ -33,12 +33,16 @@ import java.util.logging.Level;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JProgressBar;
|
||||
import javax.swing.SwingWorker;
|
||||
import javax.swing.WindowConstants;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
import java.util.concurrent.Executors;
|
||||
import org.openide.util.NbBundle;
|
||||
import org.openide.windows.WindowManager;
|
||||
import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttribute;
|
||||
import org.sleuthkit.autopsy.centralrepository.datamodel.EamDb;
|
||||
import org.sleuthkit.autopsy.centralrepository.datamodel.EamDbException;
|
||||
import org.sleuthkit.autopsy.centralrepository.datamodel.EamGlobalFileInstance;
|
||||
import org.sleuthkit.autopsy.centralrepository.datamodel.EamOrganization;
|
||||
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||
import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil;
|
||||
import org.sleuthkit.datamodel.TskCoreException;
|
||||
@ -49,9 +53,7 @@ import org.sleuthkit.datamodel.TskData;
|
||||
*/
|
||||
class ImportCentralRepoDbProgressDialog extends javax.swing.JDialog implements PropertyChangeListener{
|
||||
|
||||
|
||||
long totalHashes;
|
||||
private SwingWorker<Void, Void> worker;
|
||||
private CentralRepoImportWorker worker;
|
||||
|
||||
|
||||
/**
|
||||
@ -70,8 +72,14 @@ class ImportCentralRepoDbProgressDialog extends javax.swing.JDialog implements P
|
||||
super((JFrame) WindowManager.getDefault().getMainWindow(),
|
||||
Bundle.ImportCentralRepoDbProgressDialog_title_text(),
|
||||
true);
|
||||
|
||||
initComponents();
|
||||
|
||||
initComponents();
|
||||
customizeComponents();
|
||||
}
|
||||
|
||||
private void customizeComponents(){
|
||||
setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
|
||||
bnOk.setEnabled(false);
|
||||
}
|
||||
|
||||
void importFile(String hashSetName, String version, int orgId,
|
||||
@ -81,8 +89,7 @@ class ImportCentralRepoDbProgressDialog extends javax.swing.JDialog implements P
|
||||
|
||||
File importFile = new File(importFileName);
|
||||
worker = new ImportIDXWorker(hashSetName, version, orgId, searchDuringIngest, sendIngestMessages,
|
||||
knownFilesType, importFile, totalHashes);
|
||||
totalHashes = ((ImportIDXWorker)worker).getEstimatedTotalHashes();
|
||||
knownFilesType, importFile);
|
||||
worker.addPropertyChangeListener(this);
|
||||
worker.execute();
|
||||
|
||||
@ -91,16 +98,16 @@ class ImportCentralRepoDbProgressDialog extends javax.swing.JDialog implements P
|
||||
this.setVisible(true);
|
||||
}
|
||||
|
||||
@NbBundle.Messages({"ImportCentralRepoDbProgressDialog.linesProcessed= lines processed"})
|
||||
@Override
|
||||
public void propertyChange(PropertyChangeEvent evt) {
|
||||
System.out.println("### Evt type: " + evt.getPropertyName());
|
||||
System.out.println(" newValue: " + evt.getNewValue().toString());
|
||||
System.out.println("### Setting progress to " + worker.getProgress());
|
||||
System.out.println("### Setting progress to " + worker.getProgressPercentage());
|
||||
|
||||
if("progress".equals(evt.getPropertyName())){
|
||||
progressBar.setValue(worker.getProgress());
|
||||
String mes = "Count: " + worker.getProgress();
|
||||
lbProgress.setText(mes);
|
||||
progressBar.setValue(worker.getProgressPercentage());
|
||||
lbProgress.setText(getProgressString());
|
||||
} else if ("state".equals(evt.getPropertyName())
|
||||
&& (SwingWorker.StateValue.DONE.equals(evt.getNewValue()))) {
|
||||
// Disable cancel and enable ok
|
||||
@ -108,12 +115,24 @@ class ImportCentralRepoDbProgressDialog extends javax.swing.JDialog implements P
|
||||
bnOk.setEnabled(true);
|
||||
|
||||
progressBar.setValue(progressBar.getMaximum());
|
||||
String mes = "Count: " + worker.getProgress();
|
||||
lbProgress.setText(mes);
|
||||
lbProgress.setText(getProgressString());
|
||||
}
|
||||
}
|
||||
|
||||
class ImportIDXWorker extends SwingWorker<Void, Void>{
|
||||
private String getProgressString(){
|
||||
return worker.getLinesProcessed() + Bundle.ImportCentralRepoDbProgressDialog_linesProcessed();
|
||||
}
|
||||
|
||||
private interface CentralRepoImportWorker{
|
||||
|
||||
void execute();
|
||||
boolean cancel(boolean mayInterruptIfRunning);
|
||||
void addPropertyChangeListener(PropertyChangeListener dialog);
|
||||
int getProgressPercentage();
|
||||
long getLinesProcessed();
|
||||
}
|
||||
|
||||
class ImportIDXWorker extends SwingWorker<Void,Void> implements CentralRepoImportWorker{
|
||||
|
||||
private final int HASH_IMPORT_THRESHOLD = 10000;
|
||||
private final String hashSetName;
|
||||
@ -125,10 +144,11 @@ class ImportCentralRepoDbProgressDialog extends javax.swing.JDialog implements P
|
||||
private final File importFile;
|
||||
private final long totalLines;
|
||||
private int crIndex = -1;
|
||||
private AtomicLong numLines = new AtomicLong();
|
||||
|
||||
ImportIDXWorker(String hashSetName, String version, int orgId,
|
||||
boolean searchDuringIngest, boolean sendIngestMessages, HashDbManager.HashDb.KnownFilesType knownFilesType,
|
||||
File importFile, long totalLines){
|
||||
File importFile){
|
||||
|
||||
this.hashSetName = hashSetName;
|
||||
this.version = version;
|
||||
@ -137,7 +157,9 @@ class ImportCentralRepoDbProgressDialog extends javax.swing.JDialog implements P
|
||||
this.sendIngestMessages = sendIngestMessages;
|
||||
this.knownFilesType = knownFilesType;
|
||||
this.importFile = importFile;
|
||||
this.totalLines = totalLines;
|
||||
this.numLines.set(0);
|
||||
|
||||
this.totalLines = getEstimatedTotalHashes();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -146,11 +168,31 @@ class ImportCentralRepoDbProgressDialog extends javax.swing.JDialog implements P
|
||||
* progress bar.
|
||||
* @return Approximate number of hashes in the file
|
||||
*/
|
||||
long getEstimatedTotalHashes(){
|
||||
final long getEstimatedTotalHashes(){
|
||||
long fileSize = importFile.length();
|
||||
return (fileSize / 0x33); // IDX file lines are generally 0x33 bytes long
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getLinesProcessed(){
|
||||
return numLines.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getProgressPercentage(){
|
||||
return this.getProgress();
|
||||
}
|
||||
|
||||
//@Override
|
||||
//public void addPropertyChangeListener(PropertyChangeListener dialog){
|
||||
// super.addPropertyChangeListener(dialog);
|
||||
//}
|
||||
|
||||
//@Override
|
||||
//public void run(){
|
||||
// this.execute();
|
||||
//}
|
||||
|
||||
@Override
|
||||
protected Void doInBackground() throws Exception {
|
||||
|
||||
@ -176,8 +218,10 @@ class ImportCentralRepoDbProgressDialog extends javax.swing.JDialog implements P
|
||||
String line;
|
||||
Set<EamGlobalFileInstance> globalInstances = new HashSet<>();
|
||||
|
||||
long numLines = 0;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
if(isCancelled()){
|
||||
return null;
|
||||
}
|
||||
|
||||
String[] parts = line.split("\\|");
|
||||
|
||||
@ -193,13 +237,13 @@ class ImportCentralRepoDbProgressDialog extends javax.swing.JDialog implements P
|
||||
"");
|
||||
|
||||
globalInstances.add(eamGlobalFileInstance);
|
||||
numLines++;
|
||||
numLines.incrementAndGet();
|
||||
|
||||
if(numLines % HASH_IMPORT_THRESHOLD == 0){
|
||||
if(numLines.get() % HASH_IMPORT_THRESHOLD == 0){
|
||||
dbManager.bulkInsertReferenceTypeEntries(globalInstances, contentType);
|
||||
globalInstances.clear();
|
||||
|
||||
int progress = (int)(numLines * 100 / totalLines);
|
||||
int progress = (int)(numLines.get() * 100 / totalLines);
|
||||
if(progress < 100){
|
||||
this.setProgress(progress);
|
||||
} else {
|
||||
@ -218,28 +262,40 @@ class ImportCentralRepoDbProgressDialog extends javax.swing.JDialog implements P
|
||||
ex.printStackTrace();
|
||||
throw new TskCoreException(ex.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private void deleteIncompleteSet(int crIndex){
|
||||
if(crIndex >= 0){
|
||||
System.out.println("Deleting incomplete reference set");
|
||||
|
||||
// This can be slow on large reference sets
|
||||
Executors.newSingleThreadExecutor().execute(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try{
|
||||
EamDb.getInstance().deleteReferenceSet(crIndex);
|
||||
} catch (EamDbException ex2){
|
||||
|
||||
|
||||
// Let any external listeners know that there's a new set
|
||||
//try {
|
||||
// changeSupport.firePropertyChange(HashDbManager.SetEvt.DB_ADDED.toString(), null, hashSetName);
|
||||
//} catch (Exception e) {
|
||||
// logger.log(Level.SEVERE, "HashDbManager listener threw exception", e); //NON-NLS
|
||||
// MessageNotifyUtil.Notify.show(
|
||||
// NbBundle.getMessage(this.getClass(), "HashDbManager.moduleErr"),
|
||||
// NbBundle.getMessage(this.getClass(), "HashDbManager.moduleErrorListeningToUpdatesMsg"),
|
||||
// MessageNotifyUtil.MessageType.ERROR);
|
||||
//}
|
||||
//return hashDb;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void done() {
|
||||
if(isCancelled()){
|
||||
// If the user hit cancel, delete this incomplete hash set from the central repo
|
||||
deleteIncompleteSet(crIndex);
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
get();
|
||||
try{
|
||||
System.out.println("### Finished - adding hashDb object");
|
||||
HashDbManager.CentralRepoHashDb hashDb = HashDbManager.getInstance().addExistingCentralRepoHashSet(hashSetName, version, crIndex,
|
||||
HashDbManager.CentralRepoHashDb hashDb = HashDbManager.getInstance().addExistingCentralRepoHashSet(hashSetName, version,
|
||||
crIndex,
|
||||
searchDuringIngest, sendIngestMessages, knownFilesType);
|
||||
} catch (TskCoreException ex){
|
||||
System.out.println("\n### Error!");
|
||||
@ -248,7 +304,7 @@ class ImportCentralRepoDbProgressDialog extends javax.swing.JDialog implements P
|
||||
|
||||
System.out.println("\n### Interrupted!");
|
||||
|
||||
// If the user hit cancel, delete this incomplete hash set from the central repo
|
||||
// Delete this incomplete hash set from the central repo
|
||||
if(crIndex >= 0){
|
||||
try{
|
||||
EamDb.getInstance().deleteReferenceSet(crIndex);
|
||||
@ -257,7 +313,12 @@ class ImportCentralRepoDbProgressDialog extends javax.swing.JDialog implements P
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//@Override
|
||||
//public boolean cancel(boolean mayInterruptIfRunning) {
|
||||
// throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
|
||||
//}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -271,21 +332,14 @@ class ImportCentralRepoDbProgressDialog extends javax.swing.JDialog implements P
|
||||
|
||||
progressBar = new javax.swing.JProgressBar();
|
||||
lbProgress = new javax.swing.JLabel();
|
||||
jButton1 = new javax.swing.JButton();
|
||||
bnOk = new javax.swing.JButton();
|
||||
bnCancel = new javax.swing.JButton();
|
||||
jLabel1 = new javax.swing.JLabel();
|
||||
|
||||
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
|
||||
|
||||
org.openide.awt.Mnemonics.setLocalizedText(lbProgress, org.openide.util.NbBundle.getMessage(ImportCentralRepoDbProgressDialog.class, "ImportCentralRepoDbProgressDialog.lbProgress.text")); // NOI18N
|
||||
|
||||
org.openide.awt.Mnemonics.setLocalizedText(jButton1, org.openide.util.NbBundle.getMessage(ImportCentralRepoDbProgressDialog.class, "ImportCentralRepoDbProgressDialog.jButton1.text")); // NOI18N
|
||||
jButton1.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
jButton1ActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
org.openide.awt.Mnemonics.setLocalizedText(bnOk, org.openide.util.NbBundle.getMessage(ImportCentralRepoDbProgressDialog.class, "ImportCentralRepoDbProgressDialog.bnOk.text")); // NOI18N
|
||||
bnOk.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
@ -300,55 +354,52 @@ class ImportCentralRepoDbProgressDialog extends javax.swing.JDialog implements P
|
||||
}
|
||||
});
|
||||
|
||||
org.openide.awt.Mnemonics.setLocalizedText(jLabel1, org.openide.util.NbBundle.getMessage(ImportCentralRepoDbProgressDialog.class, "ImportCentralRepoDbProgressDialog.jLabel1.text")); // NOI18N
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
||||
getContentPane().setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGap(27, 27, 27)
|
||||
.addContainerGap()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jButton1)
|
||||
.addComponent(progressBar, javax.swing.GroupLayout.PREFERRED_SIZE, 346, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addContainerGap(27, Short.MAX_VALUE))
|
||||
.addComponent(progressBar, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addContainerGap())
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(lbProgress)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(bnOk)
|
||||
.addGap(18, 18, 18)
|
||||
.addComponent(bnCancel)
|
||||
.addGap(24, 24, 24))))
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jLabel1)
|
||||
.addComponent(lbProgress))
|
||||
.addGap(0, 172, Short.MAX_VALUE))))
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(bnOk, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(bnCancel)
|
||||
.addContainerGap())
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGap(112, 112, 112)
|
||||
.addComponent(progressBar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(lbProgress)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 89, Short.MAX_VALUE))
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(bnOk)
|
||||
.addComponent(bnCancel))
|
||||
.addGap(72, 72, 72)))
|
||||
.addComponent(jButton1)
|
||||
.addGap(42, 42, 42))
|
||||
.addContainerGap()
|
||||
.addComponent(jLabel1)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addComponent(lbProgress)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(progressBar, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(bnCancel)
|
||||
.addComponent(bnOk))
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
);
|
||||
|
||||
pack();
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
|
||||
this.dispose();
|
||||
}//GEN-LAST:event_jButton1ActionPerformed
|
||||
|
||||
private void bnCancelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bnCancelActionPerformed
|
||||
this.worker.cancel(true);
|
||||
this.dispose();
|
||||
}//GEN-LAST:event_bnCancelActionPerformed
|
||||
|
||||
private void bnOkActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bnOkActionPerformed
|
||||
@ -359,7 +410,7 @@ class ImportCentralRepoDbProgressDialog extends javax.swing.JDialog implements P
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JButton bnCancel;
|
||||
private javax.swing.JButton bnOk;
|
||||
private javax.swing.JButton jButton1;
|
||||
private javax.swing.JLabel jLabel1;
|
||||
private javax.swing.JLabel lbProgress;
|
||||
private javax.swing.JProgressBar progressBar;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
|
Loading…
x
Reference in New Issue
Block a user