Merge branch 'develop' of https://github.com/sleuthkit/autopsy into core-report

This commit is contained in:
Nick Davis 2014-03-12 12:18:50 -04:00
commit 3d3f18ed6a
137 changed files with 1748 additions and 1631 deletions

View File

@ -2,7 +2,7 @@ Manifest-Version: 1.0
OpenIDE-Module: org.sleuthkit.autopsy.core/9 OpenIDE-Module: org.sleuthkit.autopsy.core/9
OpenIDE-Module-Localizing-Bundle: org/sleuthkit/autopsy/core/Bundle.properties OpenIDE-Module-Localizing-Bundle: org/sleuthkit/autopsy/core/Bundle.properties
OpenIDE-Module-Layer: org/sleuthkit/autopsy/core/layer.xml OpenIDE-Module-Layer: org/sleuthkit/autopsy/core/layer.xml
OpenIDE-Module-Implementation-Version: 9 OpenIDE-Module-Implementation-Version: 10
OpenIDE-Module-Requires: org.openide.windows.WindowManager, org.netbeans.api.javahelp.Help OpenIDE-Module-Requires: org.openide.windows.WindowManager, org.netbeans.api.javahelp.Help
AutoUpdate-Show-In-Client: true AutoUpdate-Show-In-Client: true
AutoUpdate-Essential-Module: true AutoUpdate-Essential-Module: true

View File

@ -6,5 +6,5 @@ license.file=../LICENSE-2.0.txt
nbm.homepage=http://www.sleuthkit.org/ nbm.homepage=http://www.sleuthkit.org/
nbm.module.author=Brian Carrier nbm.module.author=Brian Carrier
nbm.needs.restart=true nbm.needs.restart=true
spec.version.base=7.0 spec.version.base=7.1

View File

@ -194,6 +194,7 @@
<package>org.sleuthkit.autopsy.actions</package> <package>org.sleuthkit.autopsy.actions</package>
<package>org.sleuthkit.autopsy.casemodule</package> <package>org.sleuthkit.autopsy.casemodule</package>
<package>org.sleuthkit.autopsy.casemodule.services</package> <package>org.sleuthkit.autopsy.casemodule.services</package>
<package>org.sleuthkit.autopsy.contentviewers</package>
<package>org.sleuthkit.autopsy.core</package> <package>org.sleuthkit.autopsy.core</package>
<package>org.sleuthkit.autopsy.corecomponentinterfaces</package> <package>org.sleuthkit.autopsy.corecomponentinterfaces</package>
<package>org.sleuthkit.autopsy.corecomponents</package> <package>org.sleuthkit.autopsy.corecomponents</package>
@ -206,14 +207,14 @@
<package>org.sleuthkit.autopsy.report</package> <package>org.sleuthkit.autopsy.report</package>
<package>org.sleuthkit.datamodel</package> <package>org.sleuthkit.datamodel</package>
</public-packages> </public-packages>
<class-path-extension>
<runtime-relative-path>ext/sqlite-jdbc-3.8.0-SNAPSHOT.jar</runtime-relative-path>
<binary-origin>release/modules/ext/sqlite-jdbc-3.8.0-SNAPSHOT.jar</binary-origin>
</class-path-extension>
<class-path-extension> <class-path-extension>
<runtime-relative-path>ext/Tsk_DataModel.jar</runtime-relative-path> <runtime-relative-path>ext/Tsk_DataModel.jar</runtime-relative-path>
<binary-origin>release/modules/ext/Tsk_DataModel.jar</binary-origin> <binary-origin>release/modules/ext/Tsk_DataModel.jar</binary-origin>
</class-path-extension> </class-path-extension>
<class-path-extension>
<runtime-relative-path>ext/sqlite-jdbc-3.8.0-SNAPSHOT.jar</runtime-relative-path>
<binary-origin>release/modules/ext/sqlite-jdbc-3.8.0-SNAPSHOT.jar</binary-origin>
</class-path-extension>
</data> </data>
</configuration> </configuration>
</project> </project>

View File

@ -109,6 +109,7 @@
</Properties> </Properties>
<AuxValues> <AuxValues>
<AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new javax.swing.JComboBox&lt;String&gt;()"/> <AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new javax.swing.JComboBox&lt;String&gt;()"/>
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="&lt;String&gt;"/>
</AuxValues> </AuxValues>
</Component> </Component>
<Component class="javax.swing.JLabel" name="tagLabel"> <Component class="javax.swing.JLabel" name="tagLabel">

View File

@ -245,7 +245,7 @@ public class GetTagNameAndCommentDialog extends JDialog {
private javax.swing.JTextField commentText; private javax.swing.JTextField commentText;
private javax.swing.JButton newTagButton; private javax.swing.JButton newTagButton;
private javax.swing.JButton okButton; private javax.swing.JButton okButton;
private javax.swing.JComboBox tagCombo; private javax.swing.JComboBox<String> tagCombo;
private javax.swing.JLabel tagLabel; private javax.swing.JLabel tagLabel;
// End of variables declaration//GEN-END:variables // End of variables declaration//GEN-END:variables
} }

View File

