From 7e042b3abc54bd1d97ad29db1fff2c5f014fb5f2 Mon Sep 17 00:00:00 2001 From: jmillman Date: Mon, 20 Jul 2015 11:51:36 -0400 Subject: [PATCH 01/10] show md5 hash for file in metadata pane; other minor cleanup; --- .../datamodel/DrawableAttribute.java | 16 ++++++++++------ .../imagegallery/datamodel/DrawableFile.java | 17 +++++++++-------- .../autopsy/imagegallery/gui/Toolbar.java | 2 +- .../gui/drawableviews/MetaDataPane.java | 4 ++-- .../imagegallery/images/icon-hashtag.png | Bin 0 -> 1038 bytes 5 files changed, 22 insertions(+), 17 deletions(-) create mode 100644 ImageGallery/src/org/sleuthkit/autopsy/imagegallery/images/icon-hashtag.png diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableAttribute.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableAttribute.java index 495aabf70f..48f580266d 100644 --- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableAttribute.java +++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableAttribute.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2013 Basis Technology Corp. + * Copyright 2013-15 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -39,6 +39,9 @@ import org.sleuthkit.datamodel.TagName; */ public class DrawableAttribute> { + public final static DrawableAttribute MD5_HASH + = new DrawableAttribute<>(AttributeName.MD5_HASH, "MD5 Hash", false, "icon-hashtag.png", f -> Collections.singleton(f.getMd5Hash())); + public final static DrawableAttribute NAME = new DrawableAttribute<>(AttributeName.NAME, "Name", true, "folder-rename.png", f -> Collections.singleton(f.getName())); @@ -50,8 +53,8 @@ public class DrawableAttribute> { * in the DrawableDB. they have special code in various places to make this * transparent. * - * //TODO: this had lead to awkward hard to maintain code, and little - * advantage. move categories into DrawableDB + * //TODO: this has lead to awkward hard to maintain code, and little + * advantage. move categories into DrawableDB? */ public final static DrawableAttribute CATEGORY = new DrawableAttribute<>(AttributeName.CATEGORY, "Category", false, "category-icon.png", f -> Collections.singleton(f.getCategory())); @@ -91,7 +94,7 @@ public class DrawableAttribute> { final private static List> values = Arrays.asList(NAME, ANALYZED, CATEGORY, TAGS, PATH, CREATED_TIME, - MODIFIED_TIME, HASHSET, MAKE, MODEL, OBJ_ID, WIDTH, HEIGHT); + MODIFIED_TIME, MD5_HASH, HASHSET, MAKE, MODEL, OBJ_ID, WIDTH, HEIGHT); private final Function, Collection> extractor; @@ -123,7 +126,7 @@ public class DrawableAttribute> { } public static List> getGroupableAttrs() { - return groupables; + return Collections.unmodifiableList(groupables); } public static List> getValues() { @@ -152,7 +155,8 @@ public class DrawableAttribute> { HASHSET, OBJ_ID, WIDTH, - HEIGHT; + HEIGHT, + MD5_HASH; } public Collection getValue(DrawableFile f) { diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableFile.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableFile.java index 79ea49f879..1080e02a85 100644 --- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableFile.java +++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableFile.java @@ -23,12 +23,11 @@ import java.util.Collection; import java.util.Collections; import java.util.List; import java.util.Set; +import java.util.function.Function; import java.util.logging.Level; import java.util.stream.Collectors; import javafx.beans.property.SimpleBooleanProperty; import javafx.beans.property.SimpleObjectProperty; -import javafx.collections.FXCollections; -import javafx.collections.ObservableList; import javafx.scene.image.Image; import javafx.util.Pair; import org.apache.commons.lang3.StringUtils; @@ -144,12 +143,14 @@ public abstract class DrawableFile extends AbstractFile return new ArrayList<>(); } - public ObservableList, ? extends Object>> getAttributesList() { - final ObservableList, ? extends Object>> attributeList = FXCollections.observableArrayList(); - for (DrawableAttribute attr : DrawableAttribute.getValues()) { - attributeList.add(new Pair<>(attr, attr.getValue(this))); - } - return attributeList; + public List, ?>> getAttributesList() { + return DrawableAttribute.getValues().stream().map(new Function, Pair, ?>>() { + @Override + public Pair, ?> apply(DrawableAttribute t) { + return new Pair<>(t, t.getValue(DrawableFile.this)); + } + + }).collect(Collectors.toList()); } public String getModel() { diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/Toolbar.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/Toolbar.java index ea8cb26b00..4b4e4a60ea 100644 --- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/Toolbar.java +++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/Toolbar.java @@ -104,7 +104,7 @@ public class Toolbar extends ToolBar { ImageGalleryController.getDefault().getGroupManager().regroup(groupByBox.getSelectionModel().getSelectedItem(), sortByBox.getSelectionModel().getSelectedItem(), getSortOrder(), false); }; - private ImageGalleryController controller; + private final ImageGalleryController controller; synchronized public SortOrder getSortOrder() { return orderProperty.get(); diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/drawableviews/MetaDataPane.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/drawableviews/MetaDataPane.java index 9e544c031c..1cda85eb9c 100644 --- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/drawableviews/MetaDataPane.java +++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/drawableviews/MetaDataPane.java @@ -22,6 +22,7 @@ import com.google.common.eventbus.Subscribe; import java.io.IOException; import java.util.Arrays; import java.util.Collection; +import java.util.List; import java.util.Objects; import java.util.Optional; import java.util.logging.Logger; @@ -29,7 +30,6 @@ import java.util.stream.Collectors; import javafx.application.Platform; import javafx.beans.property.SimpleObjectProperty; import javafx.beans.property.SimpleStringProperty; -import javafx.collections.ObservableList; import javafx.fxml.FXML; import javafx.fxml.FXMLLoader; import javafx.scene.control.Label; @@ -167,7 +167,7 @@ public class MetaDataPane extends DrawableUIBase { public void updateUI() { getFile().ifPresent(file -> { final Image icon = file.getThumbnail(); - final ObservableList, ? extends Object>> attributesList = file.getAttributesList(); + final List, ?>> attributesList = file.getAttributesList(); Platform.runLater(() -> { imageView.setImage(icon); diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/images/icon-hashtag.png b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/images/icon-hashtag.png new file mode 100644 index 0000000000000000000000000000000000000000..4fd9799874a877a98781bee01a2db58b1e86f550 GIT binary patch literal 1038 zcmV+p1o8WcP)U8P*7-ZbZ>KLZ*U+lnSp_Ufq@}0xwybFAi#%#fq@|}KQEO56)-X|e7nZL z$iTqBa9P*U#mSX{G{Bl%P*lRez;J+pfx##xwK$o9f#C}S14DXwNkIt%17i#W1A|CX zc0maP17iUL1A|C*NRTrF17iyV0~1e4YDEbH0|SF|enDkXW_m`6f}y3QrGjHhep0GJ zaAk2xYHqQDXI^rCQ9*uDVo7QW0|Nup4h9AW240u^5(W3f%sd4n162kpgNVo|1qcff zJ_s=cNG>fZg9jx8g8+j9g8_pBLjXe}Lp{R+hNBE`7{wV~7)u#fFy3PlV+vxLz;uCG zm^qSpA@ds+OO_6nTdaDlt*rOhEZL^9ePa)2-_4=K(Z%tFGm-NGmm}8}ZcXk5JW@PU zd4+f<@d@)yL(o<5icqT158+-B6_LH7;i6x}CW#w~Uy-Pgl#@Irl`kzV zeL|*8R$ca%T%Wv){2zs_iiJvgN^h0dsuZZ2sQy$tsNSU!s;Q*;LF<6_B%M@UD?LHI zSNcZ`78uqV#TeU~$eS{ozBIdFzSClfs*^S+dw;4dus<{M;#|MXC)T}S9v!D zcV!QCPhBq)ZyO(X-(bH4|NMaZz==UigLj2o41F2S6d@OB6%`R(5i>J(Puzn9wnW{e zu;hl6HK{k#IWjCVGqdJqU(99Cv(K+6*i`tgSi2;vbXD1#3jNBGs$DgVwO(~o>mN4i zHPtkqZIx>)Y(Ls5-Br|mx>vQYvH$Kwn@O`L|D75??eGkZnfg$5<;Xeg_o%+-I&+-3%01W^SH2RkDT>t<8AY({UO#lFTB>(_`g8%^e z{{R4h=>PzAFaQARU;qF*m;eA5Z<1fdMgRZ+a7jc#RCwCF&%q7CKnz6D$5s$g1U*oG zA`waekrp5+!5mnkSc>+*f$_om_FO(N2)%DIfkg=29u@Ear&`El5RK^%LNmqK{9iun zEW}#P1dc*@?NZI0L^o9GX-aB|{-pV%=yPi^8*y9diaWdq04k7H0)_1tc>n+a07*qo IM6N<$g2MT>vH$=8 literal 0 HcmV?d00001 From 332d90222d65df10df85e71c9c6b06b0c0b5dd08 Mon Sep 17 00:00:00 2001 From: jmillman Date: Mon, 20 Jul 2015 12:06:14 -0400 Subject: [PATCH 02/10] minor cleanup --- .../autopsy/imagegallery/FXMLConstructor.java | 5 +- .../imagegallery/datamodel/DrawableFile.java | 60 +++---------------- .../autopsy/imagegallery/gui/GuiUtils.java | 15 +++++ .../autopsy/imagegallery/gui/Toolbar.java | 52 +++++----------- .../gui/drawableviews/MetaDataPane.java | 18 ++---- 5 files changed, 48 insertions(+), 102 deletions(-) diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/FXMLConstructor.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/FXMLConstructor.java index 7dc9a86757..3b0a1dd4c8 100644 --- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/FXMLConstructor.java +++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/FXMLConstructor.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2013 Basis Technology Corp. + * Copyright 2013-15 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -60,4 +60,7 @@ public class FXMLConstructor { } } + + private FXMLConstructor() { + } } diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableFile.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableFile.java index 1080e02a85..137611ffc7 100644 --- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableFile.java +++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableFile.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2013 Basis Technology Corp. + * Copyright 2013-15 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -23,7 +23,6 @@ import java.util.Collection; import java.util.Collections; import java.util.List; import java.util.Set; -import java.util.function.Function; import java.util.logging.Level; import java.util.stream.Collectors; import javafx.beans.property.SimpleBooleanProperty; @@ -90,7 +89,7 @@ public abstract class DrawableFile extends AbstractFile private String drawablePath; - protected T file; + private final T file; private final SimpleBooleanProperty analyzed; @@ -143,14 +142,14 @@ public abstract class DrawableFile extends AbstractFile return new ArrayList<>(); } - public List, ?>> getAttributesList() { - return DrawableAttribute.getValues().stream().map(new Function, Pair, ?>>() { - @Override - public Pair, ?> apply(DrawableAttribute t) { - return new Pair<>(t, t.getValue(DrawableFile.this)); - } + public List, Collection>> getAttributesList() { + return DrawableAttribute.getValues().stream() + .map(this::makeAttributeValuePair) + .collect(Collectors.toList()); + } - }).collect(Collectors.toList()); + private Pair, Collection> makeAttributeValuePair(DrawableAttribute t) { + return new Pair<>(t, t.getValue(DrawableFile.this)); } public String getModel() { @@ -181,47 +180,6 @@ public abstract class DrawableFile extends AbstractFile return Collections.emptySet(); } - @Deprecated - protected final List getValuesOfBBAttribute(BlackboardArtifact.ARTIFACT_TYPE artType, BlackboardAttribute.ATTRIBUTE_TYPE attrType) { - ArrayList vals = new ArrayList<>(); - try { - //why doesn't file.getArtifacts() work? - //TODO: this seams like overkill, use a more targeted query - ArrayList artifacts = getAllArtifacts(); - - for (BlackboardArtifact artf : artifacts) { - if (artf.getArtifactTypeID() == artType.getTypeID()) { - for (BlackboardAttribute attr : artf.getAttributes()) { - if (attr.getAttributeTypeID() == attrType.getTypeID()) { - - switch (attr.getValueType()) { - case BYTE: - vals.add(attr.getValueBytes()); - break; - case DOUBLE: - vals.add(attr.getValueDouble()); - break; - case INTEGER: - vals.add(attr.getValueInt()); - break; - case LONG: - vals.add(attr.getValueLong()); - break; - case STRING: - vals.add(attr.getValueString()); - break; - } - } - } - } - } - } catch (TskCoreException ex) { - Logger.getAnonymousLogger().log(Level.WARNING, "problem looking up {0}/{1}" + " " + " for {2}", new Object[]{artType.getDisplayName(), attrType.getDisplayName(), getName()}); - } - - return vals; - } - protected Object getValueOfBBAttribute(BlackboardArtifact.ARTIFACT_TYPE artType, BlackboardAttribute.ATTRIBUTE_TYPE attrType) { try { diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/GuiUtils.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/GuiUtils.java index 4a2a84fd46..27651147cc 100644 --- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/GuiUtils.java +++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/GuiUtils.java @@ -25,6 +25,8 @@ import javafx.scene.control.SplitMenuButton; import javafx.scene.image.ImageView; import org.sleuthkit.autopsy.imagegallery.ImageGalleryController; import org.sleuthkit.autopsy.imagegallery.actions.AddDrawableTagAction; +import org.sleuthkit.autopsy.imagegallery.actions.CategorizeAction; +import org.sleuthkit.autopsy.imagegallery.datamodel.Category; import org.sleuthkit.autopsy.imagegallery.datamodel.DrawableAttribute; import org.sleuthkit.datamodel.TagName; @@ -56,6 +58,19 @@ public class GuiUtils { return menuItem; } + public static MenuItem createSelCatMenuItem(Category cat, final SplitMenuButton catSelectedMenuButton, ImageGalleryController controller) { + final MenuItem menuItem = new MenuItem(cat.getDisplayName(), new ImageView(DrawableAttribute.CATEGORY.getIcon())); + menuItem.setOnAction(new EventHandler() { + @Override + public void handle(ActionEvent t) { + new CategorizeAction(controller).addTag(controller.getTagsManager().getTagName(cat), ""); + catSelectedMenuButton.setText(cat.getDisplayName()); + catSelectedMenuButton.setOnAction(this); + } + }); + return menuItem; + } + private GuiUtils() { } diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/Toolbar.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/Toolbar.java index 4b4e4a60ea..0af29e8d64 100644 --- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/Toolbar.java +++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/Toolbar.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2013 Basis Technology Corp. + * Copyright 2013-15 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -18,7 +18,11 @@ */ package org.sleuthkit.autopsy.imagegallery.gui; -import java.util.ArrayList; +import java.util.List; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.stream.Collectors; +import java.util.stream.Stream; import javafx.application.Platform; import javafx.beans.InvalidationListener; import javafx.beans.Observable; @@ -27,7 +31,6 @@ import javafx.beans.property.SimpleObjectProperty; import javafx.beans.value.ObservableValue; import javafx.collections.FXCollections; import javafx.event.ActionEvent; -import javafx.event.EventHandler; import javafx.fxml.FXML; import javafx.scene.control.CheckBox; import javafx.scene.control.ComboBox; @@ -40,16 +43,13 @@ import javafx.scene.control.ToolBar; import javafx.scene.image.ImageView; import javafx.scene.layout.HBox; import javax.swing.SortOrder; -import org.openide.util.Exceptions; import org.sleuthkit.autopsy.imagegallery.FXMLConstructor; import org.sleuthkit.autopsy.imagegallery.FileIDSelectionModel; import org.sleuthkit.autopsy.imagegallery.ImageGalleryController; import org.sleuthkit.autopsy.imagegallery.ThumbnailCache; -import org.sleuthkit.autopsy.imagegallery.actions.CategorizeAction; import org.sleuthkit.autopsy.imagegallery.datamodel.Category; import org.sleuthkit.autopsy.imagegallery.datamodel.DrawableAttribute; import org.sleuthkit.autopsy.imagegallery.datamodel.grouping.GroupSortBy; -import org.sleuthkit.datamodel.TagName; import org.sleuthkit.datamodel.TskCoreException; /** @@ -57,6 +57,8 @@ import org.sleuthkit.datamodel.TskCoreException; */ public class Toolbar extends ToolBar { + private static final Logger LOGGER = Logger.getLogger(Toolbar.class.getName()); + private static final int SIZE_SLIDER_DEFAULT = 100; @FXML @@ -80,8 +82,6 @@ public class Toolbar extends ToolBar { @FXML private ToggleGroup orderGroup; -// @FXML -// private ToggleButton metaDataToggle; @FXML private HBox sortControlGroup; @@ -110,9 +110,6 @@ public class Toolbar extends ToolBar { return orderProperty.get(); } -// public ReadOnlyBooleanProperty showMetaDataProperty() { -// return metaDataToggle.selectedProperty(); -// } public DoubleProperty sizeSliderValue() { return sizeSlider.valueProperty(); } @@ -153,32 +150,28 @@ public class Toolbar extends ToolBar { try { GuiUtils.createSelTagMenuItem(getController().getTagsManager().getFollowUpTagName(), tagSelectedMenuButton, getController()).getOnAction().handle(t); } catch (TskCoreException ex) { - Exceptions.printStackTrace(ex); + LOGGER.log(Level.SEVERE, "Could create follow up tag menu item", ex); } }); tagSelectedMenuButton.setGraphic(new ImageView(DrawableAttribute.TAGS.getIcon())); tagSelectedMenuButton.showingProperty().addListener((ObservableValue ov, Boolean t, Boolean t1) -> { if (t1) { - ArrayList selTagMenues = new ArrayList<>(); - for (final TagName tn : getController().getTagsManager().getNonCategoryTagNames()) { - MenuItem menuItem = GuiUtils.createSelTagMenuItem(tn, tagSelectedMenuButton, getController()); - selTagMenues.add(menuItem); - } + List selTagMenues = getController().getTagsManager().getNonCategoryTagNames().stream() + .map(tn -> GuiUtils.createSelTagMenuItem(tn, tagSelectedMenuButton, getController())) + .collect(Collectors.toList()); tagSelectedMenuButton.getItems().setAll(selTagMenues); } }); - catSelectedMenuButton.setOnAction(createSelCatMenuItem(Category.FIVE, catSelectedMenuButton, getController()).getOnAction()); + catSelectedMenuButton.setOnAction(GuiUtils.createSelCatMenuItem(Category.FIVE, catSelectedMenuButton, getController()).getOnAction()); catSelectedMenuButton.setText(Category.FIVE.getDisplayName()); catSelectedMenuButton.setGraphic(new ImageView(DrawableAttribute.CATEGORY.getIcon())); catSelectedMenuButton.showingProperty().addListener((ObservableValue ov, Boolean t, Boolean t1) -> { if (t1) { - ArrayList categoryMenues = new ArrayList<>(); - for (final Category cat : Category.values()) { - MenuItem menuItem = createSelCatMenuItem(cat, catSelectedMenuButton, getController()); - categoryMenues.add(menuItem); - } + List categoryMenues = Stream.of(Category.values()) + .map((cat) -> GuiUtils.createSelCatMenuItem(cat, catSelectedMenuButton, getController())) + .collect(Collectors.toList()); catSelectedMenuButton.getItems().setAll(categoryMenues); } }); @@ -226,19 +219,6 @@ public class Toolbar extends ToolBar { FXMLConstructor.construct(this, "Toolbar.fxml"); } - private static MenuItem createSelCatMenuItem(Category cat, final SplitMenuButton catSelectedMenuButton, ImageGalleryController controller) { - final MenuItem menuItem = new MenuItem(cat.getDisplayName(), new ImageView(DrawableAttribute.CATEGORY.getIcon())); - menuItem.setOnAction(new EventHandler() { - @Override - public void handle(ActionEvent t) { - new CategorizeAction(controller).addTag(controller.getTagsManager().getTagName(cat), ""); - catSelectedMenuButton.setText(cat.getDisplayName()); - catSelectedMenuButton.setOnAction(this); - } - }); - return menuItem; - } - private ImageGalleryController getController() { return controller; } diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/drawableviews/MetaDataPane.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/drawableviews/MetaDataPane.java index 1cda85eb9c..0776dc159a 100644 --- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/drawableviews/MetaDataPane.java +++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/drawableviews/MetaDataPane.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2013 Basis Technology Corp. + * Copyright 2013-15 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -19,7 +19,6 @@ package org.sleuthkit.autopsy.imagegallery.gui.drawableviews; import com.google.common.eventbus.Subscribe; -import java.io.IOException; import java.util.Arrays; import java.util.Collection; import java.util.List; @@ -31,7 +30,6 @@ import javafx.application.Platform; import javafx.beans.property.SimpleObjectProperty; import javafx.beans.property.SimpleStringProperty; import javafx.fxml.FXML; -import javafx.fxml.FXMLLoader; import javafx.scene.control.Label; import javafx.scene.control.TableCell; import javafx.scene.control.TableColumn; @@ -46,6 +44,7 @@ import org.apache.commons.lang3.StringUtils; import org.sleuthkit.autopsy.events.ContentTagAddedEvent; import org.sleuthkit.autopsy.events.ContentTagDeletedEvent; import org.sleuthkit.autopsy.events.TagEvent; +import org.sleuthkit.autopsy.imagegallery.FXMLConstructor; import org.sleuthkit.autopsy.imagegallery.ImageGalleryController; import org.sleuthkit.autopsy.imagegallery.datamodel.Category; import org.sleuthkit.autopsy.imagegallery.datamodel.CategoryManager; @@ -77,16 +76,7 @@ public class MetaDataPane extends DrawableUIBase { public MetaDataPane(ImageGalleryController controller) { super(controller); - - FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("MetaDataPane.fxml")); - fxmlLoader.setRoot(this); - fxmlLoader.setController(this); - - try { - fxmlLoader.load(); - } catch (IOException exception) { - throw new RuntimeException(exception); - } + FXMLConstructor.construct(this, "MetaDataPane.fxml"); } @FXML @@ -167,7 +157,7 @@ public class MetaDataPane extends DrawableUIBase { public void updateUI() { getFile().ifPresent(file -> { final Image icon = file.getThumbnail(); - final List, ?>> attributesList = file.getAttributesList(); + final List, Collection>> attributesList = file.getAttributesList(); Platform.runLater(() -> { imageView.setImage(icon); From 6d4ea60f5f61a1d9c6b691f3e4e4d71ce502f2e9 Mon Sep 17 00:00:00 2001 From: jmillman Date: Tue, 21 Jul 2015 12:18:17 -0400 Subject: [PATCH 03/10] double click images to toggle between slidehsow and tile mode --- .../imagegallery/gui/drawableviews/DrawableTileBase.java | 8 ++++++-- .../imagegallery/gui/drawableviews/GroupPane.java | 9 +++++---- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/drawableviews/DrawableTileBase.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/drawableviews/DrawableTileBase.java index 631e43aea6..cffa7e0edf 100644 --- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/drawableviews/DrawableTileBase.java +++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/drawableviews/DrawableTileBase.java @@ -71,6 +71,7 @@ import org.sleuthkit.autopsy.imagegallery.actions.DeleteFollowUpTagAction; import org.sleuthkit.autopsy.imagegallery.actions.SwingMenuItemAdapter; import org.sleuthkit.autopsy.imagegallery.datamodel.DrawableAttribute; import org.sleuthkit.autopsy.imagegallery.datamodel.DrawableFile; +import org.sleuthkit.autopsy.imagegallery.datamodel.grouping.GroupViewMode; import org.sleuthkit.datamodel.ContentTag; import org.sleuthkit.datamodel.TagName; import org.sleuthkit.datamodel.TskCoreException; @@ -154,13 +155,16 @@ public abstract class DrawableTileBase extends DrawableUIBase { case PRIMARY: if (t.getClickCount() == 1) { if (t.isControlDown()) { - globalSelectionModel.toggleSelection(fileID); } else { groupPane.makeSelection(t.isShiftDown(), fileID); } } else if (t.getClickCount() > 1) { - groupPane.activateSlideShowViewer(fileID); + if (groupPane.getGroupViewMode() == GroupViewMode.TILE) { + groupPane.activateSlideShowViewer(globalSelectionModel.lastSelectedProperty().get()); + } else { + groupPane.activateTileViewer(); + } } break; case SECONDARY: diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/drawableviews/GroupPane.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/drawableviews/GroupPane.java index c33793ce4d..e844f902ad 100644 --- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/drawableviews/GroupPane.java +++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/drawableviews/GroupPane.java @@ -198,9 +198,11 @@ public class GroupPane extends BorderPane { private Integer selectionAnchorIndex; - /** - * the current GroupViewMode of this GroupPane - */ + public GroupViewMode getGroupViewMode() { + return groupViewMode.get(); + } + + /** the current GroupViewMode of this GroupPane */ private final SimpleObjectProperty groupViewMode = new SimpleObjectProperty<>(GroupViewMode.TILE); /** @@ -505,7 +507,6 @@ public class GroupPane extends BorderPane { if (groupViewMode.get() == GroupViewMode.SLIDE_SHOW) { slideShowPane.setFile(newFileId); } else { - scrollToFileID(newFileId); } }); From 909c8ad7ea74f4f52b4dda29aecf14601787f923 Mon Sep 17 00:00:00 2001 From: jmillman Date: Tue, 21 Jul 2015 12:27:23 -0400 Subject: [PATCH 04/10] cleanup --- .../gui/drawableviews/DrawableTile.java | 4 +- .../gui/drawableviews/DrawableTileBase.java | 41 +++++++------------ .../gui/drawableviews/GroupPane.java | 2 +- 3 files changed, 17 insertions(+), 30 deletions(-) diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/drawableviews/DrawableTile.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/drawableviews/DrawableTile.java index 86eed0a814..72881906cc 100644 --- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/drawableviews/DrawableTile.java +++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/drawableviews/DrawableTile.java @@ -65,9 +65,8 @@ public class DrawableTile extends DrawableTileBase { @Override protected void initialize() { super.initialize(); - assert imageBorder != null : "fx:id=\"imageAnchor\" was not injected: check your FXML file 'DrawableTile.fxml'."; assert imageView != null : "fx:id=\"imageView\" was not injected: check your FXML file 'DrawableTile.fxml'."; - assert nameLabel != null : "fx:id=\"nameLabel\" was not injected: check your FXML file 'DrawableTile.fxml'."; + //set up properties and binding setCache(true); setCacheHint(CacheHint.SPEED); @@ -91,7 +90,6 @@ public class DrawableTile extends DrawableTileBase { FXMLConstructor.construct(this, "DrawableTile.fxml"); } - @Override @ThreadConfined(type = ThreadType.JFX) protected void clearContent() { diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/drawableviews/DrawableTileBase.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/drawableviews/DrawableTileBase.java index cffa7e0edf..7ed06e03b2 100644 --- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/drawableviews/DrawableTileBase.java +++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/drawableviews/DrawableTileBase.java @@ -78,7 +78,7 @@ import org.sleuthkit.datamodel.TskCoreException; /** * An abstract base class for {@link DrawableTile} and {@link SlideShowView}, - * since they share a similar node tree and many behaviors, other implementers + * since they share a similar node tree and many behaviors, other implementors * of {@link DrawableView}s should implement the interface directly * */ @@ -87,7 +87,6 @@ public abstract class DrawableTileBase extends DrawableUIBase { private static final Logger LOGGER = Logger.getLogger(DrawableTileBase.class.getName()); private static final Border UNSELECTED_BORDER = new Border(new BorderStroke(Color.GRAY, BorderStrokeStyle.SOLID, new CornerRadii(2), new BorderWidths(3))); - private static final Border SELECTED_BORDER = new Border(new BorderStroke(Color.BLUE, BorderStrokeStyle.SOLID, new CornerRadii(2), new BorderWidths(3))); //TODO: do this in CSS? -jm @@ -99,39 +98,29 @@ public abstract class DrawableTileBase extends DrawableUIBase { protected static final FileIDSelectionModel globalSelectionModel = FileIDSelectionModel.getInstance(); private static ContextMenu contextMenu; - /** - * displays the icon representing video files - */ + /** displays the icon representing video files */ @FXML - protected ImageView fileTypeImageView; + private ImageView fileTypeImageView; - /** - * displays the icon representing hash hits - */ + /** displays the icon representing hash hits */ @FXML - protected ImageView hashHitImageView; + private ImageView hashHitImageView; - /** - * displays the icon representing follow up tag - */ + /** displays the icon representing follow up tag */ @FXML - protected ImageView followUpImageView; + private ImageView followUpImageView; @FXML - protected ToggleButton followUpToggle; - - /** - * the label that shows the name of the represented file - */ - @FXML - protected Label nameLabel; + private ToggleButton followUpToggle; @FXML - protected BorderPane imageBorder; + BorderPane imageBorder; - /** - * the groupPane this {@link DrawableTileBase} is embedded in - */ + /** the label that shows the name of the represented file */ + @FXML + Label nameLabel; + + /** the groupPane this {@link DrawableTileBase} is embedded in */ final private GroupPane groupPane; volatile private boolean registered = false; @@ -161,7 +150,7 @@ public abstract class DrawableTileBase extends DrawableUIBase { } } else if (t.getClickCount() > 1) { if (groupPane.getGroupViewMode() == GroupViewMode.TILE) { - groupPane.activateSlideShowViewer(globalSelectionModel.lastSelectedProperty().get()); + groupPane.activateSlideShowViewer(fileID); } else { groupPane.activateTileViewer(); } diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/drawableviews/GroupPane.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/drawableviews/GroupPane.java index e844f902ad..6a09ec60d0 100644 --- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/drawableviews/GroupPane.java +++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/drawableviews/GroupPane.java @@ -198,7 +198,7 @@ public class GroupPane extends BorderPane { private Integer selectionAnchorIndex; - public GroupViewMode getGroupViewMode() { + GroupViewMode getGroupViewMode() { return groupViewMode.get(); } From 852a54fbf7d83d2190ff6829d9263f372afd3c0e Mon Sep 17 00:00:00 2001 From: jmillman Date: Tue, 28 Jul 2015 17:19:15 -0400 Subject: [PATCH 05/10] re-remove thumbnail support check from DataResultViewerThumbnail --- .../corecomponents/DataResultViewerThumbnail.java | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/corecomponents/DataResultViewerThumbnail.java b/Core/src/org/sleuthkit/autopsy/corecomponents/DataResultViewerThumbnail.java index c0398ffe27..f1e790f0f8 100644 --- a/Core/src/org/sleuthkit/autopsy/corecomponents/DataResultViewerThumbnail.java +++ b/Core/src/org/sleuthkit/autopsy/corecomponents/DataResultViewerThumbnail.java @@ -296,14 +296,7 @@ final class DataResultViewerThumbnail extends AbstractDataResultViewer { if (selectedNode == null) { return false; } - - Children ch = selectedNode.getChildren(); - for (Node n : ch.getNodes()) { - if (ThumbnailViewChildren.isSupported(n)) { - return true; - } - } - return false; + return true; } @Override From a04de48c02428205a30eb55dcc6c2b5a0e9648ef Mon Sep 17 00:00:00 2001 From: momo Date: Wed, 29 Jul 2015 12:22:49 -0400 Subject: [PATCH 06/10] fix nullpointer exception --- .../photoreccarver/PhotoRecCarverFileIngestModule.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/modules/photoreccarver/PhotoRecCarverFileIngestModule.java b/Core/src/org/sleuthkit/autopsy/modules/photoreccarver/PhotoRecCarverFileIngestModule.java index e0277e524a..0b0deedc7b 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/photoreccarver/PhotoRecCarverFileIngestModule.java +++ b/Core/src/org/sleuthkit/autopsy/modules/photoreccarver/PhotoRecCarverFileIngestModule.java @@ -147,13 +147,14 @@ final class PhotoRecCarverFileIngestModule implements FileIngestModule { */ @Override public IngestModule.ProcessResult process(AbstractFile file) { + + // Safely get a reference to the totalsForIngestJobs object + IngestJobTotals totals = getTotalsForIngestJobs(jobId); + // Skip everything except unallocated space files. if (file.getType() != TskData.TSK_DB_FILES_TYPE_ENUM.UNALLOC_BLOCKS) { return IngestModule.ProcessResult.OK; } - - // Safely get a reference to the totalsForIngestJobs object - IngestJobTotals totals = getTotalsForIngestJobs(jobId); Path tempFilePath = null; try { From 899369a0ed8632a28a3d18a092d0bc442fce0860 Mon Sep 17 00:00:00 2001 From: momo Date: Wed, 29 Jul 2015 13:15:27 -0400 Subject: [PATCH 07/10] initialized IngestJobs at startup for photorec, and making sure we are using the same monitor for IngestJobs in both photorec and hashdb --- .../hashdatabase/HashDbIngestModule.java | 15 +++++----- .../PhotoRecCarverFileIngestModule.java | 28 ++++++++++++------- 2 files changed, 26 insertions(+), 17 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbIngestModule.java b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbIngestModule.java index 061d0ff602..ec63414246 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbIngestModule.java +++ b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbIngestModule.java @@ -331,7 +331,8 @@ public class HashDbIngestModule implements FileIngestModule { } } - private synchronized void postSummary() { + private static synchronized void postSummary(long jobId, IngestServices services, + List knownBadHashSets, List knownHashSets) { IngestJobTotals jobTotals = totalsForIngestJobs.remove(jobId); if ((!knownBadHashSets.isEmpty()) || (!knownHashSets.isEmpty())) { @@ -340,20 +341,20 @@ public class HashDbIngestModule implements FileIngestModule { detailsSb.append(""); //NON-NLS detailsSb.append(""); //NON-NLS detailsSb.append(""); //NON-NLS detailsSb.append("\n"); //NON-NLS detailsSb.append("\n"); //NON-NLS detailsSb.append("
") //NON-NLS - .append(NbBundle.getMessage(this.getClass(), "HashDbIngestModule.complete.knownBadsFound")) + .append(NbBundle.getMessage(HashDbIngestModule.class, "HashDbIngestModule.complete.knownBadsFound")) .append("").append(jobTotals.totalKnownBadCount.get()).append("
") //NON-NLS - .append(NbBundle.getMessage(this.getClass(), "HashDbIngestModule.complete.totalCalcTime")) + .append(NbBundle.getMessage(HashDbIngestModule.class, "HashDbIngestModule.complete.totalCalcTime")) .append("").append(jobTotals.totalCalctime.get()).append("
") //NON-NLS - .append(NbBundle.getMessage(this.getClass(), "HashDbIngestModule.complete.totalLookupTime")) + .append(NbBundle.getMessage(HashDbIngestModule.class, "HashDbIngestModule.complete.totalLookupTime")) .append("").append(jobTotals.totalLookuptime.get()).append("
"); //NON-NLS detailsSb.append("

") //NON-NLS - .append(NbBundle.getMessage(this.getClass(), "HashDbIngestModule.complete.databasesUsed")) + .append(NbBundle.getMessage(HashDbIngestModule.class, "HashDbIngestModule.complete.databasesUsed")) .append("

\n
    "); //NON-NLS for (HashDb db : knownBadHashSets) { detailsSb.append("
  • ").append(db.getHashSetName()).append("
  • \n"); //NON-NLS @@ -364,7 +365,7 @@ public class HashDbIngestModule implements FileIngestModule { services.postMessage(IngestMessage.createMessage( IngestMessage.MessageType.INFO, HashLookupModuleFactory.getModuleName(), - NbBundle.getMessage(this.getClass(), + NbBundle.getMessage(HashDbIngestModule.class, "HashDbIngestModule.complete.hashLookupResults"), detailsSb.toString())); } @@ -373,7 +374,7 @@ public class HashDbIngestModule implements FileIngestModule { @Override public void shutDown() { if (refCounter.decrementAndGet(jobId) == 0) { - postSummary(); + postSummary(jobId, services, knownBadHashSets, knownHashSets); } } } diff --git a/Core/src/org/sleuthkit/autopsy/modules/photoreccarver/PhotoRecCarverFileIngestModule.java b/Core/src/org/sleuthkit/autopsy/modules/photoreccarver/PhotoRecCarverFileIngestModule.java index 0b0deedc7b..ab02d70825 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/photoreccarver/PhotoRecCarverFileIngestModule.java +++ b/Core/src/org/sleuthkit/autopsy/modules/photoreccarver/PhotoRecCarverFileIngestModule.java @@ -98,6 +98,12 @@ final class PhotoRecCarverFileIngestModule implements FileIngestModule { } return totals; } + + private static synchronized IngestJobTotals initTotalsForIngestJobs(long ingestJobId) { + IngestJobTotals totals = new PhotoRecCarverFileIngestModule.IngestJobTotals(); + totalsForIngestJobs.put(ingestJobId, totals); + return totals; + } /** * @inheritDoc @@ -136,6 +142,9 @@ final class PhotoRecCarverFileIngestModule implements FileIngestModule { // Save the directories for the current job. PhotoRecCarverFileIngestModule.pathsByJob.put(this.jobId, new WorkingPaths(outputDirPath, tempDirPath)); + + // Initialize job totals + initTotalsForIngestJobs(jobId); } catch (SecurityException | IOException | UnsupportedOperationException ex) { throw new IngestModule.IngestModuleException(NbBundle.getMessage(this.getClass(), "cannotCreateOutputDir.message", ex.getLocalizedMessage())); } @@ -147,14 +156,13 @@ final class PhotoRecCarverFileIngestModule implements FileIngestModule { */ @Override public IngestModule.ProcessResult process(AbstractFile file) { - - // Safely get a reference to the totalsForIngestJobs object - IngestJobTotals totals = getTotalsForIngestJobs(jobId); - // Skip everything except unallocated space files. if (file.getType() != TskData.TSK_DB_FILES_TYPE_ENUM.UNALLOC_BLOCKS) { return IngestModule.ProcessResult.OK; } + + // Safely get a reference to the totalsForIngestJobs object + IngestJobTotals totals = getTotalsForIngestJobs(jobId); Path tempFilePath = null; try { @@ -272,7 +280,7 @@ final class PhotoRecCarverFileIngestModule implements FileIngestModule { } } - private synchronized void postSummary() { + private static synchronized void postSummary(long jobId, IngestServices services) { IngestJobTotals jobTotals = totalsForIngestJobs.remove(jobId); StringBuilder detailsSb = new StringBuilder(); @@ -280,22 +288,22 @@ final class PhotoRecCarverFileIngestModule implements FileIngestModule { detailsSb.append(""); //NON-NLS detailsSb.append(""); //NON-NLS detailsSb.append(""); //NON-NLS detailsSb.append("\n"); //NON-NLS detailsSb.append("\n"); //NON-NLS detailsSb.append("
    ") //NON-NLS - .append(NbBundle.getMessage(this.getClass(), "PhotoRecIngestModule.complete.numberOfCarved")) + .append(NbBundle.getMessage(PhotoRecCarverFileIngestModule.class, "PhotoRecIngestModule.complete.numberOfCarved")) .append("").append(jobTotals.totalItemsRecovered.get()).append("
    ") //NON-NLS - .append(NbBundle.getMessage(this.getClass(), "PhotoRecIngestModule.complete.totalWritetime")) + .append(NbBundle.getMessage(PhotoRecCarverFileIngestModule.class, "PhotoRecIngestModule.complete.totalWritetime")) .append("").append(jobTotals.totalWritetime.get()).append("
    ") //NON-NLS - .append(NbBundle.getMessage(this.getClass(), "PhotoRecIngestModule.complete.totalParsetime")) + .append(NbBundle.getMessage(PhotoRecCarverFileIngestModule.class, "PhotoRecIngestModule.complete.totalParsetime")) .append("").append(jobTotals.totalParsetime.get()).append("
    "); //NON-NLS services.postMessage(IngestMessage.createMessage( IngestMessage.MessageType.INFO, PhotoRecCarverIngestModuleFactory.getModuleName(), - NbBundle.getMessage(this.getClass(), + NbBundle.getMessage(PhotoRecCarverFileIngestModule.class, "PhotoRecIngestModule.complete.photoRecResults"), detailsSb.toString())); @@ -312,7 +320,7 @@ final class PhotoRecCarverFileIngestModule implements FileIngestModule { // the working paths map entry for the job and deletes the temp dir. WorkingPaths paths = PhotoRecCarverFileIngestModule.pathsByJob.remove(this.jobId); FileUtil.deleteDir(new File(paths.getTempDirPath().toString())); - postSummary(); + postSummary(jobId, services); } catch (SecurityException ex) { logger.log(Level.SEVERE, "Error shutting down PhotoRec carver module", ex); // NON-NLS From abc79c1c6c6103430e9265aa8d14308e2ef3e893 Mon Sep 17 00:00:00 2001 From: sidheshenator Date: Wed, 29 Jul 2015 15:48:07 -0400 Subject: [PATCH 08/10] jython native library exception documented --- docs/doxygen/modDevPython.dox | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/doxygen/modDevPython.dox b/docs/doxygen/modDevPython.dox index c8d7b36d63..6026a4b6ed 100755 --- a/docs/doxygen/modDevPython.dox +++ b/docs/doxygen/modDevPython.dox @@ -60,7 +60,8 @@ Jython will look in the module's folder to resolve these libraries. \subsection mod_dev_py_misc Minor Gotchas This section lists some helpful tips that we have found. These are all now in the sample modules, so refer to those for examples and a place to copy and paste from. - We haven't found a good way to debug while running inside of Autopsy. So, logging becomes critical. You need to go through a bunch of steps to get the logger to display your module name. See the sample module for a log() method that does all of this for you. -- When you name the file with your Python module in it, restrict its name to letters, numbers, and underscore (_). +- When you name the file with your Python module in it, restrict its name to letters, numbers, and underscore (_). +- Python modules using external libraries which load native code (SciPy, NumPy, etc.) are currently NOT supported. RuntimeError will be thrown. \section mod_dev_py_distribute Distribution To distribute and share your Python module, ZIP up the folder and send it around. Other users of the module should expand the ZIP file and drop the folder into their Autopsy Python folder. From 38a460d269125358c43430df5eb92f408c2c1657 Mon Sep 17 00:00:00 2001 From: momo Date: Wed, 29 Jul 2015 15:49:30 -0400 Subject: [PATCH 09/10] cleanup code --- .../modules/hashdatabase/HashDbIngestModule.java | 6 +++--- .../PhotoRecCarverFileIngestModule.java | 11 +++++------ 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbIngestModule.java b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbIngestModule.java index ec63414246..8bdb597c25 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbIngestModule.java +++ b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbIngestModule.java @@ -331,7 +331,7 @@ public class HashDbIngestModule implements FileIngestModule { } } - private static synchronized void postSummary(long jobId, IngestServices services, + private static synchronized void postSummary(long jobId, List knownBadHashSets, List knownHashSets) { IngestJobTotals jobTotals = totalsForIngestJobs.remove(jobId); @@ -362,7 +362,7 @@ public class HashDbIngestModule implements FileIngestModule { detailsSb.append("
"); //NON-NLS - services.postMessage(IngestMessage.createMessage( + IngestServices.getInstance().postMessage(IngestMessage.createMessage( IngestMessage.MessageType.INFO, HashLookupModuleFactory.getModuleName(), NbBundle.getMessage(HashDbIngestModule.class, @@ -374,7 +374,7 @@ public class HashDbIngestModule implements FileIngestModule { @Override public void shutDown() { if (refCounter.decrementAndGet(jobId) == 0) { - postSummary(jobId, services, knownBadHashSets, knownHashSets); + postSummary(jobId, knownBadHashSets, knownHashSets); } } } diff --git a/Core/src/org/sleuthkit/autopsy/modules/photoreccarver/PhotoRecCarverFileIngestModule.java b/Core/src/org/sleuthkit/autopsy/modules/photoreccarver/PhotoRecCarverFileIngestModule.java index ab02d70825..31d3d62b62 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/photoreccarver/PhotoRecCarverFileIngestModule.java +++ b/Core/src/org/sleuthkit/autopsy/modules/photoreccarver/PhotoRecCarverFileIngestModule.java @@ -99,10 +99,9 @@ final class PhotoRecCarverFileIngestModule implements FileIngestModule { return totals; } - private static synchronized IngestJobTotals initTotalsForIngestJobs(long ingestJobId) { + private static synchronized void initTotalIngestJob(long ingestJobId) { IngestJobTotals totals = new PhotoRecCarverFileIngestModule.IngestJobTotals(); totalsForIngestJobs.put(ingestJobId, totals); - return totals; } /** @@ -144,7 +143,7 @@ final class PhotoRecCarverFileIngestModule implements FileIngestModule { PhotoRecCarverFileIngestModule.pathsByJob.put(this.jobId, new WorkingPaths(outputDirPath, tempDirPath)); // Initialize job totals - initTotalsForIngestJobs(jobId); + initTotalIngestJob(jobId); } catch (SecurityException | IOException | UnsupportedOperationException ex) { throw new IngestModule.IngestModuleException(NbBundle.getMessage(this.getClass(), "cannotCreateOutputDir.message", ex.getLocalizedMessage())); } @@ -280,7 +279,7 @@ final class PhotoRecCarverFileIngestModule implements FileIngestModule { } } - private static synchronized void postSummary(long jobId, IngestServices services) { + private static synchronized void postSummary(long jobId) { IngestJobTotals jobTotals = totalsForIngestJobs.remove(jobId); StringBuilder detailsSb = new StringBuilder(); @@ -300,7 +299,7 @@ final class PhotoRecCarverFileIngestModule implements FileIngestModule { .append("").append(jobTotals.totalParsetime.get()).append("\n"); //NON-NLS detailsSb.append(""); //NON-NLS - services.postMessage(IngestMessage.createMessage( + IngestServices.getInstance().postMessage(IngestMessage.createMessage( IngestMessage.MessageType.INFO, PhotoRecCarverIngestModuleFactory.getModuleName(), NbBundle.getMessage(PhotoRecCarverFileIngestModule.class, @@ -320,7 +319,7 @@ final class PhotoRecCarverFileIngestModule implements FileIngestModule { // the working paths map entry for the job and deletes the temp dir. WorkingPaths paths = PhotoRecCarverFileIngestModule.pathsByJob.remove(this.jobId); FileUtil.deleteDir(new File(paths.getTempDirPath().toString())); - postSummary(jobId, services); + postSummary(jobId); } catch (SecurityException ex) { logger.log(Level.SEVERE, "Error shutting down PhotoRec carver module", ex); // NON-NLS From db40bf6104bd93f169a075a87f3cc0b75989537d Mon Sep 17 00:00:00 2001 From: momo Date: Wed, 29 Jul 2015 15:53:46 -0400 Subject: [PATCH 10/10] change init name --- .../photoreccarver/PhotoRecCarverFileIngestModule.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/modules/photoreccarver/PhotoRecCarverFileIngestModule.java b/Core/src/org/sleuthkit/autopsy/modules/photoreccarver/PhotoRecCarverFileIngestModule.java index 31d3d62b62..1ab4204caf 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/photoreccarver/PhotoRecCarverFileIngestModule.java +++ b/Core/src/org/sleuthkit/autopsy/modules/photoreccarver/PhotoRecCarverFileIngestModule.java @@ -99,7 +99,7 @@ final class PhotoRecCarverFileIngestModule implements FileIngestModule { return totals; } - private static synchronized void initTotalIngestJob(long ingestJobId) { + private static synchronized void initTotalsForIngestJob(long ingestJobId) { IngestJobTotals totals = new PhotoRecCarverFileIngestModule.IngestJobTotals(); totalsForIngestJobs.put(ingestJobId, totals); } @@ -143,7 +143,7 @@ final class PhotoRecCarverFileIngestModule implements FileIngestModule { PhotoRecCarverFileIngestModule.pathsByJob.put(this.jobId, new WorkingPaths(outputDirPath, tempDirPath)); // Initialize job totals - initTotalIngestJob(jobId); + initTotalsForIngestJob(jobId); } catch (SecurityException | IOException | UnsupportedOperationException ex) { throw new IngestModule.IngestModuleException(NbBundle.getMessage(this.getClass(), "cannotCreateOutputDir.message", ex.getLocalizedMessage())); }