diff --git a/BUILDING.txt b/BUILDING.txt
index 0e0172c4d8..7361735adf 100644
--- a/BUILDING.txt
+++ b/BUILDING.txt
@@ -11,7 +11,7 @@ correct C libraries.
STEPS:
1) Get Java Setup
-1a) Download and install JDK version 1.8. You can now use 32-bit or 64-bit, but special work is needed to get The Sleuth Kit to compile as 64-bit. So, 32-bit is easier.
+1a) Download and install JDK version 1.8. For the current version of JavaFX that we use, you'll need 1.8.0_40 or greater. You can now use 32-bit or 64-bit, but special work is needed to get The Sleuth Kit to compile as 64-bit. So, 32-bit is easier.
Autopsy has been used and tested with Oracle JavaSE and the included JavaFX support
(http://www.oracle.com/technetwork/java/javase/downloads/index.html).
diff --git a/Core/manifest.mf b/Core/manifest.mf
index 63742e1281..1b19165b34 100644
--- a/Core/manifest.mf
+++ b/Core/manifest.mf
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
OpenIDE-Module: org.sleuthkit.autopsy.core/10
OpenIDE-Module-Localizing-Bundle: org/sleuthkit/autopsy/core/Bundle.properties
OpenIDE-Module-Layer: org/sleuthkit/autopsy/core/layer.xml
-OpenIDE-Module-Implementation-Version: 13
+OpenIDE-Module-Implementation-Version: 14
OpenIDE-Module-Requires: org.openide.windows.WindowManager
AutoUpdate-Show-In-Client: true
AutoUpdate-Essential-Module: true
diff --git a/Core/nbproject/project.properties b/Core/nbproject/project.properties
index 2d5925dbdf..3ec5353c90 100644
--- a/Core/nbproject/project.properties
+++ b/Core/nbproject/project.properties
@@ -17,5 +17,5 @@ license.file=../LICENSE-2.0.txt
nbm.homepage=http://www.sleuthkit.org/
nbm.module.author=Brian Carrier
nbm.needs.restart=true
-spec.version.base=10.2
+spec.version.base=10.3
diff --git a/Core/nbproject/project.xml b/Core/nbproject/project.xml
index ac5f32a1ac..463e1c1903 100644
--- a/Core/nbproject/project.xml
+++ b/Core/nbproject/project.xml
@@ -192,6 +192,7 @@
org.sleuthkit.autopsy.coreutilsorg.sleuthkit.autopsy.datamodelorg.sleuthkit.autopsy.directorytree
+ org.sleuthkit.autopsy.eventsorg.sleuthkit.autopsy.externalresultsorg.sleuthkit.autopsy.filesearchorg.sleuthkit.autopsy.ingest
diff --git a/Core/src/org/sleuthkit/autopsy/actions/AddTagAction.java b/Core/src/org/sleuthkit/autopsy/actions/AddTagAction.java
index b051fa2238..7f4f813495 100755
--- a/Core/src/org/sleuthkit/autopsy/actions/AddTagAction.java
+++ b/Core/src/org/sleuthkit/autopsy/actions/AddTagAction.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,61 +19,69 @@
package org.sleuthkit.autopsy.actions;
import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
import java.util.Collections;
import java.util.List;
import java.util.logging.Level;
+import javax.swing.AbstractAction;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
-
import org.openide.util.NbBundle;
import org.openide.util.actions.Presenter;
import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.casemodule.services.TagsManager;
+import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.datamodel.TagName;
import org.sleuthkit.datamodel.TskCoreException;
-import org.sleuthkit.autopsy.coreutils.Logger;
/**
- * An abstract base class for Actions that allow users to tag SleuthKit data
- * model objects.
+ * An abstract base class for Actions that allow users to tag SleuthKit data
+ * model objects.
*/
-abstract class AddTagAction extends TagAction implements Presenter.Popup {
+abstract class AddTagAction extends AbstractAction implements Presenter.Popup {
+
private static final String NO_COMMENT = "";
-
+
AddTagAction(String menuText) {
super(menuText);
}
-
+
@Override
- public JMenuItem getPopupPresenter() {
+ public JMenuItem getPopupPresenter() {
return new TagMenu();
}
-
- @Override
- protected void doAction(ActionEvent event) {
- }
-
+
/**
- * Template method to allow derived classes to provide a string for for a
- * menu item label.
+ * Subclasses of AddTagAction, should not override actionPerformed, but
+ * instead override addTag.
+ *
+ * @param event
+ */
+ @Override
+ @SuppressWarnings("NoopMethodInAbstractClass")
+ public void actionPerformed(ActionEvent event) {
+ }
+
+ /**
+ * Template method to allow derived classes to provide a string for a menu
+ * item label.
*/
abstract protected String getActionDisplayName();
-
+
/**
- * Template method to allow derived classes to add the indicated tag and
- * comment to one or more a SleuthKit data model objects.
+ * Template method to allow derived classes to add the indicated tag and
+ * comment to one or more SleuthKit data model objects.
*/
abstract protected void addTag(TagName tagName, String comment);
/**
- * Instances of this class implement a context menu user interface for
- * creating or selecting a tag name for a tag and specifying an optional tag
- * comment.
+ * Instances of this class implement a context menu user interface for
+ * creating or selecting a tag name for a tag and specifying an optional tag
+ * comment.
*/
// @@@ This user interface has some significant usability issues and needs
// to be reworked.
private class TagMenu extends JMenu {
+
TagMenu() {
super(getActionDisplayName());
@@ -83,35 +91,29 @@ abstract class AddTagAction extends TagAction implements Presenter.Popup {
try {
tagNames = tagsManager.getAllTagNames();
Collections.sort(tagNames);
- }
- catch (TskCoreException ex) {
+ } catch (TskCoreException ex) {
Logger.getLogger(TagsManager.class.getName()).log(Level.SEVERE, "Failed to get tag names", ex); //NON-NLS
}
-
+
// Create a "Quick Tag" sub-menu.
JMenu quickTagMenu = new JMenu(NbBundle.getMessage(this.getClass(), "AddTagAction.quickTag"));
- add(quickTagMenu);
-
+ add(quickTagMenu);
+
// Each tag name in the current set of tags gets its own menu item in
// the "Quick Tags" sub-menu. Selecting one of these menu items adds
// a tag with the associated tag name.
if (null != tagNames && !tagNames.isEmpty()) {
for (final TagName tagName : tagNames) {
JMenuItem tagNameItem = new JMenuItem(tagName.getDisplayName());
- tagNameItem.addActionListener(new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- addTag(tagName, NO_COMMENT);
- refreshDirectoryTree();
- }
+ tagNameItem.addActionListener((ActionEvent e) -> {
+ addTag(tagName, NO_COMMENT);
});
quickTagMenu.add(tagNameItem);
}
- }
- else {
+ } else {
JMenuItem empty = new JMenuItem(NbBundle.getMessage(this.getClass(), "AddTagAction.noTags"));
empty.setEnabled(false);
- quickTagMenu.add(empty);
+ quickTagMenu.add(empty);
}
quickTagMenu.addSeparator();
@@ -120,14 +122,10 @@ abstract class AddTagAction extends TagAction implements Presenter.Popup {
// Selecting this item initiates a dialog that can be used to create
// or select a tag name and adds a tag with the resulting name.
JMenuItem newTagMenuItem = new JMenuItem(NbBundle.getMessage(this.getClass(), "AddTagAction.newTag"));
- newTagMenuItem.addActionListener(new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- TagName tagName = GetTagNameDialog.doDialog();
- if (tagName != null) {
- addTag(tagName, NO_COMMENT);
- refreshDirectoryTree();
- }
+ newTagMenuItem.addActionListener((ActionEvent e) -> {
+ TagName tagName = GetTagNameDialog.doDialog();
+ if (null != tagName) {
+ addTag(tagName, NO_COMMENT);
}
});
quickTagMenu.add(newTagMenuItem);
@@ -137,17 +135,13 @@ abstract class AddTagAction extends TagAction implements Presenter.Popup {
// optional comment and adds a tag with the resulting name.
JMenuItem tagAndCommentItem = new JMenuItem(
NbBundle.getMessage(this.getClass(), "AddTagAction.tagAndComment"));
- tagAndCommentItem.addActionListener(new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- GetTagNameAndCommentDialog.TagNameAndComment tagNameAndComment = GetTagNameAndCommentDialog.doDialog();
- if (null != tagNameAndComment) {
- addTag(tagNameAndComment.getTagName(), tagNameAndComment.getComment());
- refreshDirectoryTree();
- }
+ tagAndCommentItem.addActionListener((ActionEvent e) -> {
+ GetTagNameAndCommentDialog.TagNameAndComment tagNameAndComment = GetTagNameAndCommentDialog.doDialog();
+ if (null != tagNameAndComment) {
+ addTag(tagNameAndComment.getTagName(), tagNameAndComment.getComment());
}
});
- add(tagAndCommentItem);
+ add(tagAndCommentItem);
}
- }
-}
\ No newline at end of file
+ }
+}
diff --git a/Core/src/org/sleuthkit/autopsy/actions/DeleteBlackboardArtifactTagAction.java b/Core/src/org/sleuthkit/autopsy/actions/DeleteBlackboardArtifactTagAction.java
index 5c7369c603..ac9e29fe59 100755
--- a/Core/src/org/sleuthkit/autopsy/actions/DeleteBlackboardArtifactTagAction.java
+++ b/Core/src/org/sleuthkit/autopsy/actions/DeleteBlackboardArtifactTagAction.java
@@ -21,19 +21,19 @@ package org.sleuthkit.autopsy.actions;
import java.awt.event.ActionEvent;
import java.util.Collection;
import java.util.logging.Level;
-import org.sleuthkit.autopsy.coreutils.Logger;
+import javax.swing.AbstractAction;
import javax.swing.JOptionPane;
-
import org.openide.util.NbBundle;
import org.openide.util.Utilities;
import org.sleuthkit.autopsy.casemodule.Case;
+import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.datamodel.BlackboardArtifactTag;
import org.sleuthkit.datamodel.TskCoreException;
/**
* Instances of this Action allow users to delete tags applied to blackboard artifacts.
*/
-public class DeleteBlackboardArtifactTagAction extends TagAction {
+public class DeleteBlackboardArtifactTagAction extends AbstractAction {
private static final String MENU_TEXT = NbBundle.getMessage(DeleteBlackboardArtifactTagAction.class,
"DeleteBlackboardArtifactTagAction.deleteTags");
@@ -54,7 +54,7 @@ public class DeleteBlackboardArtifactTagAction extends TagAction {
}
@Override
- protected void doAction(ActionEvent event) {
+ public void actionPerformed(ActionEvent event) {
Collection extends BlackboardArtifactTag> selectedTags = Utilities.actionsGlobalContext().lookupAll(BlackboardArtifactTag.class);
for (BlackboardArtifactTag tag : selectedTags) {
try {
diff --git a/Core/src/org/sleuthkit/autopsy/actions/DeleteContentTagAction.java b/Core/src/org/sleuthkit/autopsy/actions/DeleteContentTagAction.java
index d69e60bb31..c716311eea 100755
--- a/Core/src/org/sleuthkit/autopsy/actions/DeleteContentTagAction.java
+++ b/Core/src/org/sleuthkit/autopsy/actions/DeleteContentTagAction.java
@@ -21,19 +21,19 @@ package org.sleuthkit.autopsy.actions;
import java.awt.event.ActionEvent;
import java.util.Collection;
import java.util.logging.Level;
-import org.sleuthkit.autopsy.coreutils.Logger;
+import javax.swing.AbstractAction;
import javax.swing.JOptionPane;
-
import org.openide.util.NbBundle;
import org.openide.util.Utilities;
import org.sleuthkit.autopsy.casemodule.Case;
+import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.datamodel.ContentTag;
import org.sleuthkit.datamodel.TskCoreException;
/**
* Instances of this Action allow users to delete tags applied to content.
*/
-public class DeleteContentTagAction extends TagAction {
+public class DeleteContentTagAction extends AbstractAction {
private static final String MENU_TEXT = NbBundle.getMessage(DeleteContentTagAction.class,
"DeleteContentTagAction.deleteTags");
@@ -54,7 +54,7 @@ public class DeleteContentTagAction extends TagAction {
}
@Override
- protected void doAction(ActionEvent e) {
+ public void actionPerformed(ActionEvent e) {
Collection extends ContentTag> selectedTags = Utilities.actionsGlobalContext().lookupAll(ContentTag.class);
for (ContentTag tag : selectedTags) {
try {
diff --git a/Core/src/org/sleuthkit/autopsy/actions/TagAction.java b/Core/src/org/sleuthkit/autopsy/actions/TagAction.java
deleted file mode 100755
index a540ce878a..0000000000
--- a/Core/src/org/sleuthkit/autopsy/actions/TagAction.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Autopsy Forensic Browser
- *
- * Copyright 2013 Basis Technology Corp.
- * Contact: carrier sleuthkit 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.actions;
-
-import java.awt.event.ActionEvent;
-import javax.swing.AbstractAction;
-import org.sleuthkit.autopsy.ingest.IngestServices;
-import org.sleuthkit.autopsy.ingest.ModuleDataEvent;
-import org.sleuthkit.datamodel.BlackboardArtifact;
-
-/**
- * Abstract base class for Actions involving tags.
- */
- abstract class TagAction extends AbstractAction {
- public TagAction(String menuText) {
- super(menuText);
- }
-
- @Override
- public void actionPerformed(ActionEvent event) {
- doAction(event);
- refreshDirectoryTree();
- }
-
- /**
- * Derived classes must implement this Template Method for actionPerformed().
- * @param event ActionEvent object passed to actionPerformed()
- */
- abstract protected void doAction(ActionEvent event);
-
- /**
- * Derived classes should call this method any time a tag is created, updated
- * or deleted outside of an actionPerformed() call.
- */
- @SuppressWarnings("deprecation")
- protected void refreshDirectoryTree() {
-
- /* Note: this is a hack. In an ideal world, TagsManager would fire events so
- * that the directory tree would refresh. But, we haven't had a chance to add
- * that so, we fire these events and the tree refreshes based on them.
- */
- IngestServices.getInstance().fireModuleDataEvent(new ModuleDataEvent("TagAction", BlackboardArtifact.ARTIFACT_TYPE.TSK_TAG_FILE)); //NON-NLS
- }
-}
diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/Case.java b/Core/src/org/sleuthkit/autopsy/casemodule/Case.java
index bef2f61ca9..a9f97e4a7b 100644
--- a/Core/src/org/sleuthkit/autopsy/casemodule/Case.java
+++ b/Core/src/org/sleuthkit/autopsy/casemodule/Case.java
@@ -19,6 +19,7 @@
package org.sleuthkit.autopsy.casemodule;
import java.awt.Frame;
+import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.BufferedInputStream;
@@ -53,8 +54,19 @@ import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil;
import org.sleuthkit.autopsy.coreutils.PlatformUtil;
import org.sleuthkit.autopsy.coreutils.Version;
-import org.sleuthkit.datamodel.*;
+import org.sleuthkit.autopsy.events.BlackBoardArtifactTagAddedEvent;
+import org.sleuthkit.autopsy.events.BlackBoardArtifactTagDeletedEvent;
+import org.sleuthkit.autopsy.events.ContentTagAddedEvent;
+import org.sleuthkit.autopsy.events.ContentTagDeletedEvent;
+import org.sleuthkit.datamodel.BlackboardArtifactTag;
+import org.sleuthkit.datamodel.Content;
+import org.sleuthkit.datamodel.ContentTag;
+import org.sleuthkit.datamodel.Image;
+import org.sleuthkit.datamodel.Report;
+import org.sleuthkit.datamodel.SleuthkitCase;
import org.sleuthkit.datamodel.SleuthkitJNI.CaseDbHandle.AddImageProcess;
+import org.sleuthkit.datamodel.TskCoreException;
+import org.sleuthkit.datamodel.TskException;
/**
* Stores all information for a given case. Only a single case can currently be
@@ -132,11 +144,31 @@ public class Case implements SleuthkitCase.ErrorObserver {
*/
REPORT_ADDED,
/**
- * Name for the property change event when a report/s is/are deleted
+ * Name for the property change event when a report is deleted
* from the case. Both the old value and the new value supplied by the
* event object are null.
*/
- REPORT_DELETED;
+ REPORT_DELETED,
+ /**
+ * Property name for the event when a new BlackBoardArtifactTag is
+ * added. The new value is tag added, the old value is empty
+ */
+ BLACKBOARD_ARTIFACT_TAG_ADDED,
+ /**
+ * Property name for the event when a new BlackBoardArtifactTag is
+ * deleted. The new value is empty, the old value is the deleted tag
+ */
+ BLACKBOARD_ARTIFACT_TAG_DELETED,
+ /**
+ * Property name for the event when a new ContentTag is added. The new
+ * value is tag added, the old value is empty
+ */
+ CONTENT_TAG_ADDED,
+ /**
+ * Property name for the event when a new ContentTag is deleted. The new
+ * value is empty, the old value is the deleted tag
+ */
+ CONTENT_TAG_DELETED;
};
private String name;
@@ -277,12 +309,13 @@ public class Case implements SleuthkitCase.ErrorObserver {
/**
* Creates a new case (create the XML config file and database)
*
- * @param caseDir The directory to store case data in. Will be created if it
- * doesn't already exist. If it exists, it should have all of the needed sub
- * dirs that createCaseDirectory() will create.
- * @param caseName the name of case
+ * @param caseDir The directory to store case data in. Will be created if
+ * it
+ * doesn't already exist. If it exists, it should have all of the needed sub
+ * dirs that createCaseDirectory() will create.
+ * @param caseName the name of case
* @param caseNumber the case number
- * @param examiner the examiner for this case
+ * @param examiner the examiner for this case
*/
public static void create(String caseDir, String caseName, String caseNumber, String examiner) throws CaseActionException {
logger.log(Level.INFO, "Creating new case.\ncaseDir: {0}\ncaseName: {1}", new Object[]{caseDir, caseName}); //NON-NLS
@@ -428,7 +461,7 @@ public class Case implements SleuthkitCase.ErrorObserver {
* Sends out event and reopens windows if needed.
*
* @param imgPaths the paths of the image that being added
- * @param imgId the ID of the image that being added
+ * @param imgId the ID of the image that being added
* @param timeZone the timeZone of the image where it's added
*/
@Deprecated
@@ -473,9 +506,54 @@ public class Case implements SleuthkitCase.ErrorObserver {
* @param newDataSource new data source added
*/
void notifyNewDataSource(Content newDataSource) {
+ notifyPropertyChangeEvent(new PropertyChangeEvent(Case.class, Events.DATA_SOURCE_ADDED.toString(), null, newDataSource));
+ CoreComponentControl.openCoreWindows();
+ }
+ /**
+ * Notifies the UI that a new ContentTag has been added.
+ *
+ * @param newTag new ContentTag added
+ */
+ public void notifyContentTagAdded(ContentTag newTag) {
+ notifyPropertyChangeEvent(new ContentTagAddedEvent(newTag));
+ }
+
+ /**
+ * Notifies the UI that a ContentTag has been deleted.
+ *
+ * @param deletedTag ContentTag deleted
+ */
+ public void notifyContentTagDeleted(ContentTag deletedTag) {
+ notifyPropertyChangeEvent(new ContentTagDeletedEvent(deletedTag));
+ }
+
+ /**
+ * Notifies the UI that a new BlackboardArtifactTag has been added.
+ *
+ * @param newTag new BlackboardArtifactTag added
+ */
+ public void notifyBlackBoardArtifactTagAdded(BlackboardArtifactTag newTag) {
+ notifyPropertyChangeEvent(new BlackBoardArtifactTagAddedEvent(newTag));
+ }
+
+ /**
+ * Notifies the UI that a BlackboardArtifactTag has been.
+ *
+ * @param deletedTag BlackboardArtifactTag deleted
+ */
+ public void notifyBlackBoardArtifactTagDeleted(BlackboardArtifactTag deletedTag) {
+ notifyPropertyChangeEvent(new BlackBoardArtifactTagDeletedEvent(deletedTag));
+ }
+
+ /**
+ * Notifies the UI about a Case level event.
+ *
+ * @param propertyChangeEvent the event to distribute
+ */
+ private void notifyPropertyChangeEvent(final PropertyChangeEvent propertyChangeEvent) {
try {
- pcs.firePropertyChange(Events.DATA_SOURCE_ADDED.toString(), null, newDataSource);
+ pcs.firePropertyChange(propertyChangeEvent);
} catch (Exception e) {
logger.log(Level.SEVERE, "Case threw exception", e); //NON-NLS
MessageNotifyUtil.Notify.show(NbBundle.getMessage(this.getClass(), "Case.moduleErr"),
@@ -483,7 +561,6 @@ public class Case implements SleuthkitCase.ErrorObserver {
"Case.changeCase.errListenToCaseUpdates.msg"),
MessageNotifyUtil.MessageType.ERROR);
}
- CoreComponentControl.openCoreWindows();
}
/**
@@ -550,9 +627,9 @@ public class Case implements SleuthkitCase.ErrorObserver {
* Updates the case name.
*
* @param oldCaseName the old case name that wants to be updated
- * @param oldPath the old path that wants to be updated
+ * @param oldPath the old path that wants to be updated
* @param newCaseName the new case name
- * @param newPath the new path
+ * @param newPath the new path
*/
void updateCaseName(String oldCaseName, String oldPath, String newCaseName, String newPath) throws CaseActionException {
try {
@@ -811,6 +888,7 @@ public class Case implements SleuthkitCase.ErrorObserver {
* Get the data model Content objects in the root of this case's hierarchy.
*
* @return a list of the root objects
+ *
* @throws org.sleuthkit.datamodel.TskCoreException
*/
public List getDataSources() throws TskCoreException {
@@ -944,7 +1022,7 @@ public class Case implements SleuthkitCase.ErrorObserver {
/**
* to create the case directory
*
- * @param caseDir Path to the case directory (typically base + case name)
+ * @param caseDir Path to the case directory (typically base + case name)
* @param caseName the case name (used only for error messages)
*
* @throws CaseActionException throw if could not create the case dir
@@ -1164,12 +1242,14 @@ public class Case implements SleuthkitCase.ErrorObserver {
/**
* Adds a report to the case.
*
- * @param [in] localPath The path of the report file, must be in the case
- * directory or one of its subdirectories.
- * @param [in] sourceModuleName The name of the module that created the
- * report.
- * @param [in] reportName The report name, may be empty.
+ * @param localPath The path of the report file, must be in the case
+ * directory or one of its subdirectories.
+ * @param sourceModuleName The name of the module that created the
+ * report.
+ * @param reportName The report name, may be empty.
+ *
* @return A Report data transfer object (DTO) for the new row.
+ *
* @throws TskCoreException
*/
public void addReport(String localPath, String srcModuleName, String reportName) throws TskCoreException {
diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/services/Bundle.properties b/Core/src/org/sleuthkit/autopsy/casemodule/services/Bundle.properties
index 5242f90667..b267fde0a2 100644
--- a/Core/src/org/sleuthkit/autopsy/casemodule/services/Bundle.properties
+++ b/Core/src/org/sleuthkit/autopsy/casemodule/services/Bundle.properties
@@ -14,4 +14,8 @@ FileManager.addLocalDirInt2.exception.closed.msg=Attempted to use FileManager af
TagsManager.addContentTag.exception.beginByteOffsetOOR.msg=beginByteOffset \= {0} out of content size range (0 - {1})
TagsManager.addContentTag.exception.endByteOffsetOOR.msg=endByteOffset \= {0} out of content size range (0 - {1})
TagsManager.addContentTag.exception.endLTbegin.msg=endByteOffset < beginByteOffset
-TagsManager.predefTagNames.bookmark.text=Bookmark
\ No newline at end of file
+TagsManager.predefTagNames.bookmark.text=Bookmark
+TagsManager.addContentTag.noCaseWarning=Failed to add publish new content tag event. There is no case open.
+TagsManager.deleteContentTag.noCaseWarning=Failed to add publish content tag deleted event. There is no case open.
+TagsManager.addBlackboardArtifactTag.noCaseWarning=Failed to add publish new blackboard artifact tag event. There is no case open.
+TagsManager.deleteBlackboardArtifactTag.noCaseWarning=Failed to add publish blackboard artifact tag deleted event. There is no case open.
diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagsManager.java b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagsManager.java
index 6be8439029..aa79469d4e 100755
--- a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagsManager.java
+++ b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagsManager.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");
@@ -24,9 +24,9 @@ import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.logging.Level;
-import org.sleuthkit.autopsy.coreutils.Logger;
-
import org.openide.util.NbBundle;
+import org.sleuthkit.autopsy.casemodule.Case;
+import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.coreutils.ModuleSettings;
import org.sleuthkit.datamodel.BlackboardArtifact;
import org.sleuthkit.datamodel.BlackboardArtifactTag;
@@ -37,28 +37,32 @@ import org.sleuthkit.datamodel.TagName;
import org.sleuthkit.datamodel.TskCoreException;
/**
- * A per case instance of this class functions as an Autopsy service that
- * manages the creation, updating, and deletion of tags applied to content and
- * blackboard artifacts by users.
+ * A per case instance of this class functions as an Autopsy service that
+ * manages the creation, updating, and deletion of tags applied to content and
+ * blackboard artifacts by users.
*/
public class TagsManager implements Closeable {
+
private static final String TAGS_SETTINGS_NAME = "Tags"; //NON-NLS
private static final String TAG_NAMES_SETTING_KEY = "TagNames"; //NON-NLS
- private final SleuthkitCase tskCase;
+ private final SleuthkitCase tskCase;
private final HashMap uniqueTagNames = new HashMap<>();
private boolean tagNamesInitialized = false; // @@@ This is part of a work around to be removed when database access on the EDT is correctly synchronized.
-
- // Use this exception and the member hash map to manage uniqueness of hash
- // names. This is deemed more proactive and informative than leaving this to
- // the UNIQUE constraint on the display_name field of the tag_names table in
- // the case database.
- public class TagNameAlreadyExistsException extends Exception {
- }
-
+
/**
- * Package-scope constructor for use of the Services class. An instance of
+ * Use this exception and the member hash map to manage uniqueness of hash
+ * names. This is deemed more proactive and informative than leaving this to
+ * the UNIQUE constraint on the display_name field of the tag_names table in
+ * the case database.
+ */
+ public static class TagNameAlreadyExistsException extends Exception {
+ }
+
+ /**
+ * Package-scope constructor for use of the Services class. An instance of
* TagsManager should be created for each case that is opened.
- * @param [in] tskCase The SleuthkitCase object for the current case.
+ *
+ * @param tskCase The SleuthkitCase object for the current case.
*/
TagsManager(SleuthkitCase tskCase) {
this.tskCase = tskCase;
@@ -67,38 +71,44 @@ public class TagsManager implements Closeable {
}
/**
- * Gets a list of all tag names currently available for tagging content or
+ * Gets a list of all tag names currently available for tagging content or
* blackboard artifacts.
- * @return A list, possibly empty, of TagName data transfer objects (DTOs).
- * @throws TskCoreException
+ *
+ * @return A list, possibly empty, of TagName data transfer objects (DTOs).
+ *
+ * @throws TskCoreException
*/
- public synchronized List getAllTagNames() throws TskCoreException {
+ public synchronized List getAllTagNames() throws TskCoreException {
// @@@ This is a work around to be removed when database access on the EDT is correctly synchronized.
if (!tagNamesInitialized) {
getExistingTagNames();
}
-
+
return tskCase.getAllTagNames();
}
/**
- * Gets a list of all tag names currently used for tagging content or
+ * Gets a list of all tag names currently used for tagging content or
* blackboard artifacts.
- * @return A list, possibly empty, of TagName data transfer objects (DTOs).
- * @throws TskCoreException
+ *
+ * @return A list, possibly empty, of TagName data transfer objects (DTOs).
+ *
+ * @throws TskCoreException
*/
- public synchronized List getTagNamesInUse() throws TskCoreException {
+ public synchronized List getTagNamesInUse() throws TskCoreException {
// @@@ This is a work around to be removed when database access on the EDT is correctly synchronized.
if (!tagNamesInitialized) {
getExistingTagNames();
}
-
+
return tskCase.getTagNamesInUse();
}
-
+
/**
* Checks whether a tag name with a given display name exists.
- * @param [in] tagDisplayName The display name for which to check.
+ *
+ * @param tagDisplayName The display name for which to check.
+ *
* @return True if the tag name exists, false otherwise.
*/
public synchronized boolean tagNameExists(String tagDisplayName) {
@@ -106,15 +116,19 @@ public class TagsManager implements Closeable {
if (!tagNamesInitialized) {
getExistingTagNames();
}
-
+
return uniqueTagNames.containsKey(tagDisplayName);
}
-
+
/**
* Adds a new tag name to the current case and to the tags settings.
- * @param [in] displayName The display name for the new tag name.
- * @return A TagName data transfer object (DTO) representing the new tag name.
- * @throws TagNameAlreadyExistsException, TskCoreException
+ *
+ * @param displayName The display name for the new tag name.
+ *
+ * @return A TagName data transfer object (DTO) representing the new tag
+ * name.
+ *
+ * @throws TagNameAlreadyExistsException, TskCoreException
*/
public TagName addTagName(String displayName) throws TagNameAlreadyExistsException, TskCoreException {
return addTagName(displayName, "", TagName.HTML_COLOR.NONE);
@@ -122,10 +136,14 @@ public class TagsManager implements Closeable {
/**
* Adds a new tag name to the current case and to the tags settings.
- * @param [in] displayName The display name for the new tag name.
- * @param [in] description The description for the new tag name.
- * @return A TagName data transfer object (DTO) representing the new tag name.
- * @throws TagNameAlreadyExistsException, TskCoreException
+ *
+ * @param displayName The display name for the new tag name.
+ * @param description The description for the new tag name.
+ *
+ * @return A TagName data transfer object (DTO) representing the new tag
+ * name.
+ *
+ * @throws TagNameAlreadyExistsException, TskCoreException
*/
public TagName addTagName(String displayName, String description) throws TagNameAlreadyExistsException, TskCoreException {
return addTagName(displayName, description, TagName.HTML_COLOR.NONE);
@@ -133,82 +151,95 @@ public class TagsManager implements Closeable {
/**
* Adds a new tag name to the current case and to the tags settings.
- * @param [in] displayName The display name for the new tag name.
- * @param [in] description The description for the new tag name.
- * @param [in] color The HTML color to associate with the new tag name.
- * @return A TagName data transfer object (DTO) representing the new tag name.
- * @throws TagNameAlreadyExistsException, TskCoreException
+ *
+ * @param displayName The display name for the new tag name.
+ * @param description The description for the new tag name.
+ * @param color The HTML color to associate with the new tag name.
+ *
+ * @return A TagName data transfer object (DTO) representing the new tag
+ * name.
+ *
+ * @throws TagNameAlreadyExistsException, TskCoreException
*/
public synchronized TagName addTagName(String displayName, String description, TagName.HTML_COLOR color) throws TagNameAlreadyExistsException, TskCoreException {
// @@@ This is a work around to be removed when database access on the EDT is correctly synchronized.
if (!tagNamesInitialized) {
getExistingTagNames();
}
-
+
if (uniqueTagNames.containsKey(displayName)) {
throw new TagNameAlreadyExistsException();
}
// Add the tag name to the case.
- TagName newTagName = tskCase.addTagName(displayName, description, color);
+ TagName newTagName = tskCase.addTagName(displayName, description, color);
// Add the tag name to the tags settings.
uniqueTagNames.put(newTagName.getDisplayName(), newTagName);
- saveTagNamesToTagsSettings();
+ saveTagNamesToTagsSettings();
return newTagName;
}
-
+
/**
* Tags a content object.
- * @param [in] content The content to tag.
- * @param [in] tagName The name to use for the tag.
- * @return A ContentTag data transfer object (DTO) representing the new tag.
- * @throws TskCoreException
+ *
+ * @param content The content to tag.
+ * @param tagName The name to use for the tag.
+ *
+ * @return A ContentTag data transfer object (DTO) representing the new tag.
+ *
+ * @throws TskCoreException
*/
public ContentTag addContentTag(Content content, TagName tagName) throws TskCoreException {
return addContentTag(content, tagName, "", -1, -1);
- }
-
+ }
+
/**
* Tags a content object.
- * @param [in] content The content to tag.
- * @param [in] tagName The name to use for the tag.
- * @param [in] comment A comment to store with the tag.
- * @return A ContentTag data transfer object (DTO) representing the new tag.
- * @throws TskCoreException
+ *
+ * @param content The content to tag.
+ * @param tagName The name to use for the tag.
+ * @param comment A comment to store with the tag.
+ *
+ * @return A ContentTag data transfer object (DTO) representing the new tag.
+ *
+ * @throws TskCoreException
*/
public ContentTag addContentTag(Content content, TagName tagName, String comment) throws TskCoreException {
return addContentTag(content, tagName, comment, -1, -1);
- }
-
+ }
+
/**
* Tags a content object or a section of a content object.
- * @param [in] content The content to tag.
- * @param [in] tagName The name to use for the tag.
- * @param [in] comment A comment to store with the tag.
- * @param [in] beginByteOffset Designates the beginning of a tagged section.
- * @param [in] endByteOffset Designates the end of a tagged section.
- * @return A ContentTag data transfer object (DTO) representing the new tag.
- * @throws IllegalArgumentException, TskCoreException
+ *
+ * @param content The content to tag.
+ * @param tagName The name to use for the tag.
+ * @param comment A comment to store with the tag.
+ * @param beginByteOffset Designates the beginning of a tagged section.
+ * @param endByteOffset Designates the end of a tagged section.
+ *
+ * @return A ContentTag data transfer object (DTO) representing the new tag.
+ *
+ * @throws IllegalArgumentException, TskCoreException
*/
public synchronized ContentTag addContentTag(Content content, TagName tagName, String comment, long beginByteOffset, long endByteOffset) throws IllegalArgumentException, TskCoreException {
// @@@ This is a work around to be removed when database access on the EDT is correctly synchronized.
if (!tagNamesInitialized) {
getExistingTagNames();
}
-
+
if (beginByteOffset >= 0 && endByteOffset >= 1) {
if (beginByteOffset > content.getSize() - 1) {
throw new IllegalArgumentException(NbBundle.getMessage(this.getClass(),
- "TagsManager.addContentTag.exception.beginByteOffsetOOR.msg",
- beginByteOffset, content.getSize() - 1));
+ "TagsManager.addContentTag.exception.beginByteOffsetOOR.msg",
+ beginByteOffset, content.getSize() - 1));
}
if (endByteOffset > content.getSize() - 1) {
throw new IllegalArgumentException(
NbBundle.getMessage(this.getClass(), "TagsManager.addContentTag.exception.endByteOffsetOOR.msg",
- endByteOffset, content.getSize() - 1));
+ endByteOffset, content.getSize() - 1));
}
if (endByteOffset < beginByteOffset) {
@@ -216,28 +247,42 @@ public class TagsManager implements Closeable {
NbBundle.getMessage(this.getClass(), "TagsManager.addContentTag.exception.endLTbegin.msg"));
}
}
-
- return tskCase.addContentTag(content, tagName, comment, beginByteOffset, endByteOffset);
+ final ContentTag newContentTag = tskCase.addContentTag(content, tagName, comment, beginByteOffset, endByteOffset);
+ try {
+ Case.getCurrentCase().notifyContentTagAdded(newContentTag);
+ } catch (IllegalStateException ex) {
+ Logger.getLogger(TagsManager.class.getName()).log(Level.WARNING, NbBundle.getMessage(TagsManager.class, "TagsManager.addContentTag.noCaseWarning"));
+ }
+ return newContentTag;
}
-
+
/**
* Deletes a content tag.
- * @param [in] tag The tag to delete.
- * @throws TskCoreException
+ *
+ * @param tag The tag to delete.
+ *
+ * @throws TskCoreException
*/
public synchronized void deleteContentTag(ContentTag tag) throws TskCoreException {
// @@@ This is a work around to be removed when database access on the EDT is correctly synchronized.
if (!tagNamesInitialized) {
getExistingTagNames();
}
-
+
tskCase.deleteContentTag(tag);
+ try {
+ Case.getCurrentCase().notifyContentTagDeleted(tag);
+ } catch (IllegalArgumentException e) {
+ Logger.getLogger(TagsManager.class.getName()).log(Level.WARNING, NbBundle.getMessage(TagsManager.class, "TagsManager.deleteContentTag.noCaseWarning"));
+ }
}
/**
* Gets all content tags for the current case.
+ *
* @return A list, possibly empty, of content tags.
- * @throws TskCoreException
+ *
+ * @throws TskCoreException
*/
public List getAllContentTags() throws TskCoreException {
// @@@ This is a work around to be removed when database access on the EDT is correctly synchronized.
@@ -245,100 +290,134 @@ public class TagsManager implements Closeable {
getExistingTagNames();
}
- return tskCase.getAllContentTags();
+ return tskCase.getAllContentTags();
}
-
+
/**
* Gets content tags count by tag name.
- * @param [in] tagName The tag name of interest.
+ *
+ * @param tagName The tag name of interest.
+ *
* @return A count of the content tags with the specified tag name.
- * @throws TskCoreException
+ *
+ * @throws TskCoreException
*/
public synchronized long getContentTagsCountByTagName(TagName tagName) throws TskCoreException {
// @@@ This is a work around to be removed when database access on the EDT is correctly synchronized.
if (!tagNamesInitialized) {
getExistingTagNames();
}
-
- return tskCase.getContentTagsCountByTagName(tagName);
+
+ return tskCase.getContentTagsCountByTagName(tagName);
}
-
+
/**
* Gets content tags by tag name.
- * @param [in] tagName The tag name of interest.
- * @return A list, possibly empty, of the content tags with the specified tag name.
- * @throws TskCoreException
+ *
+ * @param tagName The tag name of interest.
+ *
+ * @return A list, possibly empty, of the content tags with the specified
+ * tag name.
+ *
+ * @throws TskCoreException
*/
public synchronized List getContentTagsByTagName(TagName tagName) throws TskCoreException {
// @@@ This is a work around to be removed when database access on the EDT is correctly synchronized.
if (!tagNamesInitialized) {
getExistingTagNames();
}
-
- return tskCase.getContentTagsByTagName(tagName);
+
+ return tskCase.getContentTagsByTagName(tagName);
}
-
+
/**
* Gets content tags count by content.
- * @param [in] content The content of interest.
- * @return A list, possibly empty, of the tags that have been applied to the artifact.
- * @throws TskCoreException
+ *
+ * @param content The content of interest.
+ *
+ * @return A list, possibly empty, of the tags that have been applied to the
+ * artifact.
+ *
+ * @throws TskCoreException
*/
public synchronized List getContentTagsByContent(Content content) throws TskCoreException {
// @@@ This is a work around to be removed when database access on the EDT is correctly synchronized.
if (!tagNamesInitialized) {
getExistingTagNames();
}
-
- return tskCase.getContentTagsByContent(content);
+
+ return tskCase.getContentTagsByContent(content);
}
-
+
/**
* Tags a blackboard artifact object.
- * @param [in] artifact The blackboard artifact to tag.
- * @param [in] tagName The name to use for the tag.
- * @return A BlackboardArtifactTag data transfer object (DTO) representing the new tag.
- * @throws TskCoreException
+ *
+ * @param artifact The blackboard artifact to tag.
+ * @param tagName The name to use for the tag.
+ *
+ * @return A BlackboardArtifactTag data transfer object (DTO) representing
+ * the new tag.
+ *
+ * @throws TskCoreException
*/
public BlackboardArtifactTag addBlackboardArtifactTag(BlackboardArtifact artifact, TagName tagName) throws TskCoreException {
- return addBlackboardArtifactTag(artifact, tagName, "");
+ return addBlackboardArtifactTag(artifact, tagName, "");
}
-
+
/**
* Tags a blackboard artifact object.
- * @param [in] artifact The blackboard artifact to tag.
- * @param [in] tagName The name to use for the tag.
- * @param [in] comment A comment to store with the tag.
- * @return A BlackboardArtifactTag data transfer object (DTO) representing the new tag.
- * @throws TskCoreException
+ *
+ * @param artifact The blackboard artifact to tag.
+ * @param tagName The name to use for the tag.
+ * @param comment A comment to store with the tag.
+ *
+ * @return A BlackboardArtifactTag data transfer object (DTO) representing
+ * the new tag.
+ *
+ * @throws TskCoreException
*/
public synchronized BlackboardArtifactTag addBlackboardArtifactTag(BlackboardArtifact artifact, TagName tagName, String comment) throws TskCoreException {
// @@@ This is a work around to be removed when database access on the EDT is correctly synchronized.
if (!tagNamesInitialized) {
getExistingTagNames();
}
-
- return tskCase.addBlackboardArtifactTag(artifact, tagName, comment);
+
+ BlackboardArtifactTag addBlackboardArtifactTag = tskCase.addBlackboardArtifactTag(artifact, tagName, comment);
+ try {
+ Case.getCurrentCase().notifyBlackBoardArtifactTagAdded(addBlackboardArtifactTag);
+ } catch (IllegalArgumentException e) {
+ Logger.getLogger(TagsManager.class.getName()).log(Level.WARNING, NbBundle.getMessage(TagsManager.class, "TagsManager.addBlackboardArtifactTag.noCaseWarning"));
+ }
+ return addBlackboardArtifactTag;
}
/**
* Deletes a blackboard artifact tag.
- * @param [in] tag The tag to delete.
- * @throws TskCoreException
+ *
+ * @param tag The tag to delete.
+ *
+ * @throws TskCoreException
*/
public synchronized void deleteBlackboardArtifactTag(BlackboardArtifactTag tag) throws TskCoreException {
// @@@ This is a work around to be removed when database access on the EDT is correctly synchronized.
if (!tagNamesInitialized) {
getExistingTagNames();
}
-
+
tskCase.deleteBlackboardArtifactTag(tag);
+ try {
+ Case.getCurrentCase().notifyBlackBoardArtifactTagDeleted(tag);
+ } catch (IllegalArgumentException e) {
+ Logger.getLogger(TagsManager.class.getName()).log(Level.WARNING, NbBundle.getMessage(TagsManager.class, "TagsManager.deleteBlackboardArtifactTag.noCaseWarning"));
+ }
}
-
+
/**
* Gets all blackboard artifact tags for the current case.
+ *
* @return A list, possibly empty, of blackboard artifact tags.
- * @throws TskCoreException
+ *
+ * @throws TskCoreException
*/
public List getAllBlackboardArtifactTags() throws TskCoreException {
// @@@ This is a work around to be removed when database access on the EDT is correctly synchronized.
@@ -346,100 +425,110 @@ public class TagsManager implements Closeable {
getExistingTagNames();
}
- return tskCase.getAllBlackboardArtifactTags();
+ return tskCase.getAllBlackboardArtifactTags();
}
-
+
/**
* Gets blackboard artifact tags count by tag name.
- * @param [in] tagName The tag name of interest.
- * @return A count of the blackboard artifact tags with the specified tag name.
- * @throws TskCoreException
+ *
+ * @param tagName The tag name of interest.
+ *
+ * @return A count of the blackboard artifact tags with the specified tag
+ * name.
+ *
+ * @throws TskCoreException
*/
public synchronized long getBlackboardArtifactTagsCountByTagName(TagName tagName) throws TskCoreException {
// @@@ This is a work around to be removed when database access on the EDT is correctly synchronized.
if (!tagNamesInitialized) {
getExistingTagNames();
}
-
- return tskCase.getBlackboardArtifactTagsCountByTagName(tagName);
+
+ return tskCase.getBlackboardArtifactTagsCountByTagName(tagName);
}
-
+
/**
* Gets blackboard artifact tags by tag name.
- * @param [in] tagName The tag name of interest.
- * @return A list, possibly empty, of the blackboard artifact tags with the specified tag name.
- * @throws TskCoreException
+ *
+ * @param tagName The tag name of interest.
+ *
+ * @return A list, possibly empty, of the blackboard artifact tags with the
+ * specified tag name.
+ *
+ * @throws TskCoreException
*/
- public synchronized List getBlackboardArtifactTagsByTagName(TagName tagName) throws TskCoreException {
+ public synchronized List getBlackboardArtifactTagsByTagName(TagName tagName) throws TskCoreException {
// @@@ This is a work around to be removed when database access on the EDT is correctly synchronized.
if (!tagNamesInitialized) {
getExistingTagNames();
}
-
- return tskCase.getBlackboardArtifactTagsByTagName(tagName);
+
+ return tskCase.getBlackboardArtifactTagsByTagName(tagName);
}
/**
* Gets blackboard artifact tags for a particular blackboard artifact.
- * @param [in] artifact The blackboard artifact of interest.
- * @return A list, possibly empty, of the tags that have been applied to the artifact.
- * @throws TskCoreException
+ *
+ * @param artifact The blackboard artifact of interest.
+ *
+ * @return A list, possibly empty, of the tags that have been applied to the
+ * artifact.
+ *
+ * @throws TskCoreException
*/
- public synchronized List getBlackboardArtifactTagsByArtifact(BlackboardArtifact artifact) throws TskCoreException {
+ public synchronized List getBlackboardArtifactTagsByArtifact(BlackboardArtifact artifact) throws TskCoreException {
// @@@ This is a work around to be removed when database access on the EDT is correctly synchronized.
if (!tagNamesInitialized) {
getExistingTagNames();
}
-
- return tskCase.getBlackboardArtifactTagsByArtifact(artifact);
+
+ return tskCase.getBlackboardArtifactTagsByArtifact(artifact);
}
-
+
@Override
- public void close() throws IOException {
- saveTagNamesToTagsSettings();
- }
-
+ public void close() throws IOException {
+ saveTagNamesToTagsSettings();
+ }
+
private void getExistingTagNames() {
getTagNamesFromCurrentCase();
getTagNamesFromTagsSettings();
getPredefinedTagNames();
- saveTagNamesToTagsSettings();
+ saveTagNamesToTagsSettings();
tagNamesInitialized = true; // @@@ This is part of a work around to be removed when database access on the EDT is correctly synchronized.
}
-
+
private void getTagNamesFromCurrentCase() {
try {
List currentTagNames = tskCase.getAllTagNames();
for (TagName tagName : currentTagNames) {
uniqueTagNames.put(tagName.getDisplayName(), tagName);
}
- }
- catch (TskCoreException ex) {
+ } catch (TskCoreException ex) {
Logger.getLogger(TagsManager.class.getName()).log(Level.SEVERE, "Failed to get tag types from the current case", ex); //NON-NLS
- }
+ }
}
-
+
private void getTagNamesFromTagsSettings() {
String setting = ModuleSettings.getConfigSetting(TAGS_SETTINGS_NAME, TAG_NAMES_SETTING_KEY);
- if (null != setting && !setting.isEmpty()) {
+ if (null != setting && !setting.isEmpty()) {
// Read the tag name setting and break it into tag name tuples.
- List tagNameTuples = Arrays.asList(setting.split(";"));
-
+ List tagNameTuples = Arrays.asList(setting.split(";"));
+
// Parse each tuple and add the tag names to the current case, one
// at a time to gracefully discard any duplicates or corrupt tuples.
- for (String tagNameTuple : tagNameTuples) {
+ for (String tagNameTuple : tagNameTuples) {
String[] tagNameAttributes = tagNameTuple.split(",");
- if (!uniqueTagNames.containsKey(tagNameAttributes[0])) {
+ if (!uniqueTagNames.containsKey(tagNameAttributes[0])) {
try {
TagName tagName = tskCase.addTagName(tagNameAttributes[0], tagNameAttributes[1], TagName.HTML_COLOR.getColorByName(tagNameAttributes[2]));
uniqueTagNames.put(tagName.getDisplayName(), tagName);
- }
- catch (TskCoreException ex) {
+ } catch (TskCoreException ex) {
Logger.getLogger(TagsManager.class.getName()).log(Level.SEVERE, "Failed to add saved tag name " + tagNameAttributes[0], ex); //NON-NLS
}
}
}
- }
+ }
}
private void getPredefinedTagNames() {
@@ -448,13 +537,12 @@ public class TagsManager implements Closeable {
TagName tagName = tskCase.addTagName(
NbBundle.getMessage(this.getClass(), "TagsManager.predefTagNames.bookmark.text"), "", TagName.HTML_COLOR.NONE);
uniqueTagNames.put(tagName.getDisplayName(), tagName);
- }
- catch (TskCoreException ex) {
+ } catch (TskCoreException ex) {
Logger.getLogger(TagsManager.class.getName()).log(Level.SEVERE, "Failed to add predefined 'Bookmark' tag name", ex); //NON-NLS
}
}
- }
-
+ }
+
private void saveTagNamesToTagsSettings() {
if (!uniqueTagNames.isEmpty()) {
StringBuilder setting = new StringBuilder();
@@ -466,7 +554,7 @@ public class TagsManager implements Closeable {
setting.append(tagName.getDescription()).append(",");
setting.append(tagName.getColor().name());
}
- ModuleSettings.setConfigSetting(TAGS_SETTINGS_NAME, TAG_NAMES_SETTING_KEY, setting.toString());
+ ModuleSettings.setConfigSetting(TAGS_SETTINGS_NAME, TAG_NAMES_SETTING_KEY, setting.toString());
}
- }
+ }
}
diff --git a/Core/src/org/sleuthkit/autopsy/corecomponents/Bundle.properties b/Core/src/org/sleuthkit/autopsy/corecomponents/Bundle.properties
index fce437a96f..caa5ecd386 100644
--- a/Core/src/org/sleuthkit/autopsy/corecomponents/Bundle.properties
+++ b/Core/src/org/sleuthkit/autopsy/corecomponents/Bundle.properties
@@ -147,3 +147,7 @@ AutopsyOptionsPanel.jLabelNumThreads.text=Number of threads to use for file inge
FXVideoPanel.progress.bufferingCancelled=media buffering was canceled
FXVideoPanel.progress.bufferingInterrupted=media buffering was interrupted
FXVideoPanel.progress.errorWritingVideoToDisk=Error writing video to disk
+DataContentViewerHex.goToOffsetLabel.text=Jump to Offset
+DataContentViewerHex.goToOffsetTextField.text=
+DataContentViewerHex.goToOffsetTextField.msgDlg=Invalid Offset: {0}
+DataContentViewerHex.setDataView.invalidOffset.negativeOffsetValue=Cannot jump to the resultant offset
\ No newline at end of file
diff --git a/Core/src/org/sleuthkit/autopsy/corecomponents/Bundle_ja.properties b/Core/src/org/sleuthkit/autopsy/corecomponents/Bundle_ja.properties
old mode 100644
new mode 100755
diff --git a/Core/src/org/sleuthkit/autopsy/corecomponents/DataContentViewerHex.form b/Core/src/org/sleuthkit/autopsy/corecomponents/DataContentViewerHex.form
index a5663b4644..cd5d9e21d0 100644
--- a/Core/src/org/sleuthkit/autopsy/corecomponents/DataContentViewerHex.form
+++ b/Core/src/org/sleuthkit/autopsy/corecomponents/DataContentViewerHex.form
@@ -88,9 +88,13 @@
-
+
+
+
+
+
-
+
@@ -108,9 +112,11 @@
+
+
-
-
+
+
@@ -131,6 +137,9 @@
+
+
+
@@ -140,7 +149,7 @@
-
+
@@ -278,6 +287,23 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Core/src/org/sleuthkit/autopsy/corecomponents/DataContentViewerHex.java b/Core/src/org/sleuthkit/autopsy/corecomponents/DataContentViewerHex.java
index c7eb83ebd0..11cee38ab4 100644
--- a/Core/src/org/sleuthkit/autopsy/corecomponents/DataContentViewerHex.java
+++ b/Core/src/org/sleuthkit/autopsy/corecomponents/DataContentViewerHex.java
@@ -28,6 +28,8 @@ import org.sleuthkit.autopsy.coreutils.Logger;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
import javax.swing.JTextPane;
+import javax.swing.text.BadLocationException;
+import javax.swing.text.Utilities;
import org.openide.nodes.Node;
import org.openide.util.lookup.ServiceProvider;
import org.sleuthkit.autopsy.corecomponentinterfaces.DataContentViewer;
@@ -94,6 +96,8 @@ public class DataContentViewerHex extends javax.swing.JPanel implements DataCont
return (getSize().width < 400);
}};
this.outputViewPane.setBackground(new java.awt.Color(255, 255, 255)); // to make sure the background color is white
+ this.outputViewPane.requestFocusInWindow();
+ this.outputViewPane.setCursor(Cursor.getDefaultCursor());
totalPageLabel = new javax.swing.JLabel();
ofLabel = new javax.swing.JLabel();
currentPageLabel = new javax.swing.JLabel();
@@ -103,6 +107,8 @@ public class DataContentViewerHex extends javax.swing.JPanel implements DataCont
pageLabel2 = new javax.swing.JLabel();
goToPageTextField = new javax.swing.JTextField();
goToPageLabel = new javax.swing.JLabel();
+ goToOffsetLabel = new javax.swing.JLabel();
+ goToOffsetTextField = new javax.swing.JTextField();
copyMenuItem.setText(org.openide.util.NbBundle.getMessage(DataContentViewerHex.class, "DataContentViewerHex.copyMenuItem.text")); // NOI18N
rightClickMenu.add(copyMenuItem);
@@ -113,7 +119,8 @@ public class DataContentViewerHex extends javax.swing.JPanel implements DataCont
jScrollPane1.setBackground(new java.awt.Color(255, 255, 255));
outputViewPane.setEditable(false);
- outputViewPane.setFont(new Font("Courier New", Font.PLAIN, 11)); // NOI18N NON-NLS
+ outputViewPane.setFont(new java.awt.Font("Courier New", 0, 11)); // NOI18N
+ outputViewPane.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
outputViewPane.setMinimumSize(new java.awt.Dimension(700, 20));
outputViewPane.setPreferredSize(new java.awt.Dimension(700, 400));
jScrollPane1.setViewportView(outputViewPane);
@@ -132,28 +139,28 @@ public class DataContentViewerHex extends javax.swing.JPanel implements DataCont
pageLabel.setMinimumSize(new java.awt.Dimension(33, 14));
pageLabel.setPreferredSize(new java.awt.Dimension(33, 14));
- prevPageButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/corecomponents/btn_step_back.png"))); // NOI18N NON-NLS
+ prevPageButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/corecomponents/btn_step_back.png"))); // NOI18N
prevPageButton.setText(org.openide.util.NbBundle.getMessage(DataContentViewerHex.class, "DataContentViewerHex.prevPageButton.text")); // NOI18N
prevPageButton.setBorderPainted(false);
prevPageButton.setContentAreaFilled(false);
- prevPageButton.setDisabledIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/corecomponents/btn_step_back_disabled.png"))); // NOI18N NON-NLS
+ prevPageButton.setDisabledIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/corecomponents/btn_step_back_disabled.png"))); // NOI18N
prevPageButton.setMargin(new java.awt.Insets(2, 0, 2, 0));
prevPageButton.setPreferredSize(new java.awt.Dimension(23, 23));
- prevPageButton.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/corecomponents/btn_step_back_hover.png"))); // NOI18N NON-NLS
+ prevPageButton.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/corecomponents/btn_step_back_hover.png"))); // NOI18N
prevPageButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
prevPageButtonActionPerformed(evt);
}
});
- nextPageButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/corecomponents/btn_step_forward.png"))); // NOI18N NON-NLS
+ nextPageButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/corecomponents/btn_step_forward.png"))); // NOI18N
nextPageButton.setText(org.openide.util.NbBundle.getMessage(DataContentViewerHex.class, "DataContentViewerHex.nextPageButton.text")); // NOI18N
nextPageButton.setBorderPainted(false);
nextPageButton.setContentAreaFilled(false);
- nextPageButton.setDisabledIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/corecomponents/btn_step_forward_disabled.png"))); // NOI18N NON-NLS
+ nextPageButton.setDisabledIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/corecomponents/btn_step_forward_disabled.png"))); // NOI18N
nextPageButton.setMargin(new java.awt.Insets(2, 0, 2, 0));
nextPageButton.setPreferredSize(new java.awt.Dimension(23, 23));
- nextPageButton.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/corecomponents/btn_step_forward_hover.png"))); // NOI18N NON-NLS
+ nextPageButton.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/corecomponents/btn_step_forward_hover.png"))); // NOI18N
nextPageButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
nextPageButtonActionPerformed(evt);
@@ -174,6 +181,15 @@ public class DataContentViewerHex extends javax.swing.JPanel implements DataCont
goToPageLabel.setText(org.openide.util.NbBundle.getMessage(DataContentViewerHex.class, "DataContentViewerHex.goToPageLabel.text")); // NOI18N
+ goToOffsetLabel.setText(org.openide.util.NbBundle.getMessage(DataContentViewerHex.class, "DataContentViewerHex.goToOffsetLabel.text")); // NOI18N
+
+ goToOffsetTextField.setText(org.openide.util.NbBundle.getMessage(DataContentViewerHex.class, "DataContentViewerHex.goToOffsetTextField.text")); // NOI18N
+ goToOffsetTextField.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ goToOffsetTextFieldActionPerformed(evt);
+ }
+ });
+
javax.swing.GroupLayout hexViewerPanelLayout = new javax.swing.GroupLayout(hexViewerPanel);
hexViewerPanel.setLayout(hexViewerPanelLayout);
hexViewerPanelLayout.setHorizontalGroup(
@@ -197,8 +213,12 @@ public class DataContentViewerHex extends javax.swing.JPanel implements DataCont
.addComponent(goToPageLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(goToPageTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 79, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addContainerGap(205, Short.MAX_VALUE))
- .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 622, Short.MAX_VALUE)
+ .addGap(18, 18, 18)
+ .addComponent(goToOffsetLabel)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(goToOffsetTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 79, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+ .addComponent(jScrollPane1)
);
hexViewerPanelLayout.setVerticalGroup(
hexViewerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
@@ -213,9 +233,11 @@ public class DataContentViewerHex extends javax.swing.JPanel implements DataCont
.addComponent(nextPageButton, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(prevPageButton, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(goToPageLabel)
- .addComponent(goToPageTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
- .addGap(0, 0, 0)
- .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 388, Short.MAX_VALUE))
+ .addComponent(goToPageTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(goToOffsetLabel)
+ .addComponent(goToOffsetTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 382, Short.MAX_VALUE))
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
@@ -241,11 +263,13 @@ public class DataContentViewerHex extends javax.swing.JPanel implements DataCont
}// //GEN-END:initComponents
private void prevPageButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_prevPageButtonActionPerformed
- setDataView(currentPage - 1);
+ setDataViewByPageNumber(currentPage - 1);
+ goToPageTextField.setText(Integer.toString(currentPage));
}//GEN-LAST:event_prevPageButtonActionPerformed
private void nextPageButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_nextPageButtonActionPerformed
- setDataView(currentPage + 1);
+ setDataViewByPageNumber(currentPage + 1);
+ goToPageTextField.setText(Integer.toString(currentPage));
}//GEN-LAST:event_nextPageButtonActionPerformed
private void goToPageTextFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_goToPageTextFieldActionPerformed
@@ -267,11 +291,59 @@ public class DataContentViewerHex extends javax.swing.JPanel implements DataCont
JOptionPane.WARNING_MESSAGE);
return;
}
- setDataView(pageNumber);
+ setDataViewByPageNumber(pageNumber);
}//GEN-LAST:event_goToPageTextFieldActionPerformed
+
+ /***
+ * Calculates the offset relative to the current caret position.
+ * @param userInput the user provided signed offset value.
+ * @return returns the resultant offset value relative to the current caret
+ * position. -1L is returned if the resultant offset cannot be calculated.
+ */
+ private long getOffsetRelativeToCaretPosition(Long userInput) {
+ String userSelectedLine;
+ try {
+ // get the selected line. Extract the current hex offset location.
+ userSelectedLine = outputViewPane.getText().subSequence(
+ Utilities.getRowStart(outputViewPane, outputViewPane.getCaretPosition()),
+ Utilities.getRowEnd(outputViewPane, outputViewPane.getCaretPosition()))
+ .toString();
+ // NOTE: This needs to change if the outputFormat of outputViewPane changes.
+ String hexForUserSelectedLine = userSelectedLine.substring(0, userSelectedLine.indexOf(":"));
+
+ return Long.decode(hexForUserSelectedLine) + userInput;
+ } catch (BadLocationException | StringIndexOutOfBoundsException | NumberFormatException ex) {
+ // thrown in case the caret location is out of the range of the outputViewPane.
+ return -1L;
+ }
+ }
+
+ private void goToOffsetTextFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_goToOffsetTextFieldActionPerformed
+ long offset;
+ try {
+ if (goToOffsetTextField.getText().startsWith("+") || goToOffsetTextField.getText().startsWith("-")) {
+ offset = getOffsetRelativeToCaretPosition(Long.decode(goToOffsetTextField.getText()));
+ } else {
+ offset = Long.decode(goToOffsetTextField.getText());
+ }
+ } catch (NumberFormatException ex) {
+ // notify the user and return
+ JOptionPane.showMessageDialog(this, NbBundle.getMessage(this.getClass(), "DataContentViewerHex.goToOffsetTextField.msgDlg", goToOffsetTextField.getText()));
+ return;
+ }
+
+ if (offset >= 0) {
+ setDataViewByOffset(offset);
+ } else {
+ outputViewPane.setText(NbBundle.getMessage(DataContentViewerHex.class, "DataContentViewerHex.setDataView.invalidOffset.negativeOffsetValue"));
+ }
+ }//GEN-LAST:event_goToOffsetTextFieldActionPerformed
+
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JMenuItem copyMenuItem;
private javax.swing.JLabel currentPageLabel;
+ private javax.swing.JLabel goToOffsetLabel;
+ private javax.swing.JTextField goToOffsetTextField;
private javax.swing.JLabel goToPageLabel;
private javax.swing.JTextField goToPageTextField;
private javax.swing.JPanel hexViewerPanel;
@@ -289,26 +361,41 @@ public class DataContentViewerHex extends javax.swing.JPanel implements DataCont
/**
- * Sets the DataView (The tabbed panel)
+ * Sets the DataView (The tabbed panel) by page number
*
* @param page Page to display (1-based counting)
*/
- private void setDataView(int page) {
+ private void setDataViewByPageNumber(int page) {
if (this.dataSource == null) {
return;
}
-
if (page == 0) {
return;
}
-
currentPage = page;
long offset = (currentPage - 1) * pageLength;
-
+ setDataView(offset);
+ goToOffsetTextField.setText(Long.toString(offset));
+ }
+ /**
+ * Sets the DataView (The tabbed panel) by offset
+ *
+ * @param page Page to display (1-based counting)
+ */
+ private void setDataViewByOffset(long offset) {
+ if (this.dataSource == null) {
+ return;
+ }
+ currentPage = (int) (offset / pageLength) + 1;
+ setDataView(offset);
+ goToPageTextField.setText(Integer.toString(currentPage));
+ }
+
+ private void setDataView(long offset) {
// change the cursor to "waiting cursor" for this operation
this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
- String errorText = null;
+ String errorText = null;
int bytesRead = 0;
if (dataSource.getSize() > 0) {
@@ -316,7 +403,7 @@ public class DataContentViewerHex extends javax.swing.JPanel implements DataCont
bytesRead = dataSource.read(data, offset, pageLength); // read the data
} catch (TskException ex) {
errorText = NbBundle.getMessage(this.getClass(), "DataContentViewerHex.setDataView.errorText", offset,
- offset + pageLength);
+ offset + pageLength);
logger.log(Level.WARNING, "Error while trying to show the hex content.", ex); //NON-NLS
}
}
@@ -324,25 +411,22 @@ public class DataContentViewerHex extends javax.swing.JPanel implements DataCont
// set the data on the bottom and show it
if (bytesRead <= 0) {
errorText = NbBundle.getMessage(this.getClass(), "DataContentViewerHex.setDataView.errorText", offset,
- offset + pageLength);
+ offset + pageLength);
}
-
// disable or enable the next button
if ((errorText == null) && (currentPage < totalPages)) {
nextPageButton.setEnabled(true);
- }
- else {
+ } else {
nextPageButton.setEnabled(false);
}
if ((errorText == null) && (currentPage > 1)) {
prevPageButton.setEnabled(true);
- }
- else {
+ } else {
prevPageButton.setEnabled(false);
}
-
+
currentPageLabel.setText(Integer.toString(currentPage));
setComponentsVisibility(true); // shows the components that not needed
@@ -350,8 +434,7 @@ public class DataContentViewerHex extends javax.swing.JPanel implements DataCont
if (errorText == null) {
int showLength = bytesRead < pageLength ? bytesRead : (int) pageLength;
outputViewPane.setText(DataConversion.byteArrayToHex(data, showLength, offset));
- }
- else {
+ } else {
outputViewPane.setText(errorText);
}
@@ -379,7 +462,7 @@ public class DataContentViewerHex extends javax.swing.JPanel implements DataCont
}
totalPageLabel.setText(Integer.toString(totalPages));
- this.setDataView(1);
+ this.setDataViewByPageNumber(1);
}
@Override
@@ -423,6 +506,8 @@ public class DataContentViewerHex extends javax.swing.JPanel implements DataCont
pageLabel2.setVisible(isVisible);
goToPageTextField.setVisible(isVisible);
goToPageLabel.setVisible(isVisible);
+ goToOffsetTextField.setVisible(isVisible);
+ goToOffsetLabel.setVisible(isVisible);
}
@Override
diff --git a/Core/src/org/sleuthkit/autopsy/corecomponents/DataContentViewerMedia.java b/Core/src/org/sleuthkit/autopsy/corecomponents/DataContentViewerMedia.java
index 96f38aaae5..920cfb95cf 100644
--- a/Core/src/org/sleuthkit/autopsy/corecomponents/DataContentViewerMedia.java
+++ b/Core/src/org/sleuthkit/autopsy/corecomponents/DataContentViewerMedia.java
@@ -22,6 +22,7 @@ import java.awt.CardLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.util.Arrays;
+import static java.util.Objects.nonNull;
import java.util.Set;
import java.util.SortedSet;
import java.util.TreeSet;
@@ -33,8 +34,10 @@ import org.openide.util.lookup.ServiceProviders;
import org.sleuthkit.autopsy.corecomponentinterfaces.DataContentViewer;
import org.sleuthkit.autopsy.coreutils.ImageUtils;
import org.sleuthkit.autopsy.coreutils.Logger;
+import org.sleuthkit.autopsy.modules.filetypeid.FileTypeDetector;
import org.sleuthkit.datamodel.AbstractFile;
import org.sleuthkit.datamodel.AbstractFile.MimeMatchEnum;
+import org.sleuthkit.datamodel.TskCoreException;
import org.sleuthkit.datamodel.TskData.TSK_FS_NAME_FLAG_ENUM;
/**
@@ -51,7 +54,7 @@ public class DataContentViewerMedia extends javax.swing.JPanel implements DataCo
//UI
private final MediaViewVideoPanel videoPanel;
private final SortedSet videoExtensions; // get them from the panel
- private final SortedSet imageExtensions;
+ private final SortedSet imageExtensions;
private final SortedSet videoMimes;
private final SortedSet imageMimes;
private final MediaViewImagePanel imagePanel;
@@ -77,7 +80,7 @@ public class DataContentViewerMedia extends javax.swing.JPanel implements DataCo
imagePanelInited = imagePanel.isInited();
imageMimes = new TreeSet<>(imagePanel.getMimeTypes());
imageExtensions = new TreeSet<>(imagePanel.getExtensions());
-
+
customizeComponents();
logger.log(Level.INFO, "Created MediaView instance: " + this); //NON-NLS
}
@@ -180,56 +183,72 @@ public class DataContentViewerMedia extends javax.swing.JPanel implements DataCo
}
/**
- *
+ * is the given file a video we can display?
+ *
* @param file
- * @return True if a video file that can be displayed
+ *
+ * @return True if a video file that can be displayed
*/
private boolean isVideoSupported(AbstractFile file) {
String name = file.getName().toLowerCase();
-
- if ((containsExt(name, AUDIO_EXTENSIONS) || containsExt(name, videoExtensions)) &&
- (!videoMimes.isEmpty() && file.isMimeType(videoMimes) == MimeMatchEnum.TRUE)) {
- return true;
+
+ //TODO: is this what we want, to require both extension and mimetype support?
+ if (AUDIO_EXTENSIONS.contains("." + name) || videoExtensions.contains("." + name)) {
+ try {
+ String mimeType = new FileTypeDetector().detect(file);
+ if (nonNull(mimeType) && videoMimes.contains(mimeType)) {
+ return true;
+ }
+ } catch (FileTypeDetector.FileTypeDetectorInitException | TskCoreException ex) {
+ logger.log(Level.WARNING, "Failed to look up mimetype for " + file.getName() + " using FileTypeDetector. Fallingback on AbstractFile.isMimeType", ex);
+ if (!videoMimes.isEmpty() && file.isMimeType(videoMimes) == MimeMatchEnum.TRUE) {
+ return true;
+ }
+ }
}
return false;
}
-
+
/**
- *
+ * is the given file an image that we can display?
+ *
* @param file
- * @return True if an image file that can be displayed
+ *
+ * @return True if an image file that can be displayed
*/
private boolean isImageSupported(AbstractFile file) {
String name = file.getName().toLowerCase();
-
+
// blackboard
- if (!imageMimes.isEmpty()) {
- MimeMatchEnum mimeMatch = file.isMimeType(imageMimes);
- if (mimeMatch == MimeMatchEnum.TRUE) {
+ try {
+ String mimeType = new FileTypeDetector().detect(file);
+ if (nonNull(mimeType) && imageMimes.contains(mimeType)) {
return true;
}
- else if (mimeMatch == MimeMatchEnum.FALSE) {
- return false;
+ } catch (FileTypeDetector.FileTypeDetectorInitException | TskCoreException ex) {
+ logger.log(Level.WARNING, "Failed to look up mimetype for " + file.getName() + " using FileTypeDetector. Fallingback on AbstractFile.isMimeType", ex);
+ if (!imageMimes.isEmpty()) {
+ MimeMatchEnum mimeMatch = file.isMimeType(imageMimes);
+ if (mimeMatch == MimeMatchEnum.TRUE) {
+ return true;
+ } else if (mimeMatch == MimeMatchEnum.FALSE) {
+ return false;
+ }
}
}
-
+
// extension
- if (containsExt(name, imageExtensions)) {
+ if (imageExtensions.contains("." + name)) {
return true;
}
+
// our own signature checks for important types
- else if (ImageUtils.isJpegFileHeader(file)) {
+ if (ImageUtils.isJpegFileHeader(file)) {
return true;
}
- else if (ImageUtils.isPngFileHeader(file)) {
- return true;
- }
-
- //for gstreamer formats, check if initialized first, then
- //support audio formats, and video formats
- return false;
+ return ImageUtils.isPngFileHeader(file);
}
-
+
@Override
public boolean isSupported(Node node) {
if (node == null) {
@@ -244,15 +263,17 @@ public class DataContentViewerMedia extends javax.swing.JPanel implements DataCo
if (file.getSize() == 0) {
return false;
}
-
+
if (imagePanelInited) {
- if (isImageSupported(file))
+ if (isImageSupported(file)) {
return true;
- }
-
+ }
+ }
+
if (videoPanelInited && videoPanel.isInited()) {
- if (isVideoSupported(file))
+ if (isVideoSupported(file)) {
return true;
+ }
}
return false;
@@ -265,24 +286,13 @@ public class DataContentViewerMedia extends javax.swing.JPanel implements DataCo
if (file == null) {
return 0;
}
- String name = file.getName().toLowerCase();
+ String extension = file.getNameExtension();
boolean deleted = file.isDirNameFlagSet(TSK_FS_NAME_FLAG_ENUM.UNALLOC);
- if (containsExt(name, videoExtensions) && deleted) {
+ if (videoExtensions.contains("." + extension) && deleted) {
return 0;
- }
- else {
+ } else {
return 7;
}
-
- }
-
- private static boolean containsExt(String name, Set exts) {
- int extStart = name.lastIndexOf(".");
- String ext = "";
- if (extStart != -1) {
- ext = name.substring(extStart, name.length()).toLowerCase();
- }
- return exts.contains(ext);
}
}
diff --git a/Core/src/org/sleuthkit/autopsy/corecomponents/DataResultPanel.java b/Core/src/org/sleuthkit/autopsy/corecomponents/DataResultPanel.java
index 88d8706e71..9ba152525c 100644
--- a/Core/src/org/sleuthkit/autopsy/corecomponents/DataResultPanel.java
+++ b/Core/src/org/sleuthkit/autopsy/corecomponents/DataResultPanel.java
@@ -65,7 +65,7 @@ public class DataResultPanel extends javax.swing.JPanel implements DataResult, C
private DataContent customContentViewer;
private boolean isMain;
private String title;
- private final DummyNodeListener dummyNodeListener = new DummyNodeListener();
+ private final RootNodeListener rootNodeListener = new RootNodeListener();
private static final Logger logger = Logger.getLogger(DataResultPanel.class.getName() );
private boolean listeningToTabbedPane = false;
@@ -369,7 +369,7 @@ public class DataResultPanel extends javax.swing.JPanel implements DataResult, C
@Override
public void setNode(Node selectedNode) {
if (this.rootNode != null) {
- this.rootNode.removeNodeListener(dummyNodeListener);
+ this.rootNode.removeNodeListener(rootNodeListener);
}
// Deferring becoming a listener to the tabbed pane until this point
// eliminates handling a superfluous stateChanged event during construction.
@@ -380,8 +380,8 @@ public class DataResultPanel extends javax.swing.JPanel implements DataResult, C
this.rootNode = selectedNode;
if (this.rootNode != null) {
- dummyNodeListener.reset();
- this.rootNode.addNodeListener(dummyNodeListener);
+ rootNodeListener.reset();
+ this.rootNode.addNodeListener(rootNodeListener);
}
resetTabs(selectedNode);
@@ -620,28 +620,33 @@ public class DataResultPanel extends javax.swing.JPanel implements DataResult, C
}
}
- private class DummyNodeListener implements NodeListener {
+ private class RootNodeListener implements NodeListener {
+
+ private volatile boolean waitingForData = true;
- private volatile boolean load = true;
-
public void reset() {
- load = true;
+ waitingForData = true;
}
-
+
@Override
public void childrenAdded(final NodeMemberEvent nme) {
Node[] delta = nme.getDelta();
- if (load && containsReal(delta)) {
- load = false;
+ updateMatches();
+
+ /* There is a known issue in this code whereby we will only
+ call setupTabs() once even though childrenAdded could be
+ called multiple times. That means that each panel may not
+ have access to all of the children when they decide if they
+ support the content */
+ if (waitingForData && containsReal(delta)) {
+ waitingForData = false;
if (SwingUtilities.isEventDispatchThread()) {
setupTabs(nme.getNode());
- updateMatches();
} else {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
setupTabs(nme.getNode());
- updateMatches();
}
});
}
diff --git a/Core/src/org/sleuthkit/autopsy/coreutils/MessageNotifyUtil.java b/Core/src/org/sleuthkit/autopsy/coreutils/MessageNotifyUtil.java
index 558167c2bb..498115f310 100644
--- a/Core/src/org/sleuthkit/autopsy/coreutils/MessageNotifyUtil.java
+++ b/Core/src/org/sleuthkit/autopsy/coreutils/MessageNotifyUtil.java
@@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
- * Copyright 2013 Basis Technology Corp.
+ * Copyright 2013-2015 Basis Technology Corp.
* Contact: carrier sleuthkit org
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -20,8 +20,10 @@ package org.sleuthkit.autopsy.coreutils;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
+import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collections;
+import java.util.Date;
import java.util.List;
import java.util.logging.Level;
import javax.swing.Icon;
@@ -52,8 +54,8 @@ public class MessageNotifyUtil {
INFO(NotifyDescriptor.INFORMATION_MESSAGE, "info-icon-16.png"), //NON-NLS
ERROR(NotifyDescriptor.ERROR_MESSAGE, "error-icon-16.png"), //NON-NLS
WARNING(NotifyDescriptor.WARNING_MESSAGE, "warning-icon-16.png"); //NON-NLS
- private int notifyDescriptorType;
- private Icon icon;
+ private final int notifyDescriptorType;
+ private final Icon icon;
private MessageType(int notifyDescriptorType, String resourceName) {
this.notifyDescriptorType = notifyDescriptorType;
@@ -138,24 +140,25 @@ public class MessageNotifyUtil {
}
/**
- * Utility to display notifications with baloons
+ * Utility to display notifications with balloons
*/
public static class Notify {
+ private static final SimpleDateFormat TIME_STAMP_FORMAT = new SimpleDateFormat("MM/dd/yy HH:mm:ss z");
+
//notifications to keep track of and to reset when case is closed
private static final List notifications = Collections.synchronizedList(new ArrayList());
private Notify() {
}
-
+
/**
- * Clear pending notifications
- * Should really only be used by Case
+ * Clear pending notifications Should really only be used by Case
*/
public static void clear() {
- for (Notification n : notifications) {
+ notifications.stream().forEach((n) -> {
n.clear();
- }
+ });
notifications.clear();
}
@@ -163,8 +166,8 @@ public class MessageNotifyUtil {
* Show message with the specified type and action listener
*/
public static void show(String title, String message, MessageType type, ActionListener actionListener) {
- Notification newNotification =
- NotificationDisplayer.getDefault().notify(title, type.getIcon(), message, actionListener);
+ Notification newNotification
+ = NotificationDisplayer.getDefault().notify(addTimeStampToTitle(title), type.getIcon(), message, actionListener);
notifications.add(newNotification);
}
@@ -178,11 +181,8 @@ public class MessageNotifyUtil {
* @param type type of the message
*/
public static void show(String title, final String message, final MessageType type) {
- ActionListener actionListener = new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- MessageNotifyUtil.Message.show(message, type);
- }
+ ActionListener actionListener = (ActionEvent e) -> {
+ MessageNotifyUtil.Message.show(message, type);
};
show(title, message, type, actionListener);
@@ -217,5 +217,17 @@ public class MessageNotifyUtil {
public static void warn(String title, String message) {
show(title, message, MessageType.WARNING);
}
+
+ /**
+ * Adds a time stamp prefix to the title of notifications so that they
+ * will be in order (they are sorted alphabetically) in the
+ * notifications area.
+ *
+ * @param title A notification title without a time stamp prefix.
+ * @return The notification title with a time stamp prefix.
+ */
+ private static String addTimeStampToTitle(String title) {
+ return TIME_STAMP_FORMAT.format(new Date()) + " " + title;
+ }
}
}
diff --git a/Core/src/org/sleuthkit/autopsy/datamodel/DeletedContent.java b/Core/src/org/sleuthkit/autopsy/datamodel/DeletedContent.java
index 37f7140d37..94e46b0986 100644
--- a/Core/src/org/sleuthkit/autopsy/datamodel/DeletedContent.java
+++ b/Core/src/org/sleuthkit/autopsy/datamodel/DeletedContent.java
@@ -35,6 +35,7 @@ import org.openide.nodes.Node;
import org.openide.nodes.Sheet;
import org.openide.util.NbBundle;
import org.openide.util.lookup.Lookups;
+import org.openide.windows.WindowManager;
import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.ingest.IngestManager;
@@ -111,6 +112,7 @@ public class DeletedContent implements AutopsyVisitableItem {
private static final String NAME = NbBundle.getMessage(DeletedContent.class,
"DeletedContent.deletedContentsNode.name");
private SleuthkitCase skCase;
+
DeletedContentsNode(SleuthkitCase skCase) {
super(Children.create(new DeletedContentsChildren(skCase), true), Lookups.singleton(NAME));
@@ -151,6 +153,8 @@ public class DeletedContent implements AutopsyVisitableItem {
private SleuthkitCase skCase;
private Observable notifier;
+ // true if we have already told user that not all files will be shown
+ private static boolean maxFilesDialogShown = false;
public DeletedContentsChildren(SleuthkitCase skCase) {
this.skCase = skCase;
@@ -195,6 +199,7 @@ public class DeletedContent implements AutopsyVisitableItem {
if (evt.getNewValue() == null) {
removeListeners();
}
+ maxFilesDialogShown = false;
}
}
};
@@ -333,14 +338,19 @@ public class DeletedContent implements AutopsyVisitableItem {
List queryList = runFsQuery();
if (queryList.size() == MAX_OBJECTS) {
queryList.remove(queryList.size() - 1);
- SwingUtilities.invokeLater(new Runnable() {
- @Override
- public void run() {
- JOptionPane.showMessageDialog(null, NbBundle.getMessage(this.getClass(),
- "DeletedContent.createKeys.maxObjects.msg",
- MAX_OBJECTS - 1));
- }
- });
+
+ // only show the dialog once - not each time we refresh
+ if (maxFilesDialogShown == false) {
+ maxFilesDialogShown = true;
+ SwingUtilities.invokeLater(new Runnable() {
+ @Override
+ public void run() {
+ JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(), NbBundle.getMessage(this.getClass(),
+ "DeletedContent.createKeys.maxObjects.msg",
+ MAX_OBJECTS - 1));
+ }
+ });
+ }
}
list.addAll(queryList);
return true;
diff --git a/Core/src/org/sleuthkit/autopsy/datamodel/Tags.java b/Core/src/org/sleuthkit/autopsy/datamodel/Tags.java
index cc7958355e..5dccc5252d 100755
--- a/Core/src/org/sleuthkit/autopsy/datamodel/Tags.java
+++ b/Core/src/org/sleuthkit/autopsy/datamodel/Tags.java
@@ -35,8 +35,6 @@ import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.casemodule.services.TagsManager;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.ingest.IngestManager;
-import org.sleuthkit.autopsy.ingest.ModuleDataEvent;
-import org.sleuthkit.datamodel.BlackboardArtifact;
import org.sleuthkit.datamodel.BlackboardArtifactTag;
import org.sleuthkit.datamodel.ContentTag;
import org.sleuthkit.datamodel.TagName;
@@ -119,19 +117,14 @@ public class Tags implements AutopsyVisitableItem {
private final PropertyChangeListener pcl = new PropertyChangeListener() {
@Override
- @SuppressWarnings("deprecation")
public void propertyChange(PropertyChangeEvent evt) {
String eventType = evt.getPropertyName();
- if (eventType.equals(IngestManager.IngestModuleEvent.DATA_ADDED.toString())) {
- /* Note: this is a hack. In an ideal world, TagsManager
- * would fire events so that the directory tree would
- * refresh. But, we haven't had a chance to add that so, we
- * fire these events and the tree refreshes based on them. */
- if ((((ModuleDataEvent) evt.getOldValue()).getArtifactType() == BlackboardArtifact.ARTIFACT_TYPE.TSK_TAG_ARTIFACT)
- || ((ModuleDataEvent) evt.getOldValue()).getArtifactType() == BlackboardArtifact.ARTIFACT_TYPE.TSK_TAG_FILE) {
+ if (eventType.equals(Case.Events.BLACKBOARD_ARTIFACT_TAG_ADDED.toString())
+ || eventType.equals(Case.Events.BLACKBOARD_ARTIFACT_TAG_DELETED.toString())
+ || eventType.equals(Case.Events.CONTENT_TAG_ADDED.toString())
+ || eventType.equals(Case.Events.CONTENT_TAG_DELETED.toString())) {
refresh(true);
tagResults.update();
- }
} else if (eventType.equals(IngestManager.IngestJobEvent.COMPLETED.toString()) || eventType.equals(IngestManager.IngestJobEvent.CANCELLED.toString())) {
refresh(true);
tagResults.update();
diff --git a/Core/src/org/sleuthkit/autopsy/events/AutopsyEvent.java b/Core/src/org/sleuthkit/autopsy/events/AutopsyEvent.java
new file mode 100644
index 0000000000..fdaf727867
--- /dev/null
+++ b/Core/src/org/sleuthkit/autopsy/events/AutopsyEvent.java
@@ -0,0 +1,19 @@
+/*
+ * To change this license header, choose License Headers in Project Properties.
+ * To change this template file, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package org.sleuthkit.autopsy.events;
+
+import java.beans.PropertyChangeEvent;
+
+/**
+ * This is a place holder class to be overwritten by the version in the
+ * Collaborative branch.
+ */
+abstract class AutopsyEvent extends PropertyChangeEvent {
+
+ AutopsyEvent(Object source, String propertyName, Object oldValue, Object newValue) {
+ super(source, propertyName, oldValue, newValue);
+ }
+}
diff --git a/Core/src/org/sleuthkit/autopsy/events/BlackBoardArtifactTagAddedEvent.java b/Core/src/org/sleuthkit/autopsy/events/BlackBoardArtifactTagAddedEvent.java
new file mode 100644
index 0000000000..d50bd2237b
--- /dev/null
+++ b/Core/src/org/sleuthkit/autopsy/events/BlackBoardArtifactTagAddedEvent.java
@@ -0,0 +1,33 @@
+/*
+ * Autopsy Forensic Browser
+ *
+ * Copyright 2015 Basis Technology Corp.
+ * Contact: carrier sleuthkit 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.events;
+
+import org.sleuthkit.autopsy.casemodule.Case;
+import org.sleuthkit.datamodel.BlackboardArtifactTag;
+
+/**
+ *
+ */
+public class BlackBoardArtifactTagAddedEvent extends TagAddedEvent {
+
+ public BlackBoardArtifactTagAddedEvent(BlackboardArtifactTag newTag) {
+ super(Case.Events.BLACKBOARD_ARTIFACT_TAG_ADDED.toString(), newTag
+ );
+ }
+}
diff --git a/Core/src/org/sleuthkit/autopsy/events/BlackBoardArtifactTagDeletedEvent.java b/Core/src/org/sleuthkit/autopsy/events/BlackBoardArtifactTagDeletedEvent.java
new file mode 100644
index 0000000000..b2901ac5dc
--- /dev/null
+++ b/Core/src/org/sleuthkit/autopsy/events/BlackBoardArtifactTagDeletedEvent.java
@@ -0,0 +1,32 @@
+/*
+ * Autopsy Forensic Browser
+ *
+ * Copyright 2015 Basis Technology Corp.
+ * Contact: carrier sleuthkit 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.events;
+
+import org.sleuthkit.autopsy.casemodule.Case;
+import org.sleuthkit.datamodel.BlackboardArtifactTag;
+
+/**
+ *
+ */
+public class BlackBoardArtifactTagDeletedEvent extends TagDeletedEvent {
+
+ public BlackBoardArtifactTagDeletedEvent(BlackboardArtifactTag oldValue) {
+ super(Case.Events.BLACKBOARD_ARTIFACT_TAG_DELETED.toString(), oldValue);
+ }
+}
diff --git a/Core/src/org/sleuthkit/autopsy/events/ContentTagAddedEvent.java b/Core/src/org/sleuthkit/autopsy/events/ContentTagAddedEvent.java
new file mode 100644
index 0000000000..ffd196a4c7
--- /dev/null
+++ b/Core/src/org/sleuthkit/autopsy/events/ContentTagAddedEvent.java
@@ -0,0 +1,35 @@
+/*
+ * Autopsy Forensic Browser
+ *
+ * Copyright 2015 Basis Technology Corp.
+ * Contact: carrier sleuthkit 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.events;
+
+import javax.annotation.concurrent.Immutable;
+import org.sleuthkit.autopsy.casemodule.Case;
+import org.sleuthkit.datamodel.ContentTag;
+
+/**
+ * An event that is fired when a ContentTag is added.
+ */
+@Immutable
+public class ContentTagAddedEvent extends TagAddedEvent {
+
+ public ContentTagAddedEvent(ContentTag newTag) {
+ super(Case.Events.CONTENT_TAG_ADDED.toString(), newTag);
+ }
+
+}
diff --git a/Core/src/org/sleuthkit/autopsy/events/ContentTagDeletedEvent.java b/Core/src/org/sleuthkit/autopsy/events/ContentTagDeletedEvent.java
new file mode 100644
index 0000000000..6c6d11745f
--- /dev/null
+++ b/Core/src/org/sleuthkit/autopsy/events/ContentTagDeletedEvent.java
@@ -0,0 +1,34 @@
+/*
+ * Autopsy Forensic Browser
+ *
+ * Copyright 2015 Basis Technology Corp.
+ * Contact: carrier sleuthkit 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.events;
+
+import javax.annotation.concurrent.Immutable;
+import org.sleuthkit.autopsy.casemodule.Case;
+import org.sleuthkit.datamodel.ContentTag;
+
+/**
+ * An event that is fired when a ContentTag is deleted.
+ */
+@Immutable
+public class ContentTagDeletedEvent extends TagDeletedEvent {
+
+ public ContentTagDeletedEvent(ContentTag deletedTag) {
+ super(Case.Events.CONTENT_TAG_DELETED.toString(), deletedTag);
+ }
+}
diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/CategoryChangeEvent.java b/Core/src/org/sleuthkit/autopsy/events/TagAddedEvent.java
similarity index 59%
rename from ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/CategoryChangeEvent.java
rename to Core/src/org/sleuthkit/autopsy/events/TagAddedEvent.java
index f53acac5f5..217af496cc 100644
--- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/CategoryChangeEvent.java
+++ b/Core/src/org/sleuthkit/autopsy/events/TagAddedEvent.java
@@ -16,29 +16,31 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.sleuthkit.autopsy.imagegallery.datamodel;
+package org.sleuthkit.autopsy.events;
-import java.util.Collection;
-import java.util.Collections;
import javax.annotation.concurrent.Immutable;
+import org.sleuthkit.autopsy.casemodule.Case;
+import org.sleuthkit.datamodel.Tag;
/**
- * Event broadcast to various UI componenets when one or more files' category
- * has been changed
+ * Base Class for events that are fired when a Tag is added
*/
@Immutable
-public class CategoryChangeEvent {
+abstract class TagAddedEvent extends TagEvent {
- private final Collection ids;
+ protected TagAddedEvent(String propertyName, T newValue) {
+ super(Case.class, propertyName, null, newValue);
+ }
/**
- * @return the fileIDs of the files whose categories have changed
+ * get the Tag that was added
+ *
+ * @return the tTag
*/
- public Collection getIds() {
- return Collections.unmodifiableCollection(ids);
+ @SuppressWarnings("unchecked")
+ @Override
+ public T getTag() {
+ return (T) getNewValue();
}
- public CategoryChangeEvent(Collection ids) {
- this.ids = ids;
- }
}
diff --git a/Core/src/org/sleuthkit/autopsy/events/TagDeletedEvent.java b/Core/src/org/sleuthkit/autopsy/events/TagDeletedEvent.java
new file mode 100644
index 0000000000..6a0a1c5668
--- /dev/null
+++ b/Core/src/org/sleuthkit/autopsy/events/TagDeletedEvent.java
@@ -0,0 +1,45 @@
+/*
+ * Autopsy Forensic Browser
+ *
+ * Copyright 2015 Basis Technology Corp.
+ * Contact: carrier sleuthkit 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.events;
+
+import javax.annotation.concurrent.Immutable;
+import org.sleuthkit.autopsy.casemodule.Case;
+import org.sleuthkit.datamodel.Tag;
+
+/**
+ * Base Class for events that are fired when a Tag is deleted
+ */
+@Immutable
+abstract class TagDeletedEvent extends TagEvent {
+
+ protected TagDeletedEvent(String propertyName, T oldValue) {
+ super(Case.class, propertyName, oldValue, null);
+ }
+
+ /**
+ * get the Tag that was deleted
+ *
+ * @return the Tag
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public T getTag() {
+ return (T) getOldValue();
+ }
+}
diff --git a/Core/src/org/sleuthkit/autopsy/events/TagEvent.java b/Core/src/org/sleuthkit/autopsy/events/TagEvent.java
new file mode 100644
index 0000000000..b80725782d
--- /dev/null
+++ b/Core/src/org/sleuthkit/autopsy/events/TagEvent.java
@@ -0,0 +1,26 @@
+/*
+ * To change this license header, choose License Headers in Project Properties.
+ * To change this template file, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package org.sleuthkit.autopsy.events;
+
+import org.sleuthkit.datamodel.Tag;
+
+/**
+ *
+ */
+abstract public class TagEvent extends AutopsyEvent {
+
+ public TagEvent(Object source, String propertyName, Object oldValue, Object newValue) {
+ super(source, propertyName, oldValue, newValue);
+ }
+
+ /**
+ * get the Tag that this event is for
+ *
+ * @return the Tag
+ */
+ public abstract T getTag();
+
+}
diff --git a/Core/src/org/sleuthkit/autopsy/modules/embeddedfileextractor/Bundle.properties b/Core/src/org/sleuthkit/autopsy/modules/embeddedfileextractor/Bundle.properties
index 177f651867..c8904ee1aa 100644
--- a/Core/src/org/sleuthkit/autopsy/modules/embeddedfileextractor/Bundle.properties
+++ b/Core/src/org/sleuthkit/autopsy/modules/embeddedfileextractor/Bundle.properties
@@ -17,9 +17,9 @@ EmbeddedFileExtractorIngestModule.ArchiveExtractor.init.errInitModule.msg=Error
EmbeddedFileExtractorIngestModule.ArchiveExtractor.init.errInitModule.details=Error initializing output dir\: {0}\: {1}
EmbeddedFileExtractorIngestModule.ArchiveExtractor.init.errCantInitLib=Could not initialize 7-ZIP library\: {0}
EmbeddedFileExtractorIngestModule.ArchiveExtractor.isZipBombCheck.warnMsg=Possible ZIP bomb detected in archive\: {0}, item\: {1}
-EmbeddedFileExtractorIngestModule.ArchiveExtractor.isZipBombCheck.warnDetails=The archive item compression ratio is {0}, skipping processing of this archive item.
+EmbeddedFileExtractorIngestModule.ArchiveExtractor.isZipBombCheck.warnDetails=Compression ratio is {0}, skipping item in {1}.
EmbeddedFileExtractorIngestModule.ArchiveExtractor.unpack.warnMsg.zipBomb=Possible ZIP bomb detected\: {0}
-EmbeddedFileExtractorIngestModule.ArchiveExtractor.unpack.warnDetails.zipBomb=The archive is {0} levels deep, skipping processing of this archive and its contents
+EmbeddedFileExtractorIngestModule.ArchiveExtractor.unpack.warnDetails.zipBomb=The archive is {0} levels deep, skipping processing of {1}
EmbeddedFileExtractorIngestModule.ArchiveExtractor.unpack.unknownPath.msg=Unknown item path in archive\: {0}, will use\: {1}
EmbeddedFileExtractorIngestModule.ArchiveExtractor.unpack.notEnoughDiskSpace.msg=Not enough disk space to unpack archive item\: {0}, {1}
EmbeddedFileExtractorIngestModule.ArchiveExtractor.unpack.notEnoughDiskSpace.details=The archive item is too large to unpack, skipping unpacking this item.
diff --git a/Core/src/org/sleuthkit/autopsy/modules/embeddedfileextractor/Bundle_ja.properties b/Core/src/org/sleuthkit/autopsy/modules/embeddedfileextractor/Bundle_ja.properties
index 67303202ff..9f25567758 100644
--- a/Core/src/org/sleuthkit/autopsy/modules/embeddedfileextractor/Bundle_ja.properties
+++ b/Core/src/org/sleuthkit/autopsy/modules/embeddedfileextractor/Bundle_ja.properties
@@ -1,31 +1,31 @@
-OpenIDE-Module-Display-Category=\u30A4\u30F3\u30B8\u30A7\u30B9\u30C8\u30E2\u30B8\u30E5\u30FC\u30EB
+OpenIDE-Module-Display-Category=\u30a4\u30f3\u30b8\u30a7\u30b9\u30c8\u30e2\u30b8\u30e5\u30fc\u30eb
OpenIDE-Module-Long-Description=\
- 7Zip\u30A4\u30F3\u30B8\u30A7\u30B9\u30C8\u30E2\u30B8\u30E5\u30FC\u30EB\n\n7Zip\u30A4\u30F3\u30B8\u30A7\u30B9\u30C8\u30E2\u30B8\u30E5\u30FC\u30EB\u306F\u30A2\u30FC\u30AB\u30A4\u30D6\u30D5\u30A1\u30A4\u30EB\u3092\u51E6\u7406\u3057\u307E\u3059\uFF08zip\u30847zip\u30A8\u30AF\u30B9\u30C8\u30E9\u30AF\u30BF\u30FC\u306B\u30B5\u30DD\u30FC\u30C8\u3055\u308C\u3066\u3044\u308B\u305D\u306E\u4ED6\u306E\u30A2\u30FC\u30AB\u30A4\u30D6\u30BF\u30A4\u30D7\u306A\u3069\uFF09\u3002\n\
- \u30A2\u30FC\u30AB\u30A4\u30D6\u306E\u30B3\u30F3\u30C6\u30F3\u30C4\u306F\u62BD\u51FA\u3055\u308C\u3001\u6D3E\u751F\u30D5\u30A1\u30A4\u30EB\u306F\u8A2D\u5B9A\u3055\u308C\u305F\u30A4\u30F3\u30B8\u30A7\u30B9\u30C8\u30E2\u30B8\u30E5\u30FC\u30EB\u306B\u51E6\u7406\u3055\u308C\u308B\u305F\u3081\u3001\u73FE\u5728\u306E\u30A4\u30F3\u30B8\u30A7\u30B9\u30C8\u306B\u8FFD\u52A0\u3055\u308C\u307E\u3059\u3002\n\
- \u3082\u3057\u6D3E\u751F\u30D5\u30A1\u30A4\u30EB\u304C\u30A2\u30FC\u30AB\u30A4\u30D6\u30D5\u30A1\u30A4\u30EB\u3067\u3042\u308C\u3070\u30017Zip\u30A8\u30AF\u30B9\u30C8\u30E9\u30AF\u30BF\u30FC\u306B\u3088\u308A\u3001\u518D\u5EA6\u51E6\u7406\u3055\u308C\u307E\u3059 - \u30A8\u30AF\u30B9\u30C8\u30E9\u30AF\u30BF\u30FC\u306F\u30A2\u30FC\u30AB\u30A4\u30D6\u30D5\u30A1\u30A4\u30EB\u3092N-\u30EC\u30D9\u30EB\u306E\u6DF1\u3055\u3067\u51E6\u7406\u3057\u307E\u3059\u3002\n\n\
- \u62BD\u51FA\u3055\u308C\u305F\u30D5\u30A1\u30A4\u30EB\u306F\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u30C4\u30EA\u30FC\u3067\u30CA\u30D3\u30B2\u30FC\u30C8\u3067\u304D\u307E\u3059\u3002\n\n\
- \u3053\u306E\u30E2\u30B8\u30E5\u30FC\u30EB\u306FWindows\u3001Linux\u3001Mac\u306E\u30AA\u30DA\u30EC\u30FC\u30C6\u30A3\u30F3\u30B0\u30B7\u30B9\u30C6\u30E0\u74B0\u5883\u3092\u30B5\u30DD\u30FC\u30C8\u3057\u3066\u3044\u307E\u3059\u3002
+ 7Zip\u30a4\u30f3\u30b8\u30a7\u30b9\u30c8\u30e2\u30b8\u30e5\u30fc\u30eb\n\n7Zip\u30a4\u30f3\u30b8\u30a7\u30b9\u30c8\u30e2\u30b8\u30e5\u30fc\u30eb\u306f\u30a2\u30fc\u30ab\u30a4\u30d6\u30d5\u30a1\u30a4\u30eb\u3092\u51e6\u7406\u3057\u307e\u3059\uff08zip\u30847zip\u30a8\u30af\u30b9\u30c8\u30e9\u30af\u30bf\u30fc\u306b\u30b5\u30dd\u30fc\u30c8\u3055\u308c\u3066\u3044\u308b\u305d\u306e\u4ed6\u306e\u30a2\u30fc\u30ab\u30a4\u30d6\u30bf\u30a4\u30d7\u306a\u3069\uff09\u3002\n\
+ \u30a2\u30fc\u30ab\u30a4\u30d6\u306e\u30b3\u30f3\u30c6\u30f3\u30c4\u306f\u62bd\u51fa\u3055\u308c\u3001\u6d3e\u751f\u30d5\u30a1\u30a4\u30eb\u306f\u8a2d\u5b9a\u3055\u308c\u305f\u30a4\u30f3\u30b8\u30a7\u30b9\u30c8\u30e2\u30b8\u30e5\u30fc\u30eb\u306b\u51e6\u7406\u3055\u308c\u308b\u305f\u3081\u3001\u73fe\u5728\u306e\u30a4\u30f3\u30b8\u30a7\u30b9\u30c8\u306b\u8ffd\u52a0\u3055\u308c\u307e\u3059\u3002\n\
+ \u3082\u3057\u6d3e\u751f\u30d5\u30a1\u30a4\u30eb\u304c\u30a2\u30fc\u30ab\u30a4\u30d6\u30d5\u30a1\u30a4\u30eb\u3067\u3042\u308c\u3070\u30017Zip\u30a8\u30af\u30b9\u30c8\u30e9\u30af\u30bf\u30fc\u306b\u3088\u308a\u3001\u518d\u5ea6\u51e6\u7406\u3055\u308c\u307e\u3059 - \u30a8\u30af\u30b9\u30c8\u30e9\u30af\u30bf\u30fc\u306f\u30a2\u30fc\u30ab\u30a4\u30d6\u30d5\u30a1\u30a4\u30eb\u3092N-\u30ec\u30d9\u30eb\u306e\u6df1\u3055\u3067\u51e6\u7406\u3057\u307e\u3059\u3002\n\n\
+ \u62bd\u51fa\u3055\u308c\u305f\u30d5\u30a1\u30a4\u30eb\u306f\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u30c4\u30ea\u30fc\u3067\u30ca\u30d3\u30b2\u30fc\u30c8\u3067\u304d\u307e\u3059\u3002\n\n\
+ \u3053\u306e\u30e2\u30b8\u30e5\u30fc\u30eb\u306fWindows\u3001Linux\u3001Mac\u306e\u30aa\u30da\u30ec\u30fc\u30c6\u30a3\u30f3\u30b0\u30b7\u30b9\u30c6\u30e0\u74b0\u5883\u3092\u30b5\u30dd\u30fc\u30c8\u3057\u3066\u3044\u307e\u3059\u3002
OpenIDE-Module-Name=7Zip
-OpenIDE-Module-Short-Description=7Zip\u30A4\u30F3\u30B8\u30A7\u30B9\u30C8\u30E2\u30B8\u30E5\u30FC\u30EB
-SevenZipContentReadStream.seek.exception.invalidOrigin=\u7121\u52B9\u306A\u30B7\u30FC\u30AF\u30AA\u30EA\u30B8\u30F3\uFF1A {0}
-SevenZipContentReadStream.read.exception.errReadStream=\u30B3\u30F3\u30C6\u30F3\u30C4\u30B9\u30C8\u30EA\u30FC\u30E0\u306E\u8AAD\u307F\u53D6\u308A\u4E2D\u306B\u30A8\u30E9\u30FC\u304C\u767A\u751F\u3057\u307E\u3057\u305F\u3002
-SevenZipIngestModule.moduleName=\u30A2\u30FC\u30AB\u30A4\u30D6\u30A8\u30AF\u30B9\u30C8\u30E9\u30AF\u30BF\u30FC
-SevenZipIngestModule.moduleDesc.text=\u30A2\u30FC\u30AB\u30A4\u30D6\u30D5\u30A1\u30A4\u30EB(zip, rar, arj, 7z, gzip, bzip2, tar)\u3092\u62BD\u51FA\u3057\u3001\u73FE\u5728\u306E\u30A4\u30F3\u30B8\u30A7\u30B9\u30C8\u306B\u30EA\u30B9\u30B1\u3057\u3001\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u30C4\u30EA\u30FC\u306B\u65B0\u898F\u30D5\u30A1\u30A4\u30EB\u3092\u6295\u5165\u3057\u307E\u3059\u3002
-SevenZipIngestModule.encryptionFileLevel=\u30D5\u30A1\u30A4\u30EB\u30EC\u30D9\u30EB\u6697\u53F7\u5316
-SevenZipIngestModule.encryptionFull=\u5168\u4F53\u6697\u53F7\u5316
-SevenZipIngestModule.init.errInitModule.msg={0}\u306E\u521D\u671F\u5316\u4E2D\u306B\u30A8\u30E9\u30FC\u304C\u767A\u751F\u3057\u307E\u3057\u305F
-SevenZipIngestModule.init.errInitModule.details=\u30A2\u30A6\u30C8\u30D7\u30C3\u30C8\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\: {0}\: {1}\u306E\u521D\u671F\u5316\u4E2D\u306B\u30A8\u30E9\u30FC\u304C\u767A\u751F\u3057\u307E\u3057\u305F
-SevenZipIngestModule.init.errCantInitLib=7-Zip\u30E9\u30A4\u30D6\u30E9\u30EA\: {0}\u3092\u521D\u671F\u5316\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F
-SevenZipIngestModule.isZipBombCheck.warnMsg=Zip\u7206\u5F3E\u306E\u53EF\u80FD\u6027\u304C\u3042\u308B\u3082\u306E\u304C\u30A2\u30FC\u30AB\u30A4\u30D6\: {0}, item\: {1}\u306B\u691C\u51FA\u3055\u308C\u307E\u3057\u305F
-SevenZipIngestModule.isZipBombCheck.warnDetails=\u30A2\u30FC\u30AB\u30A4\u30D6\u30A2\u30A4\u30C6\u30E0\u306E\u5727\u7E2E\u7387\u306F{0}\u3001\u3053\u306E\u30A2\u30FC\u30AB\u30A4\u30D6\u30A2\u30A4\u30C6\u30E0\u306E\u51E6\u7406\u3092\u30B9\u30AD\u30C3\u30D7\u3057\u307E\u3059\u3002
-SevenZipIngestModule.unpack.warnMsg.zipBomb=Zip\u7206\u5F3E\u306E\u53EF\u80FD\u6027\u304C\u3042\u308B\u3082\u306E\u304C\u691C\u51FA\u3055\u308C\u307E\u3057\u305F\uFF1A {0}
-SevenZipIngestModule.unpack.warnDetails.zipBomb=\u30A2\u30FC\u30AB\u30A4\u30D6\u306F {0}\u30EC\u30D9\u30EB\u306E\u6DF1\u3055\u3067\u3059\u3001\u3053\u306E\u30A2\u30FC\u30AB\u30A4\u30D6\u3068\u305D\u306E\u30B3\u30F3\u30C6\u30F3\u30C4\u306E\u51E6\u7406\u3092\u30B9\u30AD\u30C3\u30D7\u3057\u307E\u3059
-SevenZipIngestModule.unpack.unknownPath.msg=\u30A2\u30FC\u30AB\u30A4\u30D6\: {0}\u306B\u4E0D\u660E\u306E\u30A2\u30A4\u30C6\u30E0\u30D1\u30B9\u304C\u5B58\u5728\u3057\u307E\u3059\u3001{1}\u3092\u4F7F\u7528\u3057\u307E\u3059
-SevenZipIngestModule.unpack.notEnoughDiskSpace.msg=\u30A2\u30FC\u30AB\u30A4\u30D6\u30A2\u30A4\u30C6\u30E0\: {0}, {1}\u3092\u89E3\u51CD\u3059\u308B\u306E\u306B\u5341\u5206\u306A\u30C7\u30A3\u30B9\u30AF\u30B9\u30DA\u30FC\u30B9\u304C\u3042\u308A\u307E\u305B\u3093
-SevenZipIngestModule.unpack.notEnoughDiskSpace.details=\u30A2\u30FC\u30AB\u30A4\u30D6\u30A2\u30A4\u30C6\u30E0\u306F\u89E3\u51CD\u3059\u308B\u306E\u306B\u5927\u304D\u3059\u304E\u307E\u3059\u3001\u3053\u306E\u30A2\u30A4\u30C6\u30E0\u306E\u89E3\u51CD\u3092\u30B9\u30AD\u30C3\u30D7\u3057\u307E\u3059\u3002
-SevenZipIngestModule.unpack.errUnpacking.msg={0}\u89E3\u51CD\u30A8\u30E9\u30FC
-SevenZipIngestModule.unpack.errUnpacking.details={0}. {1}\u306E\u89E3\u51CD\u4E2D\u306B\u30A8\u30E9\u30FC\u304C\u767A\u751F\u3057\u307E\u3057\u305F
-SevenZipIngestModule.unpack.encrFileDetected.msg=\u30A2\u30FC\u30AB\u30A4\u30D6\u306B\u6697\u53F7\u5316\u30D5\u30A1\u30A4\u30EB\u304C\u691C\u51FA\u3055\u308C\u307E\u3057\u305F\u3002
-SevenZipIngestModule.unpack.encrFileDetected.details=\u30A2\u30FC\u30AB\u30A4\u30D6\: {0}\u306E\u4E00\u90E8\u306E\u30D5\u30A1\u30A4\u30EB\u304C\u6697\u53F7\u5316\u3055\u308C\u3066\u3044\u307E\u3059\u3002{1}\u30A8\u30AF\u30B9\u30C8\u30E9\u30AF\u30BF\u30FC\u306F\u3053\u306E\u30A2\u30FC\u30AB\u30A4\u30D6\u304B\u3089\u5168\u3066\u306E\u30D5\u30A1\u30A4\u30EB\u306F\u62BD\u51FA\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\u3002
-SevenZipIngestModule.UnpackStream.write.exception.msg=\u89E3\u51CD\u3057\u305F\u30D5\u30A1\u30A4\u30EB\u306E\u4E0B\u8A18\u3078\u306E\u66F8\u304D\u8FBC\u307F\u4E2D\u306B\u30A8\u30E9\u30FC\u304C\u767A\u751F\u3057\u307E\u3057\u305F\: {0}
-SevenZipIngestModule.UnpackedTree.exception.msg=\u6D3E\u751F\u30D5\u30A1\u30A4\u30EB\u3092\u30C7\u30FC\u30BF\u30D9\u30FC\u30B9\:{0}\u306B\u8FFD\u52A0\u4E2D\u306B\u30A8\u30E9\u30FC\u304C\u767A\u751F\u3057\u307E\u3057\u305F
\ No newline at end of file
+OpenIDE-Module-Short-Description=7Zip\u30a4\u30f3\u30b8\u30a7\u30b9\u30c8\u30e2\u30b8\u30e5\u30fc\u30eb
+SevenZipContentReadStream.seek.exception.invalidOrigin=\u7121\u52b9\u306a\u30b7\u30fc\u30af\u30aa\u30ea\u30b8\u30f3\uff1a {0}
+SevenZipContentReadStream.read.exception.errReadStream=\u30b3\u30f3\u30c6\u30f3\u30c4\u30b9\u30c8\u30ea\u30fc\u30e0\u306e\u8aad\u307f\u53d6\u308a\u4e2d\u306b\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u307e\u3057\u305f\u3002
+SevenZipIngestModule.moduleName=\u30a2\u30fc\u30ab\u30a4\u30d6\u30a8\u30af\u30b9\u30c8\u30e9\u30af\u30bf\u30fc
+SevenZipIngestModule.moduleDesc.text=\u30a2\u30fc\u30ab\u30a4\u30d6\u30d5\u30a1\u30a4\u30eb(zip, rar, arj, 7z, gzip, bzip2, tar)\u3092\u62bd\u51fa\u3057\u3001\u73fe\u5728\u306e\u30a4\u30f3\u30b8\u30a7\u30b9\u30c8\u306b\u30ea\u30b9\u30b1\u3057\u3001\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u30c4\u30ea\u30fc\u306b\u65b0\u898f\u30d5\u30a1\u30a4\u30eb\u3092\u6295\u5165\u3057\u307e\u3059\u3002
+SevenZipIngestModule.encryptionFileLevel=\u30d5\u30a1\u30a4\u30eb\u30ec\u30d9\u30eb\u6697\u53f7\u5316
+SevenZipIngestModule.encryptionFull=\u5168\u4f53\u6697\u53f7\u5316
+SevenZipIngestModule.init.errInitModule.msg={0}\u306e\u521d\u671f\u5316\u4e2d\u306b\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u307e\u3057\u305f
+SevenZipIngestModule.init.errInitModule.details=\u30a2\u30a6\u30c8\u30d7\u30c3\u30c8\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\: {0}\: {1}\u306e\u521d\u671f\u5316\u4e2d\u306b\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u307e\u3057\u305f
+SevenZipIngestModule.init.errCantInitLib=7-Zip\u30e9\u30a4\u30d6\u30e9\u30ea\: {0}\u3092\u521d\u671f\u5316\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f
+SevenZipIngestModule.isZipBombCheck.warnMsg=Zip\u7206\u5f3e\u306e\u53ef\u80fd\u6027\u304c\u3042\u308b\u3082\u306e\u304c\u30a2\u30fc\u30ab\u30a4\u30d6\: {0}, item\: {1}\u306b\u691c\u51fa\u3055\u308c\u307e\u3057\u305f
+SevenZipIngestModule.isZipBombCheck.warnDetails=\u30a2\u30fc\u30ab\u30a4\u30d6\u30a2\u30a4\u30c6\u30e0\u306e\u5727\u7e2e\u7387\u306f{0}\u3001\u3053\u306e\u30a2\u30fc\u30ab\u30a4\u30d6\u30a2\u30a4\u30c6\u30e0\u306e\u51e6\u7406\u3092\u30b9\u30ad\u30c3\u30d7\u3057\u307e\u3059\u3002{1}
+SevenZipIngestModule.unpack.warnMsg.zipBomb=Zip\u7206\u5f3e\u306e\u53ef\u80fd\u6027\u304c\u3042\u308b\u3082\u306e\u304c\u691c\u51fa\u3055\u308c\u307e\u3057\u305f\uff1a {0}
+SevenZipIngestModule.unpack.warnDetails.zipBomb=\u30a2\u30fc\u30ab\u30a4\u30d6\u306f {0}\u30ec\u30d9\u30eb\u306e\u6df1\u3055\u3067\u3059\u3001\u3053\u306e\u30a2\u30fc\u30ab\u30a4\u30d6\u3068\u305d\u306e\u30b3\u30f3\u30c6\u30f3\u30c4\u306e\u51e6\u7406\u3092\u30b9\u30ad\u30c3\u30d7\u3057\u307e\u3059 {1}
+SevenZipIngestModule.unpack.unknownPath.msg=\u30a2\u30fc\u30ab\u30a4\u30d6\: {0}\u306b\u4e0d\u660e\u306e\u30a2\u30a4\u30c6\u30e0\u30d1\u30b9\u304c\u5b58\u5728\u3057\u307e\u3059\u3001{1}\u3092\u4f7f\u7528\u3057\u307e\u3059
+SevenZipIngestModule.unpack.notEnoughDiskSpace.msg=\u30a2\u30fc\u30ab\u30a4\u30d6\u30a2\u30a4\u30c6\u30e0\: {0}, {1}\u3092\u89e3\u51cd\u3059\u308b\u306e\u306b\u5341\u5206\u306a\u30c7\u30a3\u30b9\u30af\u30b9\u30da\u30fc\u30b9\u304c\u3042\u308a\u307e\u305b\u3093
+SevenZipIngestModule.unpack.notEnoughDiskSpace.details=\u30a2\u30fc\u30ab\u30a4\u30d6\u30a2\u30a4\u30c6\u30e0\u306f\u89e3\u51cd\u3059\u308b\u306e\u306b\u5927\u304d\u3059\u304e\u307e\u3059\u3001\u3053\u306e\u30a2\u30a4\u30c6\u30e0\u306e\u89e3\u51cd\u3092\u30b9\u30ad\u30c3\u30d7\u3057\u307e\u3059\u3002
+SevenZipIngestModule.unpack.errUnpacking.msg={0}\u89e3\u51cd\u30a8\u30e9\u30fc
+SevenZipIngestModule.unpack.errUnpacking.details={0}. {1}\u306e\u89e3\u51cd\u4e2d\u306b\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u307e\u3057\u305f
+SevenZipIngestModule.unpack.encrFileDetected.msg=\u30a2\u30fc\u30ab\u30a4\u30d6\u306b\u6697\u53f7\u5316\u30d5\u30a1\u30a4\u30eb\u304c\u691c\u51fa\u3055\u308c\u307e\u3057\u305f\u3002
+SevenZipIngestModule.unpack.encrFileDetected.details=\u30a2\u30fc\u30ab\u30a4\u30d6\: {0}\u306e\u4e00\u90e8\u306e\u30d5\u30a1\u30a4\u30eb\u304c\u6697\u53f7\u5316\u3055\u308c\u3066\u3044\u307e\u3059\u3002{1}\u30a8\u30af\u30b9\u30c8\u30e9\u30af\u30bf\u30fc\u306f\u3053\u306e\u30a2\u30fc\u30ab\u30a4\u30d6\u304b\u3089\u5168\u3066\u306e\u30d5\u30a1\u30a4\u30eb\u306f\u62bd\u51fa\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002
+SevenZipIngestModule.UnpackStream.write.exception.msg=\u89e3\u51cd\u3057\u305f\u30d5\u30a1\u30a4\u30eb\u306e\u4e0b\u8a18\u3078\u306e\u66f8\u304d\u8fbc\u307f\u4e2d\u306b\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u307e\u3057\u305f\: {0}
+SevenZipIngestModule.UnpackedTree.exception.msg=\u6d3e\u751f\u30d5\u30a1\u30a4\u30eb\u3092\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\:{0}\u306b\u8ffd\u52a0\u4e2d\u306b\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u307e\u3057\u305f
\ No newline at end of file
diff --git a/Core/src/org/sleuthkit/autopsy/modules/embeddedfileextractor/SevenZipExtractor.java b/Core/src/org/sleuthkit/autopsy/modules/embeddedfileextractor/SevenZipExtractor.java
index 953d138fb7..ad34ef2611 100755
--- a/Core/src/org/sleuthkit/autopsy/modules/embeddedfileextractor/SevenZipExtractor.java
+++ b/Core/src/org/sleuthkit/autopsy/modules/embeddedfileextractor/SevenZipExtractor.java
@@ -40,6 +40,7 @@ import net.sf.sevenzipjbinding.simple.ISimpleInArchive;
import net.sf.sevenzipjbinding.simple.ISimpleInArchiveItem;
import org.netbeans.api.progress.ProgressHandle;
import org.netbeans.api.progress.ProgressHandleFactory;
+import org.openide.util.Exceptions;
import org.openide.util.NbBundle;
import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.casemodule.services.FileManager;
@@ -178,7 +179,7 @@ class SevenZipExtractor {
* @param archiveFileItem the archive item
* @return true if potential zip bomb, false otherwise
*/
- private boolean isZipBombArchiveItemCheck(String archiveName, ISimpleInArchiveItem archiveFileItem) {
+ private boolean isZipBombArchiveItemCheck(AbstractFile archiveFile, ISimpleInArchiveItem archiveFileItem) {
try {
final Long archiveItemSize = archiveFileItem.getSize();
@@ -190,19 +191,25 @@ class SevenZipExtractor {
final Long archiveItemPackedSize = archiveFileItem.getPackedSize();
if (archiveItemPackedSize == null || archiveItemPackedSize <= 0) {
- logger.log(Level.WARNING, "Cannot getting compression ratio, cannot detect if zipbomb: {0}, item: {1}", new Object[]{archiveName, archiveFileItem.getPath()}); //NON-NLS
+ logger.log(Level.WARNING, "Cannot getting compression ratio, cannot detect if zipbomb: {0}, item: {1}", new Object[]{archiveFile.getName(), archiveFileItem.getPath()}); //NON-NLS
return false;
}
-
+
int cRatio = (int) (archiveItemSize / archiveItemPackedSize);
if (cRatio >= MAX_COMPRESSION_RATIO) {
String itemName = archiveFileItem.getPath();
logger.log(Level.INFO, "Possible zip bomb detected, compression ration: {0} for in archive item: {1}", new Object[]{cRatio, itemName}); //NON-NLS
String msg = NbBundle.getMessage(this.getClass(),
- "EmbeddedFileExtractorIngestModule.ArchiveExtractor.isZipBombCheck.warnMsg", archiveName, itemName);
+ "EmbeddedFileExtractorIngestModule.ArchiveExtractor.isZipBombCheck.warnMsg", archiveFile.getName(), itemName);
+ String path;
+ try {
+ path = archiveFile.getUniquePath();
+ } catch (TskCoreException ex) {
+ path = archiveFile.getParentPath() + archiveFile.getName();
+ }
String details = NbBundle.getMessage(this.getClass(),
- "EmbeddedFileExtractorIngestModule.ArchiveExtractor.isZipBombCheck.warnDetails", cRatio);
+ "EmbeddedFileExtractorIngestModule.ArchiveExtractor.isZipBombCheck.warnDetails", cRatio, path);
//MessageNotifyUtil.Notify.error(msg, details);
services.postMessage(IngestMessage.createWarningMessage(EmbeddedFileExtractorModuleFactory.getModuleName(), msg, details));
return true;
@@ -269,20 +276,28 @@ class SevenZipExtractor {
* @return list of unpacked derived files
*/
void unpack(AbstractFile archiveFile) {
+ String archiveFilePath;
+ try {
+ archiveFilePath = archiveFile.getUniquePath();
+ } catch (TskCoreException ex) {
+ archiveFilePath = archiveFile.getParentPath() + archiveFile.getName();
+ }
+
//check if already has derived files, skip
try {
if (archiveFile.hasChildren()) {
//check if local unpacked dir exists
if (new File(EmbeddedFileExtractorIngestModule.getUniqueName(archiveFile)).exists()) {
- logger.log(Level.INFO, "File already has been processed as it has children and local unpacked file, skipping: {0}", archiveFile.getName()); //NON-NLS
+ logger.log(Level.INFO, "File already has been processed as it has children and local unpacked file, skipping: {0}", archiveFilePath); //NON-NLS
return;
}
}
} catch (TskCoreException e) {
- logger.log(Level.INFO, "Error checking if file already has been processed, skipping: {0}", archiveFile.getName()); //NON-NLS
+ logger.log(Level.INFO, "Error checking if file already has been processed, skipping: {0}", archiveFilePath); //NON-NLS
return;
}
-
+
+
List unpackedFiles = Collections.emptyList();
//recursion depth check for zip bomb
@@ -295,7 +310,7 @@ class SevenZipExtractor {
"EmbeddedFileExtractorIngestModule.ArchiveExtractor.unpack.warnMsg.zipBomb", archiveFile.getName());
String details = NbBundle.getMessage(this.getClass(),
"EmbeddedFileExtractorIngestModule.ArchiveExtractor.unpack.warnDetails.zipBomb",
- parentAr.getDepth());
+ parentAr.getDepth(), archiveFilePath);
//MessageNotifyUtil.Notify.error(msg, details);
services.postMessage(IngestMessage.createWarningMessage(EmbeddedFileExtractorModuleFactory.getModuleName(), msg, details));
return;
@@ -322,7 +337,7 @@ class SevenZipExtractor {
inArchive = SevenZip.openInArchive(options, stream);
int numItems = inArchive.getNumberOfItems();
- logger.log(Level.INFO, "Count of items in archive: {0}: {1}", new Object[]{archiveFile.getName(), numItems}); //NON-NLS
+ logger.log(Level.INFO, "Count of items in archive: {0}: {1}", new Object[]{archiveFilePath, numItems}); //NON-NLS
progress.start(numItems);
progressStarted = true;
@@ -381,7 +396,7 @@ class SevenZipExtractor {
}
String msg = NbBundle.getMessage(this.getClass(), "EmbeddedFileExtractorIngestModule.ArchiveExtractor.unpack.unknownPath.msg",
- archiveFile.getName(), pathInArchive);
+ archiveFilePath, pathInArchive);
logger.log(Level.WARNING, msg);
}
@@ -389,7 +404,7 @@ class SevenZipExtractor {
logger.log(Level.INFO, "Extracted item path: {0}", pathInArchive); //NON-NLS
//check if possible zip bomb
- if (isZipBombArchiveItemCheck(archiveFile.getName(), item)) {
+ if (isZipBombArchiveItemCheck(archiveFile, item)) {
continue; //skip the item
}
@@ -428,12 +443,12 @@ class SevenZipExtractor {
if (newDiskSpace < MIN_FREE_DISK_SPACE) {
String msg = NbBundle.getMessage(this.getClass(),
"EmbeddedFileExtractorIngestModule.ArchiveExtractor.unpack.notEnoughDiskSpace.msg",
- archiveFile.getName(), fileName);
+ archiveFilePath, fileName);
String details = NbBundle.getMessage(this.getClass(),
"EmbeddedFileExtractorIngestModule.ArchiveExtractor.unpack.notEnoughDiskSpace.details");
//MessageNotifyUtil.Notify.error(msg, details);
services.postMessage(IngestMessage.createErrorMessage(EmbeddedFileExtractorModuleFactory.getModuleName(), msg, details));
- logger.log(Level.INFO, "Skipping archive item due to insufficient disk space: {0}, {1}", new Object[]{archiveFile.getUniquePath(), fileName}); //NON-NLS
+ logger.log(Level.INFO, "Skipping archive item due to insufficient disk space: {0}, {1}", new Object[]{archiveFilePath, fileName}); //NON-NLS
logger.log(Level.INFO, "Available disk space: {0}", new Object[]{freeDiskSpace}); //NON-NLS
continue; //skip this file
} else {
@@ -523,23 +538,17 @@ class SevenZipExtractor {
//TODO decide if anything to cleanup, for now bailing
}
- } catch (SevenZipException | TskCoreException ex) {
+ } catch (SevenZipException ex) {
logger.log(Level.SEVERE, "Error unpacking file: " + archiveFile, ex); //NON-NLS
//inbox message
- String fullName;
- try {
- fullName = archiveFile.getUniquePath();
- } catch (TskCoreException ex1) {
- fullName = archiveFile.getName();
- }
-
+
// print a message if the file is allocated
if (archiveFile.isMetaFlagSet(TskData.TSK_FS_META_FLAG_ENUM.ALLOC)) {
String msg = NbBundle.getMessage(this.getClass(), "EmbeddedFileExtractorIngestModule.ArchiveExtractor.unpack.errUnpacking.msg",
archiveFile.getName());
String details = NbBundle.getMessage(this.getClass(),
"EmbeddedFileExtractorIngestModule.ArchiveExtractor.unpack.errUnpacking.details",
- fullName, ex.getMessage());
+ archiveFilePath, ex.getMessage());
services.postMessage(IngestMessage.createErrorMessage(EmbeddedFileExtractorModuleFactory.getModuleName(), msg, details));
}
} finally {
@@ -573,7 +582,7 @@ class SevenZipExtractor {
artifact.addAttribute(new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_NAME.getTypeID(), EmbeddedFileExtractorModuleFactory.getModuleName(), encryptionType));
services.fireModuleDataEvent(new ModuleDataEvent(EmbeddedFileExtractorModuleFactory.getModuleName(), BlackboardArtifact.ARTIFACT_TYPE.TSK_ENCRYPTION_DETECTED));
} catch (TskCoreException ex) {
- logger.log(Level.SEVERE, "Error creating blackboard artifact for encryption detected for file: " + archiveFile, ex); //NON-NLS
+ logger.log(Level.SEVERE, "Error creating blackboard artifact for encryption detected for file: " + archiveFilePath, ex); //NON-NLS
}
String msg = NbBundle.getMessage(this.getClass(), "EmbeddedFileExtractorIngestModule.ArchiveExtractor.unpack.encrFileDetected.msg");
diff --git a/Core/src/org/sleuthkit/autopsy/modules/photoreccarver/Bundle.properties b/Core/src/org/sleuthkit/autopsy/modules/photoreccarver/Bundle.properties
index b9a9d6c609..41acbcf61d 100755
--- a/Core/src/org/sleuthkit/autopsy/modules/photoreccarver/Bundle.properties
+++ b/Core/src/org/sleuthkit/autopsy/modules/photoreccarver/Bundle.properties
@@ -3,10 +3,14 @@ OpenIDE-Module-Display-Category=Ingest Module
OpenIDE-Module-Long-Description=PhotoRec Carver ingest module. \n\n Carves unallocated space and feeds the resulting carved files back into the system for processing.
OpenIDE-Module-Short-Description=Carves unallocated space and feeds carved files back into the system for processing.
moduleDisplayName.text=PhotoRec Carver
-moduleDescription.text=Runs PhotoRec carver against unallocated space on the system.
+moduleDescription.text=Runs PhotoRec carver against unallocated space in the data source.
-unallocatedSpaceProcessingSettingsError.message="Process Unallocated Space" is not checked. This module is designed to carve unallocated space. Either allow processing of unallocated space, or do not use this module.
-unsupportedOS.message=Module is not supported for other than Windows platforms
-missingExecutable.message=Unable to locate unallocated carver executable.
-cannotRunExecutable.message=Unable to execute unallocated carver
+unallocatedSpaceProcessingSettingsError.message="Process Unallocated Space" is not checked. The PhotoRec module is designed to carve unallocated space. Either enable processing of unallocated space or disable this module.
+unsupportedOS.message=PhotoRec Module is supported only on Windows platforms
+missingExecutable.message=Unable to locate PhotoRec executable.
+cannotRunExecutable.message=Unable to execute PhotoRec
cannotCreateOutputDir.message=Unable to create output directory: {0}
+PhotoRecIngestModule.processTerminated=PhotoRec Carver ingest module was terminated due to exceeding max allowable run time when scanning
+PhotoRecIngestModule.moduleError=PhotoRec Carver Module Error
+PhotoRecIngestModule.UnableToCarve=Unable to carve file: {0}
+PhotoRecIngestModule.NotEnoughDiskSpace=Not enough disk space to save unallocated file. Carving will be skipped.
\ No newline at end of file
diff --git a/Core/src/org/sleuthkit/autopsy/modules/photoreccarver/PhotoRecCarverFileIngestModule.java b/Core/src/org/sleuthkit/autopsy/modules/photoreccarver/PhotoRecCarverFileIngestModule.java
index ec4beae595..f168d20e84 100755
--- a/Core/src/org/sleuthkit/autopsy/modules/photoreccarver/PhotoRecCarverFileIngestModule.java
+++ b/Core/src/org/sleuthkit/autopsy/modules/photoreccarver/PhotoRecCarverFileIngestModule.java
@@ -26,10 +26,10 @@ import java.nio.file.FileAlreadyExistsException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
-import java.text.SimpleDateFormat;
-import java.util.Date;
import java.text.DateFormat;
+import java.text.SimpleDateFormat;
import java.util.ArrayList;
+import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
@@ -38,12 +38,18 @@ import org.openide.modules.InstalledFileLocator;
import org.openide.util.NbBundle;
import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.coreutils.ExecUtil;
+import org.sleuthkit.autopsy.coreutils.FileUtil;
import org.sleuthkit.autopsy.coreutils.Logger;
+import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil;
+import org.sleuthkit.autopsy.coreutils.PlatformUtil;
import org.sleuthkit.autopsy.datamodel.ContentUtils;
import org.sleuthkit.autopsy.ingest.FileIngestModule;
+import org.sleuthkit.autopsy.ingest.FileIngestModuleProcessTerminator;
import org.sleuthkit.autopsy.ingest.IngestJobContext;
import org.sleuthkit.autopsy.ingest.IngestModule;
import org.sleuthkit.autopsy.ingest.IngestModuleReferenceCounter;
+import org.sleuthkit.autopsy.ingest.IngestServices;
+import org.sleuthkit.autopsy.ingest.ModuleContentEvent;
import org.sleuthkit.datamodel.AbstractFile;
import org.sleuthkit.datamodel.Content;
import org.sleuthkit.datamodel.Image;
@@ -51,10 +57,6 @@ import org.sleuthkit.datamodel.LayoutFile;
import org.sleuthkit.datamodel.TskCoreException;
import org.sleuthkit.datamodel.TskData;
import org.sleuthkit.datamodel.Volume;
-import org.sleuthkit.autopsy.coreutils.FileUtil;
-import org.sleuthkit.autopsy.coreutils.PlatformUtil;
-import org.sleuthkit.autopsy.ingest.FileIngestModuleProcessTerminator;
-import org.sleuthkit.autopsy.ingest.IngestServices;
/**
* A file ingest module that runs the Unallocated Carver executable with unallocated space files as input.
@@ -74,6 +76,7 @@ final class PhotoRecCarverFileIngestModule implements FileIngestModule {
private IngestJobContext context;
private Path rootOutputDirPath;
private File executableFile;
+ private IngestServices services;
/**
* @inheritDoc
@@ -81,6 +84,7 @@ final class PhotoRecCarverFileIngestModule implements FileIngestModule {
@Override
public void startUp(IngestJobContext context) throws IngestModule.IngestModuleException {
this.context = context;
+ this.services = IngestServices.getInstance();
// If the global unallocated space processing setting and the module
// process unallocated space only setting are not in sych, throw an
@@ -143,9 +147,15 @@ final class PhotoRecCarverFileIngestModule implements FileIngestModule {
// Check that we have roughly enough disk space left to complete the operation
long freeDiskSpace = IngestServices.getInstance().getFreeDiskSpace();
- if ((file.getSize() * 2) > freeDiskSpace) {
- logger.log(Level.SEVERE, "PhotoRec error processing {0} with {1} Not enough space on primary disk to carve unallocated space.", // NON-NLS
+ // Some network drives always return -1 for free disk space.
+ // In this case, expect enough space and move on.
+
+ if ((freeDiskSpace != -1) && ((file.getSize() * 1.2) > freeDiskSpace)) {
+ logger.log(Level.SEVERE, "PhotoRec error processing {0} with {1} Not enough space on primary disk to save unallocated space.", // NON-NLS
new Object[]{file.getName(), PhotoRecCarverIngestModuleFactory.getModuleName()}); // NON-NLS
+ MessageNotifyUtil.Notify.error(NbBundle.getMessage(this.getClass(), "PhotoRecIngestModule.UnableToCarve", file.getName()),
+ NbBundle.getMessage(this.getClass(), "PhotoRecIngestModule.NotEnoughDiskSpace"));
+
return IngestModule.ProcessResult.ERROR;
}
@@ -177,22 +187,12 @@ final class PhotoRecCarverFileIngestModule implements FileIngestModule {
if (this.context.fileIngestIsCancelled() == true) {
// if it was cancelled by the user, result is OK
- // cleanup the output path
- FileUtil.deleteDir(new File(outputDirPath.toString()));
- if (null != tempFilePath && Files.exists(tempFilePath)) {
- tempFilePath.toFile().delete();
- }
+ cleanup(outputDirPath, tempFilePath);
logger.log(Level.INFO, "PhotoRec cancelled by user"); // NON-NLS
return IngestModule.ProcessResult.OK;
- }
-
- else if (0 != exitValue) {
+ } else if (0 != exitValue) {
// if it failed or was cancelled by timeout, result is ERROR
- // cleanup the output path
- FileUtil.deleteDir(new File(outputDirPath.toString()));
- if (null != tempFilePath && Files.exists(tempFilePath)) {
- tempFilePath.toFile().delete();
- }
+ cleanup(outputDirPath, tempFilePath);
logger.log(Level.SEVERE, "PhotoRec carver returned error exit value = {0} when scanning {1}", // NON-NLS
new Object[]{exitValue, file.getName()}); // NON-NLS
return IngestModule.ProcessResult.ERROR;
@@ -217,6 +217,7 @@ final class PhotoRecCarverFileIngestModule implements FileIngestModule {
List theList = parser.parse(newAuditFile, id, file);
if (theList != null) { // if there were any results from carving, add the unallocated carving event to the reports list.
context.addFilesToJob(new ArrayList<>(theList));
+ services.fireModuleContentEvent(new ModuleContentEvent(theList.get(0))); // fire an event to update the tree
}
}
catch (IOException ex) {
@@ -233,6 +234,15 @@ final class PhotoRecCarverFileIngestModule implements FileIngestModule {
return IngestModule.ProcessResult.OK;
}
+
+ private void cleanup(Path outputDirPath, Path tempFilePath) {
+ // cleanup the output path
+ FileUtil.deleteDir(new File(outputDirPath.toString()));
+ if (null != tempFilePath && Files.exists(tempFilePath)) {
+ tempFilePath.toFile().delete();
+ }
+ }
+
/**
* @inheritDoc
diff --git a/Core/src/org/sleuthkit/autopsy/python/JythonModuleLoader.java b/Core/src/org/sleuthkit/autopsy/python/JythonModuleLoader.java
index c0c1e970b8..fe2e9d66f2 100755
--- a/Core/src/org/sleuthkit/autopsy/python/JythonModuleLoader.java
+++ b/Core/src/org/sleuthkit/autopsy/python/JythonModuleLoader.java
@@ -120,7 +120,7 @@ public final class JythonModuleLoader {
interpreter.exec("import sys"); //NON-NLS
String path = Matcher.quoteReplacement(script.getParent());
interpreter.exec("sys.path.append('" + path + "')"); //NON-NLS
- String moduleName = script.getName().replaceAll(".py", ""); //NON-NLS
+ String moduleName = script.getName().replaceAll("\\.py$", ""); //NON-NLS
// reload the module so that the changes made to it can be loaded.
interpreter.exec("import " + moduleName); //NON-NLS
diff --git a/CoreLibs/ivy.xml b/CoreLibs/ivy.xml
index a4cc0075e7..cc7b7312ec 100644
--- a/CoreLibs/ivy.xml
+++ b/CoreLibs/ivy.xml
@@ -38,7 +38,6 @@
-
diff --git a/CoreLibs/nbproject/project.xml b/CoreLibs/nbproject/project.xml
index a76fed8a8f..9d02b18dc2 100644
--- a/CoreLibs/nbproject/project.xml
+++ b/CoreLibs/nbproject/project.xml
@@ -64,7 +64,6 @@
com.sun.mail.smtpcom.sun.mail.utilcom.sun.mail.util.logging
- javafx.scene.controljavassistjavassist.bytecodejavassist.bytecode.analysis
@@ -616,10 +615,6 @@
ext/logkit-1.0.1.jarrelease/modules/ext/logkit-1.0.1.jar
-
- ext/openjfx-dialogs-1.0.3.jar
- release/modules/ext/openjfx-dialogs-1.0.3.jar
- ext/imgscalr-lib-4.2-javadoc.jarrelease/modules/ext/imgscalr-lib-4.2-javadoc.jar
@@ -768,14 +763,14 @@
ext/slf4j-simple-1.6.1.jarrelease/modules/ext/slf4j-simple-1.6.1.jar
-
- ext/controlsfx-8.40.9.jar
- release/modules/ext/controlsfx-8.40.9.jar
- ext/commons-lang3-3.0-javadoc.jarrelease/modules/ext/commons-lang3-3.0-javadoc.jar
+
+ ext/controlsfx-8.40.9.jar
+ release/modules/ext/controlsfx-8.40.9.jar
+ ext/platform-3.4.0.jarrelease/modules/ext/platform-3.4.0.jar
diff --git a/ImageGallery/nbproject/platform.properties b/ImageGallery/nbproject/platform.properties
index 1554e42acf..d19032bb98 100644
--- a/ImageGallery/nbproject/platform.properties
+++ b/ImageGallery/nbproject/platform.properties
@@ -7,7 +7,7 @@ nbplatform.active.dir=${suite.dir}/netbeans-plat/${netbeans-plat-version}
harness.dir=${nbplatform.active.dir}/harness
bootstrap.url=http://deadlock.netbeans.org/hudson/job/nbms-and-javadoc/lastStableBuild/artifact/nbbuild/netbeans/harness/tasks.jar
# Where we get the platform from. To see what versions are available, open URL in browser up to the .../updates part of the URL
-autoupdate.catalog.url=http://dlc.sun.com.edgesuite.net/netbeans/updates/${netbeans-plat-version}/uc/final/distribution/catalog.xml.gz
+autoupdate.catalog.url=http://updates.netbeans.org/netbeans/updates/${netbeans-plat-version}/uc/final/distribution/catalog.xml.gz
cluster.path=\
${nbplatform.active.dir}/harness:\
${nbplatform.active.dir}/java:\
diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/FileUpdateEvent.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/FileUpdateEvent.java
deleted file mode 100644
index 038ac4bafb..0000000000
--- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/FileUpdateEvent.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Autopsy Forensic Browser
- *
- * Copyright 2013 Basis Technology Corp.
- * Contact: carrier sleuthkit 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.imagegallery;
-
-import java.util.Collection;
-import java.util.EventListener;
-import java.util.HashSet;
-import java.util.Set;
-import javax.annotation.concurrent.Immutable;
-import org.sleuthkit.autopsy.imagegallery.datamodel.DrawableAttribute;
-
-/** represents a change in the database for one or more files. */
-@Immutable
-public class FileUpdateEvent {
-
- /** the obj_ids of affected files */
- private final Set fileIDs;
-
- /** the attribute that was modified */
- private final DrawableAttribute> changedAttribute;
-
- /** the type of update ( updated/removed) */
- private final UpdateType updateType;
-
- public UpdateType getUpdateType() {
- return updateType;
- }
-
- public Collection getFileIDs() {
- return fileIDs;
- }
-
- public DrawableAttribute> getChangedAttribute() {
- return changedAttribute;
- }
-
- public static FileUpdateEvent newRemovedEvent(Collection extends Long> updatedFiles) {
- return new FileUpdateEvent(updatedFiles, UpdateType.REMOVE, null);
- }
-
- /**
- *
- * @param updatedFiles the files that have been added or changed in the
- * database
- * @param changedAttribute the attribute that was changed for the files, or
- * null if this represents new files
- *
- * @return a new FileUpdateEvent
- */
- public static FileUpdateEvent newUpdateEvent(Collection extends Long> updatedFiles, DrawableAttribute> changedAttribute) {
- return new FileUpdateEvent(updatedFiles, UpdateType.UPDATE, changedAttribute);
- }
-
- private FileUpdateEvent(Collection extends Long> updatedFiles, UpdateType updateType, DrawableAttribute> changedAttribute) {
- this.fileIDs = new HashSet<>(updatedFiles);
- this.updateType = updateType;
- this.changedAttribute = changedAttribute;
- }
-
- static public enum UpdateType {
-
- /** files have been added or updated in the db */
- UPDATE,
- /** files have been removed
- * from the db */
- REMOVE;
- }
-
- /** Interface for listening to FileUpdateEvents */
- public static interface FileUpdateListener extends EventListener {
-
- public void handleFileUpdate(FileUpdateEvent evt);
- }
-}
diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/ImageGalleryController.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/ImageGalleryController.java
index b93f362dae..6e5355dae9 100644
--- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/ImageGalleryController.java
+++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/ImageGalleryController.java
@@ -21,6 +21,7 @@ package org.sleuthkit.autopsy.imagegallery;
import java.beans.PropertyChangeEvent;
import java.util.ArrayList;
import java.util.List;
+import java.util.Objects;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.logging.Level;
@@ -56,15 +57,16 @@ import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.coreutils.History;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.coreutils.ThreadConfined;
-import org.sleuthkit.autopsy.imagegallery.datamodel.Category;
+import org.sleuthkit.autopsy.events.ContentTagAddedEvent;
+import org.sleuthkit.autopsy.events.ContentTagDeletedEvent;
import org.sleuthkit.autopsy.imagegallery.datamodel.CategoryManager;
import org.sleuthkit.autopsy.imagegallery.datamodel.DrawableDB;
import org.sleuthkit.autopsy.imagegallery.datamodel.DrawableFile;
+import org.sleuthkit.autopsy.imagegallery.datamodel.DrawableTagsManager;
import org.sleuthkit.autopsy.imagegallery.datamodel.HashSetManager;
-import org.sleuthkit.autopsy.imagegallery.grouping.GroupManager;
-import org.sleuthkit.autopsy.imagegallery.grouping.GroupViewState;
+import org.sleuthkit.autopsy.imagegallery.datamodel.grouping.GroupManager;
+import org.sleuthkit.autopsy.imagegallery.datamodel.grouping.GroupViewState;
import org.sleuthkit.autopsy.imagegallery.gui.NoGroupsDialog;
-import org.sleuthkit.autopsy.imagegallery.gui.SummaryTablePane;
import org.sleuthkit.autopsy.imagegallery.gui.Toolbar;
import org.sleuthkit.autopsy.ingest.IngestManager;
import org.sleuthkit.datamodel.AbstractFile;
@@ -126,13 +128,15 @@ public final class ImageGalleryController {
private final GroupManager groupManager = new GroupManager(this);
private final HashSetManager hashSetManager = new HashSetManager();
- private final CategoryManager categoryManager = new CategoryManager();
+ private final CategoryManager categoryManager = new CategoryManager(this);
+ private final DrawableTagsManager tagsManager = new DrawableTagsManager(null);
private StackPane fullUIStackPane;
private StackPane centralStackPane;
private Node infoOverlay;
+ private SleuthkitCase sleuthKitCase;
public ReadOnlyBooleanProperty getMetaDataCollapsed() {
return metaDataCollapsed.getReadOnlyProperty();
@@ -231,7 +235,6 @@ public final class ImageGalleryController {
IngestManager.getInstance().addIngestJobEventListener((PropertyChangeEvent evt) -> {
Platform.runLater(this::updateRegroupDisabled);
});
-// metaDataCollapsed.bind(Toolbar.getDefault().showMetaDataProperty());
}
public ReadOnlyBooleanProperty getCanAdvance() {
@@ -333,7 +336,7 @@ public final class ImageGalleryController {
Platform.runLater(this::updateRegroupDisabled);
});
- Thread th = new Thread(dbWorkerThread);
+ Thread th = new Thread(dbWorkerThread, "DB-Worker-Thread");
th.setDaemon(false); // we want it to go away when it is done
th.start();
}
@@ -344,19 +347,27 @@ public final class ImageGalleryController {
* @param theNewCase the case to configure the controller for
*/
public synchronized void setCase(Case theNewCase) {
- this.db = DrawableDB.getDrawableDB(ImageGalleryModule.getModuleOutputDir(theNewCase), getSleuthKitCase());
+ if (Objects.nonNull(theNewCase)) {
+ this.sleuthKitCase = theNewCase.getSleuthkitCase();
+ this.db = DrawableDB.getDrawableDB(ImageGalleryModule.getModuleOutputDir(theNewCase), this);
- setListeningEnabled(ImageGalleryModule.isEnabledforCase(theNewCase));
- setStale(ImageGalleryModule.isDrawableDBStale(theNewCase));
+ setListeningEnabled(ImageGalleryModule.isEnabledforCase(theNewCase));
+ setStale(ImageGalleryModule.isDrawableDBStale(theNewCase));
- // if we add this line icons are made as files are analyzed rather than on demand.
- // db.addUpdatedFileListener(IconCache.getDefault());
- restartWorker();
- historyManager.clear();
- groupManager.setDB(db);
- hashSetManager.setDb(db);
- categoryManager.setDb(db);
- SummaryTablePane.getDefault().refresh();
+ // if we add this line icons are made as files are analyzed rather than on demand.
+ // db.addUpdatedFileListener(IconCache.getDefault());
+ restartWorker();
+ historyManager.clear();
+ groupManager.setDB(db);
+ hashSetManager.setDb(db);
+ categoryManager.setDb(db);
+ tagsManager.setAutopsyTagsManager(theNewCase.getServices().getTagsManager());
+ tagsManager.registerListener(groupManager);
+ tagsManager.registerListener(categoryManager);
+
+ } else {
+ reset();
+ }
}
/**
@@ -370,9 +381,11 @@ public final class ImageGalleryController {
Platform.runLater(() -> {
historyManager.clear();
});
- Category.clearTagNames();
+ tagsManager.clearFollowUpTagName();
+ tagsManager.unregisterListener(groupManager);
+ tagsManager.unregisterListener(categoryManager);
- Toolbar.getDefault().reset();
+ Toolbar.getDefault(this).reset();
groupManager.clear();
if (db != null) {
db.closeDBCon();
@@ -476,6 +489,19 @@ public final class ImageGalleryController {
setStale(true);
}
break;
+ case CONTENT_TAG_ADDED:
+ final ContentTagAddedEvent tagAddedEvent = (ContentTagAddedEvent) evt;
+ if (getDatabase().isInDB((tagAddedEvent).getTag().getContent().getId())) {
+ getTagsManager().fireTagAddedEvent(tagAddedEvent);
+ }
+ break;
+ case CONTENT_TAG_DELETED:
+ final ContentTagDeletedEvent tagDeletedEvent = (ContentTagDeletedEvent) evt;
+ if (getDatabase().isInDB((tagDeletedEvent).getTag().getContent().getId())) {
+ getTagsManager().fireTagDeletedEvent(tagDeletedEvent);
+ }
+ break;
+
}
});
}
@@ -488,6 +514,12 @@ public final class ImageGalleryController {
return categoryManager;
}
+ public DrawableTagsManager getTagsManager() {
+ return tagsManager;
+ }
+
+
+
// @@@ REVIEW IF THIS SHOLD BE STATIC...
//TODO: concept seems like the controller deal with how much work to do at a given time
// @@@ review this class for synchronization issues (i.e. reset and cancel being called, add, etc.)
@@ -551,12 +583,8 @@ public final class ImageGalleryController {
}
}
- public SleuthkitCase getSleuthKitCase() throws IllegalStateException {
- if (Case.isCaseOpen()) {
- return Case.getCurrentCase().getSleuthkitCase();
- } else {
- throw new IllegalStateException("No Case is open!");
- }
+ public synchronized SleuthkitCase getSleuthKitCase() {
+ return sleuthKitCase;
}
/**
diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/ImageGalleryTopComponent.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/ImageGalleryTopComponent.java
index 6aa431fb4c..658e523be9 100644
--- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/ImageGalleryTopComponent.java
+++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/ImageGalleryTopComponent.java
@@ -34,10 +34,9 @@ import org.openide.util.NbBundle.Messages;
import org.openide.windows.Mode;
import org.openide.windows.TopComponent;
import org.openide.windows.WindowManager;
-import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.coreutils.Logger;
-import org.sleuthkit.autopsy.imagegallery.gui.GroupPane;
-import org.sleuthkit.autopsy.imagegallery.gui.MetaDataPane;
+import org.sleuthkit.autopsy.imagegallery.gui.drawableviews.GroupPane;
+import org.sleuthkit.autopsy.imagegallery.gui.drawableviews.MetaDataPane;
import org.sleuthkit.autopsy.imagegallery.gui.StatusBar;
import org.sleuthkit.autopsy.imagegallery.gui.SummaryTablePane;
import org.sleuthkit.autopsy.imagegallery.gui.Toolbar;
@@ -145,13 +144,13 @@ public final class ImageGalleryTopComponent extends TopComponent implements Expl
fullUIStack.getChildren().add(borderPane);
splitPane = new SplitPane();
borderPane.setCenter(splitPane);
- borderPane.setTop(Toolbar.getDefault());
+ borderPane.setTop(Toolbar.getDefault(controller));
borderPane.setBottom(new StatusBar(controller));
metaDataTable = new MetaDataPane(controller);
navPanel = new NavPanel(controller);
- leftPane = new VBox(navPanel, SummaryTablePane.getDefault());
+ leftPane = new VBox(navPanel, new SummaryTablePane(controller));
SplitPane.setResizableWithParent(leftPane, Boolean.FALSE);
SplitPane.setResizableWithParent(groupPane, Boolean.TRUE);
SplitPane.setResizableWithParent(metaDataTable, Boolean.FALSE);
diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/TagUtils.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/TagUtils.java
deleted file mode 100644
index b5eb4cfc25..0000000000
--- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/TagUtils.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * Autopsy Forensic Browser
- *
- * Copyright 2013 Basis Technology Corp.
- * Contact: carrier sleuthkit 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.imagegallery;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.logging.Level;
-import javafx.event.ActionEvent;
-import javafx.event.EventHandler;
-import javafx.scene.control.MenuItem;
-import javafx.scene.control.SplitMenuButton;
-import javafx.scene.image.ImageView;
-import org.sleuthkit.autopsy.casemodule.Case;
-import org.sleuthkit.autopsy.casemodule.services.TagsManager;
-import org.sleuthkit.autopsy.coreutils.Logger;
-import org.sleuthkit.autopsy.imagegallery.actions.AddDrawableTagAction;
-import org.sleuthkit.autopsy.imagegallery.datamodel.Category;
-import org.sleuthkit.autopsy.imagegallery.datamodel.DrawableAttribute;
-import org.sleuthkit.datamodel.TagName;
-import org.sleuthkit.datamodel.TskCoreException;
-
-/**
- * Contains static methods for dealing with Tags in ImageGallery
- */
-public class TagUtils {
-
- private static final String follow_Up = "Follow Up";
-
- private static TagName followUpTagName;
-
- private final static List listeners = new ArrayList<>();
-
- synchronized public static TagName getFollowUpTagName() throws TskCoreException {
- if (followUpTagName == null) {
- followUpTagName = getTagName(follow_Up);
- }
- return followUpTagName;
- }
-
- static public Collection getNonCategoryTagNames() {
- List nonCatTagNames = new ArrayList<>();
- List allTagNames;
- try {
- allTagNames = Case.getCurrentCase().getServices().getTagsManager().getAllTagNames();
- for (TagName tn : allTagNames) {
- if (tn.getDisplayName().startsWith(Category.CATEGORY_PREFIX) == false) {
- nonCatTagNames.add(tn);
- }
- }
- } catch (TskCoreException | IllegalStateException ex) {
- Logger.getLogger(TagUtils.class.getName()).log(Level.WARNING, "couldn't access case", ex);
- }
-
- return nonCatTagNames;
- }
-
- synchronized static public TagName getTagName(String displayName) throws TskCoreException {
- try {
- final TagsManager tagsManager = Case.getCurrentCase().getServices().getTagsManager();
-
- for (TagName tn : tagsManager.getAllTagNames()) {
- if (displayName.equals(tn.getDisplayName())) {
- return tn;
- }
- }
- try {
- return tagsManager.addTagName(displayName);
- } catch (TagsManager.TagNameAlreadyExistsException ex) {
- throw new TskCoreException("tagame exists but wasn't found", ex);
- }
- } catch (IllegalStateException ex) {
- Logger.getLogger(TagUtils.class.getName()).log(Level.SEVERE, "Case was closed out from underneath", ex);
- throw new TskCoreException("Case was closed out from underneath", ex);
- }
- }
-
- public static void fireChange(Collection ids) {
- Set listenersCopy = new HashSet(listeners);
- synchronized (listeners) {
- listenersCopy.addAll(listeners);
- }
- for (TagListener list : listenersCopy) {
- list.handleTagsChanged(ids);
- }
- }
-
- public static void registerListener(TagListener aThis) {
- synchronized (listeners) {
- listeners.add(aThis);
- }
- }
-
- public static void unregisterListener(TagListener aThis) {
- synchronized (listeners) {
- listeners.remove(aThis);
- }
- }
-
- /**
- * @param tn the value of tn
- */
- static public MenuItem createSelTagMenuItem(final TagName tn, final SplitMenuButton tagSelectedMenuButton) {
- final MenuItem menuItem = new MenuItem(tn.getDisplayName(), new ImageView(DrawableAttribute.TAGS.getIcon()));
- menuItem.setOnAction(new EventHandler() {
- @Override
- public void handle(ActionEvent t) {
- AddDrawableTagAction.getInstance().addTag(tn, "");
- tagSelectedMenuButton.setText(tn.getDisplayName());
- tagSelectedMenuButton.setOnAction(this);
- }
- });
- return menuItem;
- }
-
- public static interface TagListener {
- public void handleTagsChanged(Collection ids);
- }
-}
diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/actions/AddDrawableTagAction.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/actions/AddDrawableTagAction.java
index a098e1a1c9..4399a05706 100644
--- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/actions/AddDrawableTagAction.java
+++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/actions/AddDrawableTagAction.java
@@ -18,23 +18,25 @@
*/
package org.sleuthkit.autopsy.imagegallery.actions;
-import java.util.Collections;
import java.util.HashSet;
+import java.util.List;
+import java.util.Optional;
import java.util.Set;
import java.util.concurrent.ExecutionException;
import java.util.logging.Level;
+import javafx.application.Platform;
+import javafx.scene.control.Alert;
+import javafx.scene.control.ButtonType;
import javafx.scene.control.Menu;
-import javax.swing.JOptionPane;
import javax.swing.SwingWorker;
import org.openide.util.Utilities;
-import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.imagegallery.FileIDSelectionModel;
-import org.sleuthkit.autopsy.imagegallery.FileUpdateEvent;
import org.sleuthkit.autopsy.imagegallery.ImageGalleryController;
-import org.sleuthkit.autopsy.imagegallery.datamodel.DrawableAttribute;
import org.sleuthkit.autopsy.imagegallery.datamodel.DrawableFile;
+import org.sleuthkit.autopsy.imagegallery.datamodel.DrawableTagsManager;
import org.sleuthkit.datamodel.AbstractFile;
+import org.sleuthkit.datamodel.ContentTag;
import org.sleuthkit.datamodel.TagName;
import org.sleuthkit.datamodel.TskCoreException;
@@ -45,66 +47,69 @@ import org.sleuthkit.datamodel.TskCoreException;
* diverged from autopsy action, make this extend from controlsfx Action
*/
public class AddDrawableTagAction extends AddTagAction {
-
+
private static final Logger LOGGER = Logger.getLogger(AddDrawableTagAction.class.getName());
- // This class is a singleton to support multi-selection of nodes, since
- // org.openide.nodes.NodeOp.findActions(Node[] nodes) will only pick up an Action if every
- // node in the array returns a reference to the same action object from Node.getActions(boolean).
- private static AddDrawableTagAction instance;
-
- public static synchronized AddDrawableTagAction getInstance() {
- if (null == instance) {
- instance = new AddDrawableTagAction();
- }
- return instance;
+ private final ImageGalleryController controller;
+
+ public AddDrawableTagAction(ImageGalleryController controller) {
+ this.controller = controller;
}
-
- private AddDrawableTagAction() {
- }
-
+
public Menu getPopupMenu() {
- return new TagMenu();
+ return new TagMenu(controller);
}
-
+
@Override
protected String getActionDisplayName() {
return Utilities.actionsGlobalContext().lookupAll(AbstractFile.class).size() > 1 ? "Tag Files" : "Tag File";
}
-
+
@Override
public void addTag(TagName tagName, String comment) {
Set selectedFiles = new HashSet<>(FileIDSelectionModel.getInstance().getSelected());
addTagsToFiles(tagName, comment, selectedFiles);
}
-
+
@Override
- public void addTagsToFiles(TagName tagName, String comment, Set selectedFiles){
+ public void addTagsToFiles(TagName tagName, String comment, Set selectedFiles) {
new SwingWorker() {
-
+
@Override
protected Void doInBackground() throws Exception {
for (Long fileID : selectedFiles) {
try {
- DrawableFile> file = ImageGalleryController.getDefault().getFileFromId(fileID);
+ final DrawableFile> file = controller.getFileFromId(fileID);
LOGGER.log(Level.INFO, "tagging {0} with {1} and comment {2}", new Object[]{file.getName(), tagName.getDisplayName(), comment});
- Case.getCurrentCase().getServices().getTagsManager().addContentTag(file, tagName, comment);
- } catch (IllegalStateException ex) {
- LOGGER.log(Level.SEVERE, "Case was closed out from underneath Updatefile task", ex);
- } catch (TskCoreException ex) {
- LOGGER.log(Level.SEVERE, "Error tagging result", ex);
- JOptionPane.showMessageDialog(null, "Unable to tag " + fileID + ".", "Tagging Error", JOptionPane.ERROR_MESSAGE);
- }
- //make sure rest of ui hears category change.
- ImageGalleryController.getDefault().getGroupManager().handleFileUpdate(FileUpdateEvent.newUpdateEvent(Collections.singleton(fileID), DrawableAttribute.TAGS));
-
+ // check if the same tag is being added for the same abstract file.
+ DrawableTagsManager tagsManager = controller.getTagsManager();
+ List contentTags = tagsManager.getContentTagsByContent(file);
+ Optional duplicateTagName = contentTags.stream()
+ .map(ContentTag::getName)
+ .filter(tagName::equals)
+ .findAny();
+
+ if (duplicateTagName.isPresent()) {
+ Platform.runLater(() -> {
+ Alert alert = new Alert(Alert.AlertType.WARNING, "Unable to tag " + file.getName() + ". It has already been tagged as \"" + tagName.getDisplayName() + ". Cannot reapply the same tag.", ButtonType.OK);
+ alert.setHeaderText("Tag Error");
+ alert.show();
+ });
+ } else {
+ controller.getTagsManager().addContentTag(file, tagName, comment);
+ }
+
+ } catch (TskCoreException tskCoreException) {
+ LOGGER.log(Level.SEVERE, "Error tagging result", tskCoreException);
+ Platform.runLater(() -> {
+ new Alert(Alert.AlertType.ERROR, "Unable to file " + fileID + ".").show();
+ });
+ }
}
-
- refreshDirectoryTree();
return null;
}
-
+
@Override
protected void done() {
super.done();
@@ -114,7 +119,6 @@ public class AddDrawableTagAction extends AddTagAction {
LOGGER.log(Level.SEVERE, "unexpected exception while tagging files", ex);
}
}
-
}.execute();
}
}
diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/actions/AddTagAction.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/actions/AddTagAction.java
index 42cd0ecfd1..4ae762217c 100644
--- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/actions/AddTagAction.java
+++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/actions/AddTagAction.java
@@ -18,24 +18,17 @@
*/
package org.sleuthkit.autopsy.imagegallery.actions;
-import java.util.List;
+import java.util.Collection;
import java.util.Set;
-import java.util.logging.Level;
import javafx.event.ActionEvent;
import javafx.scene.control.Menu;
import javafx.scene.control.MenuItem;
import javax.swing.SwingUtilities;
import org.sleuthkit.autopsy.actions.GetTagNameAndCommentDialog;
import org.sleuthkit.autopsy.actions.GetTagNameDialog;
-import org.sleuthkit.autopsy.casemodule.Case;
-import org.sleuthkit.autopsy.casemodule.services.TagsManager;
-import org.sleuthkit.autopsy.coreutils.Logger;
-import org.sleuthkit.autopsy.imagegallery.datamodel.Category;
-import org.sleuthkit.autopsy.ingest.IngestServices;
-import org.sleuthkit.autopsy.ingest.ModuleDataEvent;
-import org.sleuthkit.datamodel.BlackboardArtifact;
+import org.sleuthkit.autopsy.imagegallery.ImageGalleryController;
+import org.sleuthkit.autopsy.imagegallery.datamodel.CategoryManager;
import org.sleuthkit.datamodel.TagName;
-import org.sleuthkit.datamodel.TskCoreException;
/**
* An abstract base class for actions that allow users to tag SleuthKit data
@@ -43,20 +36,10 @@ import org.sleuthkit.datamodel.TskCoreException;
*
* //TODO: this class started as a cut and paste from
* org.sleuthkit.autopsy.actions.AddTagAction and needs to be
- * refactor or reintegrated to the AddTagAction hierarchy of Autopysy.
+ * refactored or reintegrated to the AddTagAction hierarchy of Autopysy.
*/
abstract class AddTagAction {
- @SuppressWarnings("deprecation")
- protected void refreshDirectoryTree() {
-
- /* Note: this is a hack. In an ideal world, TagsManager would fire
- * events so that the directory tree would refresh. But, we haven't
- * had a chance to add that so, we fire these events and the tree
- * refreshes based on them.
- */
- IngestServices.getInstance().fireModuleDataEvent(new ModuleDataEvent("TagAction", BlackboardArtifact.ARTIFACT_TYPE.TSK_TAG_FILE)); //NON-NLS
- }
protected static final String NO_COMMENT = "";
/**
@@ -86,72 +69,59 @@ abstract class AddTagAction {
// to be reworked.
protected class TagMenu extends Menu {
- TagMenu() {
+ TagMenu(ImageGalleryController controller) {
super(getActionDisplayName());
- // Get the current set of tag names.
- TagsManager tagsManager = Case.getCurrentCase().getServices().getTagsManager();
- List tagNames = null;
- try {
- tagNames = tagsManager.getAllTagNames();
- } catch (TskCoreException ex) {
- Logger.getLogger(TagsManager.class.getName()).log(Level.SEVERE, "Failed to get tag names", ex);
- }
-
// Create a "Quick Tag" sub-menu.
Menu quickTagMenu = new Menu("Quick Tag");
getItems().add(quickTagMenu);
- // Each tag name in the current set of tags gets its own menu item in
- // the "Quick Tags" sub-menu. Selecting one of these menu items adds
- // a tag with the associated tag name.
- if (null != tagNames && !tagNames.isEmpty()) {
- for (final TagName tagName : tagNames) {
- if (tagName.getDisplayName().startsWith(Category.CATEGORY_PREFIX) == false) {
- MenuItem tagNameItem = new MenuItem(tagName.getDisplayName());
- tagNameItem.setOnAction((ActionEvent t) -> {
- addTag(tagName, NO_COMMENT);
- refreshDirectoryTree();
- });
- quickTagMenu.getItems().add(tagNameItem);
- }
- }
- } else {
+ /* Each non-Category tag name in the current set of tags gets its
+ * own menu item in the "Quick Tags" sub-menu. Selecting one of
+ * these menu items adds a tag with the associated tag name. */
+ Collection tagNames = controller.getTagsManager().getNonCategoryTagNames();
+ if (tagNames.isEmpty()) {
MenuItem empty = new MenuItem("No tags");
empty.setDisable(true);
quickTagMenu.getItems().add(empty);
+ } else {
+ for (final TagName tagName : tagNames) {
+ MenuItem tagNameItem = new MenuItem(tagName.getDisplayName());
+ tagNameItem.setOnAction((ActionEvent t) -> {
+ addTag(tagName, NO_COMMENT);
+ });
+ quickTagMenu.getItems().add(tagNameItem);
+ }
}
- // quickTagMenu.addSeparator();
- // The "Quick Tag" menu also gets an "Choose Tag..." menu item.
- // Selecting this item initiates a dialog that can be used to create
- // or select a tag name and adds a tag with the resulting name.
+ /* The "Quick Tag" menu also gets an "New Tag..." menu item.
+ * Selecting this item initiates a dialog that can be used to create
+ * or select a tag name and adds a tag with the resulting name. */
MenuItem newTagMenuItem = new MenuItem("New Tag...");
newTagMenuItem.setOnAction((ActionEvent t) -> {
SwingUtilities.invokeLater(() -> {
TagName tagName = GetTagNameDialog.doDialog();
if (tagName != null) {
addTag(tagName, NO_COMMENT);
- refreshDirectoryTree();
}
});
});
quickTagMenu.getItems().add(newTagMenuItem);
- // Create a "Choose Tag and Comment..." menu item. Selecting this item initiates
- // a dialog that can be used to create or select a tag name with an
- // optional comment and adds a tag with the resulting name.
+ /* Create a "Tag and Comment..." menu item. Selecting this item
+ * initiates a dialog that can be used to create or select a tag
+ * name with an optional comment and adds a tag with the resulting
+ * name. */
MenuItem tagAndCommentItem = new MenuItem("Tag and Comment...");
tagAndCommentItem.setOnAction((ActionEvent t) -> {
SwingUtilities.invokeLater(() -> {
GetTagNameAndCommentDialog.TagNameAndComment tagNameAndComment = GetTagNameAndCommentDialog.doDialog();
if (null != tagNameAndComment) {
- if (tagNameAndComment.getTagName().getDisplayName().startsWith(Category.CATEGORY_PREFIX)) {
- new CategorizeAction().addTag(tagNameAndComment.getTagName(), tagNameAndComment.getComment());
+ if (CategoryManager.isCategoryTagName(tagNameAndComment.getTagName())) {
+ new CategorizeAction(controller).addTag(tagNameAndComment.getTagName(), tagNameAndComment.getComment());
} else {
- AddDrawableTagAction.getInstance().addTag(tagNameAndComment.getTagName(), tagNameAndComment.getComment());
+ new AddDrawableTagAction(controller).addTag(tagNameAndComment.getTagName(), tagNameAndComment.getComment());
}
- refreshDirectoryTree();
}
});
});
diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/actions/CategorizeAction.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/actions/CategorizeAction.java
index 79a04f535d..102ba5e7fa 100644
--- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/actions/CategorizeAction.java
+++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/actions/CategorizeAction.java
@@ -18,27 +18,26 @@
*/
package org.sleuthkit.autopsy.imagegallery.actions;
-import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.logging.Level;
+import java.util.stream.Collectors;
import javafx.event.ActionEvent;
import javafx.scene.control.Menu;
import javafx.scene.control.MenuItem;
import javafx.scene.input.KeyCode;
import javafx.scene.input.KeyCodeCombination;
import javax.swing.JOptionPane;
-import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.imagegallery.FileIDSelectionModel;
-import org.sleuthkit.autopsy.imagegallery.FileUpdateEvent;
import org.sleuthkit.autopsy.imagegallery.ImageGalleryController;
import org.sleuthkit.autopsy.imagegallery.datamodel.Category;
-import org.sleuthkit.autopsy.imagegallery.datamodel.DrawableAttribute;
+import org.sleuthkit.autopsy.imagegallery.datamodel.CategoryManager;
import org.sleuthkit.autopsy.imagegallery.datamodel.DrawableFile;
-import org.sleuthkit.autopsy.imagegallery.grouping.GroupKey;
+import org.sleuthkit.autopsy.imagegallery.datamodel.DrawableTagsManager;
import org.sleuthkit.datamodel.ContentTag;
+import org.sleuthkit.datamodel.Tag;
import org.sleuthkit.datamodel.TagName;
import org.sleuthkit.datamodel.TskCoreException;
@@ -54,13 +53,13 @@ public class CategorizeAction extends AddTagAction {
private final ImageGalleryController controller;
- public CategorizeAction() {
+ public CategorizeAction(ImageGalleryController controller) {
super();
- this.controller = ImageGalleryController.getDefault();
+ this.controller = controller;
}
- static public Menu getPopupMenu() {
- return new CategoryMenu();
+ public Menu getPopupMenu() {
+ return new CategoryMenu(controller);
}
@Override
@@ -84,13 +83,17 @@ public class CategorizeAction extends AddTagAction {
}
}
+ public void enforceOneCat(TagName name, String string) {
+ throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
+ }
+
/**
* Instances of this class implement a context menu user interface for
* selecting a category
*/
static private class CategoryMenu extends Menu {
- CategoryMenu() {
+ CategoryMenu(ImageGalleryController controller) {
super("Categorize");
// Each category get an item in the sub-menu. Selecting one of these menu items adds
@@ -99,8 +102,8 @@ public class CategorizeAction extends AddTagAction {
MenuItem categoryItem = new MenuItem(cat.getDisplayName());
categoryItem.setOnAction((ActionEvent t) -> {
- final CategorizeAction categorizeAction = new CategorizeAction();
- categorizeAction.addTag(cat.getTagName(), NO_COMMENT);
+ final CategorizeAction categorizeAction = new CategorizeAction(controller);
+ categorizeAction.addTag(controller.getCategoryManager().getTagName(cat), NO_COMMENT);
});
categoryItem.setAccelerator(new KeyCodeCombination(KeyCode.getKeyCode(Integer.toString(cat.getCategoryNumber()))));
getItems().add(categoryItem);
@@ -123,36 +126,40 @@ public class CategorizeAction extends AddTagAction {
@Override
public void run() {
+ final CategoryManager categoryManager = controller.getCategoryManager();
+ final DrawableTagsManager tagsManager = controller.getTagsManager();
+
+
try {
DrawableFile> file = controller.getFileFromId(fileID); //drawable db
- Category oldCat = file.getCategory();
- // remove file from old category group
- controller.getGroupManager().removeFromGroup(new GroupKey(DrawableAttribute.CATEGORY, oldCat), fileID); //memory
-
- //remove old category tag if necessary
- List allContentTags = Case.getCurrentCase().getServices().getTagsManager().getContentTagsByContent(file); //tsk db
- for (ContentTag ct : allContentTags) {
- //this is bad: treating tags as categories as long as their names start with prefix
- //TODO: abandon using tags for categories and instead add a new column to DrawableDB
- if (ct.getName().getDisplayName().startsWith(Category.CATEGORY_PREFIX)) {
- Case.getCurrentCase().getServices().getTagsManager().deleteContentTag(ct); //tsk db
- controller.getCategoryManager().decrementCategoryCount(Category.fromDisplayName(ct.getName().getDisplayName())); //memory/drawable db
+ final List fileTags = tagsManager.getContentTagsByContent(file);
+ if (tagName == categoryManager.getTagName(Category.ZERO)) {
+ // delete all cat tags for cat-0
+ fileTags.stream()
+ .filter(tag -> CategoryManager.isCategoryTagName(tag.getName()))
+ .forEach((ct) -> {
+ try {
+ tagsManager.deleteContentTag(ct);
+ } catch (TskCoreException ex) {
+ LOGGER.log(Level.SEVERE, "Error removing old categories result", ex);
+ }
+ });
+ } else {
+ //add cat tag if no existing cat tag for that cat
+ if (fileTags.stream()
+ .map(Tag::getName)
+ .filter(tagName::equals)
+ .collect(Collectors.toList()).isEmpty()) {
+ tagsManager.addContentTag(file, tagName, comment);
}
-
}
- controller.getCategoryManager().incrementCategoryCount(Category.fromDisplayName(tagName.getDisplayName())); //memory/drawable db
- if (tagName != Category.ZERO.getTagName()) { // no tags for cat-0
- Case.getCurrentCase().getServices().getTagsManager().addContentTag(file, tagName, comment); //tsk db
- }
- //make sure rest of ui hears category change.
- controller.getGroupManager().handleFileUpdate(FileUpdateEvent.newUpdateEvent(Collections.singleton(fileID), DrawableAttribute.CATEGORY)); //memory/ui
} catch (TskCoreException ex) {
LOGGER.log(Level.SEVERE, "Error categorizing result", ex);
JOptionPane.showMessageDialog(null, "Unable to categorize " + fileID + ".", "Categorizing Error", JOptionPane.ERROR_MESSAGE);
}
- refreshDirectoryTree();
}
}
+
}
diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/actions/DeleteFollowUpTagAction.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/actions/DeleteFollowUpTagAction.java
new file mode 100644
index 0000000000..27ab1cd8b1
--- /dev/null
+++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/actions/DeleteFollowUpTagAction.java
@@ -0,0 +1,67 @@
+/*
+ * Autopsy Forensic Browser
+ *
+ * Copyright 2015 Basis Technology Corp.
+ * Contact: carrier sleuthkit 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.imagegallery.actions;
+
+import java.util.List;
+import java.util.logging.Level;
+import javafx.event.ActionEvent;
+import javax.swing.SwingWorker;
+import org.controlsfx.control.action.Action;
+import org.sleuthkit.autopsy.coreutils.Logger;
+import org.sleuthkit.autopsy.imagegallery.ImageGalleryController;
+import org.sleuthkit.autopsy.imagegallery.datamodel.DrawableFile;
+import org.sleuthkit.autopsy.imagegallery.datamodel.DrawableTagsManager;
+import org.sleuthkit.datamodel.ContentTag;
+import org.sleuthkit.datamodel.TagName;
+import org.sleuthkit.datamodel.TskCoreException;
+
+/**
+ * Action to delete the follow up tag a
+ */
+public class DeleteFollowUpTagAction extends Action {
+
+ private static final Logger LOGGER = Logger.getLogger(DeleteFollowUpTagAction.class.getName());
+
+ public DeleteFollowUpTagAction(final ImageGalleryController controller, final DrawableFile> file) {
+ super("Delete Follow Up Tag");
+ setEventHandler((ActionEvent t) -> {
+ new SwingWorker() {
+
+ @Override
+ protected Void doInBackground() throws Exception {
+ final DrawableTagsManager tagsManager = controller.getTagsManager();
+
+ try {
+ final TagName followUpTagName = tagsManager.getFollowUpTagName();
+
+ List contentTagsByContent = tagsManager.getContentTagsByContent(file);
+ for (ContentTag ct : contentTagsByContent) {
+ if (ct.getName().getDisplayName().equals(followUpTagName.getDisplayName())) {
+ tagsManager.deleteContentTag(ct);
+ }
+ }
+ } catch (TskCoreException ex) {
+ LOGGER.log(Level.SEVERE, "Failed to delete follow up tag.", ex);
+ }
+ return null;
+ }
+ }.execute();
+ });
+ }
+}
diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/actions/NextUnseenGroup.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/actions/NextUnseenGroup.java
index ab8ef06401..6a68810457 100644
--- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/actions/NextUnseenGroup.java
+++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/actions/NextUnseenGroup.java
@@ -28,7 +28,7 @@ import javafx.scene.image.ImageView;
import org.controlsfx.control.action.Action;
import org.sleuthkit.autopsy.coreutils.ThreadConfined;
import org.sleuthkit.autopsy.imagegallery.ImageGalleryController;
-import org.sleuthkit.autopsy.imagegallery.grouping.GroupViewState;
+import org.sleuthkit.autopsy.imagegallery.datamodel.grouping.GroupViewState;
/**
* Marks the currently fisplayed group as "seen" and advances to the next unseen
@@ -51,6 +51,7 @@ public class NextUnseenGroup extends Action {
this.controller = controller;
setGraphic(new ImageView(ADVANCE));
+ //TODO: do we need both these listeners?
controller.getGroupManager().getAnalyzedGroups().addListener((Observable observable) -> {
Platform.runLater(this::updateButton);
diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/Category.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/Category.java
index 780e851876..8999fff2f1 100644
--- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/Category.java
+++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/Category.java
@@ -20,52 +20,42 @@ package org.sleuthkit.autopsy.imagegallery.datamodel;
import java.util.Map;
import java.util.function.Function;
-import java.util.logging.Level;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import javafx.scene.paint.Color;
-import org.sleuthkit.autopsy.coreutils.Logger;
-import org.sleuthkit.autopsy.imagegallery.TagUtils;
-import org.sleuthkit.datamodel.TagName;
-import org.sleuthkit.datamodel.TskCoreException;
/**
* Enum to represent the six categories in the DHs image categorization scheme.
*/
-public enum Category implements Comparable {
+public enum Category {
- ZERO(Color.LIGHTGREY, 0, "CAT-0, Uncategorized"),
- ONE(Color.RED, 1, "CAT-1, Child Exploitation (Illegal)"),
- TWO(Color.ORANGE, 2, "CAT-2, Child Exploitation (Non-Illegal/Age Difficult)"),
- THREE(Color.YELLOW, 3, "CAT-3, CGI/Animation (Child Exploitive)"),
- FOUR(Color.BISQUE, 4, "CAT-4, Exemplar/Comparison (Internal Use Only)"),
- FIVE(Color.GREEN, 5, "CAT-5, Non-pertinent");
+ /* This order of declaration is required so that Enum's compareTo method
+ * preserves the fact that lower category numbers are first/most sever,
+ * except 0 which is last */
+ ONE(Color.RED, 1, "CAT-1: Child Exploitation (Illegal)"),
+ TWO(Color.ORANGE, 2, "CAT-2: Child Exploitation (Non-Illegal/Age Difficult)"),
+ THREE(Color.YELLOW, 3, "CAT-3: CGI/Animation (Child Exploitive)"),
+ FOUR(Color.BISQUE, 4, "CAT-4: Exemplar/Comparison (Internal Use Only)"),
+ FIVE(Color.GREEN, 5, "CAT-5: Non-pertinent"),
+ ZERO(Color.LIGHTGREY, 0, "CAT-0: Uncategorized");
/** map from displayName to enum value */
private static final Map nameMap
- = Stream.of(values()).collect(Collectors.toMap(Category::getDisplayName,
+ = Stream.of(values()).collect(Collectors.toMap(
+ Category::getDisplayName,
Function.identity()));
- public static final String CATEGORY_PREFIX = "CAT-";
-
public static Category fromDisplayName(String displayName) {
return nameMap.get(displayName);
}
- /**
- * Use when closing a case to make sure everything is re-initialized in the
- * next case.
- */
- public static void clearTagNames() {
- Category.ZERO.tagName = null;
- Category.ONE.tagName = null;
- Category.TWO.tagName = null;
- Category.THREE.tagName = null;
- Category.FOUR.tagName = null;
- Category.FIVE.tagName = null;
+ public static boolean isCategoryName(String tName) {
+ return nameMap.containsKey(tName);
}
- private TagName tagName;
+ public static boolean isNotCategoryName(String tName) {
+ return nameMap.containsKey(tName) == false;
+ }
private final Color color;
@@ -96,19 +86,4 @@ public enum Category implements Comparable {
return displayName;
}
- /**
- * get the TagName used to store this Category in the main autopsy db.
- *
- * @return the TagName used for this Category
- */
- public TagName getTagName() {
- if (tagName == null) {
- try {
- tagName = TagUtils.getTagName(displayName);
- } catch (TskCoreException ex) {
- Logger.getLogger(Category.class.getName()).log(Level.SEVERE, "failed to get TagName for " + displayName, ex);
- }
- }
- return tagName;
- }
}
diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/CategoryManager.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/CategoryManager.java
index 699af41bbb..f6ab66fa04 100644
--- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/CategoryManager.java
+++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/CategoryManager.java
@@ -20,12 +20,23 @@
import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;
+import com.google.common.eventbus.AsyncEventBus;
import com.google.common.eventbus.EventBus;
import com.google.common.eventbus.Subscribe;
import java.util.Collection;
+import java.util.Collections;
+import java.util.concurrent.Executors;
import java.util.concurrent.atomic.LongAdder;
import java.util.logging.Level;
+import javax.annotation.concurrent.Immutable;
+import org.apache.commons.lang3.concurrent.BasicThreadFactory;
import org.sleuthkit.autopsy.coreutils.Logger;
+import org.sleuthkit.autopsy.events.ContentTagAddedEvent;
+import org.sleuthkit.autopsy.events.ContentTagDeletedEvent;
+import org.sleuthkit.autopsy.imagegallery.ImageGalleryController;
+import org.sleuthkit.datamodel.ContentTag;
+import org.sleuthkit.datamodel.TagName;
+import org.sleuthkit.datamodel.TskCoreException;
/**
* Provides a cached view of the number of files per category, and fires
@@ -43,6 +54,10 @@ public class CategoryManager {
private static final java.util.logging.Logger LOGGER = Logger.getLogger(CategoryManager.class.getName());
+ private final ImageGalleryController controller;
+
+
+
/**
* the DrawableDB that backs the category counts cache. The counts are
* initialized from this, and the counting of CAT-0 is always delegated to
@@ -53,7 +68,11 @@ public class CategoryManager {
/**
* Used to distribute {@link CategoryChangeEvent}s
*/
- private final EventBus categoryEventBus = new EventBus("Category Event Bus");
+ private final EventBus categoryEventBus = new AsyncEventBus(Executors.newSingleThreadExecutor(
+ new BasicThreadFactory.Builder().namingPattern("Category Event Bus").uncaughtExceptionHandler((Thread t, Throwable e) -> {
+ LOGGER.log(Level.SEVERE, "uncaught exception in event bus handler", e);
+ }).build()
+ ));
/**
* For performance reasons, keep current category counts in memory. All of
@@ -62,6 +81,20 @@ public class CategoryManager {
*/
private final LoadingCache categoryCounts
= CacheBuilder.newBuilder().build(CacheLoader.from(this::getCategoryCountHelper));
+ /**
+ * cached TagNames corresponding to Categories, looked up from
+ * autopsyTagManager at initial request or if invalidated by case change.
+ */
+ private final LoadingCache catTagNameMap = CacheBuilder.newBuilder().build(CacheLoader.from(cat
+ -> getController().getTagsManager().getTagName(cat)));
+
+ public CategoryManager(ImageGalleryController controller) {
+ this.controller = controller;
+ }
+
+ private ImageGalleryController getController() {
+ return controller;
+ }
/**
* assign a new db. the counts cache is invalidated and all subsequent db
@@ -71,10 +104,17 @@ public class CategoryManager {
*
* @param db
*/
- public void setDb(DrawableDB db) {
+ synchronized public void setDb(DrawableDB db) {
this.db = db;
categoryCounts.invalidateAll();
- Category.clearTagNames();
+ catTagNameMap.invalidateAll();
+ fireChange(Collections.emptyList(), null);
+ }
+
+ synchronized public void invalidateCaches() {
+ categoryCounts.invalidateAll();
+ catTagNameMap.invalidateAll();
+ fireChange(Collections.emptyList(), null);
}
/**
@@ -84,7 +124,7 @@ public class CategoryManager {
*
* @return the long the number of files with the given Category
*/
- public long getCategoryCount(Category cat) {
+ synchronized public long getCategoryCount(Category cat) {
if (cat == Category.ZERO) {
// Keeping track of the uncategorized files is a bit tricky while ingest
// is going on, so always use the list of file IDs we already have along with the
@@ -102,7 +142,7 @@ public class CategoryManager {
*
* @param cat the Category to increment
*/
- public void incrementCategoryCount(Category cat) {
+ synchronized public void incrementCategoryCount(Category cat) {
if (cat != Category.ZERO) {
categoryCounts.getUnchecked(cat).increment();
}
@@ -114,7 +154,7 @@ public class CategoryManager {
*
* @param cat the Category to decrement
*/
- public void decrementCategoryCount(Category cat) {
+ synchronized public void decrementCategoryCount(Category cat) {
if (cat != Category.ZERO) {
categoryCounts.getUnchecked(cat).decrement();
}
@@ -130,7 +170,7 @@ public class CategoryManager {
* @return a LongAdder whose value is set to the number of file with the
* given Category
*/
- private LongAdder getCategoryCountHelper(Category cat) {
+ synchronized private LongAdder getCategoryCountHelper(Category cat) {
LongAdder longAdder = new LongAdder();
longAdder.decrement();
try {
@@ -147,8 +187,8 @@ public class CategoryManager {
*
* @param fileIDs
*/
- public void fireChange(Collection fileIDs) {
- categoryEventBus.post(new CategoryChangeEvent(fileIDs));
+ public void fireChange(Collection fileIDs, Category newCategory) {
+ categoryEventBus.post(new CategoryChangeEvent(fileIDs, newCategory));
}
/**
@@ -169,4 +209,97 @@ public class CategoryManager {
categoryEventBus.unregister(listener);
}
+ /**
+ * get the TagName used to store this Category in the main autopsy db.
+ *
+ * @return the TagName used for this Category
+ */
+ synchronized public TagName getTagName(Category cat) {
+ return catTagNameMap.getUnchecked(cat);
+
+ }
+
+ public static Category categoryFromTagName(TagName tagName) {
+ return Category.fromDisplayName(tagName.getDisplayName());
+ }
+
+ public static boolean isCategoryTagName(TagName tName) {
+ return Category.isCategoryName(tName.getDisplayName());
+ }
+
+ public static boolean isNotCategoryTagName(TagName tName) {
+ return Category.isNotCategoryName(tName.getDisplayName());
+
+ }
+
+ @Subscribe
+ public void handleTagAdded(ContentTagAddedEvent event) {
+ final ContentTag addedTag = event.getTag();
+ if (isCategoryTagName(addedTag.getName())) {
+ final DrawableTagsManager tagsManager = controller.getTagsManager();
+ try {
+ //remove old category tag(s) if necessary
+ for (ContentTag ct : tagsManager.getContentTagsByContent(addedTag.getContent())) {
+ if (ct.getId() != addedTag.getId()
+ && CategoryManager.isCategoryTagName(ct.getName())) {
+ try {
+ tagsManager.deleteContentTag(ct);
+ } catch (TskCoreException tskException) {
+ LOGGER.log(Level.SEVERE, "Failed to delete content tag. Unable to maintain categories in a consistent state.", tskException);
+ }
+ }
+ }
+ } catch (TskCoreException tskException) {
+ LOGGER.log(Level.SEVERE, "Failed to get content tags for content. Unable to maintain category in a consistent state.", tskException);
+ }
+ Category newCat = CategoryManager.categoryFromTagName(addedTag.getName());
+ if (newCat != Category.ZERO) {
+ incrementCategoryCount(newCat);
+ }
+
+ fireChange(Collections.singleton(addedTag.getContent().getId()), newCat);
+ }
+ }
+
+ @Subscribe
+ public void handleTagDeleted(ContentTagDeletedEvent event) {
+ ContentTag deleted = event.getTag();
+ if (isCategoryTagName(deleted.getName())) {
+
+ Category deletedCat = CategoryManager.categoryFromTagName(deleted.getName());
+ if (deletedCat != Category.ZERO) {
+ decrementCategoryCount(deletedCat);
+ }
+ fireChange(Collections.singleton(deleted.getContent().getId()), null);
+ }
+ }
+
+ /**
+ * Event broadcast to various UI componenets when one or more files'
+ * category
+ * has been changed
+ */
+ @Immutable
+ public static class CategoryChangeEvent {
+
+ private final Collection fileIDs;
+ private final Category newCategory;
+
+ public CategoryChangeEvent(Collection fileIDs, Category newCategory) {
+ super();
+ this.fileIDs = fileIDs;
+ this.newCategory = newCategory;
+ }
+
+ public Category getNewCategory() {
+ return newCategory;
+ }
+
+ /**
+ * @return the fileIDs of the files whose categories have changed
+ */
+ public Collection getFileIDs() {
+ return Collections.unmodifiableCollection(fileIDs);
+ }
+ }
}
diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableDB.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableDB.java
index a5f91bb9d3..ecd5a6a451 100644
--- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableDB.java
+++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableDB.java
@@ -34,6 +34,7 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
+import java.util.Objects;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.locks.Lock;
@@ -46,12 +47,12 @@ import org.apache.commons.lang3.StringUtils;
import org.openide.util.Exceptions;
import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.coreutils.Logger;
-import org.sleuthkit.autopsy.imagegallery.FileUpdateEvent;
+import org.sleuthkit.autopsy.imagegallery.ImageGalleryController;
import org.sleuthkit.autopsy.imagegallery.ImageGalleryModule;
-import org.sleuthkit.autopsy.imagegallery.grouping.GroupKey;
-import org.sleuthkit.autopsy.imagegallery.grouping.GroupManager;
-import org.sleuthkit.autopsy.imagegallery.grouping.GroupSortBy;
-import static org.sleuthkit.autopsy.imagegallery.grouping.GroupSortBy.GROUP_BY_VALUE;
+import org.sleuthkit.autopsy.imagegallery.datamodel.grouping.GroupKey;
+import org.sleuthkit.autopsy.imagegallery.datamodel.grouping.GroupManager;
+import org.sleuthkit.autopsy.imagegallery.datamodel.grouping.GroupSortBy;
+import static org.sleuthkit.autopsy.imagegallery.datamodel.grouping.GroupSortBy.GROUP_BY_VALUE;
import org.sleuthkit.datamodel.AbstractFile;
import org.sleuthkit.datamodel.BlackboardArtifact;
import org.sleuthkit.datamodel.BlackboardAttribute;
@@ -124,11 +125,6 @@ public final class DrawableDB {
*/
private final Map, PreparedStatement> groupStatementMap = new HashMap<>();
- /**
- * list of observers to be notified if the database changes
- */
- private final HashSet updateListeners = new HashSet<>();
-
private GroupManager groupManager;
private final Path dbPath;
@@ -147,6 +143,7 @@ public final class DrawableDB {
}
}
private final SleuthkitCase tskCase;
+ private final ImageGalleryController controller;
//////////////general database logic , mostly borrowed from sleuthkitcase
/**
@@ -195,9 +192,11 @@ public final class DrawableDB {
*
* @throws SQLException if there is problem creating or configuring the db
*/
- private DrawableDB(Path dbPath, SleuthkitCase tskCase) throws SQLException, ExceptionInInitializerError, IOException {
+ private DrawableDB(Path dbPath, ImageGalleryController controller) throws SQLException, ExceptionInInitializerError, IOException {
this.dbPath = dbPath;
- this.tskCase = tskCase;
+ this.controller = controller;
+ this.tskCase = controller.getSleuthKitCase();
+ this.groupManager = controller.getGroupManager();
Files.createDirectories(dbPath.getParent());
if (initializeDBSchema()) {
updateFileStmt = prepareStatement(
@@ -286,10 +285,10 @@ public final class DrawableDB {
*
* @return
*/
- public static DrawableDB getDrawableDB(Path dbPath, SleuthkitCase tskCase) {
+ public static DrawableDB getDrawableDB(Path dbPath, ImageGalleryController controller) {
try {
- return new DrawableDB(dbPath.resolve("drawable.db"), tskCase);
+ return new DrawableDB(dbPath.resolve("drawable.db"), controller);
} catch (SQLException ex) {
LOGGER.log(Level.SEVERE, "sql error creating database connection", ex);
return null;
@@ -584,27 +583,25 @@ public final class DrawableDB {
stmt.setBoolean(8, f.isAnalyzed());
stmt.executeUpdate();
- final Collection hashSetNames = DrawableAttribute.HASHSET.getValue(f);
+ final Collection hashSetNames = getHashSetsForFileFromAutopsy(f.getId());
- if (hashSetNames.isEmpty() == false) {
- for (String name : hashSetNames) {
+ for (String name : hashSetNames) {
- // "insert or ignore into hash_sets (hash_set_name) values (?)"
- insertHashSetStmt.setString(1, name);
- insertHashSetStmt.executeUpdate();
+ // "insert or ignore into hash_sets (hash_set_name) values (?)"
+ insertHashSetStmt.setString(1, name);
+ insertHashSetStmt.executeUpdate();
- //TODO: use nested select to get hash_set_id rather than seperate statement/query
- //"select hash_set_id from hash_sets where hash_set_name = ?"
- selectHashSetStmt.setString(1, name);
- try (ResultSet rs = selectHashSetStmt.executeQuery()) {
- while (rs.next()) {
- int hashsetID = rs.getInt("hash_set_id");
- //"insert or ignore into hash_set_hits (hash_set_id, obj_id) values (?,?)";
- insertHashHitStmt.setInt(1, hashsetID);
- insertHashHitStmt.setLong(2, f.getId());
- insertHashHitStmt.executeUpdate();
- break;
- }
+ //TODO: use nested select to get hash_set_id rather than seperate statement/query
+ //"select hash_set_id from hash_sets where hash_set_name = ?"
+ selectHashSetStmt.setString(1, name);
+ try (ResultSet rs = selectHashSetStmt.executeQuery()) {
+ while (rs.next()) {
+ int hashsetID = rs.getInt("hash_set_id");
+ //"insert or ignore into hash_set_hits (hash_set_id, obj_id) values (?,?)";
+ insertHashHitStmt.setInt(1, hashsetID);
+ insertHashHitStmt.setLong(2, f.getId());
+ insertHashHitStmt.executeUpdate();
+ break;
}
}
}
@@ -641,22 +638,6 @@ public final class DrawableDB {
tr.commit(notify);
}
- public void addUpdatedFileListener(FileUpdateEvent.FileUpdateListener l) {
- updateListeners.add(l);
- }
-
- private void fireUpdatedFiles(Collection fileIDs) {
- for (FileUpdateEvent.FileUpdateListener listener : updateListeners) {
- listener.handleFileUpdate(FileUpdateEvent.newUpdateEvent(fileIDs, null));
- }
- }
-
- private void fireRemovedFiles(Collection fileIDs) {
- for (FileUpdateEvent.FileUpdateListener listener : updateListeners) {
- listener.handleFileUpdate(FileUpdateEvent.newRemovedEvent(fileIDs));
- }
- }
-
public Boolean isFileAnalyzed(DrawableFile> f) {
return isFileAnalyzed(f.getId());
}
@@ -698,7 +679,7 @@ public final class DrawableDB {
public Boolean isGroupAnalyzed(GroupKey> gk) {
dbReadLock();
try {
- List fileIDsInGroup = getFileIDsInGroup(gk);
+ Set fileIDsInGroup = getFileIDsInGroup(gk);
try {
// In testing, this method appears to be a lot faster than doing one large select statement
@@ -747,10 +728,10 @@ public final class DrawableDB {
*
* @throws TskCoreException
*/
- public List findAllFileIdsWhere(String sqlWhereClause) throws TskCoreException {
+ public Set findAllFileIdsWhere(String sqlWhereClause) throws TskCoreException {
Statement statement = null;
ResultSet rs = null;
- List ret = new ArrayList<>();
+ Set ret = new HashSet<>();
dbReadLock();
try {
statement = con.createStatement();
@@ -984,7 +965,7 @@ public final class DrawableDB {
}
}
- public List getFileIDsInGroup(GroupKey> groupKey) throws TskCoreException {
+ public Set getFileIDsInGroup(GroupKey> groupKey) throws TskCoreException {
if (groupKey.getAttribute().isDBColumn) {
switch (groupKey.getAttribute().attrName) {
@@ -994,7 +975,7 @@ public final class DrawableDB {
return groupManager.getFileIDsWithTag((TagName) groupKey.getValue());
}
}
- List files = new ArrayList<>();
+ Set files = new HashSet<>();
dbReadLock();
try {
PreparedStatement statement = getGroupStatment(groupKey.getAttribute());
@@ -1055,7 +1036,7 @@ public final class DrawableDB {
public List> getFilesWithCategory(Category cat) throws TskCoreException, IllegalArgumentException {
try {
List> files = new ArrayList<>();
- List contentTags = Case.getCurrentCase().getServices().getTagsManager().getContentTagsByTagName(cat.getTagName());
+ List contentTags = controller.getTagsManager().getContentTagsByTagName(controller.getTagsManager().getTagName(cat));
for (ContentTag ct : contentTags) {
if (ct.getContent() instanceof AbstractFile) {
files.add(DrawableFile.create((AbstractFile) ct.getContent(), isFileAnalyzed(ct.getContent().getId()),
@@ -1113,6 +1094,8 @@ public final class DrawableDB {
removeFileStmt.setLong(1, id);
removeFileStmt.executeUpdate();
tr.addRemovedFile(id);
+
+ //TODO: delete from hash_set_hits table also...
} catch (SQLException ex) {
LOGGER.log(Level.WARNING, "failed to delete row for obj_id = " + id, ex);
} finally {
@@ -1140,16 +1123,13 @@ public final class DrawableDB {
*
* @return a set of names, each of which is a hashset that the given file is
* in.
- *
- *
- * //TODO: why does this go to the SKC? don't we already have this in =fo
- * in the drawable db?
*/
@Nonnull
- Set getHashSetsForFile(long fileID) {
+ public Set getHashSetsForFileFromAutopsy(long fileID) {
try {
Set hashNames = new HashSet<>();
List arts = tskCase.getBlackboardArtifacts(BlackboardArtifact.ARTIFACT_TYPE.TSK_HASHSET_HIT, fileID);
+
for (BlackboardArtifact a : arts) {
List attrs = a.getAttributes();
for (BlackboardAttribute attr : attrs) {
@@ -1157,8 +1137,8 @@ public final class DrawableDB {
hashNames.add(attr.getValueString());
}
}
- return hashNames;
}
+ return hashNames;
} catch (TskCoreException ex) {
LOGGER.log(Level.SEVERE, "failed to get hash sets for file", ex);
}
@@ -1217,10 +1197,24 @@ public final class DrawableDB {
/**
* For performance reasons, keep the file type in memory
*/
- private final Map videoFileMap = new ConcurrentHashMap<>();
+ private final Map videoFileMap = new ConcurrentHashMap<>();
+ /**
+ * is this File a video file?
+ *
+ * @param f check if this file is a video. will return false for null file.
+ *
+ * @return returns true if this file is a video as determined by {@link ImageGalleryModule#isVideoFile(org.sleuthkit.datamodel.AbstractFile)
+ * } but caches the result.
+ * returns false if passed a null AbstractFile
+ */
public boolean isVideoFile(AbstractFile f) {
- return videoFileMap.computeIfAbsent(f, ImageGalleryModule::isVideoFile);
+
+ if (Objects.isNull(f)) {
+ return false;
+ } else {
+ return videoFileMap.computeIfAbsent(f.getId(), (id) -> ImageGalleryModule.isVideoFile(f));
+ }
}
/**
@@ -1240,7 +1234,7 @@ public final class DrawableDB {
*/
public long getCategoryCount(Category cat) {
try {
- return Case.getCurrentCase().getServices().getTagsManager().getContentTagsByTagName(cat.getTagName()).stream()
+ return tskCase.getContentTagsByTagName(controller.getTagsManager().getTagName(cat)).stream()
.map(ContentTag::getContent)
.map(Content::getId)
.filter(this::isInDB)
@@ -1309,8 +1303,10 @@ public final class DrawableDB {
close();
if (notify) {
- fireUpdatedFiles(updatedFiles);
- fireRemovedFiles(removedFiles);
+ if (groupManager != null) {
+ groupManager.handleFileUpdate(updatedFiles);
+ groupManager.handleFileRemoved(removedFiles);
+ }
}
} catch (SQLException ex) {
if (Case.isCaseOpen()) {
diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableFile.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableFile.java
index 78bb8c6401..79ea49f879 100644
--- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableFile.java
+++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableFile.java
@@ -46,7 +46,6 @@ import static org.sleuthkit.datamodel.BlackboardAttribute.TSK_BLACKBOARD_ATTRIBU
import static org.sleuthkit.datamodel.BlackboardAttribute.TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE.LONG;
import static org.sleuthkit.datamodel.BlackboardAttribute.TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE.STRING;
import org.sleuthkit.datamodel.Content;
-import org.sleuthkit.datamodel.ContentTag;
import org.sleuthkit.datamodel.ContentVisitor;
import org.sleuthkit.datamodel.SleuthkitItemVisitor;
import org.sleuthkit.datamodel.Tag;
@@ -111,7 +110,6 @@ public abstract class DrawableFile extends AbstractFile
super(file.getSleuthkitCase(), file.getId(), file.getAttrType(), file.getAttrId(), file.getName(), file.getType(), file.getMetaAddr(), (int) file.getMetaSeq(), file.getDirType(), file.getMetaType(), null, new Integer(0).shortValue(), file.getSize(), file.getCtime(), file.getCrtime(), file.getAtime(), file.getMtime(), new Integer(0).shortValue(), file.getUid(), file.getGid(), file.getMd5Hash(), file.getKnown(), file.getParentPath());
this.analyzed = new SimpleBooleanProperty(analyzed);
this.file = file;
-
}
public abstract boolean isVideo();
@@ -170,19 +168,16 @@ public abstract class DrawableFile extends AbstractFile
public Set getTagNames() {
try {
- List contentTagsByContent = Case.getCurrentCase().getServices().getTagsManager().getContentTagsByContent(this);
- return contentTagsByContent.stream()
+ return getSleuthkitCase().getContentTagsByContent(this).stream()
.map(Tag::getName)
.collect(Collectors.toSet());
-
} catch (TskCoreException ex) {
Logger.getAnonymousLogger().log(Level.WARNING, "problem looking up " + DrawableAttribute.TAGS.getDisplayName() + " for " + file.getName(), ex);
- return Collections.emptySet();
} catch (IllegalStateException ex) {
Logger.getAnonymousLogger().log(Level.WARNING, "there is no case open; failed to look up " + DrawableAttribute.TAGS.getDisplayName() + " for " + file.getName());
- return Collections.emptySet();
}
+ return Collections.emptySet();
}
@Deprecated
@@ -273,27 +268,21 @@ public abstract class DrawableFile extends AbstractFile
return category;
}
- public void updateCategory() {
+ /** set the category property to the most severe one found */
+ private void updateCategory() {
try {
- List contentTagsByContent = Case.getCurrentCase().getServices().getTagsManager().getContentTagsByContent(this);
- Category cat = null;
- for (ContentTag ct : contentTagsByContent) {
- if (ct.getName().getDisplayName().startsWith(Category.CATEGORY_PREFIX)) {
- cat = Category.fromDisplayName(ct.getName().getDisplayName());
- break;
- }
- }
- if (cat == null) {
- category.set(Category.ZERO);
- } else {
- category.set(cat);
- }
+ category.set(getSleuthkitCase().getContentTagsByContent(this).stream()
+ .map(Tag::getName).filter(CategoryManager::isCategoryTagName)
+ .map(TagName::getDisplayName)
+ .map(Category::fromDisplayName)
+ .sorted().findFirst() //sort by severity and take the first
+ .orElse(Category.ZERO)
+ );
} catch (TskCoreException ex) {
Logger.getLogger(DrawableFile.class.getName()).log(Level.WARNING, "problem looking up category for file " + this.getName(), ex);
} catch (IllegalStateException ex) {
// We get here many times if the case is closed during ingest, so don't print out a ton of warnings.
}
-
}
public abstract Image getThumbnail();
diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableTagsManager.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableTagsManager.java
new file mode 100644
index 0000000000..2c29f44d85
--- /dev/null
+++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableTagsManager.java
@@ -0,0 +1,230 @@
+/*
+ * Autopsy Forensic Browser
+ *
+ * Copyright 2013-15 Basis Technology Corp.
+ * Contact: carrier sleuthkit 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.imagegallery.datamodel;
+
+import com.google.common.eventbus.AsyncEventBus;
+import com.google.common.eventbus.EventBus;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.Objects;
+import java.util.concurrent.Executors;
+import java.util.logging.Level;
+import java.util.stream.Collectors;
+import javax.annotation.Nonnull;
+import org.apache.commons.lang3.concurrent.BasicThreadFactory;
+import org.sleuthkit.autopsy.casemodule.services.TagsManager;
+import org.sleuthkit.autopsy.coreutils.Logger;
+import org.sleuthkit.autopsy.events.ContentTagAddedEvent;
+import org.sleuthkit.autopsy.events.ContentTagDeletedEvent;
+import org.sleuthkit.datamodel.Content;
+import org.sleuthkit.datamodel.ContentTag;
+import org.sleuthkit.datamodel.TagName;
+import org.sleuthkit.datamodel.TskCoreException;
+
+/**
+ * Manages Tags, Tagging, and the relationship between Categories and Tags in
+ * the autopsy Db. delegates some, work to the backing {@link TagsManager}.
+ */
+public class DrawableTagsManager {
+
+ private static final Logger LOGGER = Logger.getLogger(DrawableTagsManager.class.getName());
+
+ private static final String FOLLOW_UP = "Follow Up";
+
+ final private Object autopsyTagsManagerLock = new Object();
+ private TagsManager autopsyTagsManager;
+
+ /** Used to distribute {@link TagsChangeEvent}s */
+ private final EventBus tagsEventBus = new AsyncEventBus(
+ Executors.newSingleThreadExecutor(
+ new BasicThreadFactory.Builder().namingPattern("Tags Event Bus").uncaughtExceptionHandler((Thread t, Throwable e) -> {
+ LOGGER.log(Level.SEVERE, "uncaught exception in event bus handler", e);
+ }).build()
+ ));
+
+ /** The tag name corresponding to the "built-in" tag "Follow Up" */
+ private TagName followUpTagName;
+
+ public DrawableTagsManager(TagsManager autopsyTagsManager) {
+ this.autopsyTagsManager = autopsyTagsManager;
+
+ }
+
+ /**
+ * register an object to receive CategoryChangeEvents
+ *
+ * @param listner
+ */
+ public void registerListener(Object listner) {
+ tagsEventBus.register(listner);
+ }
+
+ /**
+ * unregister an object from receiving CategoryChangeEvents
+ *
+ * @param listener
+ */
+ public void unregisterListener(Object listener) {
+ tagsEventBus.unregister(listener);
+ }
+
+ public void fireTagAddedEvent(ContentTagAddedEvent event) {
+ tagsEventBus.post(event);
+ }
+
+ public void fireTagDeletedEvent(ContentTagDeletedEvent event) {
+ tagsEventBus.post(event);
+ }
+
+ /**
+ * assign a new TagsManager to back this one, ie when the current case
+ * changes
+ *
+ * @param autopsyTagsManager
+ */
+ public void setAutopsyTagsManager(TagsManager autopsyTagsManager) {
+ synchronized (autopsyTagsManagerLock) {
+ this.autopsyTagsManager = autopsyTagsManager;
+ clearFollowUpTagName();
+ }
+ }
+
+ /**
+ * Use when closing a case to make sure everything is re-initialized in the
+ * next case.
+ */
+ public void clearFollowUpTagName() {
+ synchronized (autopsyTagsManagerLock) {
+ followUpTagName = null;
+ }
+ }
+
+ /**
+ * get the (cached) follow up TagName
+ *
+ * @return
+ *
+ * @throws TskCoreException
+ */
+ public TagName getFollowUpTagName() throws TskCoreException {
+ synchronized (autopsyTagsManagerLock) {
+ if (Objects.isNull(followUpTagName)) {
+ followUpTagName = getTagName(FOLLOW_UP);
+ }
+ return followUpTagName;
+ }
+ }
+
+ /**
+ * get all the TagNames that are not categories
+ *
+ * @return all the TagNames that are not categories, in alphabetical order
+ * by displayName, or, an empty set if there was an exception looking them
+ * up from the db.
+ */
+ @Nonnull
+ public Collection getNonCategoryTagNames() {
+ synchronized (autopsyTagsManagerLock) {
+ try {
+ return autopsyTagsManager.getAllTagNames().stream()
+ .filter(CategoryManager::isNotCategoryTagName)
+ .distinct().sorted()
+ .collect(Collectors.toList());
+ } catch (TskCoreException | IllegalStateException ex) {
+ LOGGER.log(Level.WARNING, "couldn't access case", ex);
+ }
+ return Collections.emptySet();
+ }
+ }
+
+ /**
+ * Gets content tags count by content.
+ *
+ * @param The content of interest.
+ *
+ * @return A list, possibly empty, of the tags that have been applied to the
+ * artifact.
+ *
+ * @throws TskCoreException
+ */
+ public List getContentTagsByContent(Content content) throws TskCoreException {
+ synchronized (autopsyTagsManagerLock) {
+ return autopsyTagsManager.getContentTagsByContent(content);
+ }
+ }
+
+ public TagName getTagName(String displayName) throws TskCoreException {
+ synchronized (autopsyTagsManagerLock) {
+ try {
+ for (TagName tn : autopsyTagsManager.getAllTagNames()) {
+ if (displayName.equals(tn.getDisplayName())) {
+ return tn;
+ }
+ }
+ try {
+ return autopsyTagsManager.addTagName(displayName);
+ } catch (TagsManager.TagNameAlreadyExistsException ex) {
+ throw new TskCoreException("tagame exists but wasn't found", ex);
+ }
+ } catch (IllegalStateException ex) {
+ LOGGER.log(Level.SEVERE, "Case was closed out from underneath", ex);
+ throw new TskCoreException("Case was closed out from underneath", ex);
+ }
+ }
+ }
+
+ public TagName getTagName(Category cat) {
+ try {
+ return getTagName(cat.getDisplayName());
+ } catch (TskCoreException ex) {
+ return null;
+ }
+ }
+
+ public ContentTag addContentTag(DrawableFile> file, TagName tagName, String comment) throws TskCoreException {
+ synchronized (autopsyTagsManagerLock) {
+ return autopsyTagsManager.addContentTag(file.getAbstractFile(), tagName, comment);
+ }
+ }
+
+ public List getContentTagsByTagName(TagName t) throws TskCoreException {
+ synchronized (autopsyTagsManagerLock) {
+ return autopsyTagsManager.getContentTagsByTagName(t);
+ }
+ }
+
+ public List getAllTagNames() throws TskCoreException {
+ synchronized (autopsyTagsManagerLock) {
+ return autopsyTagsManager.getAllTagNames();
+ }
+ }
+
+ public List getTagNamesInUse() throws TskCoreException {
+ synchronized (autopsyTagsManagerLock) {
+ return autopsyTagsManager.getTagNamesInUse();
+ }
+ }
+
+ public void deleteContentTag(ContentTag ct) throws TskCoreException {
+ synchronized (autopsyTagsManagerLock) {
+ autopsyTagsManager.deleteContentTag(ct);
+ }
+ }
+}
diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/HashSetManager.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/HashSetManager.java
index 1ca547c81e..b8f48b50d4 100644
--- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/HashSetManager.java
+++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/HashSetManager.java
@@ -4,6 +4,7 @@ import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;
import java.util.Set;
+import org.sleuthkit.autopsy.imagegallery.datamodel.DrawableDB;
/**
* Manages a cache of hashset hits as a map from fileID to hashset names.
@@ -35,7 +36,7 @@ public class HashSetManager {
* @return the names of the hashsets the given fileID is in
*/
private Set getHashSetsForFileHelper(long fileID) {
- return db.getHashSetsForFile(fileID);
+ return db.getHashSetsForFileFromAutopsy(fileID);
}
/**
diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/ImageFile.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/ImageFile.java
index 94a701fbc3..2811ea95ef 100644
--- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/ImageFile.java
+++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/ImageFile.java
@@ -60,7 +60,6 @@ public class ImageFile extends DrawableFile {
}
if (image == null) {
-
try (ReadContentInputStream readContentInputStream = new ReadContentInputStream(this.getAbstractFile())) {
BufferedImage read = ImageIO.read(readContentInputStream);
image = SwingFXUtils.toFXImage(read, null);
@@ -68,8 +67,8 @@ public class ImageFile extends DrawableFile {
Logger.getLogger(ImageFile.class.getName()).log(Level.WARNING, "unable to read file" + getName());
return null;
}
- imageRef = new SoftReference<>(image);
}
+ imageRef = new SoftReference<>(image);
return image;
}
diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/grouping/DrawableGroup.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/grouping/DrawableGroup.java
similarity index 87%
rename from ImageGallery/src/org/sleuthkit/autopsy/imagegallery/grouping/DrawableGroup.java
rename to ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/grouping/DrawableGroup.java
index e6d1f3dad8..ac0493d75e 100644
--- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/grouping/DrawableGroup.java
+++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/grouping/DrawableGroup.java
@@ -16,10 +16,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.sleuthkit.autopsy.imagegallery.grouping;
+package org.sleuthkit.autopsy.imagegallery.datamodel.grouping;
-import java.util.List;
import java.util.Objects;
+import java.util.Set;
import java.util.logging.Level;
import javafx.beans.property.ReadOnlyBooleanWrapper;
import javafx.collections.FXCollections;
@@ -70,7 +70,7 @@ public class DrawableGroup implements Comparable {
return groupKey.getValueDisplayName();
}
- DrawableGroup(GroupKey> groupKey, List filesInGroup, boolean seen) {
+ DrawableGroup(GroupKey> groupKey, Set filesInGroup, boolean seen) {
this.groupKey = groupKey;
this.fileIDs.setAll(filesInGroup);
this.seen.set(seen);
@@ -134,7 +134,7 @@ public class DrawableGroup implements Comparable {
((DrawableGroup) obj).groupKey);
}
- synchronized public void addFile(Long f) {
+ synchronized void addFile(Long f) {
invalidateHashSetHitsCount();
if (fileIDs.contains(f) == false) {
fileIDs.add(f);
@@ -142,7 +142,21 @@ public class DrawableGroup implements Comparable {
}
}
- synchronized public void removeFile(Long f) {
+ synchronized void setFiles(Set extends Long> newFileIds) {
+ invalidateHashSetHitsCount();
+ boolean filesRemoved = fileIDs.removeIf((Long t) -> newFileIds.contains(t) == false);
+ if (filesRemoved) {
+ seen.set(false);
+ }
+ for (Long f : newFileIds) {
+ if (fileIDs.contains(f) == false) {
+ fileIDs.add(f);
+ seen.set(false);
+ }
+ }
+ }
+
+ synchronized void removeFile(Long f) {
invalidateHashSetHitsCount();
if (fileIDs.removeAll(f)) {
seen.set(false);
@@ -166,4 +180,5 @@ public class DrawableGroup implements Comparable {
public boolean isSeen() {
return seen.get();
}
+
}
diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/grouping/GroupKey.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/grouping/GroupKey.java
similarity index 94%
rename from ImageGallery/src/org/sleuthkit/autopsy/imagegallery/grouping/GroupKey.java
rename to ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/grouping/GroupKey.java
index 789cac7375..ce64bebaa3 100644
--- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/grouping/GroupKey.java
+++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/grouping/GroupKey.java
@@ -16,7 +16,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.sleuthkit.autopsy.imagegallery.grouping;
+package org.sleuthkit.autopsy.imagegallery.datamodel.grouping;
import java.util.Map;
import java.util.Objects;
@@ -56,7 +56,7 @@ public class GroupKey> implements Comparable
@Override
public String toString() {
- return "GroupKey: " + getAttribute() + " = " + getValue();
+ return "GroupKey: " + getAttribute().attrName + " = " + getValue();
}
@Override
diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/grouping/GroupManager.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/grouping/GroupManager.java
similarity index 62%
rename from ImageGallery/src/org/sleuthkit/autopsy/imagegallery/grouping/GroupManager.java
rename to ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/grouping/GroupManager.java
index ec35f6bb60..963324fc51 100644
--- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/grouping/GroupManager.java
+++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/grouping/GroupManager.java
@@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
- * Copyright 2013-4 Basis Technology Corp.
+ * Copyright 2013-15 Basis Technology Corp.
* Contact: carrier sleuthkit org
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -16,8 +16,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.sleuthkit.autopsy.imagegallery.grouping;
+package org.sleuthkit.autopsy.imagegallery.datamodel.grouping;
+import com.google.common.eventbus.Subscribe;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
@@ -28,18 +29,31 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
+import java.util.Objects;
import java.util.Set;
import java.util.TreeSet;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
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.property.ReadOnlyDoubleProperty;
import javafx.beans.property.ReadOnlyDoubleWrapper;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
+import static javafx.concurrent.Worker.State.CANCELLED;
+import static javafx.concurrent.Worker.State.FAILED;
+import static javafx.concurrent.Worker.State.READY;
+import static javafx.concurrent.Worker.State.RUNNING;
+import static javafx.concurrent.Worker.State.SCHEDULED;
+import static javafx.concurrent.Worker.State.SUCCEEDED;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+import javax.annotation.concurrent.GuardedBy;
import javax.swing.SortOrder;
+import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.concurrent.BasicThreadFactory;
import org.netbeans.api.progress.ProgressHandle;
@@ -47,17 +61,18 @@ import org.netbeans.api.progress.ProgressHandleFactory;
import org.openide.util.Exceptions;
import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.coreutils.LoggedTask;
-import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.coreutils.ThreadConfined;
import org.sleuthkit.autopsy.coreutils.ThreadConfined.ThreadType;
-import org.sleuthkit.autopsy.imagegallery.FileUpdateEvent;
+import org.sleuthkit.autopsy.events.ContentTagAddedEvent;
+import org.sleuthkit.autopsy.events.ContentTagDeletedEvent;
import org.sleuthkit.autopsy.imagegallery.ImageGalleryController;
import org.sleuthkit.autopsy.imagegallery.ImageGalleryModule;
-import org.sleuthkit.autopsy.imagegallery.TagUtils;
import org.sleuthkit.autopsy.imagegallery.datamodel.Category;
+import org.sleuthkit.autopsy.imagegallery.datamodel.CategoryManager;
import org.sleuthkit.autopsy.imagegallery.datamodel.DrawableAttribute;
import org.sleuthkit.autopsy.imagegallery.datamodel.DrawableDB;
import org.sleuthkit.autopsy.imagegallery.datamodel.DrawableFile;
+import org.sleuthkit.autopsy.imagegallery.datamodel.DrawableTagsManager;
import org.sleuthkit.datamodel.AbstractFile;
import org.sleuthkit.datamodel.BlackboardArtifact;
import org.sleuthkit.datamodel.BlackboardAttribute;
@@ -71,18 +86,19 @@ import org.sleuthkit.datamodel.TskCoreException;
* extent {@link SleuthkitCase} ) to facilitate creation, retrieval, updating,
* and sorting of {@link DrawableGroup}s.
*/
-public class GroupManager implements FileUpdateEvent.FileUpdateListener {
+public class GroupManager {
private static final Logger LOGGER = Logger.getLogger(GroupManager.class.getName());
private DrawableDB db;
private final ImageGalleryController controller;
+
/**
* map from {@link GroupKey}s to {@link DrawableGroup}s. All groups (even
- * not
- * fully analyzed or not visible groups could be in this map
+ * not fully analyzed or not visible groups could be in this map
*/
+ @GuardedBy("this")
private final Map, DrawableGroup> groupMap = new HashMap<>();
/**
@@ -90,16 +106,12 @@ public class GroupManager implements FileUpdateEvent.FileUpdateListener {
*/
@ThreadConfined(type = ThreadType.JFX)
private final ObservableList analyzedGroups = FXCollections.observableArrayList();
+ private final ObservableList unmodifiableAnalyzedGroups = FXCollections.unmodifiableObservableList(analyzedGroups);
- private final ObservableList publicAnalyzedGroupsWrapper = FXCollections.unmodifiableObservableList(analyzedGroups);
- /**
- * list of unseen groups
- */
+ /** list of unseen groups */
@ThreadConfined(type = ThreadType.JFX)
private final ObservableList unSeenGroups = FXCollections.observableArrayList();
-
-// private final SortedList sortedUnSeenGroups = new SortedList<>(unSeenGroups);
- private final ObservableList publicSortedUnseenGroupsWrapper = FXCollections.unmodifiableObservableList(unSeenGroups);
+ private final ObservableList unmodifiableUnSeenGroups = FXCollections.unmodifiableObservableList(unSeenGroups);
private ReGroupTask> groupByTask;
@@ -109,21 +121,22 @@ public class GroupManager implements FileUpdateEvent.FileUpdateListener {
private volatile DrawableAttribute> groupBy = DrawableAttribute.PATH;
private volatile SortOrder sortOrder = SortOrder.ASCENDING;
- private ReadOnlyDoubleWrapper regroupProgress = new ReadOnlyDoubleWrapper();
+ private final ReadOnlyDoubleWrapper regroupProgress = new ReadOnlyDoubleWrapper();
public void setDB(DrawableDB db) {
this.db = db;
- db.addUpdatedFileListener(this);
regroup(groupBy, sortBy, sortOrder, Boolean.TRUE);
}
+ @SuppressWarnings("ReturnOfCollectionOrArrayField")
public ObservableList getAnalyzedGroups() {
- return publicAnalyzedGroupsWrapper;
+ return unmodifiableAnalyzedGroups;
}
@ThreadConfined(type = ThreadType.JFX)
+ @SuppressWarnings("ReturnOfCollectionOrArrayField")
public ObservableList getUnSeenGroups() {
- return publicSortedUnseenGroupsWrapper;
+ return unmodifiableUnSeenGroups;
}
/**
@@ -151,7 +164,7 @@ public class GroupManager implements FileUpdateEvent.FileUpdateListener {
Set> resultSet = new HashSet<>();
for (Comparable> val : groupBy.getValue(file)) {
if (groupBy == DrawableAttribute.TAGS) {
- if (((TagName) val).getDisplayName().startsWith(Category.CATEGORY_PREFIX) == false) {
+ if (CategoryManager.isNotCategoryTagName((TagName) val)) {
resultSet.add(new GroupKey(groupBy, val));
}
} else {
@@ -187,7 +200,8 @@ public class GroupManager implements FileUpdateEvent.FileUpdateListener {
* or
* null if no group exists for that key.
*/
- public DrawableGroup getGroupForKey(GroupKey> groupKey) {
+ @Nullable
+ public DrawableGroup getGroupForKey(@Nonnull GroupKey> groupKey) {
synchronized (groupMap) {
return groupMap.get(groupKey);
}
@@ -231,46 +245,22 @@ public class GroupManager implements FileUpdateEvent.FileUpdateListener {
}
/**
- * make and return a new group with the given key and files. If a group
- * already existed for that key, it will be replaced.
- *
- * NOTE: this is the only API for making a new group.
- *
- * @param groupKey the groupKey that uniquely identifies this group
- * @param files a list of fileids that are members of this group
- *
- * @return the new DrawableGroup for the given key
- */
- public DrawableGroup makeGroup(GroupKey> groupKey, List files) {
- List newFiles = files == null ? new ArrayList<>() : files;
- final boolean groupSeen = db.isGroupSeen(groupKey);
- DrawableGroup g = new DrawableGroup(groupKey, newFiles, groupSeen);
-
- g.seenProperty().addListener((observable, oldSeen, newSeen) -> {
- markGroupSeen(g, newSeen);
- });
- synchronized (groupMap) {
- groupMap.put(groupKey, g);
- }
- return g;
- }
-
- /**
- * 'mark' the given group as seen. This removes it from the queue of groups
- * to review, and is persisted in the drawable db.
+ * 'mark' the given group as seen. This removes it from the queue of
+ * groups to review, and is persisted in the drawable db.
*
* @param group the {@link DrawableGroup} to mark as seen
*/
@ThreadConfined(type = ThreadType.JFX)
public void markGroupSeen(DrawableGroup group, boolean seen) {
+
db.markGroupSeen(group.getGroupKey(), seen);
group.setSeen(seen);
if (seen) {
unSeenGroups.removeAll(group);
} else if (unSeenGroups.contains(group) == false) {
unSeenGroups.add(group);
- FXCollections.sort(unSeenGroups, sortBy.getGrpComparator(sortOrder));
}
+ FXCollections.sort(unSeenGroups, sortBy.getGrpComparator(sortOrder));
}
/**
@@ -281,91 +271,35 @@ public class GroupManager implements FileUpdateEvent.FileUpdateListener {
* @param groupKey the value of groupKey
* @param fileID the value of file
*/
- public synchronized void removeFromGroup(GroupKey> groupKey, final Long fileID) {
+ public synchronized DrawableGroup removeFromGroup(GroupKey> groupKey, final Long fileID) {
//get grouping this file would be in
final DrawableGroup group = getGroupForKey(groupKey);
if (group != null) {
- group.removeFile(fileID);
+ Platform.runLater(() -> {
+ group.removeFile(fileID);
+ });
// If we're grouping by category, we don't want to remove empty groups.
if (groupKey.getAttribute() != DrawableAttribute.CATEGORY) {
if (group.fileIds().isEmpty()) {
- synchronized (groupMap) {
- groupMap.remove(groupKey, group);
- }
Platform.runLater(() -> {
- analyzedGroups.remove(group);
- unSeenGroups.remove(group);
+ if (analyzedGroups.contains(group)) {
+ analyzedGroups.remove(group);
+ FXCollections.sort(analyzedGroups, sortBy.getGrpComparator(sortOrder));
+ }
+ if (unSeenGroups.contains(group)) {
+ unSeenGroups.remove(group);
+ FXCollections.sort(unSeenGroups, sortBy.getGrpComparator(sortOrder));
+ }
});
}
- } else {
+ } else { //group == null
+ // It may be that this was the last unanalyzed file in the group, so test
+ // whether the group is now fully analyzed.
+ popuplateIfAnalyzed(groupKey, null);
}
}
- }
-
- public synchronized void populateAnalyzedGroup(final GroupKey> groupKey, List filesInGroup) {
- populateAnalyzedGroup(groupKey, filesInGroup, null);
- }
-
- /**
- * create a group with the given GroupKey and file ids and add it to the
- * analyzed group list.
- *
- * @param groupKey
- * @param filesInGroup
- */
- private synchronized > void populateAnalyzedGroup(final GroupKey groupKey, List filesInGroup, ReGroupTask task) {
-
- /* if this is not part of a regroup task or it is but the task is not
- * cancelled...
- *
- * this allows us to stop if a regroup task has been cancelled (e.g. the
- * user picked a different group by attribute, while the current task
- * was still running) */
- if (task == null || (task.isCancelled() == false)) {
- DrawableGroup g = makeGroup(groupKey, filesInGroup);
- populateAnalyzedGroup(g, task);
- }
- }
-
- private synchronized void populateAnalyzedGroup(final DrawableGroup g, ReGroupTask> task) {
-
- if (task == null || (task.isCancelled() == false)) {
- final boolean groupSeen = db.isGroupSeen(g.getGroupKey());
-
- Platform.runLater(() -> {
- if (analyzedGroups.contains(g) == false) {
- analyzedGroups.add(g);
- }
- markGroupSeen(g, groupSeen);
-
- });
- }
- }
-
- /**
- * check if the group for the given groupkey is analyzed
- *
- * @param groupKey
- *
- * @return null if this group is not analyzed or a list of file ids in
- * this
- * group if they are all analyzed
- */
- public List checkAnalyzed(final GroupKey> groupKey) {
- try {
- /* for attributes other than path we can't be sure a group is fully
- * analyzed because we don't know all the files that will be a part
- * of that group */
- if ((groupKey.getAttribute() != DrawableAttribute.PATH) || db.isGroupAnalyzed(groupKey)) {
- return getFileIDsInGroup(groupKey);
- } else {
- return null;
- }
- } catch (TskCoreException ex) {
- LOGGER.log(Level.SEVERE, "failed to get files for group: " + groupKey.getAttribute().attrName.toString() + " = " + groupKey.getValue(), ex);
- return null;
- }
+ return group;
}
/**
@@ -440,8 +374,8 @@ public class GroupManager implements FileUpdateEvent.FileUpdateListener {
values = (List) Arrays.asList(Category.values());
break;
case TAGS:
- values = (List) Case.getCurrentCase().getServices().getTagsManager().getTagNamesInUse().stream()
- .filter(t -> t.getDisplayName().startsWith(Category.CATEGORY_PREFIX) == false)
+ values = (List) controller.getTagsManager().getTagNamesInUse().stream()
+ .filter(CategoryManager::isNotCategoryTagName)
.collect(Collectors.toList());
break;
case ANALYZED:
@@ -464,7 +398,7 @@ public class GroupManager implements FileUpdateEvent.FileUpdateListener {
}
- public List getFileIDsInGroup(GroupKey> groupKey) throws TskCoreException {
+ public Set getFileIDsInGroup(GroupKey> groupKey) throws TskCoreException {
switch (groupKey.getAttribute().attrName) {
//these cases get special treatment
case CATEGORY:
@@ -481,34 +415,37 @@ public class GroupManager implements FileUpdateEvent.FileUpdateListener {
// @@@ This was kind of slow in the profiler. Maybe we should cache it.
// Unless the list of file IDs is necessary, use countFilesWithCategory() to get the counts.
- public List getFileIDsWithCategory(Category category) throws TskCoreException {
+ public Set getFileIDsWithCategory(Category category) throws TskCoreException {
try {
+ final DrawableTagsManager tagsManager = controller.getTagsManager();
if (category == Category.ZERO) {
+ List< TagName> tns = Stream.of(Category.ONE, Category.TWO, Category.THREE, Category.FOUR, Category.FIVE)
+ .map(tagsManager::getTagName)
+ .collect(Collectors.toList());
- List files = new ArrayList<>();
- TagName[] tns = {Category.FOUR.getTagName(), Category.THREE.getTagName(), Category.TWO.getTagName(), Category.ONE.getTagName(), Category.FIVE.getTagName()};
+ Set files = new HashSet<>();
for (TagName tn : tns) {
- List contentTags = Case.getCurrentCase().getServices().getTagsManager().getContentTagsByTagName(tn);
- for (ContentTag ct : contentTags) {
- if (ct.getContent() instanceof AbstractFile && db.isInDB(ct.getContent().getId())) {
- files.add(ct.getContent().getId());
- }
+ if (tn != null) {
+ List contentTags = tagsManager.getContentTagsByTagName(tn);
+ files.addAll(contentTags.stream()
+ .filter(ct -> ct.getContent() instanceof AbstractFile)
+ .filter(ct -> db.isInDB(ct.getContent().getId()))
+ .map(ct -> ct.getContent().getId())
+ .collect(Collectors.toSet()));
}
}
return db.findAllFileIdsWhere("obj_id NOT IN (" + StringUtils.join(files, ',') + ")");
} else {
- List files = new ArrayList<>();
- List contentTags = Case.getCurrentCase().getServices().getTagsManager().getContentTagsByTagName(category.getTagName());
- for (ContentTag ct : contentTags) {
- if (ct.getContent() instanceof AbstractFile && db.isInDB(ct.getContent().getId())) {
- files.add(ct.getContent().getId());
- }
- }
+ List contentTags = tagsManager.getContentTagsByTagName(tagsManager.getTagName(category));
+ return contentTags.stream()
+ .filter(ct -> ct.getContent() instanceof AbstractFile)
+ .filter(ct -> db.isInDB(ct.getContent().getId()))
+ .map(ct -> ct.getContent().getId())
+ .collect(Collectors.toSet());
- return files;
}
} catch (TskCoreException ex) {
LOGGER.log(Level.WARNING, "TSK error getting files in Category:" + category.getDisplayName(), ex);
@@ -516,17 +453,15 @@ public class GroupManager implements FileUpdateEvent.FileUpdateListener {
}
}
- public List getFileIDsWithTag(TagName tagName) throws TskCoreException {
+ public Set getFileIDsWithTag(TagName tagName) throws TskCoreException {
try {
- List files = new ArrayList<>();
- List contentTags = Case.getCurrentCase().getServices().getTagsManager().getContentTagsByTagName(tagName);
+ Set files = new HashSet<>();
+ List contentTags = controller.getTagsManager().getContentTagsByTagName(tagName);
for (ContentTag ct : contentTags) {
if (ct.getContent() instanceof AbstractFile && db.isInDB(ct.getContent().getId())) {
-
files.add(ct.getContent().getId());
}
}
-
return files;
} catch (TskCoreException ex) {
LOGGER.log(Level.WARNING, "TSK error getting files with Tag:" + tagName.getDisplayName(), ex);
@@ -567,7 +502,7 @@ public class GroupManager implements FileUpdateEvent.FileUpdateListener {
* @param sortOrder
* @param force true to force a full db query regroup
*/
- public > void regroup(final DrawableAttribute groupBy, final GroupSortBy sortBy, final SortOrder sortOrder, Boolean force) {
+ public synchronized > void regroup(final DrawableAttribute groupBy, final GroupSortBy sortBy, final SortOrder sortOrder, Boolean force) {
if (!Case.isCaseOpen()) {
return;
@@ -581,9 +516,6 @@ public class GroupManager implements FileUpdateEvent.FileUpdateListener {
if (groupByTask != null) {
groupByTask.cancel(true);
}
- Platform.runLater(() -> {
- FXCollections.sort(unSeenGroups, sortBy.getGrpComparator(sortOrder));
- });
groupByTask = new ReGroupTask(groupBy, sortBy, sortOrder);
Platform.runLater(() -> {
@@ -591,12 +523,12 @@ public class GroupManager implements FileUpdateEvent.FileUpdateListener {
});
regroupExecutor.submit(groupByTask);
} else {
- // just resort the list of groups
+ // resort the list of groups
setSortBy(sortBy);
setSortOrder(sortOrder);
Platform.runLater(() -> {
- FXCollections.sort(unSeenGroups, sortBy.getGrpComparator(sortOrder));
FXCollections.sort(analyzedGroups, sortBy.getGrpComparator(sortOrder));
+ FXCollections.sort(unSeenGroups, sortBy.getGrpComparator(sortOrder));
});
}
}
@@ -610,86 +542,149 @@ public class GroupManager implements FileUpdateEvent.FileUpdateListener {
return regroupProgress.getReadOnlyProperty();
}
+ @Subscribe
+ public void handleTagAdded(ContentTagAddedEvent evt) {
+ GroupKey> newGroupKey = null;
+ final long fileID = evt.getTag().getContent().getId();
+ if (groupBy == DrawableAttribute.CATEGORY && CategoryManager.isCategoryTagName(evt.getTag().getName())) {
+ newGroupKey = new GroupKey(DrawableAttribute.CATEGORY, CategoryManager.categoryFromTagName(evt.getTag().getName()));
+ for (GroupKey> oldGroupKey : groupMap.keySet()) {
+ if (oldGroupKey.equals(newGroupKey) == false) {
+ removeFromGroup(oldGroupKey, fileID);
+ }
+ }
+ } else if (groupBy == DrawableAttribute.TAGS && CategoryManager.isNotCategoryTagName(evt.getTag().getName())) {
+ newGroupKey = new GroupKey(DrawableAttribute.TAGS, evt.getTag().getName());
+ }
+ if (newGroupKey != null) {
+ DrawableGroup g = getGroupForKey(newGroupKey);
+ addFileToGroup(g, newGroupKey, fileID);
+ }
+ }
+
+ @SuppressWarnings("AssignmentToMethodParameter")
+ private void addFileToGroup(DrawableGroup g, final GroupKey> groupKey, final long fileID) {
+ if (g == null) {
+ //if there wasn't already a group check if there should be one now
+ g = popuplateIfAnalyzed(groupKey, null);
+ }
+ DrawableGroup group = g;
+ if (group != null) {
+ //if there is aleady a group that was previously deemed fully analyzed, then add this newly analyzed file to it.
+ Platform.runLater(() -> {
+ group.addFile(fileID);
+ });
+
+ }
+ }
+
+ @Subscribe
+ public void handleTagDeleted(ContentTagDeletedEvent evt) {
+ GroupKey> groupKey = null;
+ if (groupBy == DrawableAttribute.CATEGORY && CategoryManager.isCategoryTagName(evt.getTag().getName())) {
+ groupKey = new GroupKey(DrawableAttribute.CATEGORY, CategoryManager.categoryFromTagName(evt.getTag().getName()));
+ } else if (groupBy == DrawableAttribute.TAGS && CategoryManager.isNotCategoryTagName(evt.getTag().getName())) {
+ groupKey = new GroupKey(DrawableAttribute.TAGS, evt.getTag().getName());
+ }
+ if (groupKey != null) {
+ final long fileID = evt.getTag().getContent().getId();
+ DrawableGroup g = removeFromGroup(groupKey, fileID);
+ }
+ }
+
+ @Subscribe
+ synchronized public void handleFileRemoved(Collection removedFileIDs) {
+
+ for (final long fileId : removedFileIDs) {
+ //get grouping(s) this file would be in
+ Set> groupsForFile = getGroupKeysForFileID(fileId);
+
+ for (GroupKey> gk : groupsForFile) {
+ removeFromGroup(gk, fileId);
+ }
+ }
+ }
+
/**
* handle {@link FileUpdateEvent} sent from Db when files are
* inserted/updated
*
- * TODO: why isn't this just two methods!
- *
* @param evt
*/
- @Override
- synchronized public void handleFileUpdate(FileUpdateEvent evt) {
- final Collection fileIDs = evt.getFileIDs();
- switch (evt.getUpdateType()) {
- case REMOVE:
- for (final long fileId : fileIDs) {
- //get grouping(s) this file would be in
- Set> groupsForFile = getGroupKeysForFileID(fileId);
+ @Subscribe
+ synchronized public void handleFileUpdate(Collection updatedFileIDs) {
+ /**
+ * TODO: is there a way to optimize this to avoid quering to db
+ * so much. the problem is that as a new files are analyzed they
+ * might be in new groups( if we are grouping by say make or
+ * model) -jm
+ */
+ for (long fileId : updatedFileIDs) {
- for (GroupKey> gk : groupsForFile) {
- removeFromGroup(gk, fileId);
+ controller.getHashSetManager().invalidateHashSetsForFile(fileId);
- DrawableGroup g = getGroupForKey(gk);
-
- if (g == null) {
- // It may be that this was the last unanalyzed file in the group, so test
- // whether the group is now fully analyzed.
- //TODO: use method in groupmanager ?
- List checkAnalyzed = checkAnalyzed(gk);
- if (checkAnalyzed != null) { // => the group is analyzed, so add it to the ui
- populateAnalyzedGroup(gk, checkAnalyzed);
- }
- }
- }
- }
-
- break;
- case UPDATE:
-
- /**
- * TODO: is there a way to optimize this to avoid quering to db
- * so much. the problem is that as a new files are analyzed they
- * might be in new groups( if we are grouping by say make or
- * model)
- *
- * TODO: Should this be a InnerTask so it can be done by the
- * WorkerThread? Is it already done by worker thread because
- * handlefileUpdate is invoked through call on db in UpdateTask
- * innertask? -jm
- */
- for (final long fileId : fileIDs) {
-
- controller.getHashSetManager().invalidateHashSetsForFile(fileId);
-
- //get grouping(s) this file would be in
- Set> groupsForFile = getGroupKeysForFileID(fileId);
-
- for (GroupKey> gk : groupsForFile) {
- DrawableGroup g = getGroupForKey(gk);
-
- if (g != null) {
- //if there is aleady a group that was previously deemed fully analyzed, then add this newly analyzed file to it.
- g.addFile(fileId);
- } else {
- //if there wasn't already a group check if there should be one now
- //TODO: use method in groupmanager ?
- List checkAnalyzed = checkAnalyzed(gk);
- if (checkAnalyzed != null) { // => the group is analyzed, so add it to the ui
- populateAnalyzedGroup(gk, checkAnalyzed);
- }
- }
- }
- }
-
- //we fire this event for all files so that the category counts get updated during initial db population
- controller.getCategoryManager().fireChange(fileIDs);
-
- if (evt.getChangedAttribute() == DrawableAttribute.TAGS) {
- TagUtils.fireChange(fileIDs);
- }
- break;
+ //get grouping(s) this file would be in
+ Set> groupsForFile = getGroupKeysForFileID(fileId);
+ for (GroupKey> gk : groupsForFile) {
+ DrawableGroup g = getGroupForKey(gk);
+ addFileToGroup(g, gk, fileId);
+ }
}
+
+ //we fire this event for all files so that the category counts get updated during initial db population
+ controller.getCategoryManager().fireChange(updatedFileIDs, null);
+ }
+
+ private DrawableGroup popuplateIfAnalyzed(GroupKey> groupKey, ReGroupTask> task) {
+
+ if (Objects.nonNull(task) && (task.isCancelled())) {
+ /* if this method call is part of a ReGroupTask and that task is
+ * cancelled, no-op
+ *
+ * this allows us to stop if a regroup task has been cancelled (e.g.
+ * the user picked a different group by attribute, while the
+ * current task was still running) */
+
+ } else { // no task or un-cancelled task
+ if ((groupKey.getAttribute() != DrawableAttribute.PATH) || db.isGroupAnalyzed(groupKey)) {
+ /* for attributes other than path we can't be sure a group is
+ * fully analyzed because we don't know all the files that
+ * will be a part of that group,. just show them no matter what. */
+
+ try {
+ Set fileIDs = getFileIDsInGroup(groupKey);
+ if (Objects.nonNull(fileIDs)) {
+ DrawableGroup group;
+ final boolean groupSeen = db.isGroupSeen(groupKey);
+ synchronized (groupMap) {
+ if (groupMap.containsKey(groupKey)) {
+ group = groupMap.get(groupKey);
+ group.setFiles(ObjectUtils.defaultIfNull(fileIDs, Collections.emptySet()));
+ } else {
+ group = new DrawableGroup(groupKey, fileIDs, groupSeen);
+ group.seenProperty().addListener((o, oldSeen, newSeen) -> {
+ markGroupSeen(group, newSeen);
+ });
+ groupMap.put(groupKey, group);
+ }
+ }
+ Platform.runLater(() -> {
+ if (analyzedGroups.contains(group) == false) {
+ analyzedGroups.add(group);
+ if (Objects.isNull(task)) {
+ FXCollections.sort(analyzedGroups, sortBy.getGrpComparator(sortOrder));
+ }
+ }
+ markGroupSeen(group, groupSeen);
+ });
+ return group;
+ }
+ } catch (TskCoreException ex) {
+ LOGGER.log(Level.SEVERE, "failed to get files for group: " + groupKey.getAttribute().attrName.toString() + " = " + groupKey.getValue(), ex);
+ }
+ }
+ }
+ return null;
}
/**
@@ -730,20 +725,12 @@ public class GroupManager implements FileUpdateEvent.FileUpdateListener {
groupProgress = ProgressHandleFactory.createHandle("regrouping files by " + groupBy.attrName.toString() + " sorted by " + sortBy.name() + " in " + sortOrder.toString() + " order", this);
Platform.runLater(() -> {
analyzedGroups.clear();
- synchronized (unSeenGroups) {
- unSeenGroups.clear();
- }
+ unSeenGroups.clear();
});
- synchronized (groupMap) {
- groupMap.clear();
- }
// Get the list of group keys
final List vals = findValuesForAttribute(groupBy);
- // Make a list of each group
- final List groups = new ArrayList<>();
-
groupProgress.start(vals.size());
int p = 0;
@@ -756,27 +743,9 @@ public class GroupManager implements FileUpdateEvent.FileUpdateListener {
updateMessage("regrouping files by " + groupBy.attrName.toString() + " : " + val);
updateProgress(p, vals.size());
groupProgress.progress("regrouping files by " + groupBy.attrName.toString() + " : " + val, p);
- //check if this group is analyzed
- final GroupKey groupKey = new GroupKey<>(groupBy, val);
-
- List checkAnalyzed = checkAnalyzed(groupKey);
- if (checkAnalyzed != null) { // != null => the group is analyzed, so add it to the ui
-
- // makeGroup will create the group and add it to the map groupMap, but does not
- // update anything else
- DrawableGroup g = makeGroup(groupKey, checkAnalyzed);
- groups.add(g);
- }
+ popuplateIfAnalyzed(new GroupKey(groupBy, val), this);
}
-
- // Sort the group list
- Collections.sort(groups, sortBy.getGrpComparator(sortOrder));
-
- // Officially add all groups in order
- for (DrawableGroup g : groups) {
- populateAnalyzedGroup(g, ReGroupTask.this);
- }
-
+ FXCollections.sort(analyzedGroups, sortBy.getGrpComparator(sortOrder));
updateProgress(1, 1);
return null;
}
diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/grouping/GroupSortBy.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/grouping/GroupSortBy.java
similarity index 99%
rename from ImageGallery/src/org/sleuthkit/autopsy/imagegallery/grouping/GroupSortBy.java
rename to ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/grouping/GroupSortBy.java
index fa2b3e88d0..a7bdbb342e 100644
--- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/grouping/GroupSortBy.java
+++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/grouping/GroupSortBy.java
@@ -16,7 +16,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.sleuthkit.autopsy.imagegallery.grouping;
+package org.sleuthkit.autopsy.imagegallery.datamodel.grouping;
import java.util.Arrays;
import java.util.Comparator;
diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/grouping/GroupViewMode.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/grouping/GroupViewMode.java
new file mode 100644
index 0000000000..17a970ca13
--- /dev/null
+++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/grouping/GroupViewMode.java
@@ -0,0 +1,7 @@
+package org.sleuthkit.autopsy.imagegallery.datamodel.grouping;
+
+public enum GroupViewMode {
+
+ TILE, SLIDE_SHOW
+
+}
diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/grouping/GroupViewState.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/grouping/GroupViewState.java
similarity index 97%
rename from ImageGallery/src/org/sleuthkit/autopsy/imagegallery/grouping/GroupViewState.java
rename to ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/grouping/GroupViewState.java
index 4d4905a80a..86679340ab 100644
--- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/grouping/GroupViewState.java
+++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/grouping/GroupViewState.java
@@ -16,7 +16,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.sleuthkit.autopsy.imagegallery.grouping;
+package org.sleuthkit.autopsy.imagegallery.datamodel.grouping;
import java.util.Objects;
import java.util.Optional;
diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/grouping/GroupViewMode.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/grouping/GroupViewMode.java
deleted file mode 100644
index 5506223429..0000000000
--- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/grouping/GroupViewMode.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package org.sleuthkit.autopsy.imagegallery.grouping;
-
-public enum GroupViewMode {
-
- TILE, SLIDE_SHOW
-
-}
diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/DrawableTile.fxml b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/DrawableTile.fxml
deleted file mode 100644
index 4d34061c77..0000000000
--- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/DrawableTile.fxml
+++ /dev/null
@@ -1,66 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-