@ -18,7 +18,6 @@
*/ */
package org.sleuthkit.autopsy.casemodule; package org.sleuthkit.autopsy.casemodule;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
@ -42,21 +41,17 @@ import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.corecomponentinterfaces.DataSourceProcessor; import org.sleuthkit.autopsy.corecomponentinterfaces.DataSourceProcessor;
/** /**
* visual component for the first panel of add image wizard. * visual component for the first panel of add image wizard. Allows the user to
* Allows the user to choose the data source type and then select the data source * choose the data source type and then select the data source
* *
*/ */
final class AddImageWizardChooseDataSourceVisual extends JPanel { final class AddImageWizardChooseDataSourceVisual extends JPanel {
static final Logger logger = Logger.getLogger(AddImageWizardChooseDataSourceVisual.class.getName()); static final Logger logger = Logger.getLogger(AddImageWizardChooseDataSourceVisual.class.getName());
private AddImageWizardChooseDataSourcePanel wizPanel; private AddImageWizardChooseDataSourcePanel wizPanel;
private JPanel currentPanel; private JPanel currentPanel;
private Map<String, DataSourceProcessor> datasourceProcessorsMap = new HashMap<String, DataSourceProcessor>(); private Map<String, DataSourceProcessor> datasourceProcessorsMap = new HashMap<>();
List<String> coreDSPTypes = new ArrayList<>();
List<String> coreDSPTypes = new ArrayList<String>();
/** /**
* Creates new form AddImageVisualPanel1 * Creates new form AddImageVisualPanel1
@ -66,46 +61,45 @@ final class AddImageWizardChooseDataSourceVisual extends JPanel {
AddImageWizardChooseDataSourceVisual(AddImageWizardChooseDataSourcePanel wizPanel) { AddImageWizardChooseDataSourceVisual(AddImageWizardChooseDataSourcePanel wizPanel) {
initComponents(); initComponents();
this.wizPanel = wizPanel; this.wizPanel = wizPanel;
customInit(); customInit();
} }
private void customInit() { private void customInit() {
typePanel.setLayout(new BorderLayout()); typePanel.setLayout(new BorderLayout());
discoverDataSourceProcessors(); discoverDataSourceProcessors();
// set up the DSP type combobox // set up the DSP type combobox
typeComboBox.removeAllItems(); typeComboBox.removeAllItems();
Set<String> dspTypes = datasourceProcessorsMap.keySet(); Set<String> dspTypes = datasourceProcessorsMap.keySet();
// make a list of core DSPs // make a list of core DSPs
// ensure that the core DSPs are at the top and in a fixed order // ensure that the core DSPs are at the top and in a fixed order
coreDSPTypes.add(ImageDSProcessor.getType()); coreDSPTypes.add(ImageDSProcessor.getType());
coreDSPTypes.add(LocalDiskDSProcessor.getType()); coreDSPTypes.add(LocalDiskDSProcessor.getType());
coreDSPTypes.add(LocalFilesDSProcessor.getType()); coreDSPTypes.add(LocalFilesDSProcessor.getType());
for(String dspType:coreDSPTypes){ for (String dspType : coreDSPTypes) {
typeComboBox.addItem(dspType); typeComboBox.addItem(dspType);
} }
// now add any addtional DSPs that haven't already been added // now add any addtional DSPs that haven't already been added
for(String dspType:dspTypes){ for (String dspType : dspTypes) {
if (!coreDSPTypes.contains(dspType)) { if (!coreDSPTypes.contains(dspType)) {
typeComboBox.addItem(dspType); typeComboBox.addItem(dspType);
} }
} }
// set a custom renderer that draws a separator at the end of the core DSPs in the combobox typeComboBox.setRenderer(new ComboboxSeparatorRenderer(typeComboBox.getRenderer()) {
typeComboBox.setRenderer(new ComboboxSeparatorRenderer(typeComboBox.getRenderer()){
@Override @Override
protected boolean addSeparatorAfter(JList list, Object value, int index){ protected boolean addSeparatorAfter(JList list, Object value, int index) {
return (index == coreDSPTypes.size() - 1); return (index == coreDSPTypes.size() - 1);
} }
}); });
//add actionlistner to listen for change //add actionlistner to listen for change
ActionListener cbActionListener = new ActionListener() { ActionListener cbActionListener = new ActionListener() {
@Override @Override
@ -118,24 +112,23 @@ final class AddImageWizardChooseDataSourceVisual extends JPanel {
} }
private void discoverDataSourceProcessors() { private void discoverDataSourceProcessors() {
for (DataSourceProcessor dsProcessor: Lookup.getDefault().lookupAll(DataSourceProcessor.class)) {
if (!datasourceProcessorsMap.containsKey(dsProcessor.getDataSourceType()) ) {
datasourceProcessorsMap.put(dsProcessor.getDataSourceType(), dsProcessor);
}
else {
logger.log(Level.SEVERE, "discoverDataSourceProcessors(): A DataSourceProcessor already exists for type = " + dsProcessor.getDataSourceType() );
}
}
}
private void dspSelectionChanged() { for (DataSourceProcessor dsProcessor : Lookup.getDefault().lookupAll(DataSourceProcessor.class)) {
// update the current panel to selection
currentPanel = getCurrentDSProcessor().getPanel(); if (!datasourceProcessorsMap.containsKey(dsProcessor.getDataSourceType())) {
updateCurrentPanel(currentPanel); datasourceProcessorsMap.put(dsProcessor.getDataSourceType(), dsProcessor);
} else {
logger.log(Level.SEVERE, "discoverDataSourceProcessors(): A DataSourceProcessor already exists for type = {0}", dsProcessor.getDataSourceType());
}
}
} }
private void dspSelectionChanged() {
// update the current panel to selection
currentPanel = getCurrentDSProcessor().getPanel();
updateCurrentPanel(currentPanel);
}
/** /**
* Changes the current panel to the given panel. * Changes the current panel to the given panel.
* *
@ -144,7 +137,7 @@ final class AddImageWizardChooseDataSourceVisual extends JPanel {
private void updateCurrentPanel(JPanel panel) { private void updateCurrentPanel(JPanel panel) {
currentPanel = panel; currentPanel = panel;
typePanel.removeAll(); typePanel.removeAll();
typePanel.add((JPanel) currentPanel, BorderLayout.CENTER); typePanel.add(currentPanel, BorderLayout.CENTER);
typePanel.validate(); typePanel.validate();
typePanel.repaint(); typePanel.repaint();
currentPanel.addPropertyChangeListener(new PropertyChangeListener() { currentPanel.addPropertyChangeListener(new PropertyChangeListener() {
@ -158,24 +151,26 @@ final class AddImageWizardChooseDataSourceVisual extends JPanel {
} }
} }
}); });
updateUI(null); updateUI(null);
} }
/** /**
* Returns the currently selected DS Processor * Returns the currently selected DS Processor
* @return DataSourceProcessor the DataSourceProcessor corresponding to the data source type selected in the combobox *
* @return DataSourceProcessor the DataSourceProcessor corresponding to the
* data source type selected in the combobox
*/ */
protected DataSourceProcessor getCurrentDSProcessor() { protected DataSourceProcessor getCurrentDSProcessor() {
// get the type of the currently selected panel and then look up // get the type of the currently selected panel and then look up
// the correspodning DS Handler in the map // the correspodning DS Handler in the map
String dsType = (String) typeComboBox.getSelectedItem(); String dsType = (String) typeComboBox.getSelectedItem();
DataSourceProcessor dsProcessor = datasourceProcessorsMap.get(dsType); DataSourceProcessor dsProcessor = datasourceProcessorsMap.get(dsType);
return dsProcessor; return dsProcessor;
} }
/** /**
* Returns the name of the this panel. This name will be shown on the left * Returns the name of the this panel. This name will be shown on the left
* panel of the "Add Image" wizard panel. * panel of the "Add Image" wizard panel.
@ -187,7 +182,6 @@ final class AddImageWizardChooseDataSourceVisual extends JPanel {
return NbBundle.getMessage(this.getClass(), "AddImageWizardChooseDataSourceVisual.getName.text"); return NbBundle.getMessage(this.getClass(), "AddImageWizardChooseDataSourceVisual.getName.text");
} }
/** /**
* This method is called from within the constructor to initialize the form. * This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always * WARNING: Do NOT modify this code. The content of this method is always
@ -310,25 +304,27 @@ final class AddImageWizardChooseDataSourceVisual extends JPanel {
this.wizPanel.enableNextButton(getCurrentDSProcessor().isPanelValid()); this.wizPanel.enableNextButton(getCurrentDSProcessor().isPanelValid());
} }
public abstract class ComboboxSeparatorRenderer implements ListCellRenderer {
public abstract class ComboboxSeparatorRenderer implements ListCellRenderer{
private ListCellRenderer delegate; private ListCellRenderer delegate;
private JPanel separatorPanel = new JPanel(new BorderLayout()); private JPanel separatorPanel = new JPanel(new BorderLayout());
private JSeparator separator = new JSeparator(); private JSeparator separator = new JSeparator();
public ComboboxSeparatorRenderer(ListCellRenderer delegate){ public ComboboxSeparatorRenderer(ListCellRenderer delegate) {
this.delegate = delegate; this.delegate = delegate;
} }
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus){ @Override
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
Component comp = delegate.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); Component comp = delegate.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
if(index!=-1 && addSeparatorAfter(list, value, index)){ if (index != -1 && addSeparatorAfter(list, value, index)) {
separatorPanel.removeAll(); separatorPanel.removeAll();
separatorPanel.add(comp, BorderLayout.CENTER); separatorPanel.add(comp, BorderLayout.CENTER);
separatorPanel.add(separator, BorderLayout.SOUTH); separatorPanel.add(separator, BorderLayout.SOUTH);
return separatorPanel; return separatorPanel;
}else } else {
return comp; return comp;
}
} }
protected abstract boolean addSeparatorAfter(JList list, Object value, int index); protected abstract boolean addSeparatorAfter(JList list, Object value, int index);

View File

@ -80,6 +80,10 @@
<StringArray count="0"/> <StringArray count="0"/>
</Property> </Property>
</Properties> </Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new javax.swing.JComboBox&lt;&gt;()"/>
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="&lt;LocalDisk&gt;"/>
</AuxValues>
</Component> </Component>
<Component class="javax.swing.JLabel" name="errorLabel"> <Component class="javax.swing.JLabel" name="errorLabel">
<Properties> <Properties>

View File

@ -50,12 +50,12 @@ import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil;
/** /**
* ImageTypePanel for adding a local disk or partition such as PhysicalDrive0 or C:. * ImageTypePanel for adding a local disk or partition such as PhysicalDrive0 or C:.
*/ */
class LocalDiskPanel extends JPanel { final class LocalDiskPanel extends JPanel {
private static final Logger logger = Logger.getLogger(LocalDiskPanel.class.getName()); private static final Logger logger = Logger.getLogger(LocalDiskPanel.class.getName());
private static LocalDiskPanel instance; private static LocalDiskPanel instance;
private PropertyChangeSupport pcs = null; private PropertyChangeSupport pcs = null;
private List<LocalDisk> disks = new ArrayList<LocalDisk>(); private List<LocalDisk> disks;
private LocalDiskModel model; private LocalDiskModel model;
private boolean enableNext = false; private boolean enableNext = false;
@ -63,6 +63,7 @@ import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil;
* Creates new form LocalDiskPanel * Creates new form LocalDiskPanel
*/ */
public LocalDiskPanel() { public LocalDiskPanel() {
this.disks = new ArrayList<>();
initComponents(); initComponents();
customInit(); customInit();
@ -101,7 +102,7 @@ import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil;
private void initComponents() { private void initComponents() {
diskLabel = new javax.swing.JLabel(); diskLabel = new javax.swing.JLabel();
diskComboBox = new javax.swing.JComboBox(); diskComboBox = new javax.swing.JComboBox<>();
errorLabel = new javax.swing.JLabel(); errorLabel = new javax.swing.JLabel();
timeZoneLabel = new javax.swing.JLabel(); timeZoneLabel = new javax.swing.JLabel();
timeZoneComboBox = new javax.swing.JComboBox<String>(); timeZoneComboBox = new javax.swing.JComboBox<String>();
@ -165,7 +166,7 @@ import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil;
}// </editor-fold>//GEN-END:initComponents }// </editor-fold>//GEN-END:initComponents
// Variables declaration - do not modify//GEN-BEGIN:variables // Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel descLabel; private javax.swing.JLabel descLabel;
private javax.swing.JComboBox diskComboBox; private javax.swing.JComboBox<LocalDisk> diskComboBox;
private javax.swing.JLabel diskLabel; private javax.swing.JLabel diskLabel;
private javax.swing.JLabel errorLabel; private javax.swing.JLabel errorLabel;
private javax.swing.JCheckBox noFatOrphansCheckbox; private javax.swing.JCheckBox noFatOrphansCheckbox;
@ -296,14 +297,13 @@ import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil;
private Object selected; private Object selected;
private boolean ready = false; private boolean ready = false;
private volatile boolean loadingDisks = false; private volatile boolean loadingDisks = false;
List<LocalDisk> physical = new ArrayList<LocalDisk>(); List<LocalDisk> physical = new ArrayList<>();
List<LocalDisk> partitions = new ArrayList<LocalDisk>(); List<LocalDisk> partitions = new ArrayList<>();
//private String SELECT = "Select a local disk:"; //private String SELECT = "Select a local disk:";
private String LOADING = NbBundle.getMessage(this.getClass(), "LocalDiskPanel.localDiskModel.loading.msg"); private String LOADING = NbBundle.getMessage(this.getClass(), "LocalDiskPanel.localDiskModel.loading.msg");
LocalDiskThread worker = null; LocalDiskThread worker = null;
private void loadDisks() { private void loadDisks() {
// if there is a worker already building the lists, then cancel it first. // if there is a worker already building the lists, then cancel it first.
@ -313,9 +313,9 @@ import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil;
// Clear the lists // Clear the lists
errorLabel.setText(""); errorLabel.setText("");
disks = new ArrayList<LocalDisk>(); disks = new ArrayList<>();
physical = new ArrayList<LocalDisk>(); physical = new ArrayList<>();
partitions = new ArrayList<LocalDisk>(); partitions = new ArrayList<>();
diskComboBox.setEnabled(false); diskComboBox.setEnabled(false);
ready = false; ready = false;
enableNext = false; enableNext = false;
@ -330,7 +330,7 @@ import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil;
@Override @Override
public void setSelectedItem(Object anItem) { public void setSelectedItem(Object anItem) {
if(ready) { if(ready) {
selected = anItem; selected = (LocalDisk) anItem;
enableNext = true; enableNext = true;
try { try {
@ -384,13 +384,14 @@ import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil;
label.setForeground(list.getForeground()); label.setForeground(list.getForeground());
} }
if(value !=null && value.equals(LOADING)) { String localDiskString = value.toString();
if(localDiskString.equals(LOADING)) {
Font font = new Font(label.getFont().getName(), Font.ITALIC, label.getFont().getSize()); Font font = new Font(label.getFont().getName(), Font.ITALIC, label.getFont().getSize());
label.setText(LOADING); label.setText(LOADING);
label.setFont(font); label.setFont(font);
label.setBackground(Color.GRAY); label.setBackground(Color.GRAY);
} else { } else {
label.setText(value != null ? value.toString() : ""); label.setText(value.toString());
} }
label.setOpaque(true); label.setOpaque(true);
label.setBorder(new EmptyBorder(2, 2, 2, 2)); label.setBorder(new EmptyBorder(2, 2, 2, 2));

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2012 Basis Technology Corp. * Copyright 2012-2014 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -18,7 +18,6 @@
*/ */
package org.sleuthkit.autopsy.casemodule; package org.sleuthkit.autopsy.casemodule;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.Toolkit; import java.awt.Toolkit;
import java.awt.event.WindowAdapter; import java.awt.event.WindowAdapter;
@ -31,54 +30,46 @@ import java.io.File;
import javax.swing.JFileChooser; import javax.swing.JFileChooser;
import javax.swing.JFrame; import javax.swing.JFrame;
import javax.swing.JOptionPane; import javax.swing.JOptionPane;
import org.openide.util.NbBundle; import org.openide.util.NbBundle;
import org.sleuthkit.autopsy.casemodule.GeneralFilter;
import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.datamodel.SleuthkitCase; import org.sleuthkit.datamodel.SleuthkitCase;
import org.sleuthkit.datamodel.TskCoreException; import org.sleuthkit.datamodel.TskCoreException;
class MissingImageDialog extends javax.swing.JDialog {
class MissingImageDialog extends javax.swing.JDialog {
private static final Logger logger = Logger.getLogger(MissingImageDialog.class.getName()); private static final Logger logger = Logger.getLogger(MissingImageDialog.class.getName());
long obj_id; long obj_id;
SleuthkitCase db; SleuthkitCase db;
static final GeneralFilter rawFilter = new GeneralFilter(GeneralFilter.RAW_IMAGE_EXTS, GeneralFilter.RAW_IMAGE_DESC); static final GeneralFilter rawFilter = new GeneralFilter(GeneralFilter.RAW_IMAGE_EXTS, GeneralFilter.RAW_IMAGE_DESC);
static final GeneralFilter encaseFilter = new GeneralFilter(GeneralFilter.ENCASE_IMAGE_EXTS, GeneralFilter.ENCASE_IMAGE_DESC); static final GeneralFilter encaseFilter = new GeneralFilter(GeneralFilter.ENCASE_IMAGE_EXTS, GeneralFilter.ENCASE_IMAGE_DESC);
static final List<String> allExt = new ArrayList<String>(); static final List<String> allExt = new ArrayList<String>();
static { static {
allExt.addAll(GeneralFilter.RAW_IMAGE_EXTS); allExt.addAll(GeneralFilter.RAW_IMAGE_EXTS);
allExt.addAll(GeneralFilter.ENCASE_IMAGE_EXTS); allExt.addAll(GeneralFilter.ENCASE_IMAGE_EXTS);
} }
static final String allDesc = NbBundle.getMessage(MissingImageDialog.class, "MissingImageDialog.allDesc.text"); static final String allDesc = NbBundle.getMessage(MissingImageDialog.class, "MissingImageDialog.allDesc.text");
static final GeneralFilter allFilter = new GeneralFilter(allExt, allDesc); static final GeneralFilter allFilter = new GeneralFilter(allExt, allDesc);
private JFileChooser fc = new JFileChooser(); private JFileChooser fc = new JFileChooser();
private MissingImageDialog(long obj_id, SleuthkitCase db) { private MissingImageDialog(long obj_id, SleuthkitCase db) {
super(new JFrame(), true); super(new JFrame(), true);
this.obj_id = obj_id; this.obj_id = obj_id;
this.db = db; this.db = db;
initComponents(); initComponents();
fc.setDragEnabled(false); fc.setDragEnabled(false);
fc.setFileSelectionMode(JFileChooser.FILES_ONLY); fc.setFileSelectionMode(JFileChooser.FILES_ONLY);
fc.setMultiSelectionEnabled(false); fc.setMultiSelectionEnabled(false);
fc.addChoosableFileFilter(rawFilter); fc.addChoosableFileFilter(rawFilter);
fc.addChoosableFileFilter(encaseFilter); fc.addChoosableFileFilter(encaseFilter);
fc.setFileFilter(allFilter); fc.setFileFilter(allFilter);
customInit(); customInit();
} }
// //
// * Client call to create a MissingImageDialog. // * Client call to create a MissingImageDialog.
// * // *
@ -91,16 +82,16 @@ import org.sleuthkit.datamodel.TskCoreException;
@Override @Override
public void windowClosing(WindowEvent e) { public void windowClosing(WindowEvent e) {
dialog.cancel(); dialog.cancel();
} }
}); });
dialog.display(); dialog.display();
} }
private void customInit() { private void customInit() {
selectButton.setEnabled(false); selectButton.setEnabled(false);
} }
private void display() { private void display() {
this.setTitle(NbBundle.getMessage(this.getClass(), "MissingImageDialog.display.title")); this.setTitle(NbBundle.getMessage(this.getClass(), "MissingImageDialog.display.title"));
Dimension screenDimension = Toolkit.getDefaultToolkit().getScreenSize(); Dimension screenDimension = Toolkit.getDefaultToolkit().getScreenSize();
@ -109,27 +100,27 @@ import org.sleuthkit.datamodel.TskCoreException;
int h = this.getSize().height; int h = this.getSize().height;
// set the location of the popUp Window on the center of the screen // set the location of the popUp Window on the center of the screen
setLocation((screenDimension.width - w) / 2, (screenDimension.height - h) / 2); setLocation((screenDimension.width - w) / 2, (screenDimension.height - h) / 2);
this.setVisible(true); this.setVisible(true);
} }
// //
// * Focuses the select button for easy enter-pressing access. // * Focuses the select button for easy enter-pressing access.
// //
private void moveFocusToSelect() { private void moveFocusToSelect() {
this.selectButton.requestFocusInWindow(); this.selectButton.requestFocusInWindow();
} }
// //
// * Enables/disables the select button based off the current panel. // * Enables/disables the select button based off the current panel.
// //
private void updateSelectButton() { private void updateSelectButton() {
// Enable this based on whether there is a valid path // Enable this based on whether there is a valid path
if (!pathNameTextField.getText().isEmpty()) { if (!pathNameTextField.getText().isEmpty()) {
String filePath = pathNameTextField.getText(); String filePath = pathNameTextField.getText();
boolean isExist = Case.pathExists(filePath) || Case.driveExists(filePath); boolean isExist = Case.pathExists(filePath) || Case.driveExists(filePath);
selectButton.setEnabled(isExist); selectButton.setEnabled(isExist);
} }
} }
@ -276,16 +267,14 @@ import org.sleuthkit.datamodel.TskCoreException;
private void pathNameTextFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_pathNameTextFieldActionPerformed private void pathNameTextFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_pathNameTextFieldActionPerformed
// TODO add your handling code here: // TODO add your handling code here:
updateSelectButton(); updateSelectButton();
}//GEN-LAST:event_pathNameTextFieldActionPerformed }//GEN-LAST:event_pathNameTextFieldActionPerformed
private void browseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_browseButtonActionPerformed private void browseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_browseButtonActionPerformed
String oldText = pathNameTextField.getText(); String oldText = pathNameTextField.getText();
// set the current directory of the FileChooser if the ImagePath Field is valid // set the current directory of the FileChooser if the ImagePath Field is valid
File currentDir = new File(oldText); File currentDir = new File(oldText);
if (currentDir.exists()) { if (currentDir.exists()) {
@ -298,10 +287,9 @@ import org.sleuthkit.datamodel.TskCoreException;
pathNameTextField.setText(path); pathNameTextField.setText(path);
} }
//pcs.firePropertyChange(DataSourceProcessor.DSP_PANEL_EVENT.FOCUS_NEXT.toString(), false, true); //pcs.firePropertyChange(DataSourceProcessor.DSP_PANEL_EVENT.FOCUS_NEXT.toString(), false, true);
updateSelectButton();
}//GEN-LAST:event_browseButtonActionPerformed
updateSelectButton();
}//GEN-LAST:event_browseButtonActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables // Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton browseButton; private javax.swing.JButton browseButton;
private javax.swing.JPanel buttonPanel; private javax.swing.JPanel buttonPanel;
@ -312,21 +300,19 @@ import org.sleuthkit.datamodel.TskCoreException;
private javax.swing.JLabel titleLabel; private javax.swing.JLabel titleLabel;
private javax.swing.JSeparator titleSeparator; private javax.swing.JSeparator titleSeparator;
// End of variables declaration//GEN-END:variables // End of variables declaration//GEN-END:variables
// //
// * Verify the user wants to cancel searching for the image. // * Verify the user wants to cancel searching for the image.
// //
void cancel() { void cancel() {
int ret = JOptionPane.showConfirmDialog(null, int ret = JOptionPane.showConfirmDialog(null,
NbBundle.getMessage(this.getClass(), NbBundle.getMessage(this.getClass(),
"MissingImageDialog.confDlg.noFileSel.msg"), "MissingImageDialog.confDlg.noFileSel.msg"),
NbBundle.getMessage(this.getClass(), NbBundle.getMessage(this.getClass(),
"MissingImageDialog.confDlg.noFileSel.title"), "MissingImageDialog.confDlg.noFileSel.title"),
JOptionPane.YES_NO_OPTION); JOptionPane.YES_NO_OPTION);
if (ret == JOptionPane.YES_OPTION) { if (ret == JOptionPane.YES_OPTION) {
this.dispose(); this.dispose();
} }
} }
}
}

View File

@ -120,7 +120,7 @@ import org.sleuthkit.autopsy.coreutils.Logger;
* Initialize panels representing individual wizard's steps and sets * Initialize panels representing individual wizard's steps and sets
* various properties for them influencing wizard appearance. * various properties for them influencing wizard appearance.
*/ */
@SuppressWarnings({"unchecked"}) @SuppressWarnings({"unchecked", "rawtypes"})
private WizardDescriptor.Panel<WizardDescriptor>[] getPanels() { private WizardDescriptor.Panel<WizardDescriptor>[] getPanels() {
if (panels == null) { if (panels == null) {
panels = new WizardDescriptor.Panel[]{ panels = new WizardDescriptor.Panel[]{

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2013 Basis Technology Corp. * Copyright 2013-2014 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -21,8 +21,6 @@ package org.sleuthkit.autopsy.contentviewers;
import javax.swing.JTextPane; import javax.swing.JTextPane;
import javax.swing.text.html.HTMLEditorKit; import javax.swing.text.html.HTMLEditorKit;
import javax.swing.text.html.StyleSheet; import javax.swing.text.html.StyleSheet;
import org.sleuthkit.datamodel.AbstractFile;
import org.sleuthkit.datamodel.TskCoreException;
/** /**
* *

View File

@ -13,7 +13,8 @@
<attr name="Menu\File\Separator4.instance_hidden\position" intvalue="400"/>--> <attr name="Menu\File\Separator4.instance_hidden\position" intvalue="400"/>-->
<folder name="OptionsDialog"> <folder name="OptionsDialog">
<folder name="General.instance_hidden"/> <!--<folder name="General.instance_hidden"/>-->
<file name="General.instance"/>
<folder name="Keymaps.instance_hidden"/> <!-- Keymap --> <folder name="Keymaps.instance_hidden"/> <!-- Keymap -->
<folder name="Java.instance_hidden"/> <folder name="Java.instance_hidden"/>
<folder name="Advanced.instance_hidden"/> <!-- Miscellaneous --> <folder name="Advanced.instance_hidden"/> <!-- Miscellaneous -->

View File

@ -284,6 +284,10 @@
<Events> <Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="languageComboActionPerformed"/> <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="languageComboActionPerformed"/>
</Events> </Events>
<AuxValues>
<AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new javax.swing.JComboBox&lt;&gt;()"/>
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="&lt;SCRIPT&gt;"/>
</AuxValues>
</Component> </Component>
<Component class="javax.swing.JLabel" name="languageLabel"> <Component class="javax.swing.JLabel" name="languageLabel">
<Properties> <Properties>

View File

@ -116,7 +116,7 @@ public class DataContentViewerString extends javax.swing.JPanel implements DataC
prevPageButton = new javax.swing.JButton(); prevPageButton = new javax.swing.JButton();
goToPageLabel = new javax.swing.JLabel(); goToPageLabel = new javax.swing.JLabel();
goToPageTextField = new javax.swing.JTextField(); goToPageTextField = new javax.swing.JTextField();
languageCombo = new javax.swing.JComboBox(); languageCombo = new javax.swing.JComboBox<>();
languageLabel = new javax.swing.JLabel(); languageLabel = new javax.swing.JLabel();
copyMenuItem.setText(org.openide.util.NbBundle.getMessage(DataContentViewerString.class, "DataContentViewerString.copyMenuItem.text")); // NOI18N copyMenuItem.setText(org.openide.util.NbBundle.getMessage(DataContentViewerString.class, "DataContentViewerString.copyMenuItem.text")); // NOI18N
@ -316,7 +316,7 @@ public class DataContentViewerString extends javax.swing.JPanel implements DataC
private javax.swing.JTextField goToPageTextField; private javax.swing.JTextField goToPageTextField;
private javax.swing.JPanel jPanel1; private javax.swing.JPanel jPanel1;
private javax.swing.JScrollPane jScrollPane1; private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JComboBox languageCombo; private javax.swing.JComboBox<SCRIPT> languageCombo;
private javax.swing.JLabel languageLabel; private javax.swing.JLabel languageLabel;
private javax.swing.JButton nextPageButton; private javax.swing.JButton nextPageButton;
private javax.swing.JLabel ofLabel; private javax.swing.JLabel ofLabel;

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2013 Basis Technology Corp. * Copyright 2013-2014 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -57,29 +57,28 @@ import org.sleuthkit.autopsy.corecomponentinterfaces.DataResultViewer;
// service provider when DataResultViewers can be made compatible with node // service provider when DataResultViewers can be made compatible with node
// multiple selection actions. // multiple selection actions.
//@ServiceProvider(service = DataResultViewer.class) //@ServiceProvider(service = DataResultViewer.class)
public class DataResultViewerTable extends AbstractDataResultViewer { public class DataResultViewerTable extends AbstractDataResultViewer {
private String firstColumnLabel = NbBundle.getMessage(DataResultViewerTable.class, "DataResultViewerTable.firstColLbl"); private String firstColumnLabel = NbBundle.getMessage(DataResultViewerTable.class, "DataResultViewerTable.firstColLbl");
private Set<Property> propertiesAcc = new LinkedHashSet<>(); private Set<Property> propertiesAcc = new LinkedHashSet<>();
private static final Logger logger = Logger.getLogger(DataResultViewerTable.class.getName());
private final DummyNodeListener dummyNodeListener = new DummyNodeListener(); private final DummyNodeListener dummyNodeListener = new DummyNodeListener();
private static final String DUMMY_NODE_DISPLAY_NAME = NbBundle.getMessage(DataResultViewerTable.class, "DataResultViewerTable.dummyNodeDisplayName"); private static final String DUMMY_NODE_DISPLAY_NAME = NbBundle.getMessage(DataResultViewerTable.class, "DataResultViewerTable.dummyNodeDisplayName");
/** /**
* Creates a DataResultViewerTable object that is compatible with node * Creates a DataResultViewerTable object that is compatible with node
* multiple selection actions. * multiple selection actions.
*/ */
public DataResultViewerTable(ExplorerManager explorerManager) { public DataResultViewerTable(ExplorerManager explorerManager) {
super(explorerManager); super(explorerManager);
initialize(); initialize();
} }
/** /**
* Creates a DataResultViewerTable object that is NOT compatible with node * Creates a DataResultViewerTable object that is NOT compatible with node
* multiple selection actions. * multiple selection actions.
*/ */
public DataResultViewerTable() { public DataResultViewerTable() {
initialize(); initialize();
} }
private void initialize() { private void initialize() {
@ -93,9 +92,9 @@ import org.sleuthkit.autopsy.corecomponentinterfaces.DataResultViewer;
// don't show the root node // don't show the root node
ov.getOutline().setRootVisible(false); ov.getOutline().setRootVisible(false);
ov.getOutline().setDragEnabled(false); ov.getOutline().setDragEnabled(false);
} }
/** /**
* Expand node * Expand node
* *
@ -179,6 +178,7 @@ import org.sleuthkit.autopsy.corecomponentinterfaces.DataResultViewer;
* @param parent Node with at least one child to get properties from * @param parent Node with at least one child to get properties from
* @return Properties, * @return Properties,
*/ */
@SuppressWarnings("rawtypes")
private Node.Property[] getAllChildPropertyHeaders(Node parent) { private Node.Property[] getAllChildPropertyHeaders(Node parent) {
Node firstChild = parent.getChildren().getNodeAt(0); Node firstChild = parent.getChildren().getNodeAt(0);
@ -222,7 +222,7 @@ import org.sleuthkit.autopsy.corecomponentinterfaces.DataResultViewer;
private void getAllChildPropertyHeadersRec(Node parent, int rows) { private void getAllChildPropertyHeadersRec(Node parent, int rows) {
Children children = parent.getChildren(); Children children = parent.getChildren();
int childCount = 0; int childCount = 0;
for (Node child : children.getNodes()) { for (Node child : children.getNodes()) {
if (++childCount > rows) { if (++childCount > rows) {
break; break;
} }
@ -243,8 +243,10 @@ import org.sleuthkit.autopsy.corecomponentinterfaces.DataResultViewer;
} }
/** /**
* Thread note: Make sure to run this in the EDT as it causes GUI operations. * Thread note: Make sure to run this in the EDT as it causes GUI
* @param selectedNode * operations.
*
* @param selectedNode
*/ */
@Override @Override
public void setNode(Node selectedNode) { public void setNode(Node selectedNode) {
@ -252,7 +254,7 @@ import org.sleuthkit.autopsy.corecomponentinterfaces.DataResultViewer;
this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
try { try {
boolean hasChildren = false; boolean hasChildren = false;
if (selectedNode != null) { if (selectedNode != null) {
hasChildren = selectedNode.getChildren().getNodesCount() > 0; hasChildren = selectedNode.getChildren().getNodesCount() > 0;
} }
@ -261,7 +263,7 @@ import org.sleuthkit.autopsy.corecomponentinterfaces.DataResultViewer;
if (oldNode != null) { if (oldNode != null) {
oldNode.removeNodeListener(dummyNodeListener); oldNode.removeNodeListener(dummyNodeListener);
} }
// if there's no selection node, do nothing // if there's no selection node, do nothing
if (hasChildren) { if (hasChildren) {
Node root = selectedNode; Node root = selectedNode;
@ -279,11 +281,11 @@ import org.sleuthkit.autopsy.corecomponentinterfaces.DataResultViewer;
this.setCursor(null); this.setCursor(null);
} }
} }
/** /**
* Create Column Headers based on the Content represented by the Nodes in * Create Column Headers based on the Content represented by the Nodes in
* the table. * the table.
* *
* @param root The parent Node of the ContentNodes * @param root The parent Node of the ContentNodes
*/ */
private void setupTable(final Node root) { private void setupTable(final Node root) {
@ -302,11 +304,11 @@ import org.sleuthkit.autopsy.corecomponentinterfaces.DataResultViewer;
if (ov == null) { if (ov == null) {
return; return;
} }
propertiesAcc.clear(); propertiesAcc.clear();
DataResultViewerTable.this.getAllChildPropertyHeadersRec(root, 100); DataResultViewerTable.this.getAllChildPropertyHeadersRec(root, 100);
List<Node.Property> props = new ArrayList<Node.Property>(propertiesAcc); List<Node.Property> props = new ArrayList<>(propertiesAcc);
if (props.size() > 0) { if (props.size() > 0) {
Node.Property prop = props.remove(0); Node.Property prop = props.remove(0);
((DefaultOutlineModel) ov.getOutline().getOutlineModel()).setNodesColumnLabel(prop.getDisplayName()); ((DefaultOutlineModel) ov.getOutline().getOutlineModel()).setNodesColumnLabel(prop.getDisplayName());
@ -345,15 +347,15 @@ import org.sleuthkit.autopsy.corecomponentinterfaces.DataResultViewer;
// show the horizontal scroll panel and show all the content & header // show the horizontal scroll panel and show all the content & header
int totalColumns = props.size(); int totalColumns = props.size();
//int scrollWidth = ttv.getWidth(); //int scrollWidth = ttv.getWidth();
int margin = 4; int margin = 4;
int startColumn = 1; int startColumn = 1;
// If there is only one column (which was removed from props above) // If there is only one column (which was removed from props above)
// Just let the table resize itself. // Just let the table resize itself.
ov.getOutline().setAutoResizeMode((props.size() > 0) ? JTable.AUTO_RESIZE_OFF : JTable.AUTO_RESIZE_ALL_COLUMNS); ov.getOutline().setAutoResizeMode((props.size() > 0) ? JTable.AUTO_RESIZE_OFF : JTable.AUTO_RESIZE_ALL_COLUMNS);
// get first 100 rows values for the table // get first 100 rows values for the table
@ -389,28 +391,26 @@ import org.sleuthkit.autopsy.corecomponentinterfaces.DataResultViewer;
// Populate a two-dimensional array with rows of property values for up // Populate a two-dimensional array with rows of property values for up
// to maxRows children of the node passed in. // to maxRows children of the node passed in.
private static Object[][] getRowValues(Node node, int maxRows) { private static Object[][] getRowValues(Node node, int maxRows) {
Object[][] rowValues = new Object[Math.min(maxRows, node.getChildren().getNodesCount())][]; Object[][] rowValues = new Object[Math.min(maxRows, node.getChildren().getNodesCount())][];
int rowCount = 0; int rowCount = 0;
for (Node child : node.getChildren().getNodes()) { for (Node child : node.getChildren().getNodes()) {
if (rowCount >= maxRows) { if (rowCount >= maxRows) {
break; break;
} }
PropertySet[] propertySets = child.getPropertySets(); PropertySet[] propertySets = child.getPropertySets();
if (propertySets.length > 0) if (propertySets.length > 0) {
{
Property[] properties = propertySets[0].getProperties(); Property[] properties = propertySets[0].getProperties();
rowValues[rowCount] = new Object[properties.length]; rowValues[rowCount] = new Object[properties.length];
for (int j = 0; j < properties.length; ++j) { for (int j = 0; j < properties.length; ++j) {
try { try {
rowValues[rowCount][j] = properties[j].getValue(); rowValues[rowCount][j] = properties[j].getValue();
} } catch (IllegalAccessException | InvocationTargetException ignore) {
catch (IllegalAccessException | InvocationTargetException ignore) {
rowValues[rowCount][j] = "n/a"; rowValues[rowCount][j] = "n/a";
} }
} }
} }
++rowCount; ++rowCount;
} }
return rowValues; return rowValues;
} }
@ -435,6 +435,7 @@ import org.sleuthkit.autopsy.corecomponentinterfaces.DataResultViewer;
* @param table the object table * @param table the object table
* @return max the maximum width of the column * @return max the maximum width of the column
*/ */
@SuppressWarnings("rawtypes")
private int getMaxColumnWidth(int index, FontMetrics metrics, int margin, int padding, List<Node.Property> header, Object[][] table) { private int getMaxColumnWidth(int index, FontMetrics metrics, int margin, int padding, List<Node.Property> header, Object[][] table) {
// set the tree (the node / names column) width // set the tree (the node / names column) width
String headerName = header.get(index - 1).getDisplayName(); String headerName = header.get(index - 1).getDisplayName();
@ -485,14 +486,15 @@ import org.sleuthkit.autopsy.corecomponentinterfaces.DataResultViewer;
super.clearComponent(); super.clearComponent();
} }
private class DummyNodeListener implements NodeListener { private class DummyNodeListener implements NodeListener {
private volatile boolean load = true; private volatile boolean load = true;
public void reset() { public void reset() {
load = true; load = true;
} }
@Override @Override
public void childrenAdded(final NodeMemberEvent nme) { public void childrenAdded(final NodeMemberEvent nme) {
Node[] delta = nme.getDelta(); Node[] delta = nme.getDelta();
@ -510,7 +512,7 @@ import org.sleuthkit.autopsy.corecomponentinterfaces.DataResultViewer;
} }
} }
} }
private boolean containsReal(Node[] delta) { private boolean containsReal(Node[] delta) {
for (Node n : delta) { for (Node n : delta) {
if (!n.getDisplayName().equals(DUMMY_NODE_DISPLAY_NAME)) { if (!n.getDisplayName().equals(DUMMY_NODE_DISPLAY_NAME)) {

View File

@ -16,7 +16,7 @@
<Layout> <Layout>
<DimensionLayout dim="0"> <DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="0" attributes="0">
<Component id="thumbnailScrollPanel" max="32767" attributes="0"/> <Component id="thumbnailScrollPanel" pref="642" max="32767" attributes="0"/>
<Group type="102" attributes="0"> <Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="0" attributes="0">
@ -201,18 +201,17 @@
</Component> </Component>
<Component class="javax.swing.JComboBox" name="thumbnailSizeComboBox"> <Component class="javax.swing.JComboBox" name="thumbnailSizeComboBox">
<Properties> <Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor"> <Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
<StringArray count="3"> <Connection code="new javax.swing.DefaultComboBoxModel&lt;String&gt;(new String[] { &quot;Small Thumbnails&quot;, &quot;Medium Thumbnails&quot;, &quot;Large Thumbnails&quot; })" type="code"/>
<StringItem index="0" value="Small Thumbnails"/>
<StringItem index="1" value="Medium Thumbnails"/>
<StringItem index="2" value="Large Thumbnails"/>
</StringArray>
</Property> </Property>
<Property name="selectedIndex" type="int" value="1"/>
</Properties> </Properties>
<Events> <Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="thumbnailSizeComboBoxActionPerformed"/> <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="thumbnailSizeComboBoxActionPerformed"/>
</Events> </Events>
<AuxValues>
<AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new javax.swing.JComboBox&lt;&gt;()"/>
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="&lt;String&gt;"/>
</AuxValues>
</Component> </Component>
</SubComponents> </SubComponents>
</Form> </Form>

View File

@ -121,7 +121,7 @@ import org.sleuthkit.datamodel.TskCoreException;
filePathLabel = new javax.swing.JLabel(); filePathLabel = new javax.swing.JLabel();
goToPageLabel = new javax.swing.JLabel(); goToPageLabel = new javax.swing.JLabel();
goToPageField = new javax.swing.JTextField(); goToPageField = new javax.swing.JTextField();
thumbnailSizeComboBox = new javax.swing.JComboBox(); thumbnailSizeComboBox = new javax.swing.JComboBox<>();
thumbnailScrollPanel.setPreferredSize(new java.awt.Dimension(582, 348)); thumbnailScrollPanel.setPreferredSize(new java.awt.Dimension(582, 348));
@ -171,8 +171,7 @@ import org.sleuthkit.datamodel.TskCoreException;
} }
}); });
thumbnailSizeComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Small Thumbnails", "Medium Thumbnails", "Large Thumbnails" })); thumbnailSizeComboBox.setModel(new javax.swing.DefaultComboBoxModel<String>(new String[] { "Small Thumbnails", "Medium Thumbnails", "Large Thumbnails" }));
thumbnailSizeComboBox.setSelectedIndex(1);
thumbnailSizeComboBox.addActionListener(new java.awt.event.ActionListener() { thumbnailSizeComboBox.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) { public void actionPerformed(java.awt.event.ActionEvent evt) {
thumbnailSizeComboBoxActionPerformed(evt); thumbnailSizeComboBoxActionPerformed(evt);
@ -183,7 +182,7 @@ import org.sleuthkit.datamodel.TskCoreException;
this.setLayout(layout); this.setLayout(layout);
layout.setHorizontalGroup( layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(thumbnailScrollPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(thumbnailScrollPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 642, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup() .addGroup(layout.createSequentialGroup()
.addContainerGap() .addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
@ -289,7 +288,7 @@ import org.sleuthkit.datamodel.TskCoreException;
private javax.swing.JButton pagePrevButton; private javax.swing.JButton pagePrevButton;
private javax.swing.JLabel pagesLabel; private javax.swing.JLabel pagesLabel;
private javax.swing.JScrollPane thumbnailScrollPanel; private javax.swing.JScrollPane thumbnailScrollPanel;
private javax.swing.JComboBox thumbnailSizeComboBox; private javax.swing.JComboBox<String> thumbnailSizeComboBox;
// End of variables declaration//GEN-END:variables // End of variables declaration//GEN-END:variables
@Override @Override

View File

@ -1,3 +1,21 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2013 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.sleuthkit.autopsy.corecomponents; package org.sleuthkit.autopsy.corecomponents;
import java.io.File; import java.io.File;

View File

@ -1,6 +1,20 @@
/* /*
* To change this template, choose Tools | Templates * Autopsy Forensic Browser
* and open the template in the editor. *
* Copyright 2013-2014 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
package org.sleuthkit.autopsy.corecomponents; package org.sleuthkit.autopsy.corecomponents;
@ -15,54 +29,60 @@ import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil;
import java.util.logging.Level; import java.util.logging.Level;
import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.Logger;
@OptionsPanelController.TopLevelRegistration( @OptionsPanelController.TopLevelRegistration(categoryName = "#OptionsCategory_Name_General",
categoryName = "#OptionsCategory_Name_General", iconBase = "org/sleuthkit/autopsy/corecomponents/display-options.png",
iconBase = "org/sleuthkit/autopsy/corecomponents/general-options.png", position = 1,
position = 1, keywords = "#OptionsCategory_Keywords_General",
keywords = "#OptionsCategory_Keywords_General", keywordsCategory = "General")
keywordsCategory = "General")
// moved to Bundle
//@org.openide.util.NbBundle.Messages({"OptionsCategory_Name_General=General", "OptionsCategory_Keywords_General=general"})
public final class GeneralOptionsPanelController extends OptionsPanelController { public final class GeneralOptionsPanelController extends OptionsPanelController {
private GeneralPanel panel; private GeneralPanel panel;
private final PropertyChangeSupport pcs = new PropertyChangeSupport(this); private final PropertyChangeSupport pcs = new PropertyChangeSupport(this);
private boolean changed; private boolean changed;
private static final Logger logger = Logger.getLogger(GeneralOptionsPanelController.class.getName()); private static final Logger logger = Logger.getLogger(GeneralOptionsPanelController.class.getName());
@Override
public void update() { public void update() {
getPanel().load(); getPanel().load();
changed = false; changed = false;
} }
@Override
public void applyChanges() { public void applyChanges() {
getPanel().store(); getPanel().store();
changed = false; changed = false;
} }
@Override
public void cancel() { public void cancel() {
// need not do anything special, if no changes have been persisted yet
} }
@Override
public boolean isValid() { public boolean isValid() {
return getPanel().valid(); return getPanel().valid();
} }
@Override
public boolean isChanged() { public boolean isChanged() {
return changed; return changed;
} }
@Override
public HelpCtx getHelpCtx() { public HelpCtx getHelpCtx() {
return null; // new HelpCtx("...ID") if you have a help set return null;
} }
@Override
public JComponent getComponent(Lookup masterLookup) { public JComponent getComponent(Lookup masterLookup) {
return getPanel(); return getPanel();
} }
@Override
public void addPropertyChangeListener(PropertyChangeListener l) { public void addPropertyChangeListener(PropertyChangeListener l) {
pcs.addPropertyChangeListener(l); pcs.addPropertyChangeListener(l);
} }
@Override
public void removePropertyChangeListener(PropertyChangeListener l) { public void removePropertyChangeListener(PropertyChangeListener l) {
pcs.removePropertyChangeListener(l); pcs.removePropertyChangeListener(l);
} }
@ -77,11 +97,10 @@ public final class GeneralOptionsPanelController extends OptionsPanelController
void changed() { void changed() {
if (!changed) { if (!changed) {
changed = true; changed = true;
try { try {
pcs.firePropertyChange(OptionsPanelController.PROP_CHANGED, false, true); pcs.firePropertyChange(OptionsPanelController.PROP_CHANGED, false, true);
} } catch (Exception e) {
catch (Exception e) {
logger.log(Level.SEVERE, "GeneralOptionsPanelController listener threw exception", e); logger.log(Level.SEVERE, "GeneralOptionsPanelController listener threw exception", e);
MessageNotifyUtil.Notify.show( MessageNotifyUtil.Notify.show(
NbBundle.getMessage(this.getClass(), "GeneralOptionsPanelController.moduleErr"), NbBundle.getMessage(this.getClass(), "GeneralOptionsPanelController.moduleErr"),
@ -89,16 +108,15 @@ public final class GeneralOptionsPanelController extends OptionsPanelController
MessageNotifyUtil.MessageType.ERROR); MessageNotifyUtil.MessageType.ERROR);
} }
} }
try { try {
pcs.firePropertyChange(OptionsPanelController.PROP_VALID, null, null); pcs.firePropertyChange(OptionsPanelController.PROP_VALID, null, null);
} } catch (Exception e) {
catch (Exception e) { logger.log(Level.SEVERE, "GeneralOptionsPanelController listener threw exception", e);
logger.log(Level.SEVERE, "GeneralOptionsPanelController listener threw exception", e); MessageNotifyUtil.Notify.show(
MessageNotifyUtil.Notify.show( NbBundle.getMessage(this.getClass(), "GeneralOptionsPanelController.moduleErr"),
NbBundle.getMessage(this.getClass(), "GeneralOptionsPanelController.moduleErr"), NbBundle.getMessage(this.getClass(), "GeneralOptionsPanelController.moduleErr.msg"),
NbBundle.getMessage(this.getClass(), "GeneralOptionsPanelController.moduleErr.msg"), MessageNotifyUtil.MessageType.ERROR);
MessageNotifyUtil.MessageType.ERROR); }
}
} }
} }

View File

@ -107,7 +107,7 @@ public class Installer extends ModuleInstall {
final String[] UI_MENU_ITEM_KEYS = new String[]{"MenuBarUI", final String[] UI_MENU_ITEM_KEYS = new String[]{"MenuBarUI",
}; };
Map<Object, Object> uiEntries = new TreeMap<Object, Object>(); Map<Object, Object> uiEntries = new TreeMap<>();
// Store the keys that deal with menu items // Store the keys that deal with menu items
for(String key : UI_MENU_ITEM_KEYS) { for(String key : UI_MENU_ITEM_KEYS) {
@ -129,7 +129,7 @@ public class Installer extends ModuleInstall {
} }
// Overwrite the Metal menu item keys to use the Aqua versions // Overwrite the Metal menu item keys to use the Aqua versions
for(Map.Entry entry : uiEntries.entrySet()) { for(Map.Entry<Object,Object> entry : uiEntries.entrySet()) {
UIManager.put(entry.getKey(), entry.getValue()); UIManager.put(entry.getKey(), entry.getValue());
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@ -193,10 +193,7 @@ public class ImageUtils {
* Check for the JPEG header. Since Java bytes are signed, we cast them * Check for the JPEG header. Since Java bytes are signed, we cast them
* to an int first. * to an int first.
*/ */
if (((int) (fileHeaderBuffer[0] & 0xff) == 0xff) && ((int) (fileHeaderBuffer[1] & 0xff) == 0xd8)) { return (((fileHeaderBuffer[0] & 0xff) == 0xff) && ((fileHeaderBuffer[1] & 0xff) == 0xd8));
return true;
}
return false;
} }

View File

@ -208,7 +208,7 @@ public class PlatformUtil {
* @throws IOException exception thrown if extract the file failed for IO * @throws IOException exception thrown if extract the file failed for IO
* reasons * reasons
*/ */
public static boolean extractResourceToUserConfigDir(final Class resourceClass, final String resourceFile) throws IOException { public static <T> boolean extractResourceToUserConfigDir(final Class<T> resourceClass, final String resourceFile) throws IOException {
final File userDir = new File(getUserConfigDirectory()); final File userDir = new File(getUserConfigDirectory());
final File resourceFileF = new File(userDir + File.separator + resourceFile); final File resourceFileF = new File(userDir + File.separator + resourceFile);

View File

@ -68,7 +68,7 @@ public class XMLUtil {
* For example usages, please see KeywordSearchListsXML, HashDbXML, or IngestModuleLoader. * For example usages, please see KeywordSearchListsXML, HashDbXML, or IngestModuleLoader.
* *
*/ */
public static boolean xmlIsValid(DOMSource xmlfile, Class clazz, String schemaFile) { public static <T> boolean xmlIsValid(DOMSource xmlfile, Class<T> clazz, String schemaFile) {
try{ try{
PlatformUtil.extractResourceToUserConfigDir(clazz, schemaFile); PlatformUtil.extractResourceToUserConfigDir(clazz, schemaFile);
File schemaLoc = new File(PlatformUtil.getUserConfigDirectory() + File.separator + schemaFile); File schemaLoc = new File(PlatformUtil.getUserConfigDirectory() + File.separator + schemaFile);
@ -103,7 +103,7 @@ public class XMLUtil {
* For example usages, please see KeywordSearchListsXML, HashDbXML, or IngestModuleLoader. * For example usages, please see KeywordSearchListsXML, HashDbXML, or IngestModuleLoader.
* *
*/ */
public static boolean xmlIsValid(Document doc, Class clazz, String type){ public static <T> boolean xmlIsValid(Document doc, Class<T> clazz, String type){
DOMSource dms = new DOMSource(doc); DOMSource dms = new DOMSource(doc);
return xmlIsValid(dms, clazz, type); return xmlIsValid(dms, clazz, type);
} }
@ -118,7 +118,7 @@ public class XMLUtil {
* @param xsdPath the full path to the file to validate against * @param xsdPath the full path to the file to validate against
* *
*/ */
public static Document loadDoc(Class clazz, String xmlPath, String xsdPath) { public static <T> Document loadDoc(Class<T> clazz, String xmlPath, String xsdPath) {
DocumentBuilderFactory builderFactory = DocumentBuilderFactory builderFactory =
DocumentBuilderFactory.newInstance(); DocumentBuilderFactory.newInstance();
Document ret = null; Document ret = null;
@ -154,7 +154,7 @@ public class XMLUtil {
* @param doc the document to save * @param doc the document to save
* *
*/ */
public static boolean saveDoc(Class clazz, String xmlPath, String encoding, final Document doc) { public static <T> boolean saveDoc(Class<T> clazz, String xmlPath, String encoding, final Document doc) {
TransformerFactory xf = TransformerFactory.newInstance(); TransformerFactory xf = TransformerFactory.newInstance();
xf.setAttribute("indent-number", new Integer(1)); xf.setAttribute("indent-number", new Integer(1));
boolean success = false; boolean success = false;

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2011 Basis Technology Corp. * Copyright 2011-2014 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -189,7 +189,7 @@ public abstract class AbstractAbstractFileNode<T extends AbstractFile> extends A
try { try {
path = content.getUniquePath(); path = content.getUniquePath();
} catch (TskCoreException ex) { } catch (TskCoreException ex) {
logger.log(Level.SEVERE, "Except while calling Content.getUniquePath() on " + content); logger.log(Level.SEVERE, "Except while calling Content.getUniquePath() on {0}", content);
} }
map.put(AbstractFilePropertyType.NAME.toString(), AbstractAbstractFileNode.getContentDisplayName(content)); map.put(AbstractFilePropertyType.NAME.toString(), AbstractAbstractFileNode.getContentDisplayName(content));
@ -217,10 +217,13 @@ public abstract class AbstractAbstractFileNode<T extends AbstractFile> extends A
static String getContentDisplayName(AbstractFile file) { static String getContentDisplayName(AbstractFile file) {
String name = file.getName(); String name = file.getName();
if (name.equals("..")) { switch (name) {
name = DirectoryNode.DOTDOTDIR; case "..":
} else if (name.equals(".")) { name = DirectoryNode.DOTDOTDIR;
name = DirectoryNode.DOTDIR; break;
case ".":
name = DirectoryNode.DOTDIR;
break;
} }
return name; return name;
} }

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2011 Basis Technology Corp. * Copyright 2011-2014 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -22,6 +22,8 @@ import org.openide.nodes.AbstractNode;
import org.openide.nodes.Children.Keys; import org.openide.nodes.Children.Keys;
import org.openide.nodes.Node; import org.openide.nodes.Node;
import org.openide.util.NbBundle; import org.openide.util.NbBundle;
import org.sleuthkit.autopsy.datamodel.KeywordHits.KeywordHitsRootNode;
import org.sleuthkit.datamodel.Content;
import org.sleuthkit.datamodel.DerivedFile; import org.sleuthkit.datamodel.DerivedFile;
import org.sleuthkit.datamodel.Directory; import org.sleuthkit.datamodel.Directory;
import org.sleuthkit.datamodel.File; import org.sleuthkit.datamodel.File;
@ -62,52 +64,52 @@ abstract class AbstractContentChildren<T> extends Keys<T> {
/** /**
* Creates appropriate Node for each sub-class of Content * Creates appropriate Node for each sub-class of Content
*/ */
public static class CreateSleuthkitNodeVisitor extends SleuthkitItemVisitor.Default<AbstractContentNode> { public static class CreateSleuthkitNodeVisitor extends SleuthkitItemVisitor.Default<AbstractContentNode<? extends Content>> {
@Override @Override
public AbstractContentNode visit(Directory drctr) { public AbstractContentNode<? extends Content> visit(Directory drctr) {
return new DirectoryNode(drctr); return new DirectoryNode(drctr);
} }
@Override @Override
public AbstractContentNode visit(File file) { public AbstractContentNode<? extends Content> visit(File file) {
return new FileNode(file); return new FileNode(file);
} }
@Override @Override
public AbstractContentNode visit(Image image) { public AbstractContentNode<? extends Content> visit(Image image) {
return new ImageNode(image); return new ImageNode(image);
} }
@Override @Override
public AbstractContentNode visit(Volume volume) { public AbstractContentNode<? extends Content> visit(Volume volume) {
return new VolumeNode(volume); return new VolumeNode(volume);
} }
@Override @Override
public AbstractContentNode visit(LayoutFile lf) { public AbstractContentNode<? extends Content> visit(LayoutFile lf) {
return new LayoutFileNode(lf); return new LayoutFileNode(lf);
} }
@Override @Override
public AbstractContentNode visit(DerivedFile df) { public AbstractContentNode<? extends Content> visit(DerivedFile df) {
return new LocalFileNode(df); return new LocalFileNode(df);
} }
@Override @Override
public AbstractContentNode visit(LocalFile lf) { public AbstractContentNode<? extends Content> visit(LocalFile lf) {
return new LocalFileNode(lf); return new LocalFileNode(lf);
} }
@Override @Override
public AbstractContentNode visit(VirtualDirectory ld) { public AbstractContentNode<? extends Content> visit(VirtualDirectory ld) {
return new VirtualDirectoryNode(ld); return new VirtualDirectoryNode(ld);
} }
@Override @Override
protected AbstractContentNode defaultVisit(SleuthkitVisitableItem di) { protected AbstractContentNode<? extends Content> defaultVisit(SleuthkitVisitableItem di) {
throw new UnsupportedOperationException(NbBundle.getMessage(this.getClass(), throw new UnsupportedOperationException(NbBundle.getMessage(this.getClass(),
"AbstractContentChildren.CreateTSKNodeVisitor.exception.noNodeMsg")); "AbstractContentChildren.CreateTSKNodeVisitor.exception.noNodeMsg"));
} }
} }
@ -150,12 +152,12 @@ abstract class AbstractContentChildren<T> extends Keys<T> {
public AbstractNode visit(HashsetHits hh) { public AbstractNode visit(HashsetHits hh) {
return hh.new HashsetHitsRootNode(); return hh.new HashsetHitsRootNode();
} }
@Override @Override
public AbstractNode visit(InterestingHits ih) { public AbstractNode visit(InterestingHits ih) {
return ih.new InterestingHitsRootNode(); return ih.new InterestingHitsRootNode();
} }
@Override @Override
public AbstractNode visit(EmailExtracted ee) { public AbstractNode visit(EmailExtracted ee) {
return ee.new EmailExtractedRootNode(); return ee.new EmailExtractedRootNode();
@ -189,7 +191,7 @@ abstract class AbstractContentChildren<T> extends Keys<T> {
protected AbstractNode defaultVisit(AutopsyVisitableItem di) { protected AbstractNode defaultVisit(AutopsyVisitableItem di) {
throw new UnsupportedOperationException( throw new UnsupportedOperationException(
NbBundle.getMessage(this.getClass(), NbBundle.getMessage(this.getClass(),
"AbstractContentChildren.createAutopsyNodeVisitor.exception.noNodeMsg")); "AbstractContentChildren.createAutopsyNodeVisitor.exception.noNodeMsg"));
} }
} }
} }

View File

@ -78,10 +78,10 @@ public abstract class AbstractFsContentNode<T extends AbstractFile> extends Abst
for (int i = 0; i < FS_PROPS_LEN; ++i) { for (int i = 0; i < FS_PROPS_LEN; ++i) {
final AbstractFilePropertyType propType = AbstractFilePropertyType.values()[i]; final AbstractFilePropertyType propType = AbstractFilePropertyType.values()[i];
final String propString = propType.toString(); final String propString = propType.toString();
ss.put(new NodeProperty(propString, propString, NO_DESCR, map.get(propString))); ss.put(new NodeProperty<>(propString, propString, NO_DESCR, map.get(propString)));
} }
if (directoryBrowseMode) { if (directoryBrowseMode) {
ss.put(new NodeProperty(HIDE_PARENT, HIDE_PARENT, HIDE_PARENT, HIDE_PARENT)); ss.put(new NodeProperty<>(HIDE_PARENT, HIDE_PARENT, HIDE_PARENT, HIDE_PARENT));
} }
return s; return s;

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2011 Basis Technology Corp. * Copyright 2011-2014 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -30,8 +30,9 @@ import org.sleuthkit.datamodel.SleuthkitCase;
import org.sleuthkit.datamodel.TskException; import org.sleuthkit.datamodel.TskException;
/** /**
* Node encapsulating blackboard artifact type. This is used on the left-hand navigation side of the Autopsy UI as the * Node encapsulating blackboard artifact type. This is used on the left-hand
* parent node for all of the artifacts of a given type. Its children will be BlackboardArtifactNode objects. * navigation side of the Autopsy UI as the parent node for all of the artifacts
* of a given type. Its children will be BlackboardArtifactNode objects.
*/ */
public class ArtifactTypeNode extends DisplayableItemNode { public class ArtifactTypeNode extends DisplayableItemNode {
@ -65,15 +66,15 @@ public class ArtifactTypeNode extends DisplayableItemNode {
s.put(ss); s.put(ss);
} }
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "ArtifactTypeNode.createSheet.artType.name"), ss.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "ArtifactTypeNode.createSheet.artType.name"),
NbBundle.getMessage(this.getClass(), "ArtifactTypeNode.createSheet.artType.displayName"), NbBundle.getMessage(this.getClass(), "ArtifactTypeNode.createSheet.artType.displayName"),
NbBundle.getMessage(this.getClass(), "ArtifactTypeNode.createSheet.artType.desc"), NbBundle.getMessage(this.getClass(), "ArtifactTypeNode.createSheet.artType.desc"),
type.getDisplayName())); type.getDisplayName()));
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "ArtifactTypeNode.createSheet.childCnt.name"), ss.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "ArtifactTypeNode.createSheet.childCnt.name"),
NbBundle.getMessage(this.getClass(), "ArtifactTypeNode.createSheet.childCnt.displayName"), NbBundle.getMessage(this.getClass(), "ArtifactTypeNode.createSheet.childCnt.displayName"),
NbBundle.getMessage(this.getClass(), "ArtifactTypeNode.createSheet.childCnt.desc"), NbBundle.getMessage(this.getClass(), "ArtifactTypeNode.createSheet.childCnt.desc"),
childCount)); childCount));
return s; return s;
} }
@ -127,7 +128,7 @@ public class ArtifactTypeNode extends DisplayableItemNode {
case TSK_ENCRYPTION_DETECTED: case TSK_ENCRYPTION_DETECTED:
return "encrypted-file.png"; return "encrypted-file.png";
case TSK_EXT_MISMATCH_DETECTED: case TSK_EXT_MISMATCH_DETECTED:
return "mismatch-16.png"; return "mismatch-16.png";
} }
return "artifact-icon.png"; return "artifact-icon.png";
} }

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2011 Basis Technology Corp. * Copyright 2011-2014 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -48,7 +48,7 @@ public class BlackboardArtifactNode extends DisplayableItemNode {
private BlackboardArtifact artifact; private BlackboardArtifact artifact;
private Content associated; private Content associated;
private List<NodeProperty> customProperties; private List<NodeProperty<? extends Object>> customProperties;
static final Logger logger = Logger.getLogger(BlackboardArtifactNode.class.getName()); static final Logger logger = Logger.getLogger(BlackboardArtifactNode.class.getName());
/** /**
* Artifact types which should have the associated content's full unique path * Artifact types which should have the associated content's full unique path
@ -107,16 +107,16 @@ public class BlackboardArtifactNode extends DisplayableItemNode {
} }
final String NO_DESCR = NbBundle.getMessage(this.getClass(), "BlackboardArtifactNode.noDesc.text"); final String NO_DESCR = NbBundle.getMessage(this.getClass(), "BlackboardArtifactNode.noDesc.text");
Map<String, Object> map = new LinkedHashMap<String, Object>(); Map<String, Object> map = new LinkedHashMap<>();
fillPropertyMap(map, artifact); fillPropertyMap(map, artifact);
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "BlackboardArtifactNode.createSheet.srcFile.name"), ss.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "BlackboardArtifactNode.createSheet.srcFile.name"),
NbBundle.getMessage(this.getClass(), "BlackboardArtifactNode.createSheet.srcFile.displayName"), NbBundle.getMessage(this.getClass(), "BlackboardArtifactNode.createSheet.srcFile.displayName"),
NO_DESCR, NO_DESCR,
associated.getName())); associated.getName()));
for (Map.Entry<String, Object> entry : map.entrySet()) { for (Map.Entry<String, Object> entry : map.entrySet()) {
ss.put(new NodeProperty(entry.getKey(), ss.put(new NodeProperty<>(entry.getKey(),
entry.getKey(), entry.getKey(),
NO_DESCR, NO_DESCR,
entry.getValue())); entry.getValue()));
@ -124,7 +124,7 @@ public class BlackboardArtifactNode extends DisplayableItemNode {
//append custom node properties //append custom node properties
if (customProperties != null) { if (customProperties != null) {
for (NodeProperty np : customProperties) { for (NodeProperty<? extends Object> np : customProperties) {
ss.put(np); ss.put(np);
} }
} }
@ -137,7 +137,7 @@ public class BlackboardArtifactNode extends DisplayableItemNode {
AbstractFile af = (AbstractFile) associated; AbstractFile af = (AbstractFile) associated;
ext = af.getNameExtension(); ext = af.getNameExtension();
} }
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "BlackboardArtifactNode.createSheet.ext.name"), ss.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "BlackboardArtifactNode.createSheet.ext.name"),
NbBundle.getMessage(this.getClass(), "BlackboardArtifactNode.createSheet.ext.displayName"), NbBundle.getMessage(this.getClass(), "BlackboardArtifactNode.createSheet.ext.displayName"),
NO_DESCR, NO_DESCR,
ext)); ext));
@ -156,7 +156,7 @@ public class BlackboardArtifactNode extends DisplayableItemNode {
if (actualMimeType.isEmpty()) { if (actualMimeType.isEmpty()) {
logger.log(Level.WARNING, "Could not find expected TSK_FILE_TYPE_SIG attribute."); logger.log(Level.WARNING, "Could not find expected TSK_FILE_TYPE_SIG attribute.");
} else { } else {
ss.put(new NodeProperty( ss.put(new NodeProperty<>(
NbBundle.getMessage(this.getClass(), "BlackboardArtifactNode.createSheet.mimeType.name"), NbBundle.getMessage(this.getClass(), "BlackboardArtifactNode.createSheet.mimeType.name"),
NbBundle.getMessage(this.getClass(), "BlackboardArtifactNode.createSheet.mimeType.displayName"), NbBundle.getMessage(this.getClass(), "BlackboardArtifactNode.createSheet.mimeType.displayName"),
NO_DESCR, NO_DESCR,
@ -172,11 +172,11 @@ public class BlackboardArtifactNode extends DisplayableItemNode {
try { try {
sourcePath = associated.getUniquePath(); sourcePath = associated.getUniquePath();
} catch (TskCoreException ex) { } catch (TskCoreException ex) {
logger.log(Level.WARNING, "Failed to get unique path from: " + associated.getName()); logger.log(Level.WARNING, "Failed to get unique path from: {0}", associated.getName());
} }
if (sourcePath.isEmpty() == false) { if (sourcePath.isEmpty() == false) {
ss.put(new NodeProperty( ss.put(new NodeProperty<>(
NbBundle.getMessage(this.getClass(), "BlackboardArtifactNode.createSheet.filePath.name"), NbBundle.getMessage(this.getClass(), "BlackboardArtifactNode.createSheet.filePath.name"),
NbBundle.getMessage(this.getClass(), "BlackboardArtifactNode.createSheet.filePath.displayName"), NbBundle.getMessage(this.getClass(), "BlackboardArtifactNode.createSheet.filePath.displayName"),
NO_DESCR, NO_DESCR,
@ -192,11 +192,11 @@ public class BlackboardArtifactNode extends DisplayableItemNode {
dataSource = getRootParentName(); dataSource = getRootParentName();
} }
} catch (TskCoreException ex) { } catch (TskCoreException ex) {
logger.log(Level.WARNING, "Failed to get image name from " + associated.getName()); logger.log(Level.WARNING, "Failed to get image name from {0}", associated.getName());
} }
if (dataSource.isEmpty() == false) { if (dataSource.isEmpty() == false) {
ss.put(new NodeProperty( ss.put(new NodeProperty<>(
NbBundle.getMessage(this.getClass(), "BlackboardArtifactNode.createSheet.dataSrc.name"), NbBundle.getMessage(this.getClass(), "BlackboardArtifactNode.createSheet.dataSrc.name"),
NbBundle.getMessage(this.getClass(), "BlackboardArtifactNode.createSheet.dataSrc.displayName"), NbBundle.getMessage(this.getClass(), "BlackboardArtifactNode.createSheet.dataSrc.displayName"),
NO_DESCR, NO_DESCR,
@ -215,7 +215,7 @@ public class BlackboardArtifactNode extends DisplayableItemNode {
parentName = parent.getName(); parentName = parent.getName();
} }
} catch (TskCoreException ex) { } catch (TskCoreException ex) {
logger.log(Level.WARNING, "Failed to get parent name from " + associated.getName()); logger.log(Level.WARNING, "Failed to get parent name from {0}", associated.getName());
return ""; return "";
} }
return parentName; return parentName;
@ -227,10 +227,10 @@ public class BlackboardArtifactNode extends DisplayableItemNode {
* *
* @param np NodeProperty to add * @param np NodeProperty to add
*/ */
public void addNodeProperty(NodeProperty np) { public <T> void addNodeProperty(NodeProperty<T> np) {
if (customProperties == null) { if (customProperties == null) {
//lazy create the list //lazy create the list
customProperties = new ArrayList<NodeProperty>(); customProperties = new ArrayList<>();
} }
customProperties.add(np); customProperties.add(np);
@ -297,7 +297,7 @@ public class BlackboardArtifactNode extends DisplayableItemNode {
private static Lookup getLookups(BlackboardArtifact artifact) { private static Lookup getLookups(BlackboardArtifact artifact) {
Content content = getAssociatedContent(artifact); Content content = getAssociatedContent(artifact);
HighlightLookup highlight = getHighlightLookup(artifact, content); HighlightLookup highlight = getHighlightLookup(artifact, content);
List<Object> forLookup = new ArrayList<Object>(); List<Object> forLookup = new ArrayList<>();
forLookup.add(artifact); forLookup.add(artifact);
if (content != null) { if (content != null) {
forLookup.add(content); forLookup.add(content);

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2013 Basis Technology Corp. * Copyright 2013-2014 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -32,14 +32,15 @@ import org.sleuthkit.datamodel.TskCoreException;
/** /**
* Instances of this class wrap BlackboardArtifactTag objects. In the Autopsy * Instances of this class wrap BlackboardArtifactTag objects. In the Autopsy
* presentation of the SleuthKit data model, they are leaf nodes of a sub-tree * presentation of the SleuthKit data model, they are leaf nodes of a sub-tree
* organized as follows: there is a tags root node with tag name child nodes; * organized as follows: there is a tags root node with tag name child nodes;
* tag name nodes have tag type child nodes; tag type nodes are the parents of * tag name nodes have tag type child nodes; tag type nodes are the parents of
* either content or blackboard artifact tag nodes. * either content or blackboard artifact tag nodes.
*/ */
public class BlackboardArtifactTagNode extends DisplayableItemNode { public class BlackboardArtifactTagNode extends DisplayableItemNode {
private static final String ICON_PATH = "org/sleuthkit/autopsy/images/green-tag-icon-16.png"; private static final String ICON_PATH = "org/sleuthkit/autopsy/images/green-tag-icon-16.png";
private final BlackboardArtifactTag tag; private final BlackboardArtifactTag tag;
public BlackboardArtifactTagNode(BlackboardArtifactTag tag) { public BlackboardArtifactTagNode(BlackboardArtifactTag tag) {
super(Children.LEAF, Lookups.fixed(tag, tag.getArtifact(), tag.getContent())); super(Children.LEAF, Lookups.fixed(tag, tag.getArtifact(), tag.getContent()));
@ -58,35 +59,34 @@ public class BlackboardArtifactTagNode extends DisplayableItemNode {
propertySheet.put(properties); propertySheet.put(properties);
} }
properties.put(new NodeProperty( properties.put(new NodeProperty<>(
NbBundle.getMessage(this.getClass(), "BlackboardArtifactTagNode.createSheet.srcFile.text"), NbBundle.getMessage(this.getClass(), "BlackboardArtifactTagNode.createSheet.srcFile.text"),
NbBundle.getMessage(this.getClass(), "BlackboardArtifactTagNode.createSheet.srcFile.text"), NbBundle.getMessage(this.getClass(), "BlackboardArtifactTagNode.createSheet.srcFile.text"),
"", "",
tag.getContent().getName())); tag.getContent().getName()));
String contentPath; String contentPath;
try { try {
contentPath = tag.getContent().getUniquePath(); contentPath = tag.getContent().getUniquePath();
} } catch (TskCoreException ex) {
catch (TskCoreException ex) { Logger.getLogger(ContentTagNode.class.getName()).log(Level.SEVERE, "Failed to get path for content (id = " + tag.getContent().getId() + ")", ex);
Logger.getLogger(ContentTagNode.class.getName()).log(Level.SEVERE, "Failed to get path for content (id = " + tag.getContent().getId() + ")", ex);
contentPath = NbBundle.getMessage(this.getClass(), "BlackboardArtifactTagNode.createSheet.unavail.text"); contentPath = NbBundle.getMessage(this.getClass(), "BlackboardArtifactTagNode.createSheet.unavail.text");
} }
properties.put(new NodeProperty( properties.put(new NodeProperty<>(
NbBundle.getMessage(this.getClass(), "BlackboardArtifactTagNode.createSheet.srcFilePath.text"), NbBundle.getMessage(this.getClass(), "BlackboardArtifactTagNode.createSheet.srcFilePath.text"),
NbBundle.getMessage(this.getClass(), "BlackboardArtifactTagNode.createSheet.srcFilePath.text"), NbBundle.getMessage(this.getClass(), "BlackboardArtifactTagNode.createSheet.srcFilePath.text"),
"", "",
contentPath)); contentPath));
properties.put(new NodeProperty( properties.put(new NodeProperty<>(
NbBundle.getMessage(this.getClass(), "BlackboardArtifactTagNode.createSheet.resultType.text"), NbBundle.getMessage(this.getClass(), "BlackboardArtifactTagNode.createSheet.resultType.text"),
NbBundle.getMessage(this.getClass(), "BlackboardArtifactTagNode.createSheet.resultType.text"), NbBundle.getMessage(this.getClass(), "BlackboardArtifactTagNode.createSheet.resultType.text"),
"", "",
tag.getArtifact().getDisplayName())); tag.getArtifact().getDisplayName()));
properties.put(new NodeProperty( properties.put(new NodeProperty<>(
NbBundle.getMessage(this.getClass(), "BlackboardArtifactTagNode.createSheet.comment.text"), NbBundle.getMessage(this.getClass(), "BlackboardArtifactTagNode.createSheet.comment.text"),
NbBundle.getMessage(this.getClass(), "BlackboardArtifactTagNode.createSheet.comment.text"), NbBundle.getMessage(this.getClass(), "BlackboardArtifactTagNode.createSheet.comment.text"),
"", "",
tag.getComment())); tag.getComment()));
return propertySheet; return propertySheet;
} }
@ -96,8 +96,8 @@ public class BlackboardArtifactTagNode extends DisplayableItemNode {
actions.add(null); // Adds a menu item separator. actions.add(null); // Adds a menu item separator.
actions.add(DeleteBlackboardArtifactTagAction.getInstance()); actions.add(DeleteBlackboardArtifactTagAction.getInstance());
return actions.toArray(new Action[0]); return actions.toArray(new Action[0]);
} }
@Override @Override
public <T> T accept(DisplayableItemNodeVisitor<T> v) { public <T> T accept(DisplayableItemNodeVisitor<T> v) {
return v.visit(this); return v.visit(this);
@ -106,6 +106,5 @@ public class BlackboardArtifactTagNode extends DisplayableItemNode {
@Override @Override
public boolean isLeafTypeNode() { public boolean isLeafTypeNode() {
return true; return true;
} }
} }

View File

@ -16,7 +16,6 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.sleuthkit.autopsy.datamodel; package org.sleuthkit.autopsy.datamodel;
import java.util.List; import java.util.List;
@ -32,12 +31,13 @@ import org.sleuthkit.datamodel.ContentTag;
import org.sleuthkit.datamodel.TskCoreException; import org.sleuthkit.datamodel.TskCoreException;
/** /**
* Instances of this class wrap ContentTag objects. In the Autopsy * Instances of this class wrap ContentTag objects. In the Autopsy presentation
* presentation of the SleuthKit data model, they are leaf nodes of a tree * of the SleuthKit data model, they are leaf nodes of a tree consisting of
* consisting of content and blackboard artifact tags, grouped first by tag * content and blackboard artifact tags, grouped first by tag type, then by tag
* type, then by tag name. * name.
*/ */
class ContentTagNode extends DisplayableItemNode { class ContentTagNode extends DisplayableItemNode {
private static final String ICON_PATH = "org/sleuthkit/autopsy/images/blue-tag-icon-16.png"; private static final String ICON_PATH = "org/sleuthkit/autopsy/images/blue-tag-icon-16.png";
private final ContentTag tag; private final ContentTag tag;
@ -58,27 +58,26 @@ import org.sleuthkit.datamodel.TskCoreException;
propertySheet.put(properties); propertySheet.put(properties);
} }
properties.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "ContentTagNode.createSheet.file.name"), properties.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "ContentTagNode.createSheet.file.name"),
NbBundle.getMessage(this.getClass(), "ContentTagNode.createSheet.file.displayName"), NbBundle.getMessage(this.getClass(), "ContentTagNode.createSheet.file.displayName"),
"", "",
tag.getContent().getName())); tag.getContent().getName()));
String contentPath; String contentPath;
try { try {
contentPath = tag.getContent().getUniquePath(); contentPath = tag.getContent().getUniquePath();
} } catch (TskCoreException ex) {
catch (TskCoreException ex) { Logger.getLogger(ContentTagNode.class.getName()).log(Level.SEVERE, "Failed to get path for content (id = " + tag.getContent().getId() + ")", ex);
Logger.getLogger(ContentTagNode.class.getName()).log(Level.SEVERE, "Failed to get path for content (id = " + tag.getContent().getId() + ")", ex);
contentPath = NbBundle.getMessage(this.getClass(), "ContentTagNode.createSheet.unavail.path"); contentPath = NbBundle.getMessage(this.getClass(), "ContentTagNode.createSheet.unavail.path");
} }
properties.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "ContentTagNode.createSheet.filePath.name"), properties.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "ContentTagNode.createSheet.filePath.name"),
NbBundle.getMessage(this.getClass(), "ContentTagNode.createSheet.filePath.displayName"), NbBundle.getMessage(this.getClass(), "ContentTagNode.createSheet.filePath.displayName"),
"", "",
contentPath)); contentPath));
properties.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "ContentTagNode.createSheet.comment.name"), properties.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "ContentTagNode.createSheet.comment.name"),
NbBundle.getMessage(this.getClass(), "ContentTagNode.createSheet.comment.displayName"), NbBundle.getMessage(this.getClass(), "ContentTagNode.createSheet.comment.displayName"),
"", "",
tag.getComment())); tag.getComment()));
return propertySheet; return propertySheet;
} }
@ -88,8 +87,8 @@ import org.sleuthkit.datamodel.TskCoreException;
actions.add(null); // Adds a menu item separator. actions.add(null); // Adds a menu item separator.
actions.add(DeleteContentTagAction.getInstance()); actions.add(DeleteContentTagAction.getInstance());
return actions.toArray(new Action[0]); return actions.toArray(new Action[0]);
} }
@Override @Override
public <T> T accept(DisplayableItemNodeVisitor<T> v) { public <T> T accept(DisplayableItemNodeVisitor<T> v) {
return v.visit(this); return v.visit(this);
@ -98,5 +97,5 @@ import org.sleuthkit.datamodel.TskCoreException;
@Override @Override
public boolean isLeafTypeNode() { public boolean isLeafTypeNode() {
return true; return true;
} }
} }

View File

@ -34,24 +34,24 @@ import org.sleuthkit.datamodel.TskCoreException;
/** /**
* Instances of this class are are elements of a directory tree sub-tree * Instances of this class are are elements of a directory tree sub-tree
* consisting of content and blackboard artifact tags, grouped first by tag type, * consisting of content and blackboard artifact tags, grouped first by tag
* then by tag name. * type, then by tag name.
*/ */
public class ContentTagTypeNode extends DisplayableItemNode { public class ContentTagTypeNode extends DisplayableItemNode {
private static final String DISPLAY_NAME = NbBundle.getMessage(ContentTagTypeNode.class, "ContentTagTypeNode.displayName.text");
private static final String DISPLAY_NAME = NbBundle.getMessage(ContentTagTypeNode.class, "ContentTagTypeNode.displayName.text");
private static final String ICON_PATH = "org/sleuthkit/autopsy/images/tag-folder-blue-icon-16.png"; private static final String ICON_PATH = "org/sleuthkit/autopsy/images/tag-folder-blue-icon-16.png";
public ContentTagTypeNode(TagName tagName) { public ContentTagTypeNode(TagName tagName) {
super(Children.create(new ContentTagNodeFactory(tagName), true), Lookups.singleton(tagName.getDisplayName() + " " + DISPLAY_NAME)); super(Children.create(new ContentTagNodeFactory(tagName), true), Lookups.singleton(tagName.getDisplayName() + " " + DISPLAY_NAME));
long tagsCount = 0; long tagsCount = 0;
try { try {
tagsCount = Case.getCurrentCase().getServices().getTagsManager().getContentTagsCountByTagName(tagName); tagsCount = Case.getCurrentCase().getServices().getTagsManager().getContentTagsCountByTagName(tagName);
} } catch (TskCoreException ex) {
catch (TskCoreException ex) {
Logger.getLogger(ContentTagTypeNode.class.getName()).log(Level.SEVERE, "Failed to get content tags count for " + tagName.getDisplayName() + " tag name", ex); Logger.getLogger(ContentTagTypeNode.class.getName()).log(Level.SEVERE, "Failed to get content tags count for " + tagName.getDisplayName() + " tag name", ex);
} }
super.setName(DISPLAY_NAME); super.setName(DISPLAY_NAME);
super.setDisplayName(DISPLAY_NAME + " (" + tagsCount + ")"); super.setDisplayName(DISPLAY_NAME + " (" + tagsCount + ")");
this.setIconBaseWithExtension(ICON_PATH); this.setIconBaseWithExtension(ICON_PATH);
@ -66,10 +66,10 @@ public class ContentTagTypeNode extends DisplayableItemNode {
propertySheet.put(properties); propertySheet.put(properties);
} }
properties.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "ContentTagTypeNode.createSheet.name.name"), properties.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "ContentTagTypeNode.createSheet.name.name"),
NbBundle.getMessage(this.getClass(), "ContentTagTypeNode.createSheet.name.displayName"), NbBundle.getMessage(this.getClass(), "ContentTagTypeNode.createSheet.name.displayName"),
"", "",
getName())); getName()));
return propertySheet; return propertySheet;
} }
@ -83,23 +83,23 @@ public class ContentTagTypeNode extends DisplayableItemNode {
public boolean isLeafTypeNode() { public boolean isLeafTypeNode() {
return true; return true;
} }
private static class ContentTagNodeFactory extends ChildFactory<ContentTag> { private static class ContentTagNodeFactory extends ChildFactory<ContentTag> {
private final TagName tagName; private final TagName tagName;
ContentTagNodeFactory(TagName tagName) { ContentTagNodeFactory(TagName tagName) {
this.tagName = tagName; this.tagName = tagName;
} }
@Override @Override
protected boolean createKeys(List<ContentTag> keys) { protected boolean createKeys(List<ContentTag> keys) {
// Use the content tags bearing the specified tag name as the keys. // Use the content tags bearing the specified tag name as the keys.
try { try {
keys.addAll(Case.getCurrentCase().getServices().getTagsManager().getContentTagsByTagName(tagName)); keys.addAll(Case.getCurrentCase().getServices().getTagsManager().getContentTagsByTagName(tagName));
} catch (TskCoreException ex) {
Logger.getLogger(ContentTagTypeNode.ContentTagNodeFactory.class.getName()).log(Level.SEVERE, "Failed to get tag names", ex);
} }
catch (TskCoreException ex) {
Logger.getLogger(ContentTagTypeNode.ContentTagNodeFactory.class.getName()).log(Level.SEVERE, "Failed to get tag names", ex);
}
return true; return true;
} }

View File

@ -159,8 +159,8 @@ public final class ContentUtils {
* @return number of bytes extracted * @return number of bytes extracted
* @throws IOException if file could not be written * @throws IOException if file could not be written
*/ */
public static long writeToFile(Content content, java.io.File outputFile, public static <T,V> long writeToFile(Content content, java.io.File outputFile,
ProgressHandle progress, SwingWorker worker, boolean source) throws IOException { ProgressHandle progress, SwingWorker<T,V> worker, boolean source) throws IOException {
InputStream in = new ReadContentInputStream(content); InputStream in = new ReadContentInputStream(content);
@ -215,11 +215,11 @@ public final class ContentUtils {
* Assumes there will be no collisions with existing directories/files, and * Assumes there will be no collisions with existing directories/files, and
* that the directory to contain the destination file already exists. * that the directory to contain the destination file already exists.
*/ */
public static class ExtractFscContentVisitor extends ContentVisitor.Default<Void> { public static class ExtractFscContentVisitor<T,V> extends ContentVisitor.Default<Void> {
java.io.File dest; java.io.File dest;
ProgressHandle progress; ProgressHandle progress;
SwingWorker worker; SwingWorker<T,V> worker;
boolean source = false; boolean source = false;
/** /**
@ -234,7 +234,7 @@ public final class ContentUtils {
* @param source true if source file * @param source true if source file
*/ */
public ExtractFscContentVisitor(java.io.File dest, public ExtractFscContentVisitor(java.io.File dest,
ProgressHandle progress, SwingWorker worker, boolean source) { ProgressHandle progress, SwingWorker<T,V> worker, boolean source) {
this.dest = dest; this.dest = dest;
this.progress = progress; this.progress = progress;
this.worker = worker; this.worker = worker;
@ -249,8 +249,8 @@ public final class ContentUtils {
* Convenience method to make a new instance for given destination and * Convenience method to make a new instance for given destination and
* extract given content * extract given content
*/ */
public static void extract(Content cntnt, java.io.File dest, ProgressHandle progress, SwingWorker worker) { public static <T,V> void extract(Content cntnt, java.io.File dest, ProgressHandle progress, SwingWorker<T,V> worker) {
cntnt.accept(new ExtractFscContentVisitor(dest, progress, worker, true)); cntnt.accept(new ExtractFscContentVisitor<>(dest, progress, worker, true));
} }
@Override @Override
@ -333,8 +333,8 @@ public final class ContentUtils {
// recurse on children // recurse on children
for (Content child : dir.getChildren()) { for (Content child : dir.getChildren()) {
java.io.File childFile = getFsContentDest(child); java.io.File childFile = getFsContentDest(child);
ExtractFscContentVisitor childVisitor = ExtractFscContentVisitor<T,V> childVisitor =
new ExtractFscContentVisitor(childFile, progress, worker, false); new ExtractFscContentVisitor<>(childFile, progress, worker, false);
// If this is the source directory of an extract it // If this is the source directory of an extract it
// will have a progress and worker, and will keep track // will have a progress and worker, and will keep track
// of the progress bar's progress // of the progress bar's progress

View File

@ -102,10 +102,10 @@ public class DataConversion {
outputStringBuilder.append(" "); outputStringBuilder.append(" ");
// print the ascii columns // print the ascii columns
String ascii = new String(array, curOffset, lineLen); String ascii = new String(array, curOffset, lineLen, java.nio.charset.StandardCharsets.US_ASCII);
for (int i = 0; i < 16; i++) { for (int i = 0; i < 16; i++) {
char c = ' '; char c = ' ';
if (i < lineLen) { if (i < ascii.length()) {
c = ascii.charAt(i); c = ascii.charAt(i);
int dec = (int) c; int dec = (int) c;

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2011 Basis Technology Corp. * Copyright 2011-2014 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -43,7 +43,7 @@ public class DataSourcesNode extends DisplayableItemNode {
public boolean isLeafTypeNode() { public boolean isLeafTypeNode() {
return false; return false;
} }
@Override @Override
public <T> T accept(DisplayableItemNodeVisitor<T> v) { public <T> T accept(DisplayableItemNodeVisitor<T> v) {
return v.visit(this); return v.visit(this);
@ -58,10 +58,10 @@ public class DataSourcesNode extends DisplayableItemNode {
s.put(ss); s.put(ss);
} }
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "DataSourcesNode.createSheet.name.name"), ss.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "DataSourcesNode.createSheet.name.name"),
NbBundle.getMessage(this.getClass(), "DataSourcesNode.createSheet.name.displayName"), NbBundle.getMessage(this.getClass(), "DataSourcesNode.createSheet.name.displayName"),
NbBundle.getMessage(this.getClass(), "DataSourcesNode.createSheet.name.desc"), NbBundle.getMessage(this.getClass(), "DataSourcesNode.createSheet.name.desc"),
NAME)); NAME));
return s; return s;
} }
} }

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2013 Basis Technology Corp. * Copyright 2013-2014 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -53,11 +53,11 @@ public class DeletedContent implements AutopsyVisitableItem {
public enum DeletedContentFilter implements AutopsyVisitableItem { public enum DeletedContentFilter implements AutopsyVisitableItem {
FS_DELETED_FILTER(0, FS_DELETED_FILTER(0,
"FS_DELETED_FILTER", "FS_DELETED_FILTER",
NbBundle.getMessage(DeletedContent.class, "DeletedContent.fsDelFilter.text")), NbBundle.getMessage(DeletedContent.class, "DeletedContent.fsDelFilter.text")),
ALL_DELETED_FILTER(1, ALL_DELETED_FILTER(1,
"ALL_DELETED_FILTER", "ALL_DELETED_FILTER",
NbBundle.getMessage(DeletedContent.class, "DeletedContent.allDelFilter.text")); NbBundle.getMessage(DeletedContent.class, "DeletedContent.allDelFilter.text"));
private int id; private int id;
private String name; private String name;
private String displayName; private String displayName;
@ -103,7 +103,7 @@ public class DeletedContent implements AutopsyVisitableItem {
public static class DeletedContentsNode extends DisplayableItemNode { public static class DeletedContentsNode extends DisplayableItemNode {
private static final String NAME = NbBundle.getMessage(DeletedContent.class, private static final String NAME = NbBundle.getMessage(DeletedContent.class,
"DeletedContent.deletedContentsNode.name"); "DeletedContent.deletedContentsNode.name");
private SleuthkitCase skCase; private SleuthkitCase skCase;
DeletedContentsNode(SleuthkitCase skCase) { DeletedContentsNode(SleuthkitCase skCase) {
@ -118,7 +118,7 @@ public class DeletedContent implements AutopsyVisitableItem {
public boolean isLeafTypeNode() { public boolean isLeafTypeNode() {
return false; return false;
} }
@Override @Override
public <T> T accept(DisplayableItemNodeVisitor<T> v) { public <T> T accept(DisplayableItemNodeVisitor<T> v) {
return v.visit(this); return v.visit(this);
@ -133,10 +133,10 @@ public class DeletedContent implements AutopsyVisitableItem {
s.put(ss); s.put(ss);
} }
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "DeletedContent.createSheet.name.name"), ss.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "DeletedContent.createSheet.name.name"),
NbBundle.getMessage(this.getClass(), "DeletedContent.createSheet.name.displayName"), NbBundle.getMessage(this.getClass(), "DeletedContent.createSheet.name.displayName"),
NbBundle.getMessage(this.getClass(), "DeletedContent.createSheet.name.desc"), NbBundle.getMessage(this.getClass(), "DeletedContent.createSheet.name.desc"),
NAME)); NAME));
return s; return s;
} }
} }
@ -163,14 +163,12 @@ public class DeletedContent implements AutopsyVisitableItem {
public class DeletedContentNode extends DisplayableItemNode { public class DeletedContentNode extends DisplayableItemNode {
private SleuthkitCase skCase;
private DeletedContent.DeletedContentFilter filter; private DeletedContent.DeletedContentFilter filter;
private final Logger logger = Logger.getLogger(DeletedContentNode.class.getName()); private final Logger logger = Logger.getLogger(DeletedContentNode.class.getName());
DeletedContentNode(SleuthkitCase skCase, DeletedContent.DeletedContentFilter filter) { DeletedContentNode(SleuthkitCase skCase, DeletedContent.DeletedContentFilter filter) {
super(Children.create(new DeletedContentChildren(filter, skCase), true), Lookups.singleton(filter.getDisplayName())); super(Children.create(new DeletedContentChildren(filter, skCase), true), Lookups.singleton(filter.getDisplayName()));
super.setName(filter.getName()); super.setName(filter.getName());
this.skCase = skCase;
this.filter = filter; this.filter = filter;
String tooltip = filter.getDisplayName(); String tooltip = filter.getDisplayName();
@ -197,7 +195,7 @@ public class DeletedContent implements AutopsyVisitableItem {
s.put(ss); s.put(ss);
} }
ss.put(new NodeProperty( ss.put(new NodeProperty<>(
NbBundle.getMessage(this.getClass(), "DeletedContent.createSheet.filterType.name"), NbBundle.getMessage(this.getClass(), "DeletedContent.createSheet.filterType.name"),
NbBundle.getMessage(this.getClass(), "DeletedContent.createSheet.filterType.displayName"), NbBundle.getMessage(this.getClass(), "DeletedContent.createSheet.filterType.displayName"),
NbBundle.getMessage(this.getClass(), "DeletedContent.createSheet.filterType.desc"), NbBundle.getMessage(this.getClass(), "DeletedContent.createSheet.filterType.desc"),
@ -217,8 +215,7 @@ public class DeletedContent implements AutopsyVisitableItem {
private SleuthkitCase skCase; private SleuthkitCase skCase;
private DeletedContent.DeletedContentFilter filter; private DeletedContent.DeletedContentFilter filter;
private final Logger logger = Logger.getLogger(DeletedContentChildren.class.getName()); private final Logger logger = Logger.getLogger(DeletedContentChildren.class.getName());
private static final int MAX_OBJECTS = 10001;
private static final int MAX_OBJECTS = 2001;
DeletedContentChildren(DeletedContent.DeletedContentFilter filter, SleuthkitCase skCase) { DeletedContentChildren(DeletedContent.DeletedContentFilter filter, SleuthkitCase skCase) {
this.skCase = skCase; this.skCase = skCase;
@ -233,12 +230,12 @@ public class DeletedContent implements AutopsyVisitableItem {
@Override @Override
public void run() { public void run() {
JOptionPane.showMessageDialog(null, NbBundle.getMessage(this.getClass(), JOptionPane.showMessageDialog(null, NbBundle.getMessage(this.getClass(),
"DeletedContent.createKeys.maxObjects.msg", "DeletedContent.createKeys.maxObjects.msg",
MAX_OBJECTS - 1)); MAX_OBJECTS - 1));
} }
}); });
} }
queryList.remove(queryList.size() - 1); queryList.remove(queryList.size() - 1);
list.addAll(queryList); list.addAll(queryList);
return true; return true;
@ -273,7 +270,7 @@ public class DeletedContent implements AutopsyVisitableItem {
break; break;
default: default:
logger.log(Level.SEVERE, "Unsupported filter type to get deleted content: " + filter); logger.log(Level.SEVERE, "Unsupported filter type to get deleted content: {0}", filter);
} }
@ -282,7 +279,7 @@ public class DeletedContent implements AutopsyVisitableItem {
} }
private List<AbstractFile> runFsQuery() { private List<AbstractFile> runFsQuery() {
List<AbstractFile> ret = new ArrayList<AbstractFile>(); List<AbstractFile> ret = new ArrayList<>();
String query = makeQuery(); String query = makeQuery();
try { try {
@ -338,8 +335,8 @@ public class DeletedContent implements AutopsyVisitableItem {
@Override @Override
protected AbstractNode defaultVisit(Content di) { protected AbstractNode defaultVisit(Content di) {
throw new UnsupportedOperationException(NbBundle.getMessage(this.getClass(), throw new UnsupportedOperationException(NbBundle.getMessage(this.getClass(),
"DeletedContent.createNodeForKey.typeNotSupported.msg", "DeletedContent.createNodeForKey.typeNotSupported.msg",
di.toString())); di.toString()));
} }
}); });
} }

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2012 Basis Technology Corp. * Copyright 2012-2014 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -58,7 +58,7 @@ public class EmailExtracted implements AutopsyVisitableItem {
public EmailExtracted(SleuthkitCase skCase) { public EmailExtracted(SleuthkitCase skCase) {
this.skCase = skCase; this.skCase = skCase;
accounts = new LinkedHashMap<String, Map<String, List<Long>>>(); accounts = new LinkedHashMap<>();
} }
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
@ -82,12 +82,12 @@ public class EmailExtracted implements AutopsyVisitableItem {
Map<String, List<Long>> folders = accounts.get(account); Map<String, List<Long>> folders = accounts.get(account);
if (folders == null) { if (folders == null) {
folders = new LinkedHashMap<String, List<Long>>(); folders = new LinkedHashMap<>();
accounts.put(account, folders); accounts.put(account, folders);
} }
List<Long> messages = folders.get(folder); List<Long> messages = folders.get(folder);
if (messages == null) { if (messages == null) {
messages = new ArrayList<Long>(); messages = new ArrayList<>();
folders.put(folder, messages); folders.put(folder, messages);
} }
messages.add(artifactId); messages.add(artifactId);
@ -100,11 +100,10 @@ public class EmailExtracted implements AutopsyVisitableItem {
} }
private static Map<String, String> parsePath(String path) { private static Map<String, String> parsePath(String path) {
Map<String, String> parsed = new HashMap<String, String>(); Map<String, String> parsed = new HashMap<>();
String[] split = path.split(MAIL_PATH_SEPARATOR); String[] split = path.split(MAIL_PATH_SEPARATOR);
if (split.length < 4) { if (split.length < 4) {
logger.log(Level.WARNING, "Unexpected number of tokens when parsing email PATH: " logger.log(Level.WARNING, "Unexpected number of tokens when parsing email PATH: {0}, will use defaults", split.length);
+ split.length + ", will use defaults");
parsed.put(MAIL_ACCOUNT, NbBundle.getMessage(EmailExtracted.class, "EmailExtracted.defaultAcct.text")); parsed.put(MAIL_ACCOUNT, NbBundle.getMessage(EmailExtracted.class, "EmailExtracted.defaultAcct.text"));
parsed.put(MAIL_FOLDER, NbBundle.getMessage(EmailExtracted.class, "EmailExtracted.defaultFolder.text")); parsed.put(MAIL_FOLDER, NbBundle.getMessage(EmailExtracted.class, "EmailExtracted.defaultFolder.text"));
return parsed; return parsed;
@ -137,7 +136,7 @@ public class EmailExtracted implements AutopsyVisitableItem {
public boolean isLeafTypeNode() { public boolean isLeafTypeNode() {
return false; return false;
} }
@Override @Override
public <T> T accept(DisplayableItemNodeVisitor<T> v) { public <T> T accept(DisplayableItemNodeVisitor<T> v) {
//return v.visit(this); //return v.visit(this);
@ -153,11 +152,10 @@ public class EmailExtracted implements AutopsyVisitableItem {
s.put(ss); s.put(ss);
} }
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "EmailExtracted.createSheet.name.name"), ss.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "EmailExtracted.createSheet.name.name"),
NbBundle.getMessage(this.getClass(), "EmailExtracted.createSheet.name.displayName"), NbBundle.getMessage(this.getClass(), "EmailExtracted.createSheet.name.displayName"),
NbBundle.getMessage(this.getClass(), "EmailExtracted.createSheet.name.desc"), NbBundle.getMessage(this.getClass(), "EmailExtracted.createSheet.name.desc"),
getName())); getName()));
return s; return s;
} }
} }
@ -190,7 +188,6 @@ public class EmailExtracted implements AutopsyVisitableItem {
} }
} }
list.addAll(tempList); list.addAll(tempList);
return true; return true;
} }
@ -219,7 +216,7 @@ public class EmailExtracted implements AutopsyVisitableItem {
public boolean isLeafTypeNode() { public boolean isLeafTypeNode() {
return false; return false;
} }
@Override @Override
public <T> T accept(DisplayableItemNodeVisitor<T> v) { public <T> T accept(DisplayableItemNodeVisitor<T> v) {
return v.visit(this); return v.visit(this);
@ -235,10 +232,10 @@ public class EmailExtracted implements AutopsyVisitableItem {
s.put(ss); s.put(ss);
} }
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "EmailExtracted.createSheet.name.name"), ss.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "EmailExtracted.createSheet.name.name"),
NbBundle.getMessage(this.getClass(), "EmailExtracted.createSheet.name.displayName"), NbBundle.getMessage(this.getClass(), "EmailExtracted.createSheet.name.displayName"),
NbBundle.getMessage(this.getClass(), "EmailExtracted.createSheet.name.desc"), NbBundle.getMessage(this.getClass(), "EmailExtracted.createSheet.name.desc"),
getName())); getName()));
return s; return s;
} }
@ -282,10 +279,10 @@ public class EmailExtracted implements AutopsyVisitableItem {
s.put(ss); s.put(ss);
} }
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "EmailExtracted.createSheet.name.name"), ss.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "EmailExtracted.createSheet.name.name"),
NbBundle.getMessage(this.getClass(), "EmailExtracted.createSheet.name.displayName"), NbBundle.getMessage(this.getClass(), "EmailExtracted.createSheet.name.displayName"),
NbBundle.getMessage(this.getClass(), "EmailExtracted.createSheet.name.desc"), NbBundle.getMessage(this.getClass(), "EmailExtracted.createSheet.name.desc"),
getName())); getName()));
return s; return s;
} }
@ -294,7 +291,7 @@ public class EmailExtracted implements AutopsyVisitableItem {
public boolean isLeafTypeNode() { public boolean isLeafTypeNode() {
return false; return false;
} }
@Override @Override
public <T> T accept(DisplayableItemNodeVisitor<T> v) { public <T> T accept(DisplayableItemNodeVisitor<T> v) {
return v.visit(this); return v.visit(this);
@ -352,10 +349,10 @@ public class EmailExtracted implements AutopsyVisitableItem {
s.put(ss); s.put(ss);
} }
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "EmailExtracted.createSheet.name.name"), ss.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "EmailExtracted.createSheet.name.name"),
NbBundle.getMessage(this.getClass(), "EmailExtracted.createSheet.name.displayName"), NbBundle.getMessage(this.getClass(), "EmailExtracted.createSheet.name.displayName"),
NbBundle.getMessage(this.getClass(), "EmailExtracted.createSheet.name.desc"), NbBundle.getMessage(this.getClass(), "EmailExtracted.createSheet.name.desc"),
getName())); getName()));
return s; return s;
} }

