mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-15 09:17:42 +00:00
Commit version of file types manager with fine grained-control, simpler will be better
This commit is contained in:
parent
bc251c7cce
commit
a75ebe8028
@ -1,5 +1,4 @@
|
||||
OpenIDE-Module-Name=FileTypeId
|
||||
FileTypeIdModuleSettingsPanel.skipKnownCheckBox.toolTipText=Depending on how many files have known hashes, checking this box will improve the speed of file type identification.
|
||||
FileTypeIdIngestModule.moduleName.text=File Type Identification
|
||||
FileTypeIdIngestModule.moduleDesc.text=Matches file types based on binary signatures.
|
||||
FileTypeIdIngestModule.complete.totalProcTime=Total Processing Time
|
||||
@ -7,17 +6,18 @@ FileTypeIdIngestModule.complete.totalFiles=Total Files Processed
|
||||
FileTypeIdIngestModule.complete.srvMsg.text=File Type Id Results
|
||||
FileTypeIdModuleFactory.getIngestJobSettingsPanel.exception.msg=Expected settings argument to be instanceof FileTypeIdModuleSettings
|
||||
FileTypeIdModuleFactory.createFileIngestModule.exception.msg=Expected settings argument to be instanceof FileTypeIdModuleSettings
|
||||
FileTypeIdModuleSettingsPanel.skipKnownCheckBox.text=Skip known files (NSRL)
|
||||
FileTypeIdSettingsPanel.mimeTypeTextField.text=
|
||||
FileTypeIdSettingsPanel.mimeTypeLabel.text=Mime Type
|
||||
FileTypeIdSettingsPanel.signatureTypeLabel.text=Signature Type
|
||||
FileTypeIdSettingsPanel.signatureLabel.text=Signature
|
||||
FileTypeIdSettingsPanel.offsetLabel.text=Offset
|
||||
FileTypeIdSettingsPanel.offsetTextField.text=
|
||||
FileTypeIdSettingsPanel.hexPrefixLabel.text=0x
|
||||
FileTypeIdSettingsPanel.jTextArea1.text=Enter a MIME type and signature to be used to identify files of that type. If the signature is a byte sequence, enter the sequence using two hex values for each byte, e.g., EEF0 is a two byte signature.
|
||||
FileTypeIdSettingsPanel.postHitCheckBox.text=Post interesting file hit when found
|
||||
FileTypeIdSettingsPanel.newTypeButton.text=New Type
|
||||
FileTypeIdSettingsPanel.deleteTypeButton.text=DeleteType
|
||||
FileTypeIdSettingsPanel.saveTypeButton.text=Save Type
|
||||
FileTypeIdSettingsPanel.signatureTextField.text=
|
||||
FileTypeIdIngestJobSettingsPanel.skipKnownCheckBox.toolTipText=Depending on how many files have known hashes, checking this box will improve the speed of file type identification.
|
||||
FileTypeIdIngestJobSettingsPanel.skipKnownCheckBox.text=Skip known files (NSRL)
|
||||
FileTypeIdGlobalSettingsPanel.hexPrefixLabel.text=0x
|
||||
FileTypeIdGlobalSettingsPanel.saveTypeButton.text=Save Type
|
||||
FileTypeIdGlobalSettingsPanel.deleteTypeButton.text=DeleteType
|
||||
FileTypeIdGlobalSettingsPanel.newTypeButton.text=New Type
|
||||
FileTypeIdGlobalSettingsPanel.offsetTextField.text=
|
||||
FileTypeIdGlobalSettingsPanel.offsetLabel.text=Offset
|
||||
FileTypeIdGlobalSettingsPanel.postHitCheckBox.text=Post interesting file hit when found
|
||||
FileTypeIdGlobalSettingsPanel.signatureTextField.text=
|
||||
FileTypeIdGlobalSettingsPanel.jTextArea1.text=Enter a MIME type and signature to be used to identify files of that type. If the signature is a byte sequence, enter the sequence using two hex values for each byte, e.g., EEF0 is a two byte signature.
|
||||
FileTypeIdGlobalSettingsPanel.signatureTypeLabel.text=Signature Type
|
||||
FileTypeIdGlobalSettingsPanel.mimeTypeTextField.text=
|
||||
FileTypeIdGlobalSettingsPanel.signatureLabel.text=Signature
|
||||
FileTypeIdGlobalSettingsPanel.mimeTypeLabel.text=Mime Type
|
||||
|
@ -1,10 +1,10 @@
|
||||
OpenIDE-Module-Name=\u30D5\u30A1\u30A4\u30EB\u30BF\u30A4\u30D7\u306E\u7279\u5B9A
|
||||
FileTypeIdModuleSettingsPanel.skipKnownCheckBox.toolTipText=\u65E2\u77E5\u306E\u30CF\u30C3\u30B7\u30E5\u5024\u3092\u6301\u3064\u30D5\u30A1\u30A4\u30EB\u6570\u306B\u3088\u3063\u3066\u306F\u3001\u3053\u306E\u30DC\u30C3\u30AF\u30B9\u3092\u9078\u629E\u3059\u308B\u306E\u306B\u3088\u308A\u3001\u30D5\u30A1\u30A4\u30EB\u30BF\u30A4\u30D7\u306E\u7279\u5B9A\u3092\u52A0\u901F\u3057\u307E\u3059\u3002
|
||||
FileTypeIdIngestModule.moduleName.text=\u30D5\u30A1\u30A4\u30EB\u30BF\u30A4\u30D7\u306E\u7279\u5B9A
|
||||
FileTypeIdIngestModule.moduleDesc.text=\u30D0\u30A4\u30CA\u30EA\u7F72\u540D\u306B\u57FA\u3065\u3044\u3066\u30D5\u30A1\u30A4\u30EB\u30BF\u30A4\u30D7\u3092\u4E00\u81F4\u3059\u308B\u3002
|
||||
FileTypeIdIngestModule.complete.totalProcTime=\u5408\u8A08\u51E6\u7406\u6642\u9593
|
||||
FileTypeIdIngestModule.complete.totalFiles=\u5408\u8A08\u51E6\u7406\u30D5\u30A1\u30A4\u30EB\u6570
|
||||
FileTypeIdIngestModule.complete.srvMsg.text=\u30D5\u30A1\u30A4\u30EB\u30BF\u30A4\u30D7\u7279\u5B9A\u306E\u7D50\u679C
|
||||
FileTypeIdModuleSettingsPanel.skipKnownCheckBox.text=\u65E2\u77E5\u30D5\u30A1\u30A4\u30EB\uFF08NSRL\uFF09\u3092\u30B9\u30AD\u30C3\u30D7
|
||||
FileTypeIdModuleFactory.getIngestJobSettingsPanel.exception.msg=\u8A2D\u5B9A\u3092\u884C\u3046\u70BA\u306E\u60F3\u5B9A\u3055\u308C\u308B\u5F15\u6570\u306Finstanceof FileTypeIdModuleSettings\u3067\u3059\u3002
|
||||
FileTypeIdModuleFactory.createFileIngestModule.exception.msg=\u8A2D\u5B9A\u3092\u884C\u3046\u70BA\u306E\u60F3\u5B9A\u3055\u308C\u308B\u5F15\u6570\u306Finstanceof FileTypeIdModuleSettings\u3067\u3059\u3002
|
||||
OpenIDE-Module-Name=\u30d5\u30a1\u30a4\u30eb\u30bf\u30a4\u30d7\u306e\u7279\u5b9a
|
||||
FileTypeIdIngestModule.moduleName.text=\u30d5\u30a1\u30a4\u30eb\u30bf\u30a4\u30d7\u306e\u7279\u5b9a
|
||||
FileTypeIdIngestModule.moduleDesc.text=\u30d0\u30a4\u30ca\u30ea\u7f72\u540d\u306b\u57fa\u3065\u3044\u3066\u30d5\u30a1\u30a4\u30eb\u30bf\u30a4\u30d7\u3092\u4e00\u81f4\u3059\u308b\u3002
|
||||
FileTypeIdIngestModule.complete.totalProcTime=\u5408\u8a08\u51e6\u7406\u6642\u9593
|
||||
FileTypeIdIngestModule.complete.totalFiles=\u5408\u8a08\u51e6\u7406\u30d5\u30a1\u30a4\u30eb\u6570
|
||||
FileTypeIdIngestModule.complete.srvMsg.text=\u30d5\u30a1\u30a4\u30eb\u30bf\u30a4\u30d7\u7279\u5b9a\u306e\u7d50\u679c
|
||||
FileTypeIdModuleFactory.getIngestJobSettingsPanel.exception.msg=\u8a2d\u5b9a\u3092\u884c\u3046\u70ba\u306e\u60f3\u5b9a\u3055\u308c\u308b\u5f15\u6570\u306finstanceof FileTypeIdModuleSettings\u3067\u3059\u3002
|
||||
FileTypeIdModuleFactory.createFileIngestModule.exception.msg=\u8a2d\u5b9a\u3092\u884c\u3046\u70ba\u306e\u60f3\u5b9a\u3055\u308c\u308b\u5f15\u6570\u306finstanceof FileTypeIdModuleSettings\u3067\u3059\u3002
|
||||
FileTypeIdIngestJobSettingsPanel.skipKnownCheckBox.toolTipText=\u65e2\u77e5\u306e\u30cf\u30c3\u30b7\u30e5\u5024\u3092\u6301\u3064\u30d5\u30a1\u30a4\u30eb\u6570\u306b\u3088\u3063\u3066\u306f\u3001\u3053\u306e\u30dc\u30c3\u30af\u30b9\u3092\u9078\u629e\u3059\u308b\u306e\u306b\u3088\u308a\u3001\u30d5\u30a1\u30a4\u30eb\u30bf\u30a4\u30d7\u306e\u7279\u5b9a\u3092\u52a0\u901f\u3057\u307e\u3059\u3002
|
||||
FileTypeIdIngestJobSettingsPanel.skipKnownCheckBox.text=\u65e2\u77e5\u30d5\u30a1\u30a4\u30eb\uff08NSRL\uff09\u3092\u30b9\u30ad\u30c3\u30d7
|
||||
|
@ -178,70 +178,70 @@
|
||||
<Component class="javax.swing.JLabel" name="mimeTypeLabel">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="org/sleuthkit/autopsy/modules/filetypeid/Bundle.properties" key="FileTypeIdSettingsPanel.mimeTypeLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
<ResourceString bundle="org/sleuthkit/autopsy/modules/filetypeid/Bundle.properties" key="FileTypeIdGlobalSettingsPanel.mimeTypeLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JTextField" name="mimeTypeTextField">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="org/sleuthkit/autopsy/modules/filetypeid/Bundle.properties" key="FileTypeIdSettingsPanel.mimeTypeTextField.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
<ResourceString bundle="org/sleuthkit/autopsy/modules/filetypeid/Bundle.properties" key="FileTypeIdGlobalSettingsPanel.mimeTypeTextField.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="signatureTypeLabel">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="org/sleuthkit/autopsy/modules/filetypeid/Bundle.properties" key="FileTypeIdSettingsPanel.signatureTypeLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
<ResourceString bundle="org/sleuthkit/autopsy/modules/filetypeid/Bundle.properties" key="FileTypeIdGlobalSettingsPanel.signatureTypeLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JTextField" name="signatureTextField">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="org/sleuthkit/autopsy/modules/filetypeid/Bundle.properties" key="FileTypeIdSettingsPanel.signatureTextField.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
<ResourceString bundle="org/sleuthkit/autopsy/modules/filetypeid/Bundle.properties" key="FileTypeIdGlobalSettingsPanel.signatureTextField.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="offsetLabel">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="org/sleuthkit/autopsy/modules/filetypeid/Bundle.properties" key="FileTypeIdSettingsPanel.offsetLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
<ResourceString bundle="org/sleuthkit/autopsy/modules/filetypeid/Bundle.properties" key="FileTypeIdGlobalSettingsPanel.offsetLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JTextField" name="offsetTextField">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="org/sleuthkit/autopsy/modules/filetypeid/Bundle.properties" key="FileTypeIdSettingsPanel.offsetTextField.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
<ResourceString bundle="org/sleuthkit/autopsy/modules/filetypeid/Bundle.properties" key="FileTypeIdGlobalSettingsPanel.offsetTextField.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="newTypeButton">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="org/sleuthkit/autopsy/modules/filetypeid/Bundle.properties" key="FileTypeIdSettingsPanel.newTypeButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
<ResourceString bundle="org/sleuthkit/autopsy/modules/filetypeid/Bundle.properties" key="FileTypeIdGlobalSettingsPanel.newTypeButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="deleteTypeButton">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="org/sleuthkit/autopsy/modules/filetypeid/Bundle.properties" key="FileTypeIdSettingsPanel.deleteTypeButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
<ResourceString bundle="org/sleuthkit/autopsy/modules/filetypeid/Bundle.properties" key="FileTypeIdGlobalSettingsPanel.deleteTypeButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="saveTypeButton">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="org/sleuthkit/autopsy/modules/filetypeid/Bundle.properties" key="FileTypeIdSettingsPanel.saveTypeButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
<ResourceString bundle="org/sleuthkit/autopsy/modules/filetypeid/Bundle.properties" key="FileTypeIdGlobalSettingsPanel.saveTypeButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="hexPrefixLabel">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="org/sleuthkit/autopsy/modules/filetypeid/Bundle.properties" key="FileTypeIdSettingsPanel.hexPrefixLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
<ResourceString bundle="org/sleuthkit/autopsy/modules/filetypeid/Bundle.properties" key="FileTypeIdGlobalSettingsPanel.hexPrefixLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
@ -259,7 +259,7 @@
|
||||
<Component class="javax.swing.JLabel" name="signatureLabel">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="org/sleuthkit/autopsy/modules/filetypeid/Bundle.properties" key="FileTypeIdSettingsPanel.signatureLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
<ResourceString bundle="org/sleuthkit/autopsy/modules/filetypeid/Bundle.properties" key="FileTypeIdGlobalSettingsPanel.signatureLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
@ -280,7 +280,7 @@
|
||||
<Property name="lineWrap" type="boolean" value="true"/>
|
||||
<Property name="rows" type="int" value="5"/>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="org/sleuthkit/autopsy/modules/filetypeid/Bundle.properties" key="FileTypeIdSettingsPanel.jTextArea1.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
<ResourceString bundle="org/sleuthkit/autopsy/modules/filetypeid/Bundle.properties" key="FileTypeIdGlobalSettingsPanel.jTextArea1.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
<Property name="wrapStyleWord" type="boolean" value="true"/>
|
||||
</Properties>
|
||||
@ -290,7 +290,7 @@
|
||||
<Component class="javax.swing.JCheckBox" name="postHitCheckBox">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="org/sleuthkit/autopsy/modules/filetypeid/Bundle.properties" key="FileTypeIdSettingsPanel.postHitCheckBox.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
<ResourceString bundle="org/sleuthkit/autopsy/modules/filetypeid/Bundle.properties" key="FileTypeIdGlobalSettingsPanel.postHitCheckBox.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
@ -30,7 +30,7 @@ import org.sleuthkit.autopsy.modules.filetypeid.UserDefinedFileTypesManager.User
|
||||
/**
|
||||
* A panel to allow a user to make custom file type definitions.
|
||||
*/
|
||||
final class FileTypeIdSettingsPanel extends IngestModuleGlobalSettingsPanel implements OptionsPanel {
|
||||
final class FileTypeIdGlobalSettingsPanel extends IngestModuleGlobalSettingsPanel implements OptionsPanel {
|
||||
|
||||
private final HashMap<String, FileType> fileTypes = new HashMap<>();
|
||||
private final HashMap<String, FileType> changedFileTypes = new HashMap<>();
|
||||
@ -39,7 +39,7 @@ final class FileTypeIdSettingsPanel extends IngestModuleGlobalSettingsPanel impl
|
||||
/**
|
||||
* Creates a panel to allow a user to make custom file type definitions.
|
||||
*/
|
||||
FileTypeIdSettingsPanel() {
|
||||
FileTypeIdGlobalSettingsPanel() {
|
||||
initComponents();
|
||||
}
|
||||
|
||||
@ -139,40 +139,40 @@ final class FileTypeIdSettingsPanel extends IngestModuleGlobalSettingsPanel impl
|
||||
|
||||
jSeparator1.setOrientation(javax.swing.SwingConstants.VERTICAL);
|
||||
|
||||
org.openide.awt.Mnemonics.setLocalizedText(mimeTypeLabel, org.openide.util.NbBundle.getMessage(FileTypeIdSettingsPanel.class, "FileTypeIdSettingsPanel.mimeTypeLabel.text")); // NOI18N
|
||||
org.openide.awt.Mnemonics.setLocalizedText(mimeTypeLabel, org.openide.util.NbBundle.getMessage(FileTypeIdGlobalSettingsPanel.class, "FileTypeIdGlobalSettingsPanel.mimeTypeLabel.text")); // NOI18N
|
||||
|
||||
mimeTypeTextField.setText(org.openide.util.NbBundle.getMessage(FileTypeIdSettingsPanel.class, "FileTypeIdSettingsPanel.mimeTypeTextField.text")); // NOI18N
|
||||
mimeTypeTextField.setText(org.openide.util.NbBundle.getMessage(FileTypeIdGlobalSettingsPanel.class, "FileTypeIdGlobalSettingsPanel.mimeTypeTextField.text")); // NOI18N
|
||||
|
||||
org.openide.awt.Mnemonics.setLocalizedText(signatureTypeLabel, org.openide.util.NbBundle.getMessage(FileTypeIdSettingsPanel.class, "FileTypeIdSettingsPanel.signatureTypeLabel.text")); // NOI18N
|
||||
org.openide.awt.Mnemonics.setLocalizedText(signatureTypeLabel, org.openide.util.NbBundle.getMessage(FileTypeIdGlobalSettingsPanel.class, "FileTypeIdGlobalSettingsPanel.signatureTypeLabel.text")); // NOI18N
|
||||
|
||||
signatureTextField.setText(org.openide.util.NbBundle.getMessage(FileTypeIdSettingsPanel.class, "FileTypeIdSettingsPanel.signatureTextField.text")); // NOI18N
|
||||
signatureTextField.setText(org.openide.util.NbBundle.getMessage(FileTypeIdGlobalSettingsPanel.class, "FileTypeIdGlobalSettingsPanel.signatureTextField.text")); // NOI18N
|
||||
|
||||
org.openide.awt.Mnemonics.setLocalizedText(offsetLabel, org.openide.util.NbBundle.getMessage(FileTypeIdSettingsPanel.class, "FileTypeIdSettingsPanel.offsetLabel.text")); // NOI18N
|
||||
org.openide.awt.Mnemonics.setLocalizedText(offsetLabel, org.openide.util.NbBundle.getMessage(FileTypeIdGlobalSettingsPanel.class, "FileTypeIdGlobalSettingsPanel.offsetLabel.text")); // NOI18N
|
||||
|
||||
offsetTextField.setText(org.openide.util.NbBundle.getMessage(FileTypeIdSettingsPanel.class, "FileTypeIdSettingsPanel.offsetTextField.text")); // NOI18N
|
||||
offsetTextField.setText(org.openide.util.NbBundle.getMessage(FileTypeIdGlobalSettingsPanel.class, "FileTypeIdGlobalSettingsPanel.offsetTextField.text")); // NOI18N
|
||||
|
||||
org.openide.awt.Mnemonics.setLocalizedText(newTypeButton, org.openide.util.NbBundle.getMessage(FileTypeIdSettingsPanel.class, "FileTypeIdSettingsPanel.newTypeButton.text")); // NOI18N
|
||||
org.openide.awt.Mnemonics.setLocalizedText(newTypeButton, org.openide.util.NbBundle.getMessage(FileTypeIdGlobalSettingsPanel.class, "FileTypeIdGlobalSettingsPanel.newTypeButton.text")); // NOI18N
|
||||
|
||||
org.openide.awt.Mnemonics.setLocalizedText(deleteTypeButton, org.openide.util.NbBundle.getMessage(FileTypeIdSettingsPanel.class, "FileTypeIdSettingsPanel.deleteTypeButton.text")); // NOI18N
|
||||
org.openide.awt.Mnemonics.setLocalizedText(deleteTypeButton, org.openide.util.NbBundle.getMessage(FileTypeIdGlobalSettingsPanel.class, "FileTypeIdGlobalSettingsPanel.deleteTypeButton.text")); // NOI18N
|
||||
|
||||
org.openide.awt.Mnemonics.setLocalizedText(saveTypeButton, org.openide.util.NbBundle.getMessage(FileTypeIdSettingsPanel.class, "FileTypeIdSettingsPanel.saveTypeButton.text")); // NOI18N
|
||||
org.openide.awt.Mnemonics.setLocalizedText(saveTypeButton, org.openide.util.NbBundle.getMessage(FileTypeIdGlobalSettingsPanel.class, "FileTypeIdGlobalSettingsPanel.saveTypeButton.text")); // NOI18N
|
||||
|
||||
org.openide.awt.Mnemonics.setLocalizedText(hexPrefixLabel, org.openide.util.NbBundle.getMessage(FileTypeIdSettingsPanel.class, "FileTypeIdSettingsPanel.hexPrefixLabel.text")); // NOI18N
|
||||
org.openide.awt.Mnemonics.setLocalizedText(hexPrefixLabel, org.openide.util.NbBundle.getMessage(FileTypeIdGlobalSettingsPanel.class, "FileTypeIdGlobalSettingsPanel.hexPrefixLabel.text")); // NOI18N
|
||||
|
||||
signatureTypeComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Bytes (Hex)", "String", " " }));
|
||||
|
||||
org.openide.awt.Mnemonics.setLocalizedText(signatureLabel, org.openide.util.NbBundle.getMessage(FileTypeIdSettingsPanel.class, "FileTypeIdSettingsPanel.signatureLabel.text")); // NOI18N
|
||||
org.openide.awt.Mnemonics.setLocalizedText(signatureLabel, org.openide.util.NbBundle.getMessage(FileTypeIdGlobalSettingsPanel.class, "FileTypeIdGlobalSettingsPanel.signatureLabel.text")); // NOI18N
|
||||
|
||||
jTextArea1.setEditable(false);
|
||||
jTextArea1.setColumns(20);
|
||||
jTextArea1.setFont(new java.awt.Font("Tahoma", 0, 11)); // NOI18N
|
||||
jTextArea1.setLineWrap(true);
|
||||
jTextArea1.setRows(5);
|
||||
jTextArea1.setText(org.openide.util.NbBundle.getMessage(FileTypeIdSettingsPanel.class, "FileTypeIdSettingsPanel.jTextArea1.text")); // NOI18N
|
||||
jTextArea1.setText(org.openide.util.NbBundle.getMessage(FileTypeIdGlobalSettingsPanel.class, "FileTypeIdGlobalSettingsPanel.jTextArea1.text")); // NOI18N
|
||||
jTextArea1.setWrapStyleWord(true);
|
||||
jScrollPane2.setViewportView(jTextArea1);
|
||||
|
||||
org.openide.awt.Mnemonics.setLocalizedText(postHitCheckBox, org.openide.util.NbBundle.getMessage(FileTypeIdSettingsPanel.class, "FileTypeIdSettingsPanel.postHitCheckBox.text")); // NOI18N
|
||||
org.openide.awt.Mnemonics.setLocalizedText(postHitCheckBox, org.openide.util.NbBundle.getMessage(FileTypeIdGlobalSettingsPanel.class, "FileTypeIdGlobalSettingsPanel.postHitCheckBox.text")); // NOI18N
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
||||
this.setLayout(layout);
|
@ -38,10 +38,10 @@
|
||||
<Properties>
|
||||
<Property name="selected" type="boolean" value="true"/>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="org/sleuthkit/autopsy/modules/filetypeid/Bundle.properties" key="FileTypeIdModuleSettingsPanel.skipKnownCheckBox.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
<ResourceString bundle="org/sleuthkit/autopsy/modules/filetypeid/Bundle.properties" key="FileTypeIdIngestJobSettingsPanel.skipKnownCheckBox.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
<Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="org/sleuthkit/autopsy/modules/filetypeid/Bundle.properties" key="FileTypeIdModuleSettingsPanel.skipKnownCheckBox.toolTipText" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
<ResourceString bundle="org/sleuthkit/autopsy/modules/filetypeid/Bundle.properties" key="FileTypeIdIngestJobSettingsPanel.skipKnownCheckBox.toolTipText" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Events>
|
@ -25,13 +25,13 @@ import org.sleuthkit.autopsy.ingest.IngestModuleIngestJobSettingsPanel;
|
||||
* UI component used to set ingest job options for file type identifier ingest
|
||||
* modules.
|
||||
*/
|
||||
final class FileTypeIdModuleSettingsPanel extends IngestModuleIngestJobSettingsPanel {
|
||||
final class FileTypeIdIngestJobSettingsPanel extends IngestModuleIngestJobSettingsPanel {
|
||||
|
||||
private final FileTypeIdModuleSettings settings;
|
||||
|
||||
// NOTE: This was declared public, but was inaccessible because the class is
|
||||
// not public
|
||||
FileTypeIdModuleSettingsPanel(FileTypeIdModuleSettings settings) {
|
||||
FileTypeIdIngestJobSettingsPanel(FileTypeIdModuleSettings settings) {
|
||||
this.settings = settings;
|
||||
initComponents();
|
||||
customizeComponents();
|
||||
@ -61,8 +61,8 @@ final class FileTypeIdModuleSettingsPanel extends IngestModuleIngestJobSettingsP
|
||||
skipKnownCheckBox = new javax.swing.JCheckBox();
|
||||
|
||||
skipKnownCheckBox.setSelected(true);
|
||||
skipKnownCheckBox.setText(org.openide.util.NbBundle.getMessage(FileTypeIdModuleSettingsPanel.class, "FileTypeIdModuleSettingsPanel.skipKnownCheckBox.text")); // NOI18N
|
||||
skipKnownCheckBox.setToolTipText(org.openide.util.NbBundle.getMessage(FileTypeIdModuleSettingsPanel.class, "FileTypeIdModuleSettingsPanel.skipKnownCheckBox.toolTipText")); // NOI18N
|
||||
skipKnownCheckBox.setText(org.openide.util.NbBundle.getMessage(FileTypeIdIngestJobSettingsPanel.class, "FileTypeIdIngestJobSettingsPanel.skipKnownCheckBox.text")); // NOI18N
|
||||
skipKnownCheckBox.setToolTipText(org.openide.util.NbBundle.getMessage(FileTypeIdIngestJobSettingsPanel.class, "FileTypeIdIngestJobSettingsPanel.skipKnownCheckBox.toolTipText")); // NOI18N
|
||||
skipKnownCheckBox.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
skipKnownCheckBoxActionPerformed(evt);
|
@ -82,7 +82,7 @@ public class FileTypeIdModuleFactory extends IngestModuleFactoryAdapter {
|
||||
*/
|
||||
@Override
|
||||
public IngestModuleGlobalSettingsPanel getGlobalSettingsPanel() {
|
||||
return new FileTypeIdSettingsPanel();
|
||||
return new FileTypeIdGlobalSettingsPanel();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -111,7 +111,7 @@ public class FileTypeIdModuleFactory extends IngestModuleFactoryAdapter {
|
||||
throw new IllegalArgumentException(NbBundle.getMessage(this.getClass(),
|
||||
"FileTypeIdModuleFactory.getIngestJobSettingsPanel.exception.msg"));
|
||||
}
|
||||
return new FileTypeIdModuleSettingsPanel((FileTypeIdModuleSettings) settings);
|
||||
return new FileTypeIdIngestJobSettingsPanel((FileTypeIdModuleSettings) settings);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -22,7 +22,7 @@ import org.openide.util.Lookup;
|
||||
@org.openide.util.NbBundle.Messages({"OptionsCategory_Name_FileTypeId=FileTypeId", "OptionsCategory_Keywords_FileTypeId=FileTypeId"})
|
||||
public final class FileTypeIdOptionsPanelController extends OptionsPanelController {
|
||||
|
||||
private FileTypeIdSettingsPanel panel;
|
||||
private FileTypeIdGlobalSettingsPanel panel;
|
||||
private final PropertyChangeSupport pcs = new PropertyChangeSupport(this);
|
||||
private boolean changed;
|
||||
|
||||
@ -77,9 +77,9 @@ public final class FileTypeIdOptionsPanelController extends OptionsPanelControll
|
||||
pcs.removePropertyChangeListener(l);
|
||||
}
|
||||
|
||||
private FileTypeIdSettingsPanel getPanel() {
|
||||
private FileTypeIdGlobalSettingsPanel getPanel() {
|
||||
if (panel == null) {
|
||||
panel = new FileTypeIdSettingsPanel();
|
||||
panel = new FileTypeIdGlobalSettingsPanel();
|
||||
}
|
||||
return panel;
|
||||
}
|
||||
|
@ -25,6 +25,7 @@ import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -47,21 +48,35 @@ import org.sleuthkit.autopsy.modules.hashdatabase.HashDbManager;
|
||||
final class UserDefinedFileTypesManager {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(UserDefinedFileTypesManager.class.getName());
|
||||
private static final String FILE_TYPE_DEFINITIONS_SCHEMA_FILE = "FileTypeDefinitions.xsd"; // NON-NLS
|
||||
private static final String USER_DEFINED_TYPE_DEFINITIONS_FILE = "UserFileTypeDefinitions.xml"; // NON-NLS
|
||||
private static final String FILE_TYPES_TAG_NAME = "filetypes"; // NON-NLS
|
||||
private static final String FILE_TYPE_TAG_NAME = "filetype"; // NON-NLS
|
||||
private static final String ALERT_ATTRIBUTE = "alert"; // NON-NLS
|
||||
private static final String TYPE_NAME_TAG_NAME = "typename"; // NON-NLS
|
||||
private static final String SIGNATURE_TAG_NAME = "signature"; // NON-NLS
|
||||
private static final String SIGNATURE_TYPE_ATTRIBUTE = "type"; // NON-NLS
|
||||
private static final String BYTES_TAG_NAME = "bytes"; // NON-NLS
|
||||
private static final String OFFSET_TAG_NAME = "offset"; // NON-NLS
|
||||
private static final String ENCODING = "UTF-8"; //NON-NLS
|
||||
private static final String FILE_TYPE_DEFINITIONS_SCHEMA_FILE = "FileTypeDefinitions.xsd"; //NON-NLS
|
||||
private static final String USER_DEFINED_TYPE_DEFINITIONS_FILE = "UserFileTypeDefinitions.xml"; //NON-NLS
|
||||
private static final String FILE_TYPES_TAG_NAME = "filetypes"; //NON-NLS
|
||||
private static final String FILE_TYPE_TAG_NAME = "filetype"; //NON-NLS
|
||||
private static final String ALERT_ATTRIBUTE = "alert"; //NON-NLS
|
||||
private static final String TYPE_NAME_TAG_NAME = "typename"; //NON-NLS
|
||||
private static final String SIGNATURE_TAG_NAME = "signature"; //NON-NLS
|
||||
private static final String SIGNATURE_TYPE_ATTRIBUTE = "type"; //NON-NLS
|
||||
private static final String BYTES_TAG_NAME = "bytes"; //NON-NLS
|
||||
private static final String OFFSET_TAG_NAME = "offset"; //NON-NLS
|
||||
private static final String ENCODING_FOR_XML_FILE = "UTF-8"; //NON-NLS
|
||||
private static final String ASCII_ENCODING = "US-ASCII"; //NON-NLS
|
||||
private static UserDefinedFileTypesManager instance;
|
||||
private final Map<String, FileType> predefinedFileTypes = new HashMap<>();
|
||||
|
||||
/**
|
||||
* User-defined file types to be persisted to the user-defined file type
|
||||
* definitions file are stored in this mapping of file type names to file
|
||||
* types. Access to this map is guarded by the intrinsic lock of the
|
||||
* user-defined file types manager for thread-safety.
|
||||
*/
|
||||
private final Map<String, FileType> userDefinedFileTypes = new HashMap<>();
|
||||
|
||||
/**
|
||||
* The combined set of user-defined file types and file types predefined by
|
||||
* Autopsy are stored in this mapping of file type names to file types. This
|
||||
* is the current working set of file types. Access to this map is guarded
|
||||
* by the intrinsic lock of the user-defined file types manager for
|
||||
* thread-safety.
|
||||
*/
|
||||
private final Map<String, FileType> fileTypes = new HashMap<>();
|
||||
|
||||
/**
|
||||
@ -70,10 +85,10 @@ final class UserDefinedFileTypesManager {
|
||||
* @return A singleton user-defined file types manager.
|
||||
*/
|
||||
synchronized static UserDefinedFileTypesManager getInstance() {
|
||||
if (instance == null) {
|
||||
instance = new UserDefinedFileTypesManager();
|
||||
if (UserDefinedFileTypesManager.instance == null) {
|
||||
UserDefinedFileTypesManager.instance = new UserDefinedFileTypesManager();
|
||||
}
|
||||
return instance;
|
||||
return UserDefinedFileTypesManager.instance;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -90,7 +105,7 @@ final class UserDefinedFileTypesManager {
|
||||
* names to predefined file types.
|
||||
*/
|
||||
private void loadPredefinedFileTypes() {
|
||||
// RJCTODO: Remove
|
||||
// RJCTODO: Remove test type
|
||||
/**
|
||||
* Create a file type that should match $MBR in Small2 image.
|
||||
*/
|
||||
@ -99,11 +114,11 @@ final class UserDefinedFileTypesManager {
|
||||
/**
|
||||
* Create a file type that should match test.txt in the Small2 image.
|
||||
*/
|
||||
// RJCTODO: Remove
|
||||
// RJCTODO: Remove test type
|
||||
try {
|
||||
this.fileTypes.put("predefinedASCII", new FileType("predefinedASCII", new Signature("hello".getBytes(ASCII_ENCODING), 0L, FileType.Signature.Type.ASCII), true));
|
||||
this.fileTypes.put("predefinedASCII", new FileType("predefinedASCII", new Signature("hello".getBytes(UserDefinedFileTypesManager.ASCII_ENCODING), 0L, FileType.Signature.Type.ASCII), true));
|
||||
} catch (UnsupportedEncodingException ex) {
|
||||
logger.log(Level.SEVERE, "Unable to create 'predefinedASCII' predefined file type definition", ex); //NON-NLS
|
||||
UserDefinedFileTypesManager.logger.log(Level.SEVERE, "Unable to create 'predefinedASCII' predefined file type definition", ex); //NON-NLS
|
||||
}
|
||||
|
||||
try {
|
||||
@ -129,9 +144,13 @@ final class UserDefinedFileTypesManager {
|
||||
// catch (IndexOutOfBoundsException e) {
|
||||
// // do nothing
|
||||
// }
|
||||
this.predefinedFileTypes.put("text/xml", new FileType("text/xml", new Signature("<?xml".getBytes(ASCII_ENCODING), 0L, FileType.Signature.Type.ASCII), false));
|
||||
this.fileTypes.put("text/xml", new FileType("text/xml", new Signature("<?xml".getBytes(UserDefinedFileTypesManager.ASCII_ENCODING), 0L, FileType.Signature.Type.ASCII), false));
|
||||
} catch (UnsupportedEncodingException ex) {
|
||||
logger.log(Level.SEVERE, "Unable to create 'text/xml' predefined file type definition", ex); //NON-NLS
|
||||
/**
|
||||
* Using an all-or-none strategy.
|
||||
*/
|
||||
UserDefinedFileTypesManager.logger.log(Level.SEVERE, "Unable to create predefined file type definitions", ex); //NON-NLS
|
||||
this.fileTypes.clear();
|
||||
}
|
||||
}
|
||||
|
||||
@ -141,29 +160,27 @@ final class UserDefinedFileTypesManager {
|
||||
*/
|
||||
private void loadUserDefinedFileTypes() {
|
||||
try {
|
||||
|
||||
/**
|
||||
* Read the user-defined types from the backing XML file. These
|
||||
* types are put into one map that will be used to write changes to
|
||||
* the XML backing a file, and to another ,map where user-defined
|
||||
* types overwrite predefined types of the same name.
|
||||
*/
|
||||
String filePath = getFileTypeDefinitionsFilePath(USER_DEFINED_TYPE_DEFINITIONS_FILE);
|
||||
String filePath = getFileTypeDefinitionsFilePath(UserDefinedFileTypesManager.USER_DEFINED_TYPE_DEFINITIONS_FILE);
|
||||
File file = new File(filePath);
|
||||
if (file.exists() && file.canRead()) {
|
||||
for (FileType fileType : XMLReader.readFileTypes(filePath)) {
|
||||
userDefinedFileTypes.put(fileType.getTypeName(), fileType);
|
||||
fileTypes.put(fileType.getTypeName(), fileType);
|
||||
this.userDefinedFileTypes.put(fileType.getTypeName(), fileType);
|
||||
this.fileTypes.put(fileType.getTypeName(), fileType);
|
||||
}
|
||||
}
|
||||
|
||||
} catch (InvalidXMLException ex) {
|
||||
// RJCTODO:
|
||||
} catch (UserDefinedFileTypesManager.InvalidXMLException ex) {
|
||||
/**
|
||||
* Using an all-or-none strategy.
|
||||
*/
|
||||
UserDefinedFileTypesManager.logger.log(Level.SEVERE, "Unable to load user-defined types", ex); //NON-NLS
|
||||
this.fileTypes.clear();
|
||||
this.userDefinedFileTypes.clear();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the file types.
|
||||
* Gets the user-defined file types.
|
||||
*
|
||||
* @return A mapping of file type names to file types, possibly empty.
|
||||
*/
|
||||
@ -176,50 +193,50 @@ final class UserDefinedFileTypesManager {
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a new file type definition, overwriting any file type with the same
|
||||
* type name that already exists.
|
||||
* Adds a new user-defined file type, overwriting any existing file type
|
||||
* with the same type name.
|
||||
*
|
||||
* @param fileType The file type to add.
|
||||
* @throws
|
||||
* org.sleuthkit.autopsy.modules.filetypeid.UserDefinedFileTypesManager.UserDefinedFileTypesException
|
||||
*/
|
||||
synchronized void addFileType(FileType fileType) throws UserDefinedFileTypesException {
|
||||
List<FileType> newFileTypes = new ArrayList<>();
|
||||
newFileTypes.add(fileType);
|
||||
addFileTypes(newFileTypes);
|
||||
this.addFileTypes(Collections.singletonList(fileType));
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a set of new file types, overwriting any file types with the same
|
||||
* type names that already exist.
|
||||
* Adds a collection of new user-defined file types, overwriting any
|
||||
* existing file types with the same type names.
|
||||
*
|
||||
* @param newFileTypes The file types to add.
|
||||
* @throws
|
||||
* org.sleuthkit.autopsy.modules.filetypeid.UserDefinedFileTypesManager.UserDefinedFileTypesException
|
||||
*/
|
||||
synchronized void addFileTypes(Collection<FileType> newFileTypes) throws UserDefinedFileTypesException {
|
||||
/**
|
||||
* It is safe to hold references to client-constructed file type objects
|
||||
* because they are immutable.
|
||||
*/
|
||||
for (FileType fileType : newFileTypes) {
|
||||
userDefinedFileTypes.put(fileType.getTypeName(), fileType);
|
||||
fileTypes.put(fileType.getTypeName(), fileType);
|
||||
this.userDefinedFileTypes.put(fileType.getTypeName(), fileType);
|
||||
this.fileTypes.put(fileType.getTypeName(), fileType);
|
||||
}
|
||||
saveUserDefinedTypes();
|
||||
this.saveUserDefinedTypes();
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes a file type.
|
||||
* Deletes a user-defined file type.
|
||||
*
|
||||
* @param fileType The file type to delete.
|
||||
* @throws
|
||||
* org.sleuthkit.autopsy.modules.filetypeid.UserDefinedFileTypesManager.UserDefinedFileTypesException
|
||||
*/
|
||||
synchronized void deleteFileType(FileType fileType) throws UserDefinedFileTypesException {
|
||||
List<FileType> deletedFileTypes = new ArrayList<>();
|
||||
deletedFileTypes.add(fileType);
|
||||
deleteFileTypes(deletedFileTypes);
|
||||
this.deleteFileTypes(Collections.singletonList(fileType));
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes a set of file types.
|
||||
* Deletes a set of user-defined file types.
|
||||
*
|
||||
* @param deletedFileTypes The file types to delete.
|
||||
* @throws
|
||||
@ -227,21 +244,21 @@ final class UserDefinedFileTypesManager {
|
||||
*/
|
||||
synchronized void deleteFileTypes(Collection<FileType> deletedFileTypes) throws UserDefinedFileTypesException {
|
||||
for (FileType fileType : deletedFileTypes) {
|
||||
userDefinedFileTypes.remove(fileType.getTypeName(), fileType);
|
||||
fileTypes.remove(fileType.getTypeName(), fileType);
|
||||
this.userDefinedFileTypes.remove(fileType.getTypeName(), fileType);
|
||||
this.fileTypes.remove(fileType.getTypeName(), fileType);
|
||||
}
|
||||
saveUserDefinedTypes();
|
||||
this.saveUserDefinedTypes();
|
||||
}
|
||||
|
||||
/**
|
||||
* Persist the user-defined file type definitions.
|
||||
* Persists the user-defined file type definitions.
|
||||
*
|
||||
* @throws
|
||||
* org.sleuthkit.autopsy.modules.filetypeid.UserDefinedFileTypesManager.UserDefinedFileTypesException
|
||||
*/
|
||||
private void saveUserDefinedTypes() throws UserDefinedFileTypesException {
|
||||
String filePath = getFileTypeDefinitionsFilePath(USER_DEFINED_TYPE_DEFINITIONS_FILE);
|
||||
writeFileTypes(userDefinedFileTypes.values(), filePath);
|
||||
String filePath = UserDefinedFileTypesManager.getFileTypeDefinitionsFilePath(UserDefinedFileTypesManager.USER_DEFINED_TYPE_DEFINITIONS_FILE);
|
||||
UserDefinedFileTypesManager.writeFileTypes(this.userDefinedFileTypes.values(), filePath);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -253,10 +270,10 @@ final class UserDefinedFileTypesManager {
|
||||
*/
|
||||
private static void writeFileTypes(Collection<FileType> fileTypes, String filePath) throws UserDefinedFileTypesException {
|
||||
try {
|
||||
XMLWriter.writeFileTypes(fileTypes, filePath);
|
||||
UserDefinedFileTypesManager.XMLWriter.writeFileTypes(fileTypes, filePath);
|
||||
} catch (ParserConfigurationException | IOException ex) {
|
||||
UserDefinedFileTypesManager.logger.log(Level.SEVERE, "Failed to write file types file", ex);
|
||||
throw new UserDefinedFileTypesException(ex.getLocalizedMessage()); // RJCTODO: Create a bundled message
|
||||
throw new UserDefinedFileTypesManager.UserDefinedFileTypesException(ex.getLocalizedMessage()); // RJCTODO: Create a bundled message
|
||||
}
|
||||
}
|
||||
|
||||
@ -291,9 +308,9 @@ final class UserDefinedFileTypesManager {
|
||||
Element fileTypeElem = UserDefinedFileTypesManager.XMLWriter.createFileTypeElement(fileType, doc);
|
||||
fileTypesElem.appendChild(fileTypeElem);
|
||||
}
|
||||
if (!XMLUtil.saveDoc(HashDbManager.class, filePath, UserDefinedFileTypesManager.ENCODING, doc)) {
|
||||
if (!XMLUtil.saveDoc(HashDbManager.class, filePath, UserDefinedFileTypesManager.ENCODING_FOR_XML_FILE, doc)) {
|
||||
// RJCTODO: If time permits add XMLUtil that properly throws and deprecate this one
|
||||
throw new IOException("Error saving user defined file types, see log for details"); // NON-NLS
|
||||
throw new IOException("Error saving user defined file types, see log for details"); //NON-NLS
|
||||
}
|
||||
}
|
||||
|
||||
@ -451,17 +468,18 @@ final class UserDefinedFileTypesManager {
|
||||
if (!textContent.isEmpty()) {
|
||||
return textContent;
|
||||
} else {
|
||||
throw new InvalidXMLException("File type " + tagName + " child element missing text content"); // NON-NLS
|
||||
throw new InvalidXMLException("File type " + tagName + " child element missing text content"); //NON-NLS
|
||||
}
|
||||
} else {
|
||||
throw new InvalidXMLException("File type element missing " + tagName + " child element"); // NON-NLS
|
||||
throw new InvalidXMLException("File type element missing " + tagName + " child element"); //NON-NLS
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* RJCTODO
|
||||
* Used for exceptions when parsing user-defined types XML elements and
|
||||
* attributes.
|
||||
*/
|
||||
static class InvalidXMLException extends Exception {
|
||||
private static class InvalidXMLException extends Exception {
|
||||
|
||||
InvalidXMLException(String message) {
|
||||
super(message);
|
||||
|
Loading…
x
Reference in New Issue
Block a user