View File

@ -46,7 +46,7 @@ class ExtractedContentChildren extends ChildFactory<BlackboardArtifact.ARTIFACT_
this.skCase = skCase; this.skCase = skCase;
// these are shown in other parts of the UI tree // these are shown in other parts of the UI tree
doNotShow = new ArrayList(); doNotShow = new ArrayList<>();
doNotShow.add(BlackboardArtifact.ARTIFACT_TYPE.TSK_GEN_INFO); doNotShow.add(BlackboardArtifact.ARTIFACT_TYPE.TSK_GEN_INFO);
doNotShow.add(BlackboardArtifact.ARTIFACT_TYPE.TSK_EMAIL_MSG); doNotShow.add(BlackboardArtifact.ARTIFACT_TYPE.TSK_EMAIL_MSG);
doNotShow.add(BlackboardArtifact.ARTIFACT_TYPE.TSK_HASHSET_HIT); doNotShow.add(BlackboardArtifact.ARTIFACT_TYPE.TSK_HASHSET_HIT);

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2011 Basis Technology Corp. * Copyright 2011-2014 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -25,7 +25,8 @@ import org.openide.util.lookup.Lookups;
import org.sleuthkit.datamodel.SleuthkitCase; import org.sleuthkit.datamodel.SleuthkitCase;
/** /**
* Node for the extracted content artifacts (artifacts that are not shown in more specific areas of the tree) * Node for the extracted content artifacts (artifacts that are not shown in
* more specific areas of the tree)
*/ */
public class ExtractedContentNode extends DisplayableItemNode { public class ExtractedContentNode extends DisplayableItemNode {
@ -42,7 +43,7 @@ public class ExtractedContentNode extends DisplayableItemNode {
public boolean isLeafTypeNode() { public boolean isLeafTypeNode() {
return false; return false;
} }
@Override @Override
public <T> T accept(DisplayableItemNodeVisitor<T> v) { public <T> T accept(DisplayableItemNodeVisitor<T> v) {
return v.visit(this); return v.visit(this);
@ -57,9 +58,9 @@ public class ExtractedContentNode extends DisplayableItemNode {
s.put(ss); s.put(ss);
} }
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "ExtractedContentNode.createSheet.name.name"), ss.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "ExtractedContentNode.createSheet.name.name"),
NbBundle.getMessage(this.getClass(), "ExtractedContentNode.createSheet.name.displayName"), NbBundle.getMessage(this.getClass(), "ExtractedContentNode.createSheet.name.displayName"),
NbBundle.getMessage(this.getClass(), "ExtractedContentNode.createSheet.name.desc"), NbBundle.getMessage(this.getClass(), "ExtractedContentNode.createSheet.name.desc"),
NAME)); NAME));
return s; return s;
} }

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2013 Basis Technology Corp. * Copyright 2013-2014 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -101,13 +101,11 @@ public class FileSize implements AutopsyVisitableItem {
public static class FileSizeRootNode extends DisplayableItemNode { public static class FileSizeRootNode extends DisplayableItemNode {
private static final String NAME = NbBundle.getMessage(FileSize.class, "FileSize.fileSizeRootNode.name"); private static final String NAME = NbBundle.getMessage(FileSize.class, "FileSize.fileSizeRootNode.name");
private SleuthkitCase skCase;
FileSizeRootNode(SleuthkitCase skCase) { FileSizeRootNode(SleuthkitCase skCase) {
super(Children.create(new FileSizeRootChildren(skCase), true), Lookups.singleton(NAME)); super(Children.create(new FileSizeRootChildren(skCase), true), Lookups.singleton(NAME));
super.setName(NAME); super.setName(NAME);
super.setDisplayName(NAME); super.setDisplayName(NAME);
this.skCase = skCase;
this.setIconBaseWithExtension("org/sleuthkit/autopsy/images/file-size-16.png"); this.setIconBaseWithExtension("org/sleuthkit/autopsy/images/file-size-16.png");
} }
@ -115,7 +113,7 @@ public class FileSize implements AutopsyVisitableItem {
public boolean isLeafTypeNode() { public boolean isLeafTypeNode() {
return false; return false;
} }
@Override @Override
public <T> T accept(DisplayableItemNodeVisitor<T> v) { public <T> T accept(DisplayableItemNodeVisitor<T> v) {
return v.visit(this); return v.visit(this);
@ -130,9 +128,9 @@ public class FileSize implements AutopsyVisitableItem {
s.put(ss); s.put(ss);
} }
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "FileSize.createSheet.name.name"), ss.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "FileSize.createSheet.name.name"),
NbBundle.getMessage(this.getClass(), "FileSize.createSheet.name.displayName"), NbBundle.getMessage(this.getClass(), "FileSize.createSheet.name.displayName"),
NbBundle.getMessage(this.getClass(), "FileSize.createSheet.name.desc"), NbBundle.getMessage(this.getClass(), "FileSize.createSheet.name.desc"),
NAME)); NAME));
return s; return s;
} }
@ -160,14 +158,12 @@ public class FileSize implements AutopsyVisitableItem {
public class FileSizeNode extends DisplayableItemNode { public class FileSizeNode extends DisplayableItemNode {
private SleuthkitCase skCase;
private FileSizeFilter filter; private FileSizeFilter filter;
private final Logger logger = Logger.getLogger(FileSizeNode.class.getName()); private final Logger logger = Logger.getLogger(FileSizeNode.class.getName());
FileSizeNode(SleuthkitCase skCase, FileSizeFilter filter) { FileSizeNode(SleuthkitCase skCase, FileSizeFilter filter) {
super(Children.create(new FileSizeChildren(filter, skCase), true), Lookups.singleton(filter.getDisplayName())); super(Children.create(new FileSizeChildren(filter, skCase), true), Lookups.singleton(filter.getDisplayName()));
super.setName(filter.getName()); super.setName(filter.getName());
this.skCase = skCase;
this.filter = filter; this.filter = filter;
String tooltip = filter.getDisplayName(); String tooltip = filter.getDisplayName();
@ -194,10 +190,10 @@ public class FileSize implements AutopsyVisitableItem {
s.put(ss); s.put(ss);
} }
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "FileSize.createSheet.filterType.name"), ss.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "FileSize.createSheet.filterType.name"),
NbBundle.getMessage(this.getClass(), "FileSize.createSheet.filterType.displayName"), NbBundle.getMessage(this.getClass(), "FileSize.createSheet.filterType.displayName"),
NbBundle.getMessage(this.getClass(), "FileSize.createSheet.filterType.desc"), NbBundle.getMessage(this.getClass(), "FileSize.createSheet.filterType.desc"),
filter.getDisplayName())); filter.getDisplayName()));
return s; return s;
} }
@ -244,7 +240,7 @@ public class FileSize implements AutopsyVisitableItem {
break; break;
default: default:
logger.log(Level.SEVERE, "Unsupported filter type to get files by size: " + filter); logger.log(Level.SEVERE, "Unsupported filter type to get files by size: {0}", filter);
return null; return null;
} }
// ignore unalloc block files // ignore unalloc block files
@ -254,13 +250,13 @@ public class FileSize implements AutopsyVisitableItem {
} }
private List<AbstractFile> runFsQuery() { private List<AbstractFile> runFsQuery() {
List<AbstractFile> ret = new ArrayList<AbstractFile>(); List<AbstractFile> ret = new ArrayList<>();
String query = makeQuery(); String query = makeQuery();
if (query == null) { if (query == null) {
return null; return null;
} }
try { try {
ret = skCase.findAllFilesWhere(query); ret = skCase.findAllFilesWhere(query);
} catch (TskCoreException e) { } catch (TskCoreException e) {
@ -330,8 +326,8 @@ public class FileSize implements AutopsyVisitableItem {
protected AbstractNode defaultVisit(Content di) { protected AbstractNode defaultVisit(Content di) {
throw new UnsupportedOperationException( throw new UnsupportedOperationException(
NbBundle.getMessage(this.getClass(), NbBundle.getMessage(this.getClass(),
"FileSize.exception.notSupported.msg", "FileSize.exception.notSupported.msg",
di.toString())); di.toString()));
} }
}); });
} }

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2011 Basis Technology Corp. * Copyright 2011-2014 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -34,12 +34,12 @@ public class FileTypeNode extends DisplayableItemNode {
FileTypeNode(FileTypeExtensionFilters.SearchFilterInterface filter, SleuthkitCase skCase) { FileTypeNode(FileTypeExtensionFilters.SearchFilterInterface filter, SleuthkitCase skCase) {
super(Children.create(new FileTypeChildren(filter, skCase), true), Lookups.singleton(filter.getDisplayName())); super(Children.create(new FileTypeChildren(filter, skCase), true), Lookups.singleton(filter.getDisplayName()));
this.filter = filter; this.filter = filter;
this.skCase = skCase; this.skCase = skCase;
super.setName(filter.getName()); super.setName(filter.getName());
//get count of children without preloading all children nodes //get count of children without preloading all children nodes
final long count = new FileTypeChildren(filter, skCase).calculateItems(); final long count = new FileTypeChildren(filter, skCase).calculateItems();
//final long count = getChildren().getNodesCount(true); //final long count = getChildren().getNodesCount(true);
@ -62,19 +62,19 @@ public class FileTypeNode extends DisplayableItemNode {
s.put(ss); s.put(ss);
} }
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "FileTypeNode.createSheet.filterType.name"), ss.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "FileTypeNode.createSheet.filterType.name"),
NbBundle.getMessage(this.getClass(), "FileTypeNode.createSheet.filterType.displayName"), NbBundle.getMessage(this.getClass(), "FileTypeNode.createSheet.filterType.displayName"),
NbBundle.getMessage(this.getClass(), "FileTypeNode.createSheet.filterType.desc"), NbBundle.getMessage(this.getClass(), "FileTypeNode.createSheet.filterType.desc"),
filter.getDisplayName())); filter.getDisplayName()));
String extensions = ""; String extensions = "";
for (String ext : filter.getFilter()) { for (String ext : filter.getFilter()) {
extensions += "'" + ext + "', "; extensions += "'" + ext + "', ";
} }
extensions = extensions.substring(0, extensions.lastIndexOf(',')); extensions = extensions.substring(0, extensions.lastIndexOf(','));
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "FileTypeNode.createSheet.fileExt.name"), ss.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "FileTypeNode.createSheet.fileExt.name"),
NbBundle.getMessage(this.getClass(), "FileTypeNode.createSheet.fileExt.displayName"), NbBundle.getMessage(this.getClass(), "FileTypeNode.createSheet.fileExt.displayName"),
NbBundle.getMessage(this.getClass(), "FileTypeNode.createSheet.fileExt.desc"), NbBundle.getMessage(this.getClass(), "FileTypeNode.createSheet.fileExt.desc"),
extensions)); extensions));
return s; return s;
} }

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2011 Basis Technology Corp. * Copyright 2011-2014 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -30,12 +30,12 @@ import org.sleuthkit.datamodel.SleuthkitCase;
public class FileTypesNode extends DisplayableItemNode { public class FileTypesNode extends DisplayableItemNode {
private static final String FNAME = NbBundle.getMessage(FileTypesNode.class, "FileTypesNode.fname.text"); private static final String FNAME = NbBundle.getMessage(FileTypesNode.class, "FileTypesNode.fname.text");
private SleuthkitCase skCase;
/** /**
* *
* @param skCase * @param skCase
* @param filter null to display root node of file type tree, pass in something to provide a sub-node. * @param filter null to display root node of file type tree, pass in
* something to provide a sub-node.
*/ */
FileTypesNode(SleuthkitCase skCase, FileTypeExtensionFilters.RootFilter filter) { FileTypesNode(SleuthkitCase skCase, FileTypeExtensionFilters.RootFilter filter) {
super(Children.create(new FileTypesChildren(skCase, filter), true), Lookups.singleton(filter == null ? FNAME : filter.getName())); super(Children.create(new FileTypesChildren(skCase, filter), true), Lookups.singleton(filter == null ? FNAME : filter.getName()));
@ -43,13 +43,11 @@ public class FileTypesNode extends DisplayableItemNode {
if (filter == null) { if (filter == null) {
super.setName(FNAME); super.setName(FNAME);
super.setDisplayName(FNAME); super.setDisplayName(FNAME);
} } // sub-node in file tree (i.e. documents, exec, etc.)
// sub-node in file tree (i.e. documents, exec, etc.)
else { else {
super.setName(filter.getName()); super.setName(filter.getName());
super.setDisplayName(filter.getDisplayName()); super.setDisplayName(filter.getDisplayName());
} }
this.skCase = skCase;
this.setIconBaseWithExtension("org/sleuthkit/autopsy/images/file_types.png"); this.setIconBaseWithExtension("org/sleuthkit/autopsy/images/file_types.png");
} }
@ -57,7 +55,7 @@ public class FileTypesNode extends DisplayableItemNode {
public boolean isLeafTypeNode() { public boolean isLeafTypeNode() {
return false; return false;
} }
@Override @Override
public <T> T accept(DisplayableItemNodeVisitor<T> v) { public <T> T accept(DisplayableItemNodeVisitor<T> v) {
return v.visit(this); return v.visit(this);
@ -72,9 +70,9 @@ public class FileTypesNode extends DisplayableItemNode {
s.put(ss); s.put(ss);
} }
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "FileTypesNode.createSheet.name.name"), ss.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "FileTypesNode.createSheet.name.name"),
NbBundle.getMessage(this.getClass(), "FileTypesNode.createSheet.name.displayName"), NbBundle.getMessage(this.getClass(), "FileTypesNode.createSheet.name.displayName"),
NbBundle.getMessage(this.getClass(), "FileTypesNode.createSheet.name.desc"), NbBundle.getMessage(this.getClass(), "FileTypesNode.createSheet.name.desc"),
getName())); getName()));
return s; return s;
} }

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2011 Basis Technology Corp. * Copyright 2011-2014 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -52,7 +52,7 @@ public class HashsetHits implements AutopsyVisitableItem {
public HashsetHits(SleuthkitCase skCase) { public HashsetHits(SleuthkitCase skCase) {
this.skCase = skCase; this.skCase = skCase;
hashSetHitsMap = new LinkedHashMap<String, Set<Long>>(); hashSetHitsMap = new LinkedHashMap<>();
} }
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
@ -77,21 +77,20 @@ public class HashsetHits implements AutopsyVisitableItem {
hashSetHitsMap.get(value).add(artifactId); hashSetHitsMap.get(value).add(artifactId);
} }
} catch (SQLException ex) { } catch (SQLException ex) {
logger.log(Level.WARNING, "SQL Exception occurred: ", ex); logger.log(Level.WARNING, "SQL Exception occurred: ", ex);
} } finally {
finally {
if (rs != null) { if (rs != null) {
try { try {
skCase.closeRunQuery(rs); skCase.closeRunQuery(rs);
} catch (SQLException ex) { } catch (SQLException ex) {
logger.log(Level.WARNING, "Error closing result set after getting hashset hits", ex); logger.log(Level.WARNING, "Error closing result set after getting hashset hits", ex);
} }
} }
} }
} }
@Override @Override
public <T> T accept(AutopsyItemVisitor<T> v) { public <T> T accept(AutopsyItemVisitor<T> v) {
return v.visit(this); return v.visit(this);
@ -114,7 +113,7 @@ public class HashsetHits implements AutopsyVisitableItem {
public boolean isLeafTypeNode() { public boolean isLeafTypeNode() {
return false; return false;
} }
@Override @Override
public <T> T accept(DisplayableItemNodeVisitor<T> v) { public <T> T accept(DisplayableItemNodeVisitor<T> v) {
return v.visit(this); return v.visit(this);
@ -129,10 +128,10 @@ public class HashsetHits implements AutopsyVisitableItem {
s.put(ss); s.put(ss);
} }
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "HashsetHits.createSheet.name.name"), ss.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "HashsetHits.createSheet.name.name"),
NbBundle.getMessage(this.getClass(), "HashsetHits.createSheet.name.displayName"), NbBundle.getMessage(this.getClass(), "HashsetHits.createSheet.name.displayName"),
NbBundle.getMessage(this.getClass(), "HashsetHits.createSheet.name.desc"), NbBundle.getMessage(this.getClass(), "HashsetHits.createSheet.name.desc"),
getName())); getName()));
return s; return s;
} }
@ -175,10 +174,10 @@ public class HashsetHits implements AutopsyVisitableItem {
s.put(ss); s.put(ss);
} }
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "HashsetHits.createSheet.name.name"), ss.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "HashsetHits.createSheet.name.name"),
NbBundle.getMessage(this.getClass(), "HashsetHits.createSheet.name.displayName"), NbBundle.getMessage(this.getClass(), "HashsetHits.createSheet.name.displayName"),
NbBundle.getMessage(this.getClass(), "HashsetHits.createSheet.name.desc"), NbBundle.getMessage(this.getClass(), "HashsetHits.createSheet.name.desc"),
getName())); getName()));
return s; return s;
} }

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2011 Basis Technology Corp. * Copyright 2011-2014 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -85,11 +85,10 @@ public class ImageNode extends AbstractContentNode<Image> {
s.put(ss); s.put(ss);
} }
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "ImageNode.createSheet.name.name"), ss.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "ImageNode.createSheet.name.name"),
NbBundle.getMessage(this.getClass(), "ImageNode.createSheet.name.displayName"), NbBundle.getMessage(this.getClass(), "ImageNode.createSheet.name.displayName"),
NbBundle.getMessage(this.getClass(), "ImageNode.createSheet.name.desc"), NbBundle.getMessage(this.getClass(), "ImageNode.createSheet.name.desc"),
getName())); getName()));
// @@@ add more properties here...
return s; return s;
} }
@ -103,7 +102,7 @@ public class ImageNode extends AbstractContentNode<Image> {
public boolean isLeafTypeNode() { public boolean isLeafTypeNode() {
return false; return false;
} }
@Override @Override
public <T> T accept(DisplayableItemNodeVisitor<T> v) { public <T> T accept(DisplayableItemNodeVisitor<T> v) {
return v.visit(this); return v.visit(this);

View File

@ -135,7 +135,7 @@ public class InterestingHits implements AutopsyVisitableItem {
s.put(ss); s.put(ss);
} }
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "InterestingHits.createSheet.name.name"), ss.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "InterestingHits.createSheet.name.name"),
NbBundle.getMessage(this.getClass(), "InterestingHits.createSheet.name.displayName"), NbBundle.getMessage(this.getClass(), "InterestingHits.createSheet.name.displayName"),
NbBundle.getMessage(this.getClass(), "InterestingHits.createSheet.name.desc"), NbBundle.getMessage(this.getClass(), "InterestingHits.createSheet.name.desc"),
getName())); getName()));
@ -181,7 +181,7 @@ public class InterestingHits implements AutopsyVisitableItem {
s.put(ss); s.put(ss);
} }
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "InterestingHits.createSheet.name.name"), ss.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "InterestingHits.createSheet.name.name"),
NbBundle.getMessage(this.getClass(), "InterestingHits.createSheet.name.name"), NbBundle.getMessage(this.getClass(), "InterestingHits.createSheet.name.name"),
NbBundle.getMessage(this.getClass(), "InterestingHits.createSheet.name.desc"), NbBundle.getMessage(this.getClass(), "InterestingHits.createSheet.name.desc"),
getName())); getName()));

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2011 Basis Technology Corp. * Copyright 2011-2014 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -31,10 +31,8 @@ import org.sleuthkit.datamodel.AbstractFile;
* Node that contains a KeyValue object. The node also has that KeyValue object * Node that contains a KeyValue object. The node also has that KeyValue object
* set to its lookup so that when the node is passed to the content viewers its * set to its lookup so that when the node is passed to the content viewers its
* string will be displayed. * string will be displayed.
*
* @author alawrence
*/ */
public class KeyValueNode extends AbstractNode { public class KeyValueNode extends AbstractNode {
private KeyValue data; private KeyValue data;
@ -50,12 +48,12 @@ import org.sleuthkit.datamodel.AbstractFile;
super(children, lookup); super(children, lookup);
this.setName(thing.getName()); this.setName(thing.getName());
this.data = thing; this.data = thing;
setIcon(); setIcon();
} }
private void setIcon() { private void setIcon() {
//if file/dir, set icon //if file/dir, set icon
AbstractFile af = Lookup.getDefault().lookup(AbstractFile.class); AbstractFile af = Lookup.getDefault().lookup(AbstractFile.class);
if (af != null) { if (af != null) {
// set name, display name, and icon // set name, display name, and icon
@ -79,18 +77,18 @@ import org.sleuthkit.datamodel.AbstractFile;
// table view drops first column of properties under assumption // table view drops first column of properties under assumption
// that it contains the node's name // that it contains the node's name
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "KeyValueNode.createSheet.name.name"), ss.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "KeyValueNode.createSheet.name.name"),
NbBundle.getMessage(this.getClass(), "KeyValueNode.createSheet.name.displayName"), NbBundle.getMessage(this.getClass(), "KeyValueNode.createSheet.name.displayName"),
NbBundle.getMessage(this.getClass(), "KeyValueNode.createSheet.name.desc"), NbBundle.getMessage(this.getClass(), "KeyValueNode.createSheet.name.desc"),
data.getName())); data.getName()));
for (Map.Entry<String, Object> entry : data.getMap().entrySet()) { for (Map.Entry<String, Object> entry : data.getMap().entrySet()) {
String key = entry.getKey(); String key = entry.getKey();
Object value = entry.getValue(); Object value = entry.getValue();
ss.put(new NodeProperty(key, ss.put(new NodeProperty<>(key,
key, key,
NbBundle.getMessage(this.getClass(), "KeyValueNode.createSheet.map.desc"), NbBundle.getMessage(this.getClass(), "KeyValueNode.createSheet.map.desc"),
value)); value));
} }
return s; return s;

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2011 Basis Technology Corp. * Copyright 2011-2014 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -27,7 +27,6 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.logging.Level; import java.util.logging.Level;
import org.openide.util.NbBundle; import org.openide.util.NbBundle;
import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.Logger;
import org.openide.nodes.ChildFactory; import org.openide.nodes.ChildFactory;
@ -66,11 +65,11 @@ public class KeywordHits implements AutopsyVisitableItem {
public KeywordHits(SleuthkitCase skCase) { public KeywordHits(SleuthkitCase skCase) {
this.skCase = skCase; this.skCase = skCase;
artifacts = new LinkedHashMap<Long, Map<Long, String>>(); artifacts = new LinkedHashMap<>();
listsMap = new LinkedHashMap<String, Map<String, Set<Long>>>(); listsMap = new LinkedHashMap<>();
literalMap = new LinkedHashMap<String, Set<Long>>(); literalMap = new LinkedHashMap<>();
regexMap = new LinkedHashMap<String, Set<Long>>(); regexMap = new LinkedHashMap<>();
topLevelMap = new LinkedHashMap<String, Map<String, Set<Long>>>(); topLevelMap = new LinkedHashMap<>();
} }
private void initMaps() { private void initMaps() {
@ -107,7 +106,6 @@ public class KeywordHits implements AutopsyVisitableItem {
literalMap.get(word).add(id); literalMap.get(word).add(id);
} }
topLevelMap.putAll(listsMap); topLevelMap.putAll(listsMap);
} }
} }
@ -140,16 +138,15 @@ public class KeywordHits implements AutopsyVisitableItem {
} }
} }
} catch (SQLException ex) { } catch (SQLException ex) {
logger.log(Level.WARNING, "SQL Exception occurred: ", ex); logger.log(Level.WARNING, "SQL Exception occurred: ", ex);
} } finally {
finally { if (rs != null) {
if (rs != null) {
try { try {
skCase.closeRunQuery(rs); skCase.closeRunQuery(rs);
} catch (SQLException ex) { } catch (SQLException ex) {
logger.log(Level.WARNING, "Error closing result set after getting keyword hits", ex); logger.log(Level.WARNING, "Error closing result set after getting keyword hits", ex);
} }
} }
} }
@ -167,18 +164,15 @@ public class KeywordHits implements AutopsyVisitableItem {
super.setName(NAME); super.setName(NAME);
super.setDisplayName(KEYWORD_HITS); super.setDisplayName(KEYWORD_HITS);
this.setIconBaseWithExtension("org/sleuthkit/autopsy/images/keyword_hits.png"); this.setIconBaseWithExtension("org/sleuthkit/autopsy/images/keyword_hits.png");
//long start = System.currentTimeMillis();
initArtifacts(); initArtifacts();
initMaps(); initMaps();
//long finish = System.currentTimeMillis();
//logger.info("Process took " + (finish-start) + " ms" );
} }
@Override @Override
public boolean isLeafTypeNode() { public boolean isLeafTypeNode() {
return false; return false;
} }
@Override @Override
public <T> T accept(DisplayableItemNodeVisitor<T> v) { public <T> T accept(DisplayableItemNodeVisitor<T> v) {
return v.visit(this); return v.visit(this);
@ -193,10 +187,10 @@ public class KeywordHits implements AutopsyVisitableItem {
s.put(ss); s.put(ss);
} }
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "KeywordHits.createSheet.name.name"), ss.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "KeywordHits.createSheet.name.name"),
NbBundle.getMessage(this.getClass(), "KeywordHits.createSheet.name.displayName"), NbBundle.getMessage(this.getClass(), "KeywordHits.createSheet.name.displayName"),
NbBundle.getMessage(this.getClass(), "KeywordHits.createSheet.name.desc"), NbBundle.getMessage(this.getClass(), "KeywordHits.createSheet.name.desc"),
getName())); getName()));
return s; return s;
} }
@ -242,17 +236,17 @@ public class KeywordHits implements AutopsyVisitableItem {
ss = Sheet.createPropertiesSet(); ss = Sheet.createPropertiesSet();
s.put(ss); s.put(ss);
} }
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "KeywordHits.createSheet.listName.name"), ss.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "KeywordHits.createSheet.listName.name"),
NbBundle.getMessage(this.getClass(), "KeywordHits.createSheet.listName.displayName"), NbBundle.getMessage(this.getClass(), "KeywordHits.createSheet.listName.displayName"),
NbBundle.getMessage(this.getClass(), "KeywordHits.createSheet.listName.desc"), NbBundle.getMessage(this.getClass(), "KeywordHits.createSheet.listName.desc"),
name)); name));
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "KeywordHits.createSheet.numChildren.name"), ss.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "KeywordHits.createSheet.numChildren.name"),
NbBundle.getMessage(this.getClass(), "KeywordHits.createSheet.numChildren.displayName"), NbBundle.getMessage(this.getClass(), "KeywordHits.createSheet.numChildren.displayName"),
NbBundle.getMessage(this.getClass(), "KeywordHits.createSheet.numChildren.desc"), NbBundle.getMessage(this.getClass(), "KeywordHits.createSheet.numChildren.desc"),
children.size())); children.size()));
return s; return s;
} }
@ -261,7 +255,7 @@ public class KeywordHits implements AutopsyVisitableItem {
public boolean isLeafTypeNode() { public boolean isLeafTypeNode() {
return false; return false;
} }
@Override @Override
public <T> T accept(DisplayableItemNodeVisitor<T> v) { public <T> T accept(DisplayableItemNodeVisitor<T> v) {
return v.visit(this); return v.visit(this);
@ -291,7 +285,6 @@ public class KeywordHits implements AutopsyVisitableItem {
public class KeywordHitsKeywordNode extends DisplayableItemNode { public class KeywordHitsKeywordNode extends DisplayableItemNode {
private String name;
private Set<Long> children; private Set<Long> children;
public KeywordHitsKeywordNode(String name, Set<Long> children) { public KeywordHitsKeywordNode(String name, Set<Long> children) {
@ -299,7 +292,6 @@ public class KeywordHits implements AutopsyVisitableItem {
super.setName(name); super.setName(name);
super.setDisplayName(name + " (" + children.size() + ")"); super.setDisplayName(name + " (" + children.size() + ")");
this.setIconBaseWithExtension("org/sleuthkit/autopsy/images/keyword_hits.png"); this.setIconBaseWithExtension("org/sleuthkit/autopsy/images/keyword_hits.png");
this.name = name;
this.children = children; this.children = children;
} }
@ -308,8 +300,6 @@ public class KeywordHits implements AutopsyVisitableItem {
return true; return true;
} }
@Override @Override
public <T> T accept(DisplayableItemNodeVisitor<T> v) { public <T> T accept(DisplayableItemNodeVisitor<T> v) {
return v.visit(this); return v.visit(this);
@ -323,17 +313,16 @@ public class KeywordHits implements AutopsyVisitableItem {
ss = Sheet.createPropertiesSet(); ss = Sheet.createPropertiesSet();
s.put(ss); s.put(ss);
} }
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "KeywordHits.createSheet.listName.name"),
NbBundle.getMessage(this.getClass(), "KeywordHits.createSheet.listName.displayName"),
NbBundle.getMessage(this.getClass(), "KeywordHits.createSheet.listName.desc"),
getDisplayName()));
ss.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "KeywordHits.createSheet.listName.name"),
NbBundle.getMessage(this.getClass(), "KeywordHits.createSheet.listName.displayName"),
NbBundle.getMessage(this.getClass(), "KeywordHits.createSheet.listName.desc"),
getDisplayName()));
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "KeywordHits.createSheet.filesWithHits.name"), ss.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "KeywordHits.createSheet.filesWithHits.name"),
NbBundle.getMessage(this.getClass(), "KeywordHits.createSheet.filesWithHits.displayName"), NbBundle.getMessage(this.getClass(), "KeywordHits.createSheet.filesWithHits.displayName"),
NbBundle.getMessage(this.getClass(), "KeywordHits.createSheet.filesWithHits.desc"), NbBundle.getMessage(this.getClass(), "KeywordHits.createSheet.filesWithHits.desc"),
children.size())); children.size()));
return s; return s;
} }
@ -373,27 +362,27 @@ public class KeywordHits implements AutopsyVisitableItem {
logger.log(Level.SEVERE, "TskCoreException while constructing BlackboardArtifact Node from KeywordHitsKeywordChildren"); logger.log(Level.SEVERE, "TskCoreException while constructing BlackboardArtifact Node from KeywordHitsKeywordChildren");
return n; return n;
} }
n.addNodeProperty(new NodeProperty( n.addNodeProperty(new NodeProperty<>(
NbBundle.getMessage(this.getClass(), "KeywordHits.createNodeForKey.modTime.name"), NbBundle.getMessage(this.getClass(), "KeywordHits.createNodeForKey.modTime.name"),
NbBundle.getMessage(this.getClass(), NbBundle.getMessage(this.getClass(),
"KeywordHits.createNodeForKey.modTime.displayName"), "KeywordHits.createNodeForKey.modTime.displayName"),
NbBundle.getMessage(this.getClass(), NbBundle.getMessage(this.getClass(),
"KeywordHits.createNodeForKey.modTime.desc"), "KeywordHits.createNodeForKey.modTime.desc"),
ContentUtils.getStringTime(file.getMtime(), file))); ContentUtils.getStringTime(file.getMtime(), file)));
n.addNodeProperty(new NodeProperty( n.addNodeProperty(new NodeProperty<>(
NbBundle.getMessage(this.getClass(), "KeywordHits.createNodeForKey.accessTime.name"), NbBundle.getMessage(this.getClass(), "KeywordHits.createNodeForKey.accessTime.name"),
NbBundle.getMessage(this.getClass(), NbBundle.getMessage(this.getClass(),
"KeywordHits.createNodeForKey.accessTime.displayName"), "KeywordHits.createNodeForKey.accessTime.displayName"),
NbBundle.getMessage(this.getClass(), NbBundle.getMessage(this.getClass(),
"KeywordHits.createNodeForKey.accessTime.desc"), "KeywordHits.createNodeForKey.accessTime.desc"),
ContentUtils.getStringTime(file.getAtime(), file))); ContentUtils.getStringTime(file.getAtime(), file)));
n.addNodeProperty(new NodeProperty( n.addNodeProperty(new NodeProperty<>(
NbBundle.getMessage(this.getClass(), "KeywordHits.createNodeForKey.chgTime.name"), NbBundle.getMessage(this.getClass(), "KeywordHits.createNodeForKey.chgTime.name"),
NbBundle.getMessage(this.getClass(), NbBundle.getMessage(this.getClass(),
"KeywordHits.createNodeForKey.chgTime.displayName"), "KeywordHits.createNodeForKey.chgTime.displayName"),
NbBundle.getMessage(this.getClass(), NbBundle.getMessage(this.getClass(),
"KeywordHits.createNodeForKey.chgTime.desc"), "KeywordHits.createNodeForKey.chgTime.desc"),
ContentUtils.getStringTime(file.getCtime(), file))); ContentUtils.getStringTime(file.getCtime(), file)));
return n; return n;

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2011 - 2013 Basis Technology Corp. * Copyright 2011-2014 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -73,19 +73,18 @@ public class LayoutFileNode extends AbstractAbstractFileNode<LayoutFile> {
s.put(ss); s.put(ss);
} }
Map<String, Object> map = new LinkedHashMap<String, Object>(); Map<String, Object> map = new LinkedHashMap<>();
fillPropertyMap(map, content); fillPropertyMap(map, content);
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "LayoutFileNode.createSheet.name.name"), ss.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "LayoutFileNode.createSheet.name.name"),
NbBundle.getMessage(this.getClass(), "LayoutFileNode.createSheet.name.displayName"), NbBundle.getMessage(this.getClass(), "LayoutFileNode.createSheet.name.displayName"),
NbBundle.getMessage(this.getClass(), "LayoutFileNode.createSheet.name.desc"), NbBundle.getMessage(this.getClass(), "LayoutFileNode.createSheet.name.desc"),
getName())); getName()));
final String NO_DESCR = NbBundle.getMessage(this.getClass(), "LayoutFileNode.createSheet.noDescr.text"); final String NO_DESCR = NbBundle.getMessage(this.getClass(), "LayoutFileNode.createSheet.noDescr.text");
for (Map.Entry<String, Object> entry : map.entrySet()) { for (Map.Entry<String, Object> entry : map.entrySet()) {
ss.put(new NodeProperty(entry.getKey(), entry.getKey(), NO_DESCR, entry.getValue())); ss.put(new NodeProperty<>(entry.getKey(), entry.getKey(), NO_DESCR, entry.getValue()));
} }
// @@@ add more properties here...
return s; return s;
} }
@ -99,7 +98,7 @@ public class LayoutFileNode extends AbstractAbstractFileNode<LayoutFile> {
public boolean isLeafTypeNode() { public boolean isLeafTypeNode() {
return false; return false;
} }
@Override @Override
public <T> T accept(DisplayableItemNodeVisitor<T> v) { public <T> T accept(DisplayableItemNodeVisitor<T> v) {
return v.visit(this); return v.visit(this);

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2013 Basis Technology Corp. * Copyright 2013-2014 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -16,7 +16,6 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.sleuthkit.autopsy.datamodel; package org.sleuthkit.autopsy.datamodel;
import java.util.ArrayList; import java.util.ArrayList;
@ -65,17 +64,17 @@ public class LocalFileNode extends AbstractAbstractFileNode<AbstractFile> {
s.put(ss); s.put(ss);
} }
Map<String, Object> map = new LinkedHashMap<String, Object>(); Map<String, Object> map = new LinkedHashMap<>();
fillPropertyMap(map, content); fillPropertyMap(map, content);
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "LocalFileNode.createSheet.name.name"), ss.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "LocalFileNode.createSheet.name.name"),
NbBundle.getMessage(this.getClass(), "LocalFileNode.createSheet.name.displayName"), NbBundle.getMessage(this.getClass(), "LocalFileNode.createSheet.name.displayName"),
NbBundle.getMessage(this.getClass(), "LocalFileNode.createSheet.name.desc"), NbBundle.getMessage(this.getClass(), "LocalFileNode.createSheet.name.desc"),
getName())); getName()));
final String NO_DESCR = NbBundle.getMessage(this.getClass(), "LocalFileNode.createSheet.noDescr.text"); final String NO_DESCR = NbBundle.getMessage(this.getClass(), "LocalFileNode.createSheet.noDescr.text");
for (Map.Entry<String, Object> entry : map.entrySet()) { for (Map.Entry<String, Object> entry : map.entrySet()) {
ss.put(new NodeProperty(entry.getKey(), entry.getKey(), NO_DESCR, entry.getValue())); ss.put(new NodeProperty<>(entry.getKey(), entry.getKey(), NO_DESCR, entry.getValue()));
} }
// @@@ add more properties here... // @@@ add more properties here...

View File

@ -25,19 +25,19 @@ import org.openide.nodes.PropertySupport;
* This class is used to represent the properties for each node. * This class is used to represent the properties for each node.
* *
*/ */
public class NodeProperty extends PropertySupport.ReadOnly { public class NodeProperty<T> extends PropertySupport.ReadOnly<T> {
private Object value; private T value;
@SuppressWarnings({"unchecked"}) @SuppressWarnings("unchecked")
public NodeProperty(String name, String displayName, String desc, Object value) { public NodeProperty(String name, String displayName, String desc, T value) {
super(name, value.getClass(), displayName, desc); super(name, (Class<T>) value.getClass(), displayName, desc);
setValue("suppressCustomEditor", Boolean.TRUE); // remove the "..." (editing) button setValue("suppressCustomEditor", Boolean.TRUE); // remove the "..." (editing) button
this.value = value; this.value = value;
} }
@Override @Override
public Object getValue() throws IllegalAccessException, InvocationTargetException { public T getValue() throws IllegalAccessException, InvocationTargetException {
return this.value; return this.value;
} }
} }

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2011 Basis Technology Corp. * Copyright 2011-2014 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -20,10 +20,8 @@ package org.sleuthkit.autopsy.datamodel;
import java.util.Calendar; import java.util.Calendar;
import java.util.Locale; import java.util.Locale;
import org.openide.util.NbBundle; import org.openide.util.NbBundle;
import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.Logger;
import org.openide.nodes.AbstractNode;
import org.openide.nodes.Children; import org.openide.nodes.Children;
import org.openide.nodes.Sheet; import org.openide.nodes.Sheet;
import org.openide.util.lookup.Lookups; import org.openide.util.lookup.Lookups;
@ -42,7 +40,6 @@ public class RecentFilesFilterNode extends DisplayableItemNode {
RecentFilesFilterNode(SleuthkitCase skCase, RecentFilesFilter filter, Calendar lastDay) { RecentFilesFilterNode(SleuthkitCase skCase, RecentFilesFilter filter, Calendar lastDay) {
super(Children.create(new RecentFilesFilterChildren(filter, skCase, lastDay), true), Lookups.singleton(filter.getDisplayName())); super(Children.create(new RecentFilesFilterChildren(filter, skCase, lastDay), true), Lookups.singleton(filter.getDisplayName()));
super.setName(filter.getName()); super.setName(filter.getName());
//super.setDisplayName(filter.getDisplayName());
this.skCase = skCase; this.skCase = skCase;
this.filter = filter; this.filter = filter;
Calendar prevDay = (Calendar) lastDay.clone(); Calendar prevDay = (Calendar) lastDay.clone();
@ -52,10 +49,9 @@ public class RecentFilesFilterNode extends DisplayableItemNode {
+ prevDay.get(Calendar.YEAR); + prevDay.get(Calendar.YEAR);
this.setShortDescription(tooltip); this.setShortDescription(tooltip);
this.setIconBaseWithExtension("org/sleuthkit/autopsy/images/recent_files.png"); this.setIconBaseWithExtension("org/sleuthkit/autopsy/images/recent_files.png");
//get count of children without preloading all children nodes //get count of children without preloading all children nodes
final long count = new RecentFilesFilterChildren(filter, skCase, lastDay).calculateItems(); final long count = new RecentFilesFilterChildren(filter, skCase, lastDay).calculateItems();
//final long count = getChildren().getNodesCount(true);
super.setDisplayName(filter.getDisplayName() + " (" + count + ")"); super.setDisplayName(filter.getDisplayName() + " (" + count + ")");
} }
@ -73,7 +69,7 @@ public class RecentFilesFilterNode extends DisplayableItemNode {
s.put(ss); s.put(ss);
} }
ss.put(new NodeProperty( ss.put(new NodeProperty<>(
NbBundle.getMessage(this.getClass(), "RecentFilesFilterNode.createSheet.filterType.name"), NbBundle.getMessage(this.getClass(), "RecentFilesFilterNode.createSheet.filterType.name"),
NbBundle.getMessage(this.getClass(), "RecentFilesFilterNode.createSheet.filterType.displayName"), NbBundle.getMessage(this.getClass(), "RecentFilesFilterNode.createSheet.filterType.displayName"),
NbBundle.getMessage(this.getClass(), "RecentFilesFilterNode.createSheet.filterType.desc"), NbBundle.getMessage(this.getClass(), "RecentFilesFilterNode.createSheet.filterType.desc"),

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2011 Basis Technology Corp. * Copyright 2011-2014 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -18,7 +18,6 @@
*/ */
package org.sleuthkit.autopsy.datamodel; package org.sleuthkit.autopsy.datamodel;
import org.openide.nodes.AbstractNode;
import org.openide.nodes.Children; import org.openide.nodes.Children;
import org.openide.nodes.Sheet; import org.openide.nodes.Sheet;
import org.openide.util.NbBundle; import org.openide.util.NbBundle;
@ -39,14 +38,13 @@ public class RecentFilesNode extends DisplayableItemNode {
super.setDisplayName(NAME); super.setDisplayName(NAME);
this.skCase = skCase; this.skCase = skCase;
this.setIconBaseWithExtension("org/sleuthkit/autopsy/images/recent_files.png"); this.setIconBaseWithExtension("org/sleuthkit/autopsy/images/recent_files.png");
} }
@Override @Override
public boolean isLeafTypeNode() { public boolean isLeafTypeNode() {
return false; return false;
} }
@Override @Override
public <T> T accept(DisplayableItemNodeVisitor<T> v) { public <T> T accept(DisplayableItemNodeVisitor<T> v) {
return v.visit(this); return v.visit(this);
@ -61,10 +59,10 @@ public class RecentFilesNode extends DisplayableItemNode {
s.put(ss); s.put(ss);
} }
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "RecentFilesNode.createSheet.name.name"), ss.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "RecentFilesNode.createSheet.name.name"),
NbBundle.getMessage(this.getClass(), "RecentFilesNode.createSheet.name.displayName"), NbBundle.getMessage(this.getClass(), "RecentFilesNode.createSheet.name.displayName"),
NbBundle.getMessage(this.getClass(), "RecentFilesNode.createSheet.name.desc"), NbBundle.getMessage(this.getClass(), "RecentFilesNode.createSheet.name.desc"),
NAME)); NAME));
return s; return s;
} }
} }

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2011 Basis Technology Corp. * Copyright 2011-2014 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -37,8 +37,7 @@ public class ResultsNode extends DisplayableItemNode {
new HashsetHits(sleuthkitCase), new HashsetHits(sleuthkitCase),
new EmailExtracted(sleuthkitCase), new EmailExtracted(sleuthkitCase),
new InterestingHits(sleuthkitCase), new InterestingHits(sleuthkitCase),
new TagsNodeKey() new TagsNodeKey())), Lookups.singleton(NAME));
)), Lookups.singleton(NAME));
setName(NAME); setName(NAME);
setDisplayName(NAME); setDisplayName(NAME);
this.setIconBaseWithExtension("org/sleuthkit/autopsy/images/results.png"); this.setIconBaseWithExtension("org/sleuthkit/autopsy/images/results.png");
@ -48,7 +47,7 @@ public class ResultsNode extends DisplayableItemNode {
public boolean isLeafTypeNode() { public boolean isLeafTypeNode() {
return false; return false;
} }
@Override @Override
public <T> T accept(DisplayableItemNodeVisitor<T> v) { public <T> T accept(DisplayableItemNodeVisitor<T> v) {
return v.visit(this); return v.visit(this);
@ -63,10 +62,10 @@ public class ResultsNode extends DisplayableItemNode {
s.put(ss); s.put(ss);
} }
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "ResultsNode.createSheet.name.name"), ss.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "ResultsNode.createSheet.name.name"),
NbBundle.getMessage(this.getClass(), "ResultsNode.createSheet.name.displayName"), NbBundle.getMessage(this.getClass(), "ResultsNode.createSheet.name.displayName"),
NbBundle.getMessage(this.getClass(), "ResultsNode.createSheet.name.desc"), NbBundle.getMessage(this.getClass(), "ResultsNode.createSheet.name.desc"),
NAME)); NAME));
return s; return s;
} }
} }

View File

@ -33,39 +33,38 @@ import org.sleuthkit.datamodel.TagName;
import org.sleuthkit.datamodel.TskCoreException; import org.sleuthkit.datamodel.TskCoreException;
/** /**
* Instances of this class are elements of Node hierarchies consisting of * Instances of this class are elements of Node hierarchies consisting of
* content and blackboard artifact tags, grouped first by tag type, then by * content and blackboard artifact tags, grouped first by tag type, then by tag
* tag name. * name.
*/ */
public class TagNameNode extends DisplayableItemNode { public class TagNameNode extends DisplayableItemNode {
private static final String ICON_PATH = "org/sleuthkit/autopsy/images/tag-folder-blue-icon-16.png"; private static final String ICON_PATH = "org/sleuthkit/autopsy/images/tag-folder-blue-icon-16.png";
private static final String BOOKMARK_TAG_ICON_PATH = "org/sleuthkit/autopsy/images/star-bookmark-icon-16.png"; private static final String BOOKMARK_TAG_ICON_PATH = "org/sleuthkit/autopsy/images/star-bookmark-icon-16.png";
private final TagName tagName; private final TagName tagName;
private static final String CONTENT_TAG_TYPE_NODE_KEY = NbBundle.getMessage(TagNameNode.class, private static final String CONTENT_TAG_TYPE_NODE_KEY = NbBundle.getMessage(TagNameNode.class,
"TagNameNode.contentTagTypeNodeKey.text"); "TagNameNode.contentTagTypeNodeKey.text");
private static final String BLACKBOARD_ARTIFACT_TAG_TYPE_NODE_KEY = NbBundle.getMessage(TagNameNode.class, private static final String BLACKBOARD_ARTIFACT_TAG_TYPE_NODE_KEY = NbBundle.getMessage(TagNameNode.class,
"TagNameNode.bbArtTagTypeNodeKey.text"); "TagNameNode.bbArtTagTypeNodeKey.text");
public TagNameNode(TagName tagName) { public TagNameNode(TagName tagName) {
super(Children.create(new TagTypeNodeFactory(tagName), true), Lookups.singleton( super(Children.create(new TagTypeNodeFactory(tagName), true), Lookups.singleton(
NbBundle.getMessage(TagNameNode.class, "TagNameNode.namePlusTags.text", tagName.getDisplayName()))); NbBundle.getMessage(TagNameNode.class, "TagNameNode.namePlusTags.text", tagName.getDisplayName())));
this.tagName = tagName; this.tagName = tagName;
long tagsCount = 0; long tagsCount = 0;
try { try {
tagsCount = Case.getCurrentCase().getServices().getTagsManager().getContentTagsCountByTagName(tagName); tagsCount = Case.getCurrentCase().getServices().getTagsManager().getContentTagsCountByTagName(tagName);
tagsCount += Case.getCurrentCase().getServices().getTagsManager().getBlackboardArtifactTagsCountByTagName(tagName); tagsCount += Case.getCurrentCase().getServices().getTagsManager().getBlackboardArtifactTagsCountByTagName(tagName);
} } catch (TskCoreException ex) {
catch (TskCoreException ex) {
Logger.getLogger(TagNameNode.class.getName()).log(Level.SEVERE, "Failed to get tags count for " + tagName.getDisplayName() + " tag name", ex); Logger.getLogger(TagNameNode.class.getName()).log(Level.SEVERE, "Failed to get tags count for " + tagName.getDisplayName() + " tag name", ex);
} }
super.setName(tagName.getDisplayName()); super.setName(tagName.getDisplayName());
super.setDisplayName(tagName.getDisplayName() + " (" + tagsCount + ")"); super.setDisplayName(tagName.getDisplayName() + " (" + tagsCount + ")");
if (tagName.getDisplayName().equals(NbBundle.getMessage(this.getClass(), "TagNameNode.bookmark.text"))) { if (tagName.getDisplayName().equals(NbBundle.getMessage(this.getClass(), "TagNameNode.bookmark.text"))) {
setIconBaseWithExtension(BOOKMARK_TAG_ICON_PATH); setIconBaseWithExtension(BOOKMARK_TAG_ICON_PATH);
} } else {
else {
setIconBaseWithExtension(ICON_PATH); setIconBaseWithExtension(ICON_PATH);
} }
} }
@ -79,10 +78,10 @@ public class TagNameNode extends DisplayableItemNode {
propertySheet.put(properties); propertySheet.put(properties);
} }
properties.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "TagNameNode.createSheet.name.name"), properties.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "TagNameNode.createSheet.name.name"),
NbBundle.getMessage(this.getClass(), "TagNameNode.createSheet.name.displayName"), NbBundle.getMessage(this.getClass(), "TagNameNode.createSheet.name.displayName"),
tagName.getDescription(), tagName.getDescription(),
getName())); getName()));
return propertySheet; return propertySheet;
} }
@ -98,14 +97,15 @@ public class TagNameNode extends DisplayableItemNode {
public boolean isLeafTypeNode() { public boolean isLeafTypeNode() {
return false; return false;
} }
private static class TagTypeNodeFactory extends ChildFactory<String> { private static class TagTypeNodeFactory extends ChildFactory<String> {
private final TagName tagName; private final TagName tagName;
TagTypeNodeFactory(TagName tagName) { TagTypeNodeFactory(TagName tagName) {
this.tagName = tagName; this.tagName = tagName;
} }
@Override @Override
protected boolean createKeys(List<String> keys) { protected boolean createKeys(List<String> keys) {
keys.add(CONTENT_TAG_TYPE_NODE_KEY); keys.add(CONTENT_TAG_TYPE_NODE_KEY);
@ -136,4 +136,3 @@ public class TagNameNode extends DisplayableItemNode {
} }
} }
} }

View File

@ -32,27 +32,28 @@ import org.sleuthkit.datamodel.TagName;
import org.sleuthkit.datamodel.TskCoreException; import org.sleuthkit.datamodel.TskCoreException;
/** /**
* Instances of this class are the root nodes of tree that is a sub-tree of the * Instances of this class are the root nodes of tree that is a sub-tree of the
* Autopsy presentation of the SleuthKit data model. The sub-tree consists of * Autopsy presentation of the SleuthKit data model. The sub-tree consists of
* content and blackboard artifact tags, grouped first by tag type, then by * content and blackboard artifact tags, grouped first by tag type, then by tag
* tag name. * name.
*/ */
class TagsNode extends DisplayableItemNode { class TagsNode extends DisplayableItemNode {
private static final String DISPLAY_NAME = NbBundle.getMessage(TagsNode.class, "TagsNode.displayName.text"); private static final String DISPLAY_NAME = NbBundle.getMessage(TagsNode.class, "TagsNode.displayName.text");
private static final String ICON_PATH = "org/sleuthkit/autopsy/images/tag-folder-blue-icon-16.png"; private static final String ICON_PATH = "org/sleuthkit/autopsy/images/tag-folder-blue-icon-16.png";
public TagsNode() { public TagsNode() {
super(Children.create(new TagNameNodeFactory(), true), Lookups.singleton(DISPLAY_NAME)); super(Children.create(new TagNameNodeFactory(), true), Lookups.singleton(DISPLAY_NAME));
super.setName(DISPLAY_NAME); super.setName(DISPLAY_NAME);
super.setDisplayName(DISPLAY_NAME); super.setDisplayName(DISPLAY_NAME);
this.setIconBaseWithExtension(ICON_PATH); this.setIconBaseWithExtension(ICON_PATH);
} }
@Override @Override
public boolean isLeafTypeNode() { public boolean isLeafTypeNode() {
return false; return false;
} }
@Override @Override
public <T> T accept(DisplayableItemNodeVisitor<T> v) { public <T> T accept(DisplayableItemNodeVisitor<T> v) {
return v.visit(this); return v.visit(this);
@ -67,23 +68,23 @@ import org.sleuthkit.datamodel.TskCoreException;
propertySheet.put(properties); propertySheet.put(properties);
} }
properties.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "TagsNode.createSheet.name.name"), properties.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "TagsNode.createSheet.name.name"),
NbBundle.getMessage(this.getClass(), "TagsNode.createSheet.name.displayName"), NbBundle.getMessage(this.getClass(), "TagsNode.createSheet.name.displayName"),
"", "",
getName())); getName()));
return propertySheet; return propertySheet;
} }
private static class TagNameNodeFactory extends ChildFactory<TagName> { private static class TagNameNodeFactory extends ChildFactory<TagName> {
@Override @Override
protected boolean createKeys(List<TagName> keys) { protected boolean createKeys(List<TagName> keys) {
try { try {
keys.addAll(Case.getCurrentCase().getServices().getTagsManager().getTagNamesInUse()); keys.addAll(Case.getCurrentCase().getServices().getTagsManager().getTagNamesInUse());
} catch (TskCoreException ex) {
Logger.getLogger(TagNameNodeFactory.class.getName()).log(Level.SEVERE, "Failed to get tag names", ex);
} }
catch (TskCoreException ex) {
Logger.getLogger(TagNameNodeFactory.class.getName()).log(Level.SEVERE, "Failed to get tag names", ex);
}
return true; return true;
} }

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2011 Basis Technology Corp. * Copyright 2011-2014 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -35,11 +35,10 @@ public class ViewsNode extends DisplayableItemNode {
public ViewsNode(SleuthkitCase sleuthkitCase) { public ViewsNode(SleuthkitCase sleuthkitCase) {
super(new RootContentChildren(Arrays.asList( super(new RootContentChildren(Arrays.asList(
new FileTypeExtensionFilters(sleuthkitCase), new FileTypeExtensionFilters(sleuthkitCase),
new RecentFiles(sleuthkitCase), new RecentFiles(sleuthkitCase),
new DeletedContent(sleuthkitCase), new DeletedContent(sleuthkitCase),
new FileSize(sleuthkitCase) new FileSize(sleuthkitCase))),
)),
Lookups.singleton(NAME)); Lookups.singleton(NAME));
setName(NAME); setName(NAME);
setDisplayName(NAME); setDisplayName(NAME);
@ -50,7 +49,7 @@ public class ViewsNode extends DisplayableItemNode {
public boolean isLeafTypeNode() { public boolean isLeafTypeNode() {
return false; return false;
} }
@Override @Override
public <T> T accept(DisplayableItemNodeVisitor<T> v) { public <T> T accept(DisplayableItemNodeVisitor<T> v) {
return v.visit(this); return v.visit(this);
@ -65,10 +64,10 @@ public class ViewsNode extends DisplayableItemNode {
s.put(ss); s.put(ss);
} }
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "ViewsNode.createSheet.name.name"), ss.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "ViewsNode.createSheet.name.name"),
NbBundle.getMessage(this.getClass(), "ViewsNode.createSheet.name.displayName"), NbBundle.getMessage(this.getClass(), "ViewsNode.createSheet.name.displayName"),
NbBundle.getMessage(this.getClass(), "ViewsNode.createSheet.name.desc"), NbBundle.getMessage(this.getClass(), "ViewsNode.createSheet.name.desc"),
NAME)); NAME));
return s; return s;
} }
} }

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2011 - 2013 Basis Technology Corp. * Copyright 2011-2014 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -36,12 +36,11 @@ import org.sleuthkit.datamodel.TskData;
* Node for layout dir * Node for layout dir
*/ */
public class VirtualDirectoryNode extends AbstractAbstractFileNode<VirtualDirectory> { public class VirtualDirectoryNode extends AbstractAbstractFileNode<VirtualDirectory> {
private static Logger logger = Logger.getLogger(VirtualDirectoryNode.class.getName());
private static Logger logger = Logger.getLogger(VirtualDirectoryNode.class.getName());
//prefix for special VirtualDirectory root nodes grouping local files //prefix for special VirtualDirectory root nodes grouping local files
public final static String LOGICAL_FILE_SET_PREFIX = "LogicalFileSet"; public final static String LOGICAL_FILE_SET_PREFIX = "LogicalFileSet";
public static String nameForLayoutFile(VirtualDirectory ld) { public static String nameForLayoutFile(VirtualDirectory ld) {
return ld.getName(); return ld.getName();
} }
@ -50,26 +49,23 @@ public class VirtualDirectoryNode extends AbstractAbstractFileNode<VirtualDirect
super(ld); super(ld);
this.setDisplayName(nameForLayoutFile(ld)); this.setDisplayName(nameForLayoutFile(ld));
String name = ld.getName(); String name = ld.getName();
//set icon for name, special case for some built-ins //set icon for name, special case for some built-ins
if (name.equals(VirtualDirectory.NAME_UNALLOC)) { if (name.equals(VirtualDirectory.NAME_UNALLOC)) {
this.setIconBaseWithExtension("org/sleuthkit/autopsy/images/folder-icon-deleted.png"); this.setIconBaseWithExtension("org/sleuthkit/autopsy/images/folder-icon-deleted.png");
} } else if (name.startsWith(LOGICAL_FILE_SET_PREFIX)) {
else if (name.startsWith(LOGICAL_FILE_SET_PREFIX)) {
this.setIconBaseWithExtension("org/sleuthkit/autopsy/images/fileset-icon-16.png"); this.setIconBaseWithExtension("org/sleuthkit/autopsy/images/fileset-icon-16.png");
} } else if (name.equals(VirtualDirectory.NAME_CARVED)) {
else if (name.equals(VirtualDirectory.NAME_CARVED)) {
this.setIconBaseWithExtension("org/sleuthkit/autopsy/images/Folder-icon.png"); //TODO this.setIconBaseWithExtension("org/sleuthkit/autopsy/images/Folder-icon.png"); //TODO
} } else {
else {
this.setIconBaseWithExtension("org/sleuthkit/autopsy/images/Folder-icon.png"); this.setIconBaseWithExtension("org/sleuthkit/autopsy/images/Folder-icon.png");
} }
} }
/** /**
* Right click action for this node * Right click action for this node
* *
* @param popup * @param popup
@ -86,7 +82,7 @@ public class VirtualDirectoryNode extends AbstractAbstractFileNode<VirtualDirect
actions.addAll(ContextMenuExtensionPoint.getActions()); actions.addAll(ContextMenuExtensionPoint.getActions());
return actions.toArray(new Action[0]); return actions.toArray(new Action[0]);
} }
@Override @Override
protected Sheet createSheet() { protected Sheet createSheet() {
Sheet s = super.createSheet(); Sheet s = super.createSheet();
@ -96,20 +92,19 @@ public class VirtualDirectoryNode extends AbstractAbstractFileNode<VirtualDirect
s.put(ss); s.put(ss);
} }
Map<String, Object> map = new LinkedHashMap<String, Object>(); Map<String, Object> map = new LinkedHashMap<>();
fillPropertyMap(map, content); fillPropertyMap(map, content);
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "VirtualDirectoryNode.createSheet.name.name"), ss.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "VirtualDirectoryNode.createSheet.name.name"),
NbBundle.getMessage(this.getClass(), NbBundle.getMessage(this.getClass(),
"VirtualDirectoryNode.createSheet.name.displayName"), "VirtualDirectoryNode.createSheet.name.displayName"),
NbBundle.getMessage(this.getClass(), "VirtualDirectoryNode.createSheet.name.desc"), NbBundle.getMessage(this.getClass(), "VirtualDirectoryNode.createSheet.name.desc"),
getName())); getName()));
final String NO_DESCR = NbBundle.getMessage(this.getClass(), "VirtualDirectoryNode.createSheet.noDesc"); final String NO_DESCR = NbBundle.getMessage(this.getClass(), "VirtualDirectoryNode.createSheet.noDesc");
for (Map.Entry<String, Object> entry : map.entrySet()) { for (Map.Entry<String, Object> entry : map.entrySet()) {
ss.put(new NodeProperty(entry.getKey(), entry.getKey(), NO_DESCR, entry.getValue())); ss.put(new NodeProperty<>(entry.getKey(), entry.getKey(), NO_DESCR, entry.getValue()));
} }
// @@@ add more properties here...
return s; return s;
} }
@ -129,7 +124,6 @@ public class VirtualDirectoryNode extends AbstractAbstractFileNode<VirtualDirect
return true; return true;
} }
/** /**
* Convert meta flag long to user-readable string / label * Convert meta flag long to user-readable string / label
* *
@ -143,12 +137,6 @@ public class VirtualDirectoryNode extends AbstractAbstractFileNode<VirtualDirect
short allocFlag = TskData.TSK_FS_META_FLAG_ENUM.ALLOC.getValue(); short allocFlag = TskData.TSK_FS_META_FLAG_ENUM.ALLOC.getValue();
short unallocFlag = TskData.TSK_FS_META_FLAG_ENUM.UNALLOC.getValue(); short unallocFlag = TskData.TSK_FS_META_FLAG_ENUM.UNALLOC.getValue();
// some variables that might be needed in the future
//long usedFlag = TskData.TSK_FS_META_FLAG_ENUM.USED.getMetaFlag();
//long unusedFlag = TskData.TSK_FS_META_FLAG_ENUM.UNUSED.getMetaFlag();
//long compFlag = TskData.TSK_FS_META_FLAG_ENUM.COMP.getMetaFlag();
//long orphanFlag = TskData.TSK_FS_META_FLAG_ENUM.ORPHAN.getMetaFlag();
if ((metaFlag & allocFlag) == allocFlag) { if ((metaFlag & allocFlag) == allocFlag) {
result = TskData.TSK_FS_META_FLAG_ENUM.ALLOC.toString(); result = TskData.TSK_FS_META_FLAG_ENUM.ALLOC.toString();
} }

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2011 Basis Technology Corp. * Copyright 2011-2014 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -69,7 +69,7 @@ public class VolumeNode extends AbstractContentNode<Volume> {
*/ */
@Override @Override
public Action[] getActions(boolean popup) { public Action[] getActions(boolean popup) {
List<Action> actionsList = new ArrayList<Action>(); List<Action> actionsList = new ArrayList<>();
actionsList.add(new NewWindowViewAction( actionsList.add(new NewWindowViewAction(
NbBundle.getMessage(this.getClass(), "VolumeNode.getActions.viewInNewWin.text"), this)); NbBundle.getMessage(this.getClass(), "VolumeNode.getActions.viewInNewWin.text"), this));
@ -87,30 +87,30 @@ public class VolumeNode extends AbstractContentNode<Volume> {
s.put(ss); s.put(ss);
} }
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.name.name"), ss.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.name.name"),
NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.name.displayName"), NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.name.displayName"),
NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.name.desc"), NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.name.desc"),
this.getDisplayName())); this.getDisplayName()));
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.id.name"), ss.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.id.name"),
NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.id.displayName"), NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.id.displayName"),
NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.id.desc"), NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.id.desc"),
content.getAddr())); content.getAddr()));
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.startSector.name"), ss.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.startSector.name"),
NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.startSector.displayName"), NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.startSector.displayName"),
NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.startSector.desc"), NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.startSector.desc"),
content.getStart())); content.getStart()));
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.lenSectors.name"), ss.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.lenSectors.name"),
NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.lenSectors.displayName"), NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.lenSectors.displayName"),
NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.lenSectors.desc"), NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.lenSectors.desc"),
content.getLength())); content.getLength()));
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.description.name"), ss.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.description.name"),
NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.description.displayName"), NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.description.displayName"),
NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.description.desc"), NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.description.desc"),
content.getDescription())); content.getDescription()));
ss.put(new NodeProperty(NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.flags.name"), ss.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.flags.name"),
NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.flags.displayName"), NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.flags.displayName"),
NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.flags.desc"), NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.flags.desc"),
content.getFlagsAsString())); content.getFlagsAsString()));
return s; return s;
} }
@ -124,7 +124,7 @@ public class VolumeNode extends AbstractContentNode<Volume> {
public boolean isLeafTypeNode() { public boolean isLeafTypeNode() {
return false; return false;
} }
@Override @Override
public <T> T accept(DisplayableItemNodeVisitor<T> v) { public <T> T accept(DisplayableItemNodeVisitor<T> v) {
return v.visit(this); return v.visit(this);

View File

@ -72,7 +72,7 @@ public class BlackboardArtifactTagTypeNode extends DisplayableItemNode {
propertySheet.put(properties); propertySheet.put(properties);
} }
properties.put(new NodeProperty( properties.put(new NodeProperty<>(
NbBundle.getMessage(this.getClass(), "BlackboardArtifactTagTypeNode.createSheet.name.name"), NbBundle.getMessage(this.getClass(), "BlackboardArtifactTagTypeNode.createSheet.name.name"),
NbBundle.getMessage(this.getClass(), "BlackboardArtifactTagTypeNode.createSheet.name.displayName"), NbBundle.getMessage(this.getClass(), "BlackboardArtifactTagTypeNode.createSheet.name.displayName"),
"", "",

View File

@ -180,7 +180,7 @@ class DirectoryTreeFilterChildren extends FilterNode.Children {
return isLeafDirectory(dn); return isLeafDirectory(dn);
} }
private Boolean visitDeep(AbstractAbstractFileNode node) { private Boolean visitDeep(AbstractAbstractFileNode<? extends AbstractFile> node) {
//is a leaf if has no children, or children are files not dirs //is a leaf if has no children, or children are files not dirs
boolean hasChildren = node.hasContentChildren(); boolean hasChildren = node.hasContentChildren();
if (!hasChildren) { if (!hasChildren) {

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2011 Basis Technology Corp. * Copyright 2011-2014 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -92,7 +92,7 @@ class DirectoryTreeFilterNode extends FilterNode {
*/ */
@Override @Override
public Action[] getActions(boolean popup) { public Action[] getActions(boolean popup) {
List<Action> actions = new ArrayList<Action>(); List<Action> actions = new ArrayList<>();
final Content content = this.getLookup().lookup(Content.class); final Content content = this.getLookup().lookup(Content.class);
if (content != null) { if (content != null) {
@ -103,24 +103,24 @@ class DirectoryTreeFilterNode extends FilterNode {
if (dir != null) { if (dir != null) {
actions.add(ExtractAction.getInstance()); actions.add(ExtractAction.getInstance());
} }
// file search action // file search action
final Image img = this.getLookup().lookup(Image.class); final Image img = this.getLookup().lookup(Image.class);
if (img != null) { if (img != null) {
actions.add(new FileSearchAction( actions.add(new FileSearchAction(
NbBundle.getMessage(this.getClass(), "DirectoryTreeFilterNode.action.openFileSrcByAttr.text"))); NbBundle.getMessage(this.getClass(), "DirectoryTreeFilterNode.action.openFileSrcByAttr.text")));
} }
//ingest action //ingest action
actions.add(new AbstractAction( actions.add(new AbstractAction(
NbBundle.getMessage(this.getClass(), "DirectoryTreeFilterNode.action.runIngestMods.text")) { NbBundle.getMessage(this.getClass(), "DirectoryTreeFilterNode.action.runIngestMods.text")) {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
final IngestDialog ingestDialog = new IngestDialog(); final IngestDialog ingestDialog = new IngestDialog();
ingestDialog.setContent(Collections.<Content>singletonList(content)); ingestDialog.setContent(Collections.<Content>singletonList(content));
ingestDialog.display(); ingestDialog.display();
} }
}); });
} }
//check if delete actions should be added //check if delete actions should be added
@ -135,7 +135,7 @@ class DirectoryTreeFilterNode extends FilterNode {
} }
private static List<Action> getDeleteActions(DisplayableItemNode original) { private static List<Action> getDeleteActions(DisplayableItemNode original) {
List<Action> actions = new ArrayList<Action>(); List<Action> actions = new ArrayList<>();
//actions.addAll(original.accept(getDeleteActionVisitor)); //actions.addAll(original.accept(getDeleteActionVisitor));
return actions; return actions;
} }

View File

@ -76,6 +76,8 @@ public class NewWindowViewAction extends AbstractAction{
@Override @Override
public void run() { public void run() {
dctc.setNode(contentNode); dctc.setNode(contentNode);
dctc.toFront();
dctc.requestActive();
} }
}); });
} }

View File

@ -39,6 +39,7 @@ import org.sleuthkit.autopsy.datamodel.AbstractFsContentNode;
import org.sleuthkit.autopsy.datamodel.BlackboardArtifactNode; import org.sleuthkit.autopsy.datamodel.BlackboardArtifactNode;
import org.sleuthkit.autopsy.datamodel.DataSourcesNode; import org.sleuthkit.autopsy.datamodel.DataSourcesNode;
import org.sleuthkit.autopsy.datamodel.RootContentChildren; import org.sleuthkit.autopsy.datamodel.RootContentChildren;
import org.sleuthkit.datamodel.AbstractFile;
import org.sleuthkit.datamodel.Content; import org.sleuthkit.datamodel.Content;
import org.sleuthkit.datamodel.ContentVisitor; import org.sleuthkit.datamodel.ContentVisitor;
import org.sleuthkit.datamodel.FileSystem; import org.sleuthkit.datamodel.FileSystem;
@ -66,7 +67,7 @@ public class ViewContextAction extends AbstractAction {
} }
public ViewContextAction(String title, AbstractFsContentNode node) { public ViewContextAction(String title, AbstractFsContentNode<? extends AbstractFile> node) {
super(title); super(title);
this.content = node.getLookup().lookup(Content.class); this.content = node.getLookup().lookup(Content.class);
} }

View File

@ -32,7 +32,6 @@ package org.sleuthkit.autopsy.examples;
import java.util.List; import java.util.List;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.openide.util.Exceptions;
import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.casemodule.services.FileManager; import org.sleuthkit.autopsy.casemodule.services.FileManager;
import org.sleuthkit.autopsy.casemodule.services.Services; import org.sleuthkit.autopsy.casemodule.services.Services;
@ -50,8 +49,7 @@ import org.sleuthkit.datamodel.TskCoreException;
* Sample DataSource-level ingest module that doesn't do much at all. * Sample DataSource-level ingest module that doesn't do much at all.
* Just exists to show basic idea of these modules * Just exists to show basic idea of these modules
*/ */
class SampleDataSourceIngestModule extends org.sleuthkit.autopsy.ingest.IngestModuleDataSource { public class SampleDataSourceIngestModule extends org.sleuthkit.autopsy.ingest.IngestModuleDataSource {
/* Data Source modules operate on a disk or set of logical files. They /* Data Source modules operate on a disk or set of logical files. They
* are passed in teh data source refernce and query it for things they want. * are passed in teh data source refernce and query it for things they want.
*/ */
@ -84,23 +82,19 @@ import org.sleuthkit.datamodel.TskCoreException;
} catch (TskCoreException ex) { } catch (TskCoreException ex) {
Logger log = Logger.getLogger(SampleDataSourceIngestModule.class); Logger log = Logger.getLogger(SampleDataSourceIngestModule.class);
log.fatal("Error retrieving files from database: " + ex.getLocalizedMessage()); log.fatal("Error retrieving files from database: " + ex.getLocalizedMessage());
return;
} }
} }
@Override @Override
public void init(IngestModuleInit initContext) throws IngestModuleException { public void init(IngestModuleInit initContext) throws IngestModuleException {
// do nothing
} }
@Override @Override
public void complete() { public void complete() {
// do nothing
} }
@Override @Override
public void stop() { public void stop() {
// do nothing
} }
@Override @Override

View File

@ -1,33 +1,32 @@
/* /*
* Sample module in the public domain. Feel free to use this as a template * Sample module in the public domain. Feel free to use this as a template
* for your modules. * for your modules.
* *
* Contact: Brian Carrier [carrier <at> sleuthkit [dot] org] * Contact: Brian Carrier [carrier <at> sleuthkit [dot] org]
* *
* This is free and unencumbered software released into the public domain. * This is free and unencumbered software released into the public domain.
* *
* Anyone is free to copy, modify, publish, use, compile, sell, or * Anyone is free to copy, modify, publish, use, compile, sell, or
* distribute this software, either in source code form or as a compiled * distribute this software, either in source code form or as a compiled
* binary, for any purpose, commercial or non-commercial, and by any * binary, for any purpose, commercial or non-commercial, and by any
* means. * means.
* *
* In jurisdictions that recognize copyright laws, the author or authors * In jurisdictions that recognize copyright laws, the author or authors
* of this software dedicate any and all copyright interest in the * of this software dedicate any and all copyright interest in the
* software to the public domain. We make this dedication for the benefit * software to the public domain. We make this dedication for the benefit
* of the public at large and to the detriment of our heirs and * of the public at large and to the detriment of our heirs and
* successors. We intend this dedication to be an overt act of * successors. We intend this dedication to be an overt act of
* relinquishment in perpetuity of all present and future rights to this * relinquishment in perpetuity of all present and future rights to this
* software under copyright law. * software under copyright law.
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE. * OTHER DEALINGS IN THE SOFTWARE.
*/ */
package org.sleuthkit.autopsy.examples; package org.sleuthkit.autopsy.examples;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
@ -44,23 +43,25 @@ import org.sleuthkit.datamodel.SleuthkitCase;
import org.sleuthkit.datamodel.TskData; import org.sleuthkit.datamodel.TskData;
/** /**
* This is a sample and simple module. It is a file-level ingest module, meaning * This is a sample and simple module. It is a file-level ingest module, meaning
* that it will get called on each file in the disk image / logical file set. * that it will get called on each file in the disk image / logical file set. It
* It does a stupid calculation of the number of null bytes in the beginning of the * does a stupid calculation of the number of null bytes in the beginning of the
* file in order to show the basic flow. * file in order to show the basic flow.
* *
* Autopsy has been hard coded to ignore this module based on the it's package name. * Autopsy has been hard coded to ignore this module based on the it's package
* IngestModuleLoader will not load things from the org.sleuthkit.autopsy.examples package. * name. IngestModuleLoader will not load things from the
* Either change the package or the loading code to make this module actually run. * org.sleuthkit.autopsy.examples package. Either change the package or the
* loading code to make this module actually run.
*/ */
class SampleFileIngestModule extends org.sleuthkit.autopsy.ingest.IngestModuleAbstractFile { public class SampleFileIngestModule extends org.sleuthkit.autopsy.ingest.IngestModuleAbstractFile {
private int attrId = -1; private int attrId = -1;
private static SampleFileIngestModule defaultInstance = null; private static SampleFileIngestModule defaultInstance = null;
// Private to ensure Singleton status // Private to ensure Singleton status
private SampleFileIngestModule() { private SampleFileIngestModule() {
} }
// File-level ingest modules are currently singleton -- this is required // File-level ingest modules are currently singleton -- this is required
public static synchronized SampleFileIngestModule getDefault() { public static synchronized SampleFileIngestModule getDefault() {
//defaultInstance is a private static class variable //defaultInstance is a private static class variable
@ -70,7 +71,6 @@ import org.sleuthkit.datamodel.TskData;
return defaultInstance; return defaultInstance;
} }
@Override @Override
public void init(IngestModuleInit initContext) throws IngestModuleException { public void init(IngestModuleInit initContext) throws IngestModuleException {
/* For this demo, we are going to make a private attribute to post our /* For this demo, we are going to make a private attribute to post our
@ -82,7 +82,7 @@ import org.sleuthkit.datamodel.TskData;
*/ */
Case case1 = Case.getCurrentCase(); Case case1 = Case.getCurrentCase();
SleuthkitCase sleuthkitCase = case1.getSleuthkitCase(); SleuthkitCase sleuthkitCase = case1.getSleuthkitCase();
// see if the type already exists in the blackboard. // see if the type already exists in the blackboard.
try { try {
attrId = sleuthkitCase.getAttrTypeID("ATTR_SAMPLE"); attrId = sleuthkitCase.getAttrTypeID("ATTR_SAMPLE");
@ -97,21 +97,21 @@ import org.sleuthkit.datamodel.TskData;
} }
} }
} }
@Override @Override
public ProcessResult process(PipelineContext<IngestModuleAbstractFile> pipelineContext, AbstractFile abstractFile) { public ProcessResult process(PipelineContext<IngestModuleAbstractFile> pipelineContext, AbstractFile abstractFile) {
// skip non-files // skip non-files
if ((abstractFile.getType() == TskData.TSK_DB_FILES_TYPE_ENUM.UNALLOC_BLOCKS) || if ((abstractFile.getType() == TskData.TSK_DB_FILES_TYPE_ENUM.UNALLOC_BLOCKS)
(abstractFile.getType() == TskData.TSK_DB_FILES_TYPE_ENUM.UNUSED_BLOCKS)) { || (abstractFile.getType() == TskData.TSK_DB_FILES_TYPE_ENUM.UNUSED_BLOCKS)) {
return ProcessResult.OK; return ProcessResult.OK;
} }
// skip NSRL / known files // skip NSRL / known files
if (abstractFile.getKnown() == TskData.FileKnown.KNOWN) { if (abstractFile.getKnown() == TskData.FileKnown.KNOWN) {
return ProcessResult.OK; return ProcessResult.OK;
} }
/* Do a non-sensical calculation of the number of 0x00 bytes /* Do a non-sensical calculation of the number of 0x00 bytes
* in the first 1024-bytes of the file. This is for demo * in the first 1024-bytes of the file. This is for demo
* purposes only. * purposes only.
@ -125,7 +125,7 @@ import org.sleuthkit.datamodel.TskData;
count++; count++;
} }
} }
if (attrId != -1) { if (attrId != -1) {
// Make an attribute using the ID for the private type that we previously created. // Make an attribute using the ID for the private type that we previously created.
BlackboardAttribute attr = new BlackboardAttribute(attrId, getName(), count); BlackboardAttribute attr = new BlackboardAttribute(attrId, getName(), count);
@ -136,30 +136,27 @@ import org.sleuthkit.datamodel.TskData;
BlackboardArtifact art = abstractFile.getGenInfoArtifact(); BlackboardArtifact art = abstractFile.getGenInfoArtifact();
art.addAttribute(attr); art.addAttribute(attr);
} }
return ProcessResult.OK; return ProcessResult.OK;
} catch (TskCoreException ex) { } catch (TskCoreException ex) {
Exceptions.printStackTrace(ex); Exceptions.printStackTrace(ex);
return ProcessResult.ERROR; return ProcessResult.ERROR;
} }
} }
@Override @Override
public void complete() { public void complete() {
} }
@Override @Override
public void stop() { public void stop() {
} }
@Override @Override
public String getVersion() { public String getVersion() {
return "1.0"; return "1.0";
} }
@Override @Override
public String getName() { public String getName() {
return "SampleFileIngestModule"; return "SampleFileIngestModule";
@ -172,7 +169,6 @@ import org.sleuthkit.datamodel.TskData;
@Override @Override
public boolean hasBackgroundJobsRunning() { public boolean hasBackgroundJobsRunning() {
// we're single threaded...
return false; return false;
} }
} }

View File

@ -204,7 +204,7 @@ class DateSearchFilter extends AbstractFileSearchFilter<DateSearchPanel> {
/** /**
* Inner class to put the separator inside the combo box. * Inner class to put the separator inside the combo box.
*/ */
static class ComboBoxRenderer extends JLabel implements ListCellRenderer { static class ComboBoxRenderer extends JLabel implements ListCellRenderer<String> {
JSeparator separator; JSeparator separator;
@ -215,8 +215,8 @@ class DateSearchFilter extends AbstractFileSearchFilter<DateSearchPanel> {
} }
@Override @Override
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { public Component getListCellRendererComponent(JList<? extends String> list, String value, int index, boolean isSelected, boolean cellHasFocus) {
String str = (value == null) ? "" : value.toString(); String str = (value == null) ? "" : value;
if (SEPARATOR.equals(str)) { if (SEPARATOR.equals(str)) {
return separator; return separator;
} }

View File

@ -1,4 +1,4 @@
<?xml version="1.1" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo"> <Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<NonVisualComponents> <NonVisualComponents>
@ -181,8 +181,9 @@
</Property> </Property>
</Properties> </Properties>
<AuxValues> <AuxValues>
<AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new JComboBox(this.timeZones.toArray());"/> <AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new JComboBox&lt;&gt;(this.timeZones.toArray(new String[this.timeZones.size()]))"/>
<AuxValue name="JavaCodeGenerator_CreateCodePost" type="java.lang.String" value="timeZoneComboBox.setRenderer(new DateSearchFilter.ComboBoxRenderer());"/> <AuxValue name="JavaCodeGenerator_CreateCodePost" type="java.lang.String" value="timeZoneComboBox.setRenderer(new DateSearchFilter.ComboBoxRenderer());"/>
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="&lt;String&gt;"/>
</AuxValues> </AuxValues>
</Component> </Component>
<Component class="javax.swing.JLabel" name="jLabel3"> <Component class="javax.swing.JLabel" name="jLabel3">

View File

@ -102,7 +102,7 @@ class DateSearchPanel extends javax.swing.JPanel {
return modifiedCheckBox; return modifiedCheckBox;
} }
JComboBox getTimeZoneComboBox() { JComboBox<String> getTimeZoneComboBox() {
return timeZoneComboBox; return timeZoneComboBox;
} }
@ -132,7 +132,7 @@ class DateSearchPanel extends javax.swing.JPanel {
jLabel1 = new javax.swing.JLabel(); jLabel1 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel(); jLabel4 = new javax.swing.JLabel();
dateCheckBox = new javax.swing.JCheckBox(); dateCheckBox = new javax.swing.JCheckBox();
timeZoneComboBox = new JComboBox(this.timeZones.toArray()); timeZoneComboBox = new JComboBox<>(this.timeZones.toArray(new String[this.timeZones.size()]));
timeZoneComboBox.setRenderer(new DateSearchFilter.ComboBoxRenderer()); timeZoneComboBox.setRenderer(new DateSearchFilter.ComboBoxRenderer());
jLabel3 = new javax.swing.JLabel(); jLabel3 = new javax.swing.JLabel();
dateFromTextField = new JFormattedTextField(this.dateFormat); dateFromTextField = new JFormattedTextField(this.dateFormat);
@ -359,7 +359,7 @@ class DateSearchPanel extends javax.swing.JPanel {
private javax.swing.JMenuItem pasteMenuItem; private javax.swing.JMenuItem pasteMenuItem;
private javax.swing.JPopupMenu rightClickMenu; private javax.swing.JPopupMenu rightClickMenu;
private javax.swing.JMenuItem selectAllMenuItem; private javax.swing.JMenuItem selectAllMenuItem;
private javax.swing.JComboBox timeZoneComboBox; private javax.swing.JComboBox<String> timeZoneComboBox;
// End of variables declaration//GEN-END:variables // End of variables declaration//GEN-END:variables
void addActionListener(ActionListener l) { void addActionListener(ActionListener l) {

View File

@ -51,7 +51,7 @@ class SizeSearchFilter extends AbstractFileSearchFilter<SizeSearchPanel> {
return "size " + operator + " " + size; return "size " + operator + " " + size;
} }
private String compareComboBoxToOperator(JComboBox compare) { private String compareComboBoxToOperator(JComboBox<String> compare) {
String compareSize = compare.getSelectedItem().toString(); String compareSize = compare.getSelectedItem().toString();
if (compareSize.equals("equal to")) { if (compareSize.equals("equal to")) {

View File

@ -1,4 +1,4 @@
<?xml version="1.1" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo"> <Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<NonVisualComponents> <NonVisualComponents>
@ -79,16 +79,13 @@
<SubComponents> <SubComponents>
<Component class="javax.swing.JComboBox" name="sizeUnitComboBox"> <Component class="javax.swing.JComboBox" name="sizeUnitComboBox">
<Properties> <Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor"> <Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
<StringArray count="5"> <Connection code="new javax.swing.DefaultComboBoxModel&lt;String&gt;(new String[] { &quot;Byte(s)&quot;, &quot;KB&quot;, &quot;MB&quot;, &quot;GB&quot;, &quot;TB&quot; })" type="code"/>
<StringItem index="0" value="Byte(s)"/>
<StringItem index="1" value="KB"/>
<StringItem index="2" value="MB"/>
<StringItem index="3" value="GB"/>
<StringItem index="4" value="TB"/>
</StringArray>
</Property> </Property>
</Properties> </Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="&lt;String&gt;"/>
</AuxValues>
</Component> </Component>
<Component class="javax.swing.JFormattedTextField" name="sizeTextField"> <Component class="javax.swing.JFormattedTextField" name="sizeTextField">
<Properties> <Properties>
@ -105,14 +102,13 @@
</Component> </Component>
<Component class="javax.swing.JComboBox" name="sizeCompareComboBox"> <Component class="javax.swing.JComboBox" name="sizeCompareComboBox">
<Properties> <Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor"> <Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
<StringArray count="3"> <Connection code="new javax.swing.DefaultComboBoxModel&lt;String&gt;(new String[] { &quot;equal to&quot;, &quot;greater than&quot;, &quot;less than&quot; })" type="code"/>
<StringItem index="0" value="equal to"/>
<StringItem index="1" value="greater than"/>
<StringItem index="2" value="less than"/>
</StringArray>
</Property> </Property>
</Properties> </Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="&lt;String&gt;"/>
</AuxValues>
</Component> </Component>
<Component class="javax.swing.JCheckBox" name="sizeCheckBox"> <Component class="javax.swing.JCheckBox" name="sizeCheckBox">
<Properties> <Properties>

View File

@ -67,7 +67,7 @@ class SizeSearchPanel extends javax.swing.JPanel {
return sizeCheckBox; return sizeCheckBox;
} }
JComboBox getSizeCompareComboBox() { JComboBox<String> getSizeCompareComboBox() {
return sizeCompareComboBox; return sizeCompareComboBox;
} }
@ -75,7 +75,7 @@ class SizeSearchPanel extends javax.swing.JPanel {
return sizeTextField; return sizeTextField;
} }
JComboBox getSizeUnitComboBox() { JComboBox<String> getSizeUnitComboBox() {
return sizeUnitComboBox; return sizeUnitComboBox;
} }
@ -93,9 +93,9 @@ class SizeSearchPanel extends javax.swing.JPanel {
copyMenuItem = new javax.swing.JMenuItem(); copyMenuItem = new javax.swing.JMenuItem();
pasteMenuItem = new javax.swing.JMenuItem(); pasteMenuItem = new javax.swing.JMenuItem();
selectAllMenuItem = new javax.swing.JMenuItem(); selectAllMenuItem = new javax.swing.JMenuItem();
sizeUnitComboBox = new javax.swing.JComboBox(); sizeUnitComboBox = new javax.swing.JComboBox<String>();
sizeTextField = new JFormattedTextField(NumberFormat.getIntegerInstance()); sizeTextField = new JFormattedTextField(NumberFormat.getIntegerInstance());
sizeCompareComboBox = new javax.swing.JComboBox(); sizeCompareComboBox = new javax.swing.JComboBox<String>();
sizeCheckBox = new javax.swing.JCheckBox(); sizeCheckBox = new javax.swing.JCheckBox();
cutMenuItem.setText(org.openide.util.NbBundle.getMessage(SizeSearchPanel.class, "SizeSearchPanel.cutMenuItem.text")); // NOI18N cutMenuItem.setText(org.openide.util.NbBundle.getMessage(SizeSearchPanel.class, "SizeSearchPanel.cutMenuItem.text")); // NOI18N
@ -110,7 +110,7 @@ class SizeSearchPanel extends javax.swing.JPanel {
selectAllMenuItem.setText(org.openide.util.NbBundle.getMessage(SizeSearchPanel.class, "SizeSearchPanel.selectAllMenuItem.text")); // NOI18N selectAllMenuItem.setText(org.openide.util.NbBundle.getMessage(SizeSearchPanel.class, "SizeSearchPanel.selectAllMenuItem.text")); // NOI18N
rightClickMenu.add(selectAllMenuItem); rightClickMenu.add(selectAllMenuItem);
sizeUnitComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Byte(s)", "KB", "MB", "GB", "TB" })); sizeUnitComboBox.setModel(new javax.swing.DefaultComboBoxModel<String>(new String[] { "Byte(s)", "KB", "MB", "GB", "TB" }));
sizeTextField.setValue(0); sizeTextField.setValue(0);
sizeTextField.addMouseListener(new java.awt.event.MouseAdapter() { sizeTextField.addMouseListener(new java.awt.event.MouseAdapter() {
@ -119,7 +119,7 @@ class SizeSearchPanel extends javax.swing.JPanel {
} }
}); });
sizeCompareComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "equal to", "greater than", "less than" })); sizeCompareComboBox.setModel(new javax.swing.DefaultComboBoxModel<String>(new String[] { "equal to", "greater than", "less than" }));
sizeCheckBox.setText(org.openide.util.NbBundle.getMessage(SizeSearchPanel.class, "SizeSearchPanel.sizeCheckBox.text")); // NOI18N sizeCheckBox.setText(org.openide.util.NbBundle.getMessage(SizeSearchPanel.class, "SizeSearchPanel.sizeCheckBox.text")); // NOI18N
@ -157,9 +157,9 @@ class SizeSearchPanel extends javax.swing.JPanel {
private javax.swing.JPopupMenu rightClickMenu; private javax.swing.JPopupMenu rightClickMenu;
private javax.swing.JMenuItem selectAllMenuItem; private javax.swing.JMenuItem selectAllMenuItem;
private javax.swing.JCheckBox sizeCheckBox; private javax.swing.JCheckBox sizeCheckBox;
private javax.swing.JComboBox sizeCompareComboBox; private javax.swing.JComboBox<String> sizeCompareComboBox;
private javax.swing.JFormattedTextField sizeTextField; private javax.swing.JFormattedTextField sizeTextField;
private javax.swing.JComboBox sizeUnitComboBox; private javax.swing.JComboBox<String> sizeUnitComboBox;
// End of variables declaration//GEN-END:variables // End of variables declaration//GEN-END:variables
void addActionListener(ActionListener l) { void addActionListener(ActionListener l) {

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2013 Basis Technology Corp. * Copyright 2013-2014 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -20,7 +20,6 @@
package org.sleuthkit.autopsy.ingest; package org.sleuthkit.autopsy.ingest;
import java.util.List; import java.util.List;
import org.openide.util.NbBundle; import org.openide.util.NbBundle;
import org.sleuthkit.datamodel.Content; import org.sleuthkit.datamodel.Content;
@ -93,6 +92,7 @@ class DataSourceTask<T extends IngestModuleAbstract> {
if (getClass() != obj.getClass()) { if (getClass() != obj.getClass()) {
return false; return false;
} }
@SuppressWarnings("unchecked")
final DataSourceTask<T> other = (DataSourceTask<T>) obj; final DataSourceTask<T> other = (DataSourceTask<T>) obj;
if (this.input != other.input && (this.input == null || !this.input.equals(other.input))) { if (this.input != other.input && (this.input == null || !this.input.equals(other.input))) {
return false; return false;

View File

@ -343,7 +343,7 @@ public class IngestManager {
* @param pipelineContext ingest context used to ingest parent of the file * @param pipelineContext ingest context used to ingest parent of the file
* to be scheduled * to be scheduled
*/ */
void scheduleFile(AbstractFile file, PipelineContext pipelineContext) { void scheduleFile(AbstractFile file, PipelineContext<IngestModuleAbstractFile> pipelineContext) {
scheduler.getFileScheduler().schedule(file, pipelineContext); scheduler.getFileScheduler().schedule(file, pipelineContext);
} }

View File

@ -100,11 +100,11 @@
<EmptySpace min="-2" pref="101" max="-2" attributes="0"/> <EmptySpace min="-2" pref="101" max="-2" attributes="0"/>
<Component id="totalMessagesNameLabel" min="-2" max="-2" attributes="0"/> <Component id="totalMessagesNameLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Component id="totalMessagesNameVal" pref="9" max="32767" attributes="0"/> <Component id="totalMessagesNameVal" pref="24" max="32767" attributes="0"/>
<EmptySpace min="-2" pref="22" max="-2" attributes="0"/> <EmptySpace min="-2" pref="22" max="-2" attributes="0"/>
<Component id="totalUniqueMessagesNameLabel" min="-2" max="-2" attributes="0"/> <Component id="totalUniqueMessagesNameLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Component id="totalUniqueMessagesNameVal" pref="8" max="32767" attributes="0"/> <Component id="totalUniqueMessagesNameVal" pref="24" max="32767" attributes="0"/>
<EmptySpace min="-2" pref="22" max="-2" attributes="0"/> <EmptySpace min="-2" pref="22" max="-2" attributes="0"/>
</Group> </Group>
</Group> </Group>
@ -132,11 +132,8 @@
</Component> </Component>
<Component class="javax.swing.JComboBox" name="sortByComboBox"> <Component class="javax.swing.JComboBox" name="sortByComboBox">
<Properties> <Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor"> <Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
<StringArray count="2"> <Connection code="new javax.swing.DefaultComboBoxModel&lt;String&gt;(new String[] { &quot;Time&quot;, &quot;Priority&quot; })" type="code"/>
<StringItem index="0" value="Time"/>
<StringItem index="1" value="Priority"/>
</StringArray>
</Property> </Property>
<Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> <Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/ingest/Bundle.properties" key="IngestMessagePanel.sortByComboBox.toolTipText" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/> <ResourceString bundle="org/sleuthkit/autopsy/ingest/Bundle.properties" key="IngestMessagePanel.sortByComboBox.toolTipText" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
@ -146,7 +143,7 @@
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="sortByComboBoxActionPerformed"/> <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="sortByComboBoxActionPerformed"/>
</Events> </Events>
<AuxValues> <AuxValues>
<AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new javax.swing.JComboBox&lt;String&gt;()"/> <AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="&lt;String&gt;"/>
</AuxValues> </AuxValues>
</Component> </Component>
<Component class="javax.swing.JLabel" name="totalMessagesNameLabel"> <Component class="javax.swing.JLabel" name="totalMessagesNameLabel">

View File

@ -149,7 +149,7 @@ class IngestMessagePanel extends JPanel implements TableModelListener {
sortByLabel.setText(org.openide.util.NbBundle.getMessage(IngestMessagePanel.class, "IngestMessagePanel.sortByLabel.text")); // NOI18N sortByLabel.setText(org.openide.util.NbBundle.getMessage(IngestMessagePanel.class, "IngestMessagePanel.sortByLabel.text")); // NOI18N
sortByComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Time", "Priority" })); sortByComboBox.setModel(new javax.swing.DefaultComboBoxModel<String>(new String[] { "Time", "Priority" }));
sortByComboBox.setToolTipText(org.openide.util.NbBundle.getMessage(IngestMessagePanel.class, "IngestMessagePanel.sortByComboBox.toolTipText")); // NOI18N sortByComboBox.setToolTipText(org.openide.util.NbBundle.getMessage(IngestMessagePanel.class, "IngestMessagePanel.sortByComboBox.toolTipText")); // NOI18N
sortByComboBox.addActionListener(new java.awt.event.ActionListener() { sortByComboBox.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) { public void actionPerformed(java.awt.event.ActionEvent evt) {
@ -177,11 +177,11 @@ class IngestMessagePanel extends JPanel implements TableModelListener {
.addGap(101, 101, 101) .addGap(101, 101, 101)
.addComponent(totalMessagesNameLabel) .addComponent(totalMessagesNameLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(totalMessagesNameVal, javax.swing.GroupLayout.DEFAULT_SIZE, 9, Short.MAX_VALUE) .addComponent(totalMessagesNameVal, javax.swing.GroupLayout.DEFAULT_SIZE, 24, Short.MAX_VALUE)
.addGap(22, 22, 22) .addGap(22, 22, 22)
.addComponent(totalUniqueMessagesNameLabel) .addComponent(totalUniqueMessagesNameLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(totalUniqueMessagesNameVal, javax.swing.GroupLayout.DEFAULT_SIZE, 8, Short.MAX_VALUE) .addComponent(totalUniqueMessagesNameVal, javax.swing.GroupLayout.DEFAULT_SIZE, 24, Short.MAX_VALUE)
.addGap(22, 22, 22)) .addGap(22, 22, 22))
); );
controlPanelLayout.setVerticalGroup( controlPanelLayout.setVerticalGroup(
@ -224,7 +224,7 @@ class IngestMessagePanel extends JPanel implements TableModelListener {
private javax.swing.JPanel controlPanel; private javax.swing.JPanel controlPanel;
private javax.swing.JScrollPane jScrollPane1; private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTable messageTable; private javax.swing.JTable messageTable;
private javax.swing.JComboBox sortByComboBox; private javax.swing.JComboBox<String> sortByComboBox;
private javax.swing.JLabel sortByLabel; private javax.swing.JLabel sortByLabel;
private javax.swing.JLabel totalMessagesNameLabel; private javax.swing.JLabel totalMessagesNameLabel;
private javax.swing.JLabel totalMessagesNameVal; private javax.swing.JLabel totalMessagesNameVal;

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2012-2013 Basis Technology Corp. * Copyright 2012-2014 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -369,8 +369,8 @@ class IngestScheduler {
* @param originalContext original content schedule context that was used * @param originalContext original content schedule context that was used
* to schedule the parent origin content, with the modules, settings, etc. * to schedule the parent origin content, with the modules, settings, etc.
*/ */
synchronized void schedule(AbstractFile file, PipelineContext originalContext) { synchronized void schedule(AbstractFile file, PipelineContext<IngestModuleAbstractFile> originalContext) {
DataSourceTask originalTask = originalContext.getDataSourceTask(); DataSourceTask<IngestModuleAbstractFile> originalTask = originalContext.getDataSourceTask();
//skip if task contains no modules //skip if task contains no modules
if (originalTask.getModules().isEmpty()) { if (originalTask.getModules().isEmpty()) {
@ -393,7 +393,6 @@ class IngestScheduler {
* @param context context to schedule, with scheduled task containing content to process and modules * @param context context to schedule, with scheduled task containing content to process and modules
*/ */
synchronized void schedule(DataSourceTask<IngestModuleAbstractFile> task) { synchronized void schedule(DataSourceTask<IngestModuleAbstractFile> task) {
//skip if task contains no modules //skip if task contains no modules
if (task.getModules().isEmpty()) { if (task.getModules().isEmpty()) {
return; return;

View File

@ -136,7 +136,7 @@ public class IngestServices {
* @param file file to be scheduled * @param file file to be scheduled
* @param pipelineContext the ingest context for the file ingest pipeline * @param pipelineContext the ingest context for the file ingest pipeline
*/ */
public void scheduleFile(AbstractFile file, PipelineContext pipelineContext) { public void scheduleFile(AbstractFile file, PipelineContext<IngestModuleAbstractFile> pipelineContext) {
logger.log(Level.INFO, "Scheduling file: " + file.getName()); logger.log(Level.INFO, "Scheduling file: " + file.getName());
manager.scheduleFile(file, pipelineContext); manager.scheduleFile(file, pipelineContext);
} }

View File

@ -65,6 +65,7 @@ public class PipelineContext <T extends IngestModuleAbstract> {
if (getClass() != obj.getClass()) { if (getClass() != obj.getClass()) {
return false; return false;
} }
@SuppressWarnings("unchecked")
final PipelineContext<T> other = (PipelineContext<T>) obj; final PipelineContext<T> other = (PipelineContext<T>) obj;
if (!Objects.equals(this.task, other.task)) { if (!Objects.equals(this.task, other.task)) {

View File

@ -85,6 +85,10 @@
<Property name="selectionMode" type="int" value="0"/> <Property name="selectionMode" type="int" value="0"/>
<Property name="layoutOrientation" type="int" value="2"/> <Property name="layoutOrientation" type="int" value="2"/>
</Properties> </Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new javax.swing.JList&lt;&gt;()"/>
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="&lt;ARTIFACT_TYPE&gt;"/>
</AuxValues>
</Component> </Component>
</SubComponents> </SubComponents>
</Container> </Container>

View File

@ -36,7 +36,6 @@ import javax.swing.JList;
import javax.swing.ListCellRenderer; import javax.swing.ListCellRenderer;
import javax.swing.ListModel; import javax.swing.ListModel;
import javax.swing.event.ListDataListener; import javax.swing.event.ListDataListener;
import org.openide.util.NbBundle; import org.openide.util.NbBundle;
import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.Logger;
@ -45,12 +44,12 @@ import org.sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE;
import org.sleuthkit.datamodel.TskCoreException; import org.sleuthkit.datamodel.TskCoreException;
public class ArtifactSelectionDialog extends javax.swing.JDialog { public class ArtifactSelectionDialog extends javax.swing.JDialog {
private ArtifactModel model; private ArtifactModel model;
private ArtifactRenderer renderer; private ArtifactRenderer renderer;
private Map<BlackboardArtifact.ARTIFACT_TYPE, Boolean> artifactStates; private Map<BlackboardArtifact.ARTIFACT_TYPE, Boolean> artifactStates;
private List<BlackboardArtifact.ARTIFACT_TYPE> artifacts; private List<BlackboardArtifact.ARTIFACT_TYPE> artifacts;
/** /**
* Creates new form ArtifactSelectionDialog * Creates new form ArtifactSelectionDialog
*/ */
@ -60,27 +59,27 @@ public class ArtifactSelectionDialog extends javax.swing.JDialog {
populateList(); populateList();
customInit(); customInit();
} }
/** /**
* Populate the list of artifacts with all important artifacts. * Populate the list of artifacts with all important artifacts.
*/ */
private void populateList() { private void populateList() {
try { try {
ArrayList<BlackboardArtifact.ARTIFACT_TYPE> doNotReport = new ArrayList(); ArrayList<BlackboardArtifact.ARTIFACT_TYPE> doNotReport = new ArrayList<>();
doNotReport.add(BlackboardArtifact.ARTIFACT_TYPE.TSK_GEN_INFO); doNotReport.add(BlackboardArtifact.ARTIFACT_TYPE.TSK_GEN_INFO);
doNotReport.add(BlackboardArtifact.ARTIFACT_TYPE.TSK_TAG_FILE); // Obsolete artifact type doNotReport.add(BlackboardArtifact.ARTIFACT_TYPE.TSK_TAG_FILE); // Obsolete artifact type
doNotReport.add(BlackboardArtifact.ARTIFACT_TYPE.TSK_TAG_ARTIFACT); // Obsolete artifact type doNotReport.add(BlackboardArtifact.ARTIFACT_TYPE.TSK_TAG_ARTIFACT); // Obsolete artifact type
artifacts = Case.getCurrentCase().getSleuthkitCase().getBlackboardArtifactTypesInUse(); artifacts = Case.getCurrentCase().getSleuthkitCase().getBlackboardArtifactTypesInUse();
artifacts.removeAll(doNotReport); artifacts.removeAll(doNotReport);
Collections.sort(artifacts, new Comparator<BlackboardArtifact.ARTIFACT_TYPE>() { Collections.sort(artifacts, new Comparator<BlackboardArtifact.ARTIFACT_TYPE>() {
@Override @Override
public int compare(ARTIFACT_TYPE o1, ARTIFACT_TYPE o2) { public int compare(ARTIFACT_TYPE o1, ARTIFACT_TYPE o2) {
return o1.getDisplayName().compareTo(o2.getDisplayName()); return o1.getDisplayName().compareTo(o2.getDisplayName());
} }
}); });
artifactStates = new EnumMap<>(BlackboardArtifact.ARTIFACT_TYPE.class); artifactStates = new EnumMap<>(BlackboardArtifact.ARTIFACT_TYPE.class);
for (BlackboardArtifact.ARTIFACT_TYPE type : artifacts) { for (BlackboardArtifact.ARTIFACT_TYPE type : artifacts) {
artifactStates.put(type, Boolean.TRUE); artifactStates.put(type, Boolean.TRUE);
} }
@ -88,26 +87,26 @@ public class ArtifactSelectionDialog extends javax.swing.JDialog {
Logger.getLogger(ArtifactSelectionDialog.class.getName()).log(Level.SEVERE, "Error getting list of artifacts in use: " + ex.getLocalizedMessage()); Logger.getLogger(ArtifactSelectionDialog.class.getName()).log(Level.SEVERE, "Error getting list of artifacts in use: " + ex.getLocalizedMessage());
} }
} }
private void customInit() { private void customInit() {
model = new ArtifactModel(); model = new ArtifactModel();
renderer = new ArtifactRenderer(); renderer = new ArtifactRenderer();
artifactList.setModel(model); artifactList.setModel(model);
artifactList.setCellRenderer(renderer); artifactList.setCellRenderer(renderer);
artifactList.setVisibleRowCount(-1); artifactList.setVisibleRowCount(-1);
artifactList.addMouseListener(new MouseAdapter() { artifactList.addMouseListener(new MouseAdapter() {
@Override @Override
public void mousePressed(MouseEvent evt) { public void mousePressed(MouseEvent evt) {
JList list = (JList) evt.getSource(); JList list = (JList) evt.getSource();
int index = list.locationToIndex(evt.getPoint()); int index = list.locationToIndex(evt.getPoint());
BlackboardArtifact.ARTIFACT_TYPE type = (BlackboardArtifact.ARTIFACT_TYPE) model.getElementAt(index); BlackboardArtifact.ARTIFACT_TYPE type = model.getElementAt(index);
artifactStates.put(type, !artifactStates.get(type)); artifactStates.put(type, !artifactStates.get(type));
list.repaint(); list.repaint();
} }
}); });
} }
/** /**
* Display this dialog, and return the selected artifacts. * Display this dialog, and return the selected artifacts.
*/ */
@ -120,7 +119,7 @@ public class ArtifactSelectionDialog extends javax.swing.JDialog {
// set the location of the popUp Window on the center of the screen // set the location of the popUp Window on the center of the screen
setLocation((screenDimension.width - w) / 2, (screenDimension.height - h) / 2); setLocation((screenDimension.width - w) / 2, (screenDimension.height - h) / 2);
this.setVisible(true); this.setVisible(true);
return artifactStates; return artifactStates;
} }
@ -135,7 +134,7 @@ public class ArtifactSelectionDialog extends javax.swing.JDialog {
private void initComponents() { private void initComponents() {
artifactScrollPane = new javax.swing.JScrollPane(); artifactScrollPane = new javax.swing.JScrollPane();
artifactList = new javax.swing.JList(); artifactList = new javax.swing.JList<>();
okButton = new javax.swing.JButton(); okButton = new javax.swing.JButton();
titleLabel = new javax.swing.JLabel(); titleLabel = new javax.swing.JLabel();
selectAllButton = new javax.swing.JButton(); selectAllButton = new javax.swing.JButton();
@ -229,9 +228,8 @@ public class ArtifactSelectionDialog extends javax.swing.JDialog {
} }
artifactList.repaint(); artifactList.repaint();
}//GEN-LAST:event_deselectAllButtonActionPerformed }//GEN-LAST:event_deselectAllButtonActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables // Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JList artifactList; private javax.swing.JList<ARTIFACT_TYPE> artifactList;
private javax.swing.JScrollPane artifactScrollPane; private javax.swing.JScrollPane artifactScrollPane;
private javax.swing.JButton deselectAllButton; private javax.swing.JButton deselectAllButton;
private javax.swing.JButton okButton; private javax.swing.JButton okButton;
@ -239,7 +237,7 @@ public class ArtifactSelectionDialog extends javax.swing.JDialog {
private javax.swing.JLabel titleLabel; private javax.swing.JLabel titleLabel;
// End of variables declaration//GEN-END:variables // End of variables declaration//GEN-END:variables
private class ArtifactModel implements ListModel { private class ArtifactModel implements ListModel<ARTIFACT_TYPE> {
@Override @Override
public int getSize() { public int getSize() {
@ -247,7 +245,7 @@ public class ArtifactSelectionDialog extends javax.swing.JDialog {
} }
@Override @Override
public Object getElementAt(int index) { public ARTIFACT_TYPE getElementAt(int index) {
return artifacts.get(index); return artifacts.get(index);
} }
@ -259,11 +257,11 @@ public class ArtifactSelectionDialog extends javax.swing.JDialog {
public void removeListDataListener(ListDataListener l) { public void removeListDataListener(ListDataListener l) {
} }
} }
private class ArtifactRenderer extends JCheckBox implements ListCellRenderer<BlackboardArtifact.ARTIFACT_TYPE> { private class ArtifactRenderer extends JCheckBox implements ListCellRenderer<BlackboardArtifact.ARTIFACT_TYPE> {
@Override @Override
public Component getListCellRendererComponent(JList list, BlackboardArtifact.ARTIFACT_TYPE value, int index, boolean isSelected, boolean cellHasFocus) { public Component getListCellRendererComponent(JList<? extends ARTIFACT_TYPE> list, ARTIFACT_TYPE value, int index, boolean isSelected, boolean cellHasFocus) {
if (value != null) { if (value != null) {
setEnabled(list.isEnabled()); setEnabled(list.isEnabled());
setSelected(artifactStates.get(value)); setSelected(artifactStates.get(value));
@ -274,6 +272,6 @@ public class ArtifactSelectionDialog extends javax.swing.JDialog {
return this; return this;
} }
return new JLabel(); return new JLabel();
} }
} }
} }

View File

@ -345,7 +345,7 @@ import org.sleuthkit.datamodel.TskData;
return absFiles; return absFiles;
} catch (TskCoreException ex) { } catch (TskCoreException ex) {
// TODO // TODO
return Collections.EMPTY_LIST; return Collections.<AbstractFile>emptyList();
} }
} }
@ -515,7 +515,6 @@ import org.sleuthkit.datamodel.TskData;
module.addRow(rowData); module.addRow(rowData);
} }
} }
// Finish up this data type // Finish up this data type
for (TableReportModule module : tableModules) { for (TableReportModule module : tableModules) {
tableProgress.get(module).increment(); tableProgress.get(module).increment();

View File

@ -123,16 +123,14 @@
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor"> <Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="f0" green="f0" red="f0" type="rgb"/> <Color blue="f0" green="f0" red="f0" type="rgb"/>
</Property> </Property>
<Property name="model" type="javax.swing.ListModel" editor="org.netbeans.modules.form.editors2.ListModelEditor"> <Property name="model" type="javax.swing.ListModel" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
<StringArray count="5"> <Connection code="new javax.swing.AbstractListModel&lt;ReportModule&gt;() {&#xa; ReportModule[] modules = {};&#xa; public int getSize() { return modules.length; }&#xa; public ReportModule getElementAt(int i) { return modules[i]; }&#xa;}" type="code"/>
<StringItem index="0" value="Item 1"/>
<StringItem index="1" value="Item 2"/>
<StringItem index="2" value="Item 3"/>
<StringItem index="3" value="Item 4"/>
<StringItem index="4" value="Item 5"/>
</StringArray>
</Property> </Property>
</Properties> </Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new javax.swing.JList&lt;&gt;()"/>
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="&lt;ReportModule&gt;"/>
</AuxValues>
</Component> </Component>
</SubComponents> </SubComponents>
</Container> </Container>

View File

@ -93,7 +93,7 @@ import org.sleuthkit.autopsy.coreutils.Logger;
modulesJList.getSelectionModel().addListSelectionListener(this); modulesJList.getSelectionModel().addListSelectionListener(this);
modulesJList.setCellRenderer(new ModuleCellRenderer()); modulesJList.setCellRenderer(new ModuleCellRenderer());
modulesJList.setListData(modules.toArray()); modulesJList.setListData(modules.toArray(new ReportModule[modules.size()]));
selectedIndex = 0; selectedIndex = 0;
modulesJList.setSelectedIndex(selectedIndex); modulesJList.setSelectedIndex(selectedIndex);
} }
@ -162,7 +162,7 @@ import org.sleuthkit.autopsy.coreutils.Logger;
descriptionScrollPane = new javax.swing.JScrollPane(); descriptionScrollPane = new javax.swing.JScrollPane();
descriptionTextPane = new javax.swing.JTextPane(); descriptionTextPane = new javax.swing.JTextPane();
modulesScrollPane = new javax.swing.JScrollPane(); modulesScrollPane = new javax.swing.JScrollPane();
modulesJList = new javax.swing.JList(); modulesJList = new javax.swing.JList<>();
setPreferredSize(new java.awt.Dimension(650, 250)); setPreferredSize(new java.awt.Dimension(650, 250));
@ -188,10 +188,10 @@ import org.sleuthkit.autopsy.coreutils.Logger;
descriptionScrollPane.setViewportView(descriptionTextPane); descriptionScrollPane.setViewportView(descriptionTextPane);
modulesJList.setBackground(new java.awt.Color(240, 240, 240)); modulesJList.setBackground(new java.awt.Color(240, 240, 240));
modulesJList.setModel(new javax.swing.AbstractListModel() { modulesJList.setModel(new javax.swing.AbstractListModel<ReportModule>() {
String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" }; ReportModule[] modules = {};
public int getSize() { return strings.length; } public int getSize() { return modules.length; }
public Object getElementAt(int i) { return strings[i]; } public ReportModule getElementAt(int i) { return modules[i]; }
}); });
modulesScrollPane.setViewportView(modulesJList); modulesScrollPane.setViewportView(modulesJList);
@ -229,7 +229,7 @@ import org.sleuthkit.autopsy.coreutils.Logger;
private javax.swing.JPanel configurationPanel; private javax.swing.JPanel configurationPanel;
private javax.swing.JScrollPane descriptionScrollPane; private javax.swing.JScrollPane descriptionScrollPane;
private javax.swing.JTextPane descriptionTextPane; private javax.swing.JTextPane descriptionTextPane;
private javax.swing.JList modulesJList; private javax.swing.JList<ReportModule> modulesJList;
private javax.swing.JScrollPane modulesScrollPane; private javax.swing.JScrollPane modulesScrollPane;
private javax.swing.JLabel reportModulesLabel; private javax.swing.JLabel reportModulesLabel;
// End of variables declaration//GEN-END:variables // End of variables declaration//GEN-END:variables
@ -264,7 +264,7 @@ import org.sleuthkit.autopsy.coreutils.Logger;
private class ModuleCellRenderer extends JRadioButton implements ListCellRenderer<ReportModule> { private class ModuleCellRenderer extends JRadioButton implements ListCellRenderer<ReportModule> {
@Override @Override
public Component getListCellRendererComponent(JList list, ReportModule value, int index, boolean isSelected, boolean cellHasFocus) { public Component getListCellRendererComponent(JList<? extends ReportModule> list, ReportModule value, int index, boolean isSelected, boolean cellHasFocus) {
this.setText(value.getName()); this.setText(value.getName());
this.setEnabled(true); this.setEnabled(true);
this.setSelected(isSelected); this.setSelected(isSelected);

View File

@ -143,6 +143,10 @@
<Property name="selectionMode" type="int" value="0"/> <Property name="selectionMode" type="int" value="0"/>
<Property name="layoutOrientation" type="int" value="1"/> <Property name="layoutOrientation" type="int" value="1"/>
</Properties> </Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new javax.swing.JList&lt;&gt;()"/>
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="&lt;String&gt;"/>
</AuxValues>
</Component> </Component>
</SubComponents> </SubComponents>
</Container> </Container>

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2013 Basis Technology Corp. * Copyright 2013-2014 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -45,16 +45,14 @@ import org.sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE;
import org.sleuthkit.datamodel.TagName; import org.sleuthkit.datamodel.TagName;
import org.sleuthkit.datamodel.TskCoreException; import org.sleuthkit.datamodel.TskCoreException;
final class ReportVisualPanel2 extends JPanel { final class ReportVisualPanel2 extends JPanel {
private ReportWizardPanel2 wizPanel; private ReportWizardPanel2 wizPanel;
private Map<String, Boolean> tagStates = new LinkedHashMap<>(); private Map<String, Boolean> tagStates = new LinkedHashMap<>();
private List<String> tags = new ArrayList<>(); private List<String> tags = new ArrayList<>();
ArtifactSelectionDialog dialog = new ArtifactSelectionDialog(new JFrame(), true); ArtifactSelectionDialog dialog = new ArtifactSelectionDialog(new JFrame(), true);
private Map<ARTIFACT_TYPE, Boolean> artifactStates = new EnumMap<>(ARTIFACT_TYPE.class); private Map<ARTIFACT_TYPE, Boolean> artifactStates = new EnumMap<>(ARTIFACT_TYPE.class);
private List<ARTIFACT_TYPE> artifacts = new ArrayList<>(); private List<ARTIFACT_TYPE> artifacts = new ArrayList<>();
private TagsListModel tagsModel; private TagsListModel tagsModel;
private TagsListRenderer tagsRenderer; private TagsListRenderer tagsRenderer;
@ -71,58 +69,57 @@ import org.sleuthkit.datamodel.TskCoreException;
allResultsRadioButton.setSelected(true); allResultsRadioButton.setSelected(true);
this.wizPanel = wizPanel; this.wizPanel = wizPanel;
} }
// Initialize the list of Tags // Initialize the list of Tags
private void initTags() { private void initTags() {
List<TagName> tagNamesInUse; List<TagName> tagNamesInUse;
try { try {
tagNamesInUse = Case.getCurrentCase().getServices().getTagsManager().getTagNamesInUse(); tagNamesInUse = Case.getCurrentCase().getServices().getTagsManager().getTagNamesInUse();
} } catch (TskCoreException ex) {
catch (TskCoreException ex) { Logger.getLogger(ReportVisualPanel2.class.getName()).log(Level.SEVERE, "Failed to get tag names", ex);
Logger.getLogger(ReportVisualPanel2.class.getName()).log(Level.SEVERE, "Failed to get tag names", ex);
return; return;
} }
for(TagName tagName : tagNamesInUse) { for (TagName tagName : tagNamesInUse) {
tagStates.put(tagName.getDisplayName(), Boolean.FALSE); tagStates.put(tagName.getDisplayName(), Boolean.FALSE);
} }
tags.addAll(tagStates.keySet()); tags.addAll(tagStates.keySet());
tagsModel = new TagsListModel(); tagsModel = new TagsListModel();
tagsRenderer = new TagsListRenderer(); tagsRenderer = new TagsListRenderer();
tagsList.setModel(tagsModel); tagsList.setModel(tagsModel);
tagsList.setCellRenderer(tagsRenderer); tagsList.setCellRenderer(tagsRenderer);
tagsList.setVisibleRowCount(-1); tagsList.setVisibleRowCount(-1);
// Add the ability to enable and disable Tag checkboxes to the list // Add the ability to enable and disable Tag checkboxes to the list
tagsList.addMouseListener(new MouseAdapter() { tagsList.addMouseListener(new MouseAdapter() {
@Override @Override
public void mousePressed(MouseEvent evt) { public void mousePressed(MouseEvent evt) {
JList list = (JList) evt.getSource(); JList list = (JList) evt.getSource();
int index = list.locationToIndex(evt.getPoint()); int index = list.locationToIndex(evt.getPoint());
String value = (String) tagsModel.getElementAt(index); String value = tagsModel.getElementAt(index);
tagStates.put(value, !tagStates.get(value)); tagStates.put(value, !tagStates.get(value));
list.repaint(); list.repaint();
updateFinishButton(); updateFinishButton();
} }
}); });
} }
// Initialize the list of Artifacts // Initialize the list of Artifacts
private void initArtifactTypes() { private void initArtifactTypes() {
try { try {
ArrayList<BlackboardArtifact.ARTIFACT_TYPE> doNotReport = new ArrayList(); ArrayList<BlackboardArtifact.ARTIFACT_TYPE> doNotReport = new ArrayList<>();
doNotReport.add(BlackboardArtifact.ARTIFACT_TYPE.TSK_GEN_INFO); doNotReport.add(BlackboardArtifact.ARTIFACT_TYPE.TSK_GEN_INFO);
doNotReport.add(BlackboardArtifact.ARTIFACT_TYPE.TSK_TAG_FILE); // Obsolete artifact type doNotReport.add(BlackboardArtifact.ARTIFACT_TYPE.TSK_TAG_FILE); // Obsolete artifact type
doNotReport.add(BlackboardArtifact.ARTIFACT_TYPE.TSK_TAG_ARTIFACT); // Obsolete artifact type doNotReport.add(BlackboardArtifact.ARTIFACT_TYPE.TSK_TAG_ARTIFACT); // Obsolete artifact type
artifacts = Case.getCurrentCase().getSleuthkitCase().getBlackboardArtifactTypesInUse(); artifacts = Case.getCurrentCase().getSleuthkitCase().getBlackboardArtifactTypesInUse();
artifacts.removeAll(doNotReport); artifacts.removeAll(doNotReport);
artifactStates = new EnumMap<>(ARTIFACT_TYPE.class); artifactStates = new EnumMap<>(ARTIFACT_TYPE.class);
for (ARTIFACT_TYPE type : artifacts) { for (ARTIFACT_TYPE type : artifacts) {
artifactStates.put(type, Boolean.TRUE); artifactStates.put(type, Boolean.TRUE);
} }
} catch (TskCoreException ex) { } catch (TskCoreException ex) {
@ -134,41 +131,41 @@ import org.sleuthkit.datamodel.TskCoreException;
public String getName() { public String getName() {
return NbBundle.getMessage(this.getClass(), "ReportVisualPanel2.getName.text"); return NbBundle.getMessage(this.getClass(), "ReportVisualPanel2.getName.text");
} }
/** /**
* @return the enabled/disabled state of all Artifacts * @return the enabled/disabled state of all Artifacts
*/ */
Map<ARTIFACT_TYPE, Boolean> getArtifactStates() { Map<ARTIFACT_TYPE, Boolean> getArtifactStates() {
return artifactStates; return artifactStates;
} }
/** /**
* @return the enabled/disabled state of all Tags * @return the enabled/disabled state of all Tags
*/ */
Map<String, Boolean> getTagStates() { Map<String, Boolean> getTagStates() {
return tagStates; return tagStates;
} }
private boolean areTagsSelected() { private boolean areTagsSelected() {
boolean result = false; boolean result = false;
for (Entry<String, Boolean> entry: tagStates.entrySet()) { for (Entry<String, Boolean> entry : tagStates.entrySet()) {
if (entry.getValue()) { if (entry.getValue()) {
result = true; result = true;
} }
} }
return result; return result;
} }
private boolean areArtifactsSelected() { private boolean areArtifactsSelected() {
boolean result = false; boolean result = false;
for (Entry<ARTIFACT_TYPE, Boolean> entry: artifactStates.entrySet()) { for (Entry<ARTIFACT_TYPE, Boolean> entry : artifactStates.entrySet()) {
if (entry.getValue()) { if (entry.getValue()) {
result = true; result = true;
} }
} }
return result; return result;
} }
private void updateFinishButton() { private void updateFinishButton() {
if (taggedResultsRadioButton.isSelected()) { if (taggedResultsRadioButton.isSelected()) {
wizPanel.setFinish(areTagsSelected()); wizPanel.setFinish(areTagsSelected());
@ -176,14 +173,14 @@ import org.sleuthkit.datamodel.TskCoreException;
wizPanel.setFinish(areArtifactsSelected()); wizPanel.setFinish(areArtifactsSelected());
} }
} }
/** /**
* @return true if the Tags radio button is selected, false otherwise * @return true if the Tags radio button is selected, false otherwise
*/ */
boolean isTaggedResultsRadioButtonSelected() { boolean isTaggedResultsRadioButtonSelected() {
return taggedResultsRadioButton.isSelected(); return taggedResultsRadioButton.isSelected();
} }
/** /**
* This method is called from within the constructor to initialize the form. * This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always * WARNING: Do NOT modify this code. The content of this method is always
@ -199,7 +196,7 @@ import org.sleuthkit.datamodel.TskCoreException;
selectAllButton = new javax.swing.JButton(); selectAllButton = new javax.swing.JButton();
deselectAllButton = new javax.swing.JButton(); deselectAllButton = new javax.swing.JButton();
tagsScrollPane = new javax.swing.JScrollPane(); tagsScrollPane = new javax.swing.JScrollPane();
tagsList = new javax.swing.JList(); tagsList = new javax.swing.JList<>();
advancedButton = new javax.swing.JButton(); advancedButton = new javax.swing.JButton();
setPreferredSize(new java.awt.Dimension(650, 250)); setPreferredSize(new java.awt.Dimension(650, 250));
@ -316,7 +313,6 @@ import org.sleuthkit.datamodel.TskCoreException;
artifactStates = dialog.display(); artifactStates = dialog.display();
wizPanel.setFinish(areArtifactsSelected()); wizPanel.setFinish(areArtifactsSelected());
}//GEN-LAST:event_advancedButtonActionPerformed }//GEN-LAST:event_advancedButtonActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables // Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton advancedButton; private javax.swing.JButton advancedButton;
private javax.swing.JRadioButton allResultsRadioButton; private javax.swing.JRadioButton allResultsRadioButton;
@ -325,11 +321,11 @@ import org.sleuthkit.datamodel.TskCoreException;
private javax.swing.ButtonGroup optionsButtonGroup; private javax.swing.ButtonGroup optionsButtonGroup;
private javax.swing.JButton selectAllButton; private javax.swing.JButton selectAllButton;
private javax.swing.JRadioButton taggedResultsRadioButton; private javax.swing.JRadioButton taggedResultsRadioButton;
private javax.swing.JList tagsList; private javax.swing.JList<String> tagsList;
private javax.swing.JScrollPane tagsScrollPane; private javax.swing.JScrollPane tagsScrollPane;
// End of variables declaration//GEN-END:variables // End of variables declaration//GEN-END:variables
private class TagsListModel implements ListModel { private class TagsListModel implements ListModel<String> {
@Override @Override
public int getSize() { public int getSize() {
@ -337,7 +333,7 @@ import org.sleuthkit.datamodel.TskCoreException;
} }
@Override @Override
public Object getElementAt(int index) { public String getElementAt(int index) {
return tags.get(index); return tags.get(index);
} }
@ -349,12 +345,12 @@ import org.sleuthkit.datamodel.TskCoreException;
public void removeListDataListener(ListDataListener l) { public void removeListDataListener(ListDataListener l) {
} }
} }
// Render the Tags as JCheckboxes // Render the Tags as JCheckboxes
private class TagsListRenderer extends JCheckBox implements ListCellRenderer { private class TagsListRenderer extends JCheckBox implements ListCellRenderer<String> {
@Override @Override
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { public Component getListCellRendererComponent(JList<? extends String> list, String value, int index, boolean isSelected, boolean cellHasFocus) {
if (value != null) { if (value != null) {
setEnabled(list.isEnabled()); setEnabled(list.isEnabled());
setSelected(tagStates.get(value.toString())); setSelected(tagStates.get(value.toString()));
@ -365,6 +361,6 @@ import org.sleuthkit.datamodel.TskCoreException;
return this; return this;
} }
return new JLabel(); return new JLabel();
} }
} }
} }

View File

@ -64,11 +64,13 @@ public final class ReportWizardAction extends CallableSystemAction implements P
* When the wizard is finished, create a ReportGenerator with the wizard information, * When the wizard is finished, create a ReportGenerator with the wizard information,
* and start all necessary reports. * and start all necessary reports.
*/ */
@SuppressWarnings("unchecked")
public static void doReportWizard() { public static void doReportWizard() {
WizardDescriptor wiz = new WizardDescriptor(new ReportWizardIterator()); WizardDescriptor wiz = new WizardDescriptor(new ReportWizardIterator());
wiz.setTitleFormat(new MessageFormat("{0} {1}")); wiz.setTitleFormat(new MessageFormat("{0} {1}"));
wiz.setTitle(NbBundle.getMessage(ReportWizardAction.class, "ReportWizardAction.reportWiz.title")); wiz.setTitle(NbBundle.getMessage(ReportWizardAction.class, "ReportWizardAction.reportWiz.title"));
if (DialogDisplayer.getDefault().notify(wiz) == WizardDescriptor.FINISH_OPTION) { if (DialogDisplayer.getDefault().notify(wiz) == WizardDescriptor.FINISH_OPTION) {
@SuppressWarnings("unchecked")
ReportGenerator generator = new ReportGenerator((Map<TableReportModule, Boolean>)wiz.getProperty("tableModuleStates"), ReportGenerator generator = new ReportGenerator((Map<TableReportModule, Boolean>)wiz.getProperty("tableModuleStates"),
(Map<GeneralReportModule, Boolean>)wiz.getProperty("generalModuleStates"), (Map<GeneralReportModule, Boolean>)wiz.getProperty("generalModuleStates"),
(Map<FileReportModule, Boolean>)wiz.getProperty("fileModuleStates")); (Map<FileReportModule, Boolean>)wiz.getProperty("fileModuleStates"));

View File

@ -63,16 +63,14 @@
<SubComponents> <SubComponents>
<Component class="javax.swing.JList" name="optionsList"> <Component class="javax.swing.JList" name="optionsList">
<Properties> <Properties>
<Property name="model" type="javax.swing.ListModel" editor="org.netbeans.modules.form.editors2.ListModelEditor"> <Property name="model" type="javax.swing.ListModel" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
<StringArray count="5"> <Connection code="new javax.swing.AbstractListModel&lt;FileReportDataTypes&gt;() {&#xa; FileReportDataTypes[] types = { };&#xa; public int getSize() { return types.length; }&#xa; public FileReportDataTypes getElementAt(int i) { return types[i]; }&#xa;}" type="code"/>
<StringItem index="0" value="Item 1"/>
<StringItem index="1" value="Item 2"/>
<StringItem index="2" value="Item 3"/>
<StringItem index="3" value="Item 4"/>
<StringItem index="4" value="Item 5"/>
</StringArray>
</Property> </Property>
</Properties> </Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new javax.swing.JList&lt;&gt;()"/>
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="&lt;FileReportDataTypes&gt;"/>
</AuxValues>
</Component> </Component>
</SubComponents> </SubComponents>
</Container> </Container>

View File

@ -42,7 +42,7 @@ import javax.swing.event.ListDataListener;
class ReportWizardFileOptionsVisualPanel extends javax.swing.JPanel { class ReportWizardFileOptionsVisualPanel extends javax.swing.JPanel {
private List<FileReportDataTypes> options; private List<FileReportDataTypes> options;
private Map<FileReportDataTypes, Boolean> optionStates = new EnumMap<>(FileReportDataTypes.class); private Map<FileReportDataTypes, Boolean> optionStates = new EnumMap<>(FileReportDataTypes.class);
private ListModel model; private ListModel<FileReportDataTypes> model;
private ReportWizardFileOptionsPanel wizPanel; private ReportWizardFileOptionsPanel wizPanel;
@ -80,7 +80,7 @@ class ReportWizardFileOptionsVisualPanel extends javax.swing.JPanel {
public void mousePressed(MouseEvent evt) { public void mousePressed(MouseEvent evt) {
JList list = (JList) evt.getSource(); JList list = (JList) evt.getSource();
int index = list.locationToIndex(evt.getPoint()); int index = list.locationToIndex(evt.getPoint());
FileReportDataTypes value = (FileReportDataTypes) model.getElementAt(index); FileReportDataTypes value = model.getElementAt(index);
optionStates.put(value, !optionStates.get(value)); optionStates.put(value, !optionStates.get(value));
list.repaint(); list.repaint();
boolean anySelected = anySelected(); boolean anySelected = anySelected();
@ -134,15 +134,15 @@ class ReportWizardFileOptionsVisualPanel extends javax.swing.JPanel {
private void initComponents() { private void initComponents() {
jScrollPane1 = new javax.swing.JScrollPane(); jScrollPane1 = new javax.swing.JScrollPane();
optionsList = new javax.swing.JList(); optionsList = new javax.swing.JList<>();
selectAllButton = new javax.swing.JButton(); selectAllButton = new javax.swing.JButton();
deselectAllButton = new javax.swing.JButton(); deselectAllButton = new javax.swing.JButton();
jLabel1 = new javax.swing.JLabel(); jLabel1 = new javax.swing.JLabel();
optionsList.setModel(new javax.swing.AbstractListModel() { optionsList.setModel(new javax.swing.AbstractListModel<FileReportDataTypes>() {
String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" }; FileReportDataTypes[] types = { };
public int getSize() { return strings.length; } public int getSize() { return types.length; }
public Object getElementAt(int i) { return strings[i]; } public FileReportDataTypes getElementAt(int i) { return types[i]; }
}); });
jScrollPane1.setViewportView(optionsList); jScrollPane1.setViewportView(optionsList);
@ -219,11 +219,11 @@ class ReportWizardFileOptionsVisualPanel extends javax.swing.JPanel {
private javax.swing.JButton deselectAllButton; private javax.swing.JButton deselectAllButton;
private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel1;
private javax.swing.JScrollPane jScrollPane1; private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JList optionsList; private javax.swing.JList<FileReportDataTypes> optionsList;
private javax.swing.JButton selectAllButton; private javax.swing.JButton selectAllButton;
// End of variables declaration//GEN-END:variables // End of variables declaration//GEN-END:variables
private class OptionsListModel implements ListModel { private class OptionsListModel implements ListModel<FileReportDataTypes> {
@Override @Override
public int getSize() { public int getSize() {
@ -231,7 +231,7 @@ class ReportWizardFileOptionsVisualPanel extends javax.swing.JPanel {
} }
@Override @Override
public Object getElementAt(int index) { public FileReportDataTypes getElementAt(int index) {
return options.get(index); return options.get(index);
} }
@ -247,12 +247,12 @@ class ReportWizardFileOptionsVisualPanel extends javax.swing.JPanel {
/** /**
* Render each item in the list to be a selectable check box. * Render each item in the list to be a selectable check box.
*/ */
private class OptionsListRenderer extends JCheckBox implements ListCellRenderer { private class OptionsListRenderer extends JCheckBox implements ListCellRenderer<FileReportDataTypes> {
@Override @Override
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { public Component getListCellRendererComponent(JList<? extends FileReportDataTypes> list, FileReportDataTypes value, int index, boolean isSelected, boolean cellHasFocus) {
if (value != null) { if (value != null) {
FileReportDataTypes col = (FileReportDataTypes) value; FileReportDataTypes col = value;
setEnabled(list.isEnabled()); setEnabled(list.isEnabled());
setSelected(optionStates.get(col)); setSelected(optionStates.get(col));
setFont(list.getFont()); setFont(list.getFont());

View File

@ -49,6 +49,7 @@ import org.openide.util.NbPreferences;
private WizardDescriptor.Panel<WizardDescriptor>[] fileConfigPanels; private WizardDescriptor.Panel<WizardDescriptor>[] fileConfigPanels;
private String[] fileConfigIndex; private String[] fileConfigIndex;
@SuppressWarnings({"rawtypes", "unchecked"})
ReportWizardIterator() { ReportWizardIterator() {
firstPanel = new ReportWizardPanel1(); firstPanel = new ReportWizardPanel1();
tableConfigPanel = new ReportWizardPanel2(); tableConfigPanel = new ReportWizardPanel2();

View File

@ -1,6 +1,6 @@
Manifest-Version: 1.0 Manifest-Version: 1.0
AutoUpdate-Show-In-Client: true AutoUpdate-Show-In-Client: true
OpenIDE-Module: org.sleuthkit.autopsy.exifparser/3 OpenIDE-Module: org.sleuthkit.autopsy.exifparser/3
OpenIDE-Module-Implementation-Version: 9 OpenIDE-Module-Implementation-Version: 10
OpenIDE-Module-Layer: org/sleuthkit/autopsy/exifparser/layer.xml OpenIDE-Module-Layer: org/sleuthkit/autopsy/exifparser/layer.xml
OpenIDE-Module-Localizing-Bundle: org/sleuthkit/autopsy/exifparser/Bundle.properties OpenIDE-Module-Localizing-Bundle: org/sleuthkit/autopsy/exifparser/Bundle.properties

View File

@ -20,7 +20,7 @@
<compile-dependency/> <compile-dependency/>
<run-dependency> <run-dependency>
<release-version>9</release-version> <release-version>9</release-version>
<specification-version>7.0</specification-version> <specification-version>7.1</specification-version>
</run-dependency> </run-dependency>
</dependency> </dependency>
</module-dependencies> </module-dependencies>

View File

@ -120,7 +120,7 @@ class FileExtMismatchXML {
Element extEl = (Element)extNList.item(extIndex); Element extEl = (Element)extNList.item(extIndex);
extStrings.add(extEl.getTextContent()); extStrings.add(extEl.getTextContent());
} }
String[] sarray = (String[])extStrings.toArray(new String[0]); String[] sarray = extStrings.toArray(new String[0]);
sigTypeToExtMap.put(mimetype, sarray); sigTypeToExtMap.put(mimetype, sarray);
} else { } else {
sigTypeToExtMap.put(mimetype, null); //ok to have an empty type (the ingest module will not use it) sigTypeToExtMap.put(mimetype, null); //ok to have an empty type (the ingest module will not use it)

View File

@ -1,7 +1,7 @@
Manifest-Version: 1.0 Manifest-Version: 1.0
AutoUpdate-Show-In-Client: true AutoUpdate-Show-In-Client: true
OpenIDE-Module: org.sleuthkit.autopsy.hashdatabase/3 OpenIDE-Module: org.sleuthkit.autopsy.hashdatabase/3
OpenIDE-Module-Implementation-Version: 9 OpenIDE-Module-Implementation-Version: 10
OpenIDE-Module-Layer: org/sleuthkit/autopsy/hashdatabase/layer.xml OpenIDE-Module-Layer: org/sleuthkit/autopsy/hashdatabase/layer.xml
OpenIDE-Module-Localizing-Bundle: org/sleuthkit/autopsy/hashdatabase/Bundle.properties OpenIDE-Module-Localizing-Bundle: org/sleuthkit/autopsy/hashdatabase/Bundle.properties

View File

@ -78,7 +78,7 @@
<compile-dependency/> <compile-dependency/>
<run-dependency> <run-dependency>
<release-version>9</release-version> <release-version>9</release-version>
<specification-version>7.0</specification-version> <specification-version>7.1</specification-version>
</run-dependency> </run-dependency>
</dependency> </dependency>
<dependency> <dependency>

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2011 Basis Technology Corp. * Copyright 2011-2014 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -50,8 +50,7 @@ class HashDbPanelSearchAction extends CallableSystemAction {
if(evt.getPropertyName().equals(Case.Events.CURRENT_CASE.toString())){ if(evt.getPropertyName().equals(Case.Events.CURRENT_CASE.toString())){
setEnabled(evt.getNewValue() != null); setEnabled(evt.getNewValue() != null);
} }
} }
}); });
} }

View File

@ -1,7 +1,7 @@
Manifest-Version: 1.0 Manifest-Version: 1.0
AutoUpdate-Show-In-Client: true AutoUpdate-Show-In-Client: true
OpenIDE-Module: org.sleuthkit.autopsy.keywordsearch/5 OpenIDE-Module: org.sleuthkit.autopsy.keywordsearch/5
OpenIDE-Module-Implementation-Version: 9 OpenIDE-Module-Implementation-Version: 10
OpenIDE-Module-Install: org/sleuthkit/autopsy/keywordsearch/Installer.class OpenIDE-Module-Install: org/sleuthkit/autopsy/keywordsearch/Installer.class
OpenIDE-Module-Layer: org/sleuthkit/autopsy/keywordsearch/layer.xml OpenIDE-Module-Layer: org/sleuthkit/autopsy/keywordsearch/layer.xml
OpenIDE-Module-Localizing-Bundle: org/sleuthkit/autopsy/keywordsearch/Bundle.properties OpenIDE-Module-Localizing-Bundle: org/sleuthkit/autopsy/keywordsearch/Bundle.properties

View File

@ -96,7 +96,7 @@
<compile-dependency/> <compile-dependency/>
<run-dependency> <run-dependency>
<release-version>9</release-version> <release-version>9</release-version>
<specification-version>7.0</specification-version> <specification-version>7.1</specification-version>
</run-dependency> </run-dependency>
</dependency> </dependency>
</module-dependencies> </module-dependencies>

View File

@ -45,6 +45,7 @@ import org.sleuthkit.datamodel.ReadContentInputStream;
private static final int SINGLE_READ_CHARS = 1024; private static final int SINGLE_READ_CHARS = 1024;
private static final int EXTRA_CHARS = 128; //for whitespace private static final int EXTRA_CHARS = 128; //for whitespace
private static final char[] TEXT_CHUNK_BUF = new char[MAX_EXTR_TEXT_CHARS]; private static final char[] TEXT_CHUNK_BUF = new char[MAX_EXTR_TEXT_CHARS];
private static final int MAX_SIZE = 50000000;
private KeywordSearchIngestModule module; private KeywordSearchIngestModule module;
private Ingester ingester; private Ingester ingester;
private AbstractFile sourceFile; private AbstractFile sourceFile;
@ -217,7 +218,7 @@ import org.sleuthkit.datamodel.ReadContentInputStream;
public boolean isSupported(AbstractFile file, String detectedFormat) { public boolean isSupported(AbstractFile file, String detectedFormat) {
if (detectedFormat == null) { if (detectedFormat == null) {
return false; return false;
} else if (WEB_MIME_TYPES.contains(detectedFormat)) { } else if (WEB_MIME_TYPES.contains(detectedFormat) && file.getSize() <= MAX_SIZE) {
return true; return true;
} else { } else {
return false; return false;

View File

@ -279,6 +279,10 @@ class AbstractFileTikaTextExtract implements AbstractFileExtract {
else if (detectedFormat.contains("video/") else if (detectedFormat.contains("video/")
&& !detectedFormat.equals("video/x-flv")) { && !detectedFormat.equals("video/x-flv")) {
return false; return false;
} else if (detectedFormat.contains("application/x-font-ttf")) {
// Tika currently has a bug in the ttf parser in fontbox.
// It will throw an out of memory exception
return false;
} }

Some files were not shown because too many files have changed in this diff Show More