mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-15 01:07:42 +00:00
Merge pull request #4317 from rcordovano/image-gallery-lifecycle-management
4288 Image gallery life cycle management and thread safety improvements
This commit is contained in:
commit
c2b9dbc941
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Autopsy Forensic Browser
|
* Autopsy Forensic Browser
|
||||||
*
|
*
|
||||||
* Copyright 2011-2018 Basis Technology Corp.
|
* Copyright 2013-2018 Basis Technology Corp.
|
||||||
* Contact: carrier <at> sleuthkit <dot> org
|
* Contact: carrier <at> sleuthkit <dot> org
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
@ -37,7 +37,6 @@ import javafx.beans.Observable;
|
|||||||
import javafx.beans.property.DoubleProperty;
|
import javafx.beans.property.DoubleProperty;
|
||||||
import javafx.beans.property.ReadOnlyBooleanProperty;
|
import javafx.beans.property.ReadOnlyBooleanProperty;
|
||||||
import javafx.beans.property.ReadOnlyBooleanWrapper;
|
import javafx.beans.property.ReadOnlyBooleanWrapper;
|
||||||
import javafx.beans.property.ReadOnlyDoubleProperty;
|
|
||||||
import javafx.beans.property.ReadOnlyIntegerProperty;
|
import javafx.beans.property.ReadOnlyIntegerProperty;
|
||||||
import javafx.beans.property.ReadOnlyIntegerWrapper;
|
import javafx.beans.property.ReadOnlyIntegerWrapper;
|
||||||
import javafx.beans.property.ReadOnlyObjectProperty;
|
import javafx.beans.property.ReadOnlyObjectProperty;
|
||||||
@ -51,7 +50,6 @@ import javax.annotation.Nonnull;
|
|||||||
import static org.apache.commons.collections4.CollectionUtils.isNotEmpty;
|
import static org.apache.commons.collections4.CollectionUtils.isNotEmpty;
|
||||||
import org.netbeans.api.progress.ProgressHandle;
|
import org.netbeans.api.progress.ProgressHandle;
|
||||||
import org.openide.util.Cancellable;
|
import org.openide.util.Cancellable;
|
||||||
import org.openide.util.Exceptions;
|
|
||||||
import org.openide.util.NbBundle;
|
import org.openide.util.NbBundle;
|
||||||
import org.sleuthkit.autopsy.casemodule.Case;
|
import org.sleuthkit.autopsy.casemodule.Case;
|
||||||
import org.sleuthkit.autopsy.casemodule.Case.CaseType;
|
import org.sleuthkit.autopsy.casemodule.Case.CaseType;
|
||||||
@ -71,7 +69,6 @@ import org.sleuthkit.autopsy.imagegallery.datamodel.grouping.GroupManager;
|
|||||||
import org.sleuthkit.autopsy.imagegallery.datamodel.grouping.GroupViewState;
|
import org.sleuthkit.autopsy.imagegallery.datamodel.grouping.GroupViewState;
|
||||||
import org.sleuthkit.autopsy.ingest.IngestManager;
|
import org.sleuthkit.autopsy.ingest.IngestManager;
|
||||||
import org.sleuthkit.datamodel.AbstractFile;
|
import org.sleuthkit.datamodel.AbstractFile;
|
||||||
import org.sleuthkit.datamodel.Content;
|
|
||||||
import org.sleuthkit.datamodel.DataSource;
|
import org.sleuthkit.datamodel.DataSource;
|
||||||
import org.sleuthkit.datamodel.SleuthkitCase;
|
import org.sleuthkit.datamodel.SleuthkitCase;
|
||||||
import org.sleuthkit.datamodel.SleuthkitCase.CaseDbTransaction;
|
import org.sleuthkit.datamodel.SleuthkitCase.CaseDbTransaction;
|
||||||
@ -117,7 +114,7 @@ public final class ImageGalleryController {
|
|||||||
private final CategoryManager categoryManager;
|
private final CategoryManager categoryManager;
|
||||||
private final DrawableTagsManager tagsManager;
|
private final DrawableTagsManager tagsManager;
|
||||||
|
|
||||||
private ListeningExecutorService dbExecutor;
|
private final ListeningExecutorService dbExecutor;
|
||||||
|
|
||||||
private final Case autopsyCase;
|
private final Case autopsyCase;
|
||||||
private final SleuthkitCase sleuthKitCase;
|
private final SleuthkitCase sleuthKitCase;
|
||||||
@ -192,7 +189,6 @@ public final class ImageGalleryController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ImageGalleryController(@Nonnull Case newCase) throws TskCoreException {
|
ImageGalleryController(@Nonnull Case newCase) throws TskCoreException {
|
||||||
|
|
||||||
this.autopsyCase = Objects.requireNonNull(newCase);
|
this.autopsyCase = Objects.requireNonNull(newCase);
|
||||||
this.sleuthKitCase = newCase.getSleuthkitCase();
|
this.sleuthKitCase = newCase.getSleuthkitCase();
|
||||||
|
|
||||||
@ -325,19 +321,17 @@ public final class ImageGalleryController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* reset the state of the controller (eg if the case is closed)
|
* Shuts down this per case singleton image gallery controller.
|
||||||
*/
|
*/
|
||||||
public synchronized void reset() {
|
public synchronized void shutDown() {
|
||||||
logger.info("Closing ImageGalleryControler for case."); //NON-NLS
|
logger.log(Level.INFO, String.format("Shutting down image gallery controller for case %s (%s)", autopsyCase.getDisplayName(), autopsyCase.getName()));
|
||||||
|
|
||||||
selectionModel.clearSelection();
|
selectionModel.clearSelection();
|
||||||
thumbnailCache.clearCache();
|
thumbnailCache.clearCache();
|
||||||
historyManager.clear();
|
historyManager.clear();
|
||||||
groupManager.reset();
|
groupManager.reset();
|
||||||
|
|
||||||
shutDownDBExecutor();
|
shutDownDBExecutor();
|
||||||
drawableDB.close();
|
drawableDB.close();
|
||||||
dbExecutor = getNewDBExecutor();
|
logger.log(Level.INFO, String.format("Completed shut down of image gallery controller for case %s (%s)", autopsyCase.getDisplayName(), autopsyCase.getName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -353,8 +347,8 @@ public final class ImageGalleryController {
|
|||||||
* Returns a set of data source object ids that are stale.
|
* Returns a set of data source object ids that are stale.
|
||||||
*
|
*
|
||||||
* This includes any data sources already in the table, that are not in
|
* This includes any data sources already in the table, that are not in
|
||||||
* COMPLETE or IN_PROGRESS status, or any data sources that might have been added to the
|
* COMPLETE or IN_PROGRESS status, or any data sources that might have been
|
||||||
* case, but are not in the datasources table.
|
* added to the case, but are not in the datasources table.
|
||||||
*
|
*
|
||||||
* @return list of data source object ids that are stale.
|
* @return list of data source object ids that are stale.
|
||||||
*/
|
*/
|
||||||
@ -502,7 +496,6 @@ public final class ImageGalleryController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
synchronized private void shutDownDBExecutor() {
|
synchronized private void shutDownDBExecutor() {
|
||||||
if (dbExecutor != null) {
|
|
||||||
dbExecutor.shutdownNow();
|
dbExecutor.shutdownNow();
|
||||||
try {
|
try {
|
||||||
dbExecutor.awaitTermination(30, TimeUnit.SECONDS);
|
dbExecutor.awaitTermination(30, TimeUnit.SECONDS);
|
||||||
@ -510,7 +503,6 @@ public final class ImageGalleryController {
|
|||||||
logger.log(Level.WARNING, "Image Gallery failed to shutdown DB Task Executor in a timely fashion.", ex);
|
logger.log(Level.WARNING, "Image Gallery failed to shutdown DB Task Executor in a timely fashion.", ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private static ListeningExecutorService getNewDBExecutor() {
|
private static ListeningExecutorService getNewDBExecutor() {
|
||||||
return MoreExecutors.listeningDecorator(Executors.newSingleThreadExecutor(
|
return MoreExecutors.listeningDecorator(Executors.newSingleThreadExecutor(
|
||||||
@ -523,12 +515,10 @@ public final class ImageGalleryController {
|
|||||||
* @param bgTask
|
* @param bgTask
|
||||||
*/
|
*/
|
||||||
public synchronized void queueDBTask(BackgroundTask bgTask) {
|
public synchronized void queueDBTask(BackgroundTask bgTask) {
|
||||||
if (dbExecutor == null || dbExecutor.isShutdown()) {
|
if (!dbExecutor.isShutdown()) {
|
||||||
dbExecutor = getNewDBExecutor();
|
|
||||||
}
|
|
||||||
incrementQueueSize();
|
incrementQueueSize();
|
||||||
dbExecutor.submit(bgTask).addListener(this::decrementQueueSize, MoreExecutors.directExecutor());
|
dbExecutor.submit(bgTask).addListener(this::decrementQueueSize, MoreExecutors.directExecutor());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void incrementQueueSize() {
|
private void incrementQueueSize() {
|
||||||
@ -634,7 +624,6 @@ public final class ImageGalleryController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* task that updates one file in database with results from ingest
|
* task that updates one file in database with results from ingest
|
||||||
*/
|
*/
|
||||||
@ -671,7 +660,6 @@ public final class ImageGalleryController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base abstract class for various methods of copying image files data, for
|
* Base abstract class for various methods of copying image files data, for
|
||||||
* a given data source, into the Image gallery DB.
|
* a given data source, into the Image gallery DB.
|
||||||
@ -680,6 +668,7 @@ public final class ImageGalleryController {
|
|||||||
"BulkTask.stopCopy.status=Stopping copy to drawable db task.",
|
"BulkTask.stopCopy.status=Stopping copy to drawable db task.",
|
||||||
"BulkTask.errPopulating.errMsg=There was an error populating Image Gallery database."})
|
"BulkTask.errPopulating.errMsg=There was an error populating Image Gallery database."})
|
||||||
abstract static class BulkTransferTask extends BackgroundTask {
|
abstract static class BulkTransferTask extends BackgroundTask {
|
||||||
|
|
||||||
static private final String MIMETYPE_CLAUSE
|
static private final String MIMETYPE_CLAUSE
|
||||||
= "(mime_type LIKE '" //NON-NLS
|
= "(mime_type LIKE '" //NON-NLS
|
||||||
+ String.join("' OR mime_type LIKE '", FileTypeUtils.getAllSupportedMimeTypes()) //NON-NLS
|
+ String.join("' OR mime_type LIKE '", FileTypeUtils.getAllSupportedMimeTypes()) //NON-NLS
|
||||||
@ -756,7 +745,6 @@ public final class ImageGalleryController {
|
|||||||
updateProgress(0.0);
|
updateProgress(0.0);
|
||||||
int workDone = 0;
|
int workDone = 0;
|
||||||
|
|
||||||
|
|
||||||
// Cycle through all of the files returned and call processFile on each
|
// Cycle through all of the files returned and call processFile on each
|
||||||
//do in transaction
|
//do in transaction
|
||||||
drawableDbTransaction = taskDB.beginTransaction();
|
drawableDbTransaction = taskDB.beginTransaction();
|
||||||
@ -777,7 +765,6 @@ public final class ImageGalleryController {
|
|||||||
endedEarly = true;
|
endedEarly = true;
|
||||||
progressHandle.finish();
|
progressHandle.finish();
|
||||||
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Autopsy Forensic Browser
|
* Autopsy Forensic Browser
|
||||||
*
|
*
|
||||||
* Copyright 2013-18 Basis Technology Corp.
|
* Copyright 2013-2018 Basis Technology Corp.
|
||||||
* Contact: carrier <at> sleuthkit <dot> org
|
* Contact: carrier <at> sleuthkit <dot> org
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
@ -22,12 +22,16 @@ import java.beans.PropertyChangeEvent;
|
|||||||
import java.beans.PropertyChangeListener;
|
import java.beans.PropertyChangeListener;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
|
import java.util.EnumSet;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import javafx.application.Platform;
|
import javafx.application.Platform;
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
import javax.annotation.concurrent.GuardedBy;
|
||||||
import javax.swing.JOptionPane;
|
import javax.swing.JOptionPane;
|
||||||
import javax.swing.SwingUtilities;
|
import javax.swing.SwingUtilities;
|
||||||
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
import static org.apache.commons.lang3.StringUtils.isNotBlank;
|
import static org.apache.commons.lang3.StringUtils.isNotBlank;
|
||||||
import org.openide.util.Exceptions;
|
|
||||||
import org.openide.util.NbBundle;
|
import org.openide.util.NbBundle;
|
||||||
import org.sleuthkit.autopsy.casemodule.Case;
|
import org.sleuthkit.autopsy.casemodule.Case;
|
||||||
import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
|
import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
|
||||||
@ -35,16 +39,13 @@ import org.sleuthkit.autopsy.casemodule.events.ContentTagAddedEvent;
|
|||||||
import org.sleuthkit.autopsy.casemodule.events.ContentTagDeletedEvent;
|
import org.sleuthkit.autopsy.casemodule.events.ContentTagDeletedEvent;
|
||||||
import org.sleuthkit.autopsy.core.RuntimeProperties;
|
import org.sleuthkit.autopsy.core.RuntimeProperties;
|
||||||
import org.sleuthkit.autopsy.coreutils.Logger;
|
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||||
import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil;
|
|
||||||
import org.sleuthkit.autopsy.events.AutopsyEvent;
|
import org.sleuthkit.autopsy.events.AutopsyEvent;
|
||||||
import org.sleuthkit.autopsy.imagegallery.datamodel.DrawableDB;
|
import org.sleuthkit.autopsy.imagegallery.datamodel.DrawableDB;
|
||||||
import org.sleuthkit.autopsy.ingest.IngestManager;
|
import org.sleuthkit.autopsy.ingest.IngestManager;
|
||||||
import org.sleuthkit.autopsy.ingest.IngestManager.IngestJobEvent;
|
|
||||||
import static org.sleuthkit.autopsy.ingest.IngestManager.IngestModuleEvent.DATA_ADDED;
|
import static org.sleuthkit.autopsy.ingest.IngestManager.IngestModuleEvent.DATA_ADDED;
|
||||||
import static org.sleuthkit.autopsy.ingest.IngestManager.IngestModuleEvent.FILE_DONE;
|
import static org.sleuthkit.autopsy.ingest.IngestManager.IngestModuleEvent.FILE_DONE;
|
||||||
import org.sleuthkit.autopsy.ingest.ModuleDataEvent;
|
import org.sleuthkit.autopsy.ingest.ModuleDataEvent;
|
||||||
import org.sleuthkit.autopsy.ingest.events.DataSourceAnalysisCompletedEvent;
|
import org.sleuthkit.autopsy.ingest.events.DataSourceAnalysisEvent;
|
||||||
import org.sleuthkit.autopsy.ingest.events.DataSourceAnalysisStartedEvent;
|
|
||||||
import org.sleuthkit.autopsy.modules.filetypeid.FileTypeDetector;
|
import org.sleuthkit.autopsy.modules.filetypeid.FileTypeDetector;
|
||||||
import org.sleuthkit.datamodel.AbstractFile;
|
import org.sleuthkit.datamodel.AbstractFile;
|
||||||
import org.sleuthkit.datamodel.BlackboardArtifact;
|
import org.sleuthkit.datamodel.BlackboardArtifact;
|
||||||
@ -53,262 +54,266 @@ import org.sleuthkit.datamodel.Content;
|
|||||||
import org.sleuthkit.datamodel.TskCoreException;
|
import org.sleuthkit.datamodel.TskCoreException;
|
||||||
import org.sleuthkit.datamodel.TskData;
|
import org.sleuthkit.datamodel.TskData;
|
||||||
|
|
||||||
/** static definitions, utilities, and listeners for the ImageGallery module */
|
/**
|
||||||
|
* This class is reponsible for handling selected application events for the
|
||||||
|
* image gallery module, managing the image gallery module's per case MVC
|
||||||
|
* controller and keeping track of the following state: the module name, the
|
||||||
|
* module output directory and whether or not the ingest gallery module is
|
||||||
|
* enabled for the current case.
|
||||||
|
*/
|
||||||
@NbBundle.Messages({"ImageGalleryModule.moduleName=Image Gallery"})
|
@NbBundle.Messages({"ImageGalleryModule.moduleName=Image Gallery"})
|
||||||
public class ImageGalleryModule {
|
public class ImageGalleryModule {
|
||||||
|
|
||||||
private static final Logger logger = Logger.getLogger(ImageGalleryModule.class.getName());
|
private static final Logger logger = Logger.getLogger(ImageGalleryModule.class.getName());
|
||||||
|
|
||||||
private static final String MODULE_NAME = Bundle.ImageGalleryModule_moduleName();
|
private static final String MODULE_NAME = Bundle.ImageGalleryModule_moduleName();
|
||||||
|
private static final Set<Case.Events> CASE_EVENTS_OF_INTEREST = EnumSet.of(
|
||||||
|
Case.Events.CURRENT_CASE,
|
||||||
|
Case.Events.DATA_SOURCE_ADDED,
|
||||||
|
Case.Events.CONTENT_TAG_ADDED,
|
||||||
|
Case.Events.CONTENT_TAG_DELETED
|
||||||
|
);
|
||||||
private static final Object controllerLock = new Object();
|
private static final Object controllerLock = new Object();
|
||||||
|
@GuardedBy("controllerLock")
|
||||||
private static ImageGalleryController controller;
|
private static ImageGalleryController controller;
|
||||||
|
|
||||||
public static ImageGalleryController getController() throws TskCoreException, NoCurrentCaseException {
|
/**
|
||||||
|
* Gets the per case image gallery controller for the current case. The
|
||||||
|
* controller is changed in the case event listener.
|
||||||
|
*
|
||||||
|
* @return The image gallery controller for the current case.
|
||||||
|
*
|
||||||
|
* @throws TskCoreException If there is a problem creating the controller.
|
||||||
|
*/
|
||||||
|
public static ImageGalleryController getController() throws TskCoreException {
|
||||||
synchronized (controllerLock) {
|
synchronized (controllerLock) {
|
||||||
if (controller == null) {
|
if (controller == null) {
|
||||||
controller = new ImageGalleryController(Case.getCurrentCaseThrows());
|
try {
|
||||||
|
Case currentCase = Case.getCurrentCaseThrows();
|
||||||
|
controller = new ImageGalleryController(currentCase);
|
||||||
|
} catch (NoCurrentCaseException ex) {
|
||||||
|
throw new TskCoreException("Failed to get ", ex);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return controller;
|
return controller;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Sets the implicit exit property attribute of the JavaFX runtime to false
|
||||||
*
|
* and sets up listeners for application events. It is invoked at
|
||||||
* This method is invoked by virtue of the OnStart annotation on the OnStart
|
* application start up by virtue of the OnStart annotation on the OnStart
|
||||||
* class class
|
* class in this package.
|
||||||
*/
|
*/
|
||||||
static void onStart() {
|
static void onStart() {
|
||||||
Platform.setImplicitExit(false);
|
Platform.setImplicitExit(false);
|
||||||
logger.info("Setting up ImageGallery listeners"); //NON-NLS
|
|
||||||
|
|
||||||
IngestManager.getInstance().addIngestJobEventListener(new IngestJobEventListener());
|
IngestManager.getInstance().addIngestJobEventListener(new IngestJobEventListener());
|
||||||
IngestManager.getInstance().addIngestModuleEventListener(new IngestModuleEventListener());
|
IngestManager.getInstance().addIngestModuleEventListener(new IngestModuleEventListener());
|
||||||
Case.addPropertyChangeListener(new CaseEventListener());
|
Case.addEventTypeSubscriber(CASE_EVENTS_OF_INTEREST, new CaseEventListener());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the image gallery module name.
|
||||||
|
*
|
||||||
|
* @return The module name,
|
||||||
|
*/
|
||||||
static String getModuleName() {
|
static String getModuleName() {
|
||||||
return MODULE_NAME;
|
return MODULE_NAME;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get the Path to the Case's ImageGallery ModuleOutput subfolder; ie
|
* Gets the path to the image gallery module output folder for a given case.
|
||||||
* ".../[CaseName]/ModuleOutput/Image Gallery/"
|
|
||||||
*
|
*
|
||||||
* @param theCase the case to get the ImageGallery ModuleOutput subfolder
|
* @param theCase The case.
|
||||||
* for
|
|
||||||
*
|
*
|
||||||
* @return the Path to the ModuleOuput subfolder for Image Gallery
|
* @return The path to the image gallery module output folder for the case.
|
||||||
*/
|
*/
|
||||||
public static Path getModuleOutputDir(Case theCase) {
|
public static Path getModuleOutputDir(Case theCase) {
|
||||||
return Paths.get(theCase.getModuleDirectory(), getModuleName());
|
return Paths.get(theCase.getModuleDirectory(), getModuleName());
|
||||||
}
|
}
|
||||||
|
|
||||||
/** provides static utilities, can not be instantiated */
|
/**
|
||||||
|
* Prevents instantiation.
|
||||||
|
*/
|
||||||
private ImageGalleryModule() {
|
private ImageGalleryModule() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** is listening enabled for the given case
|
/**
|
||||||
|
* Indicates whether or not the image gallery module is enabled for a given
|
||||||
|
* case.
|
||||||
*
|
*
|
||||||
* @param c
|
* @param theCase The case.
|
||||||
*
|
*
|
||||||
* @return true if listening is enabled for the given case, false otherwise
|
* @return True or false.
|
||||||
*/
|
*/
|
||||||
static boolean isEnabledforCase(Case c) {
|
static boolean isEnabledforCase(@Nonnull Case theCase) {
|
||||||
if (c != null) {
|
String enabledforCaseProp = new PerCaseProperties(theCase).getConfigSetting(ImageGalleryModule.MODULE_NAME, PerCaseProperties.ENABLED);
|
||||||
String enabledforCaseProp = new PerCaseProperties(c).getConfigSetting(ImageGalleryModule.MODULE_NAME, PerCaseProperties.ENABLED);
|
|
||||||
return isNotBlank(enabledforCaseProp) ? Boolean.valueOf(enabledforCaseProp) : ImageGalleryPreferences.isEnabledByDefault();
|
return isNotBlank(enabledforCaseProp) ? Boolean.valueOf(enabledforCaseProp) : ImageGalleryPreferences.isEnabledByDefault();
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is the given file 'supported' and not 'known'(nsrl hash hit). If so we
|
* Indicates whether or not a given file is of interest to the image gallery
|
||||||
* should include it in {@link DrawableDB} and UI
|
* module (is "drawable") and is not marked as a "known" file (e.g., is not
|
||||||
|
* a file in the NSRL hash set).
|
||||||
*
|
*
|
||||||
* @param abstractFile
|
* @param file The file.
|
||||||
*
|
*
|
||||||
* @return true if the given {@link AbstractFile} is "drawable" and not
|
* @return True if the file is "drawable" and not "known", false otherwise.
|
||||||
* 'known', else false
|
|
||||||
*
|
*
|
||||||
* @throws
|
* @throws FileTypeDetectorInitException If there is an error determining
|
||||||
* org.sleuthkit.autopsy.modules.filetypeid.FileTypeDetector.FileTypeDetectorInitException
|
* the type of the file.
|
||||||
*/
|
*/
|
||||||
public static boolean isDrawableAndNotKnown(AbstractFile abstractFile) throws FileTypeDetector.FileTypeDetectorInitException {
|
private static boolean isDrawableAndNotKnown(AbstractFile abstractFile) throws FileTypeDetector.FileTypeDetectorInitException {
|
||||||
return (abstractFile.getKnown() != TskData.FileKnown.KNOWN) && FileTypeUtils.isDrawable(abstractFile);
|
return (abstractFile.getKnown() != TskData.FileKnown.KNOWN) && FileTypeUtils.isDrawable(abstractFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Listener for IngestModuleEvents
|
* A listener for ingest module application events.
|
||||||
*/
|
*/
|
||||||
static private class IngestModuleEventListener implements PropertyChangeListener {
|
static private class IngestModuleEventListener implements PropertyChangeListener {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void propertyChange(PropertyChangeEvent evt) {
|
public void propertyChange(PropertyChangeEvent event) {
|
||||||
if (RuntimeProperties.runningWithGUI() == false) {
|
|
||||||
/*
|
/*
|
||||||
* Running in "headless" mode, no need to process any events.
|
* Only process individual files and artifacts in "real time" on the
|
||||||
* This cannot be done earlier because the switch to core
|
* node that is running the ingest job. On a remote node, image
|
||||||
* components inactive may not have been made at start up.
|
* files are processed as a group when the ingest job is complete.
|
||||||
*/
|
*/
|
||||||
IngestManager.getInstance().removeIngestModuleEventListener(this);
|
// RJCTODO: DO we need to handle any events at all on an auot ingest node?
|
||||||
|
if (((AutopsyEvent) event).getSourceType() != AutopsyEvent.SourceType.LOCAL) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* only process individual files in realtime on the node that is
|
ImageGalleryController currentController;
|
||||||
* running the ingest. on a remote node, image files are processed
|
|
||||||
* enblock when ingest is complete */
|
|
||||||
if (((AutopsyEvent) evt).getSourceType() != AutopsyEvent.SourceType.LOCAL) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Bail out if the case is closed
|
|
||||||
try {
|
try {
|
||||||
if (controller == null || Case.getCurrentCaseThrows() == null) {
|
currentController = getController();
|
||||||
return;
|
// RJCTODO: If a closed controller had a method that could be
|
||||||
}
|
// queried to determine whether it was shut down, we could
|
||||||
} catch (NoCurrentCaseException ex) {
|
// bail out here. The older code that used to try to check for
|
||||||
return;
|
// a current case was flawed; there was no guarantee the current
|
||||||
}
|
// case was the same case associated with the event.
|
||||||
|
|
||||||
if (IngestManager.IngestModuleEvent.valueOf(evt.getPropertyName()) == FILE_DONE) {
|
|
||||||
|
|
||||||
// getOldValue has fileID getNewValue has Abstractfile
|
|
||||||
AbstractFile file = (AbstractFile) evt.getNewValue();
|
|
||||||
if (false == file.isFile()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
ImageGalleryController con = getController();
|
|
||||||
if (con.isListeningEnabled()) {
|
|
||||||
try {
|
|
||||||
// Update the entry if it is a picture and not in NSRL
|
|
||||||
if (isDrawableAndNotKnown(file)) {
|
|
||||||
con.queueDBTask(new ImageGalleryController.UpdateFileTask(file, controller.getDatabase()));
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (FileTypeDetector.FileTypeDetectorInitException ex) {
|
|
||||||
logger.log(Level.SEVERE, "Unable to determine if file is drawable and not known. Not making any changes to DB", ex); //NON-NLS
|
|
||||||
MessageNotifyUtil.Notify.error("Image Gallery Error",
|
|
||||||
"Unable to determine if file is drawable and not known. Not making any changes to DB. See the logs for details.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (NoCurrentCaseException ex) {
|
|
||||||
logger.log(Level.SEVERE, "Attempted to access ImageGallery with no case open.", ex); //NON-NLS
|
|
||||||
} catch (TskCoreException ex) {
|
} catch (TskCoreException ex) {
|
||||||
logger.log(Level.SEVERE, "Error getting ImageGalleryController.", ex); //NON-NLS
|
logger.log(Level.SEVERE, String.format("Failed to handle %s event", event.getPropertyName()), ex); //NON-NLS
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else if (IngestManager.IngestModuleEvent.valueOf(evt.getPropertyName()) == DATA_ADDED) {
|
|
||||||
ModuleDataEvent mde = (ModuleDataEvent) evt.getOldValue();
|
|
||||||
|
|
||||||
if (mde.getBlackboardArtifactType().getTypeID() == ARTIFACT_TYPE.TSK_METADATA_EXIF.getTypeID()) {
|
String eventType = event.getPropertyName();
|
||||||
DrawableDB drawableDB = controller.getDatabase();
|
switch (IngestManager.IngestModuleEvent.valueOf(eventType)) {
|
||||||
if (mde.getArtifacts() != null) {
|
case FILE_DONE:
|
||||||
for (BlackboardArtifact art : mde.getArtifacts()) {
|
AbstractFile file = (AbstractFile) event.getNewValue();
|
||||||
|
if (!file.isFile()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (currentController.isListeningEnabled()) {
|
||||||
|
try {
|
||||||
|
if (isDrawableAndNotKnown(file)) {
|
||||||
|
currentController.queueDBTask(new ImageGalleryController.UpdateFileTask(file, currentController.getDatabase()));
|
||||||
|
}
|
||||||
|
} catch (FileTypeDetector.FileTypeDetectorInitException ex) {
|
||||||
|
logger.log(Level.SEVERE, String.format("Failed to determine if file is of interest to the image gallery module, ignoring file (obj_id=%d)", file.getId()), ex); //NON-NLS
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case DATA_ADDED:
|
||||||
|
ModuleDataEvent artifactAddedEvent = (ModuleDataEvent) event.getOldValue();
|
||||||
|
if (CollectionUtils.isNotEmpty(artifactAddedEvent.getArtifacts())) {
|
||||||
|
DrawableDB drawableDB = currentController.getDatabase();
|
||||||
|
for (BlackboardArtifact art : artifactAddedEvent.getArtifacts()) {
|
||||||
|
if (artifactAddedEvent.getBlackboardArtifactType().getTypeID() == ARTIFACT_TYPE.TSK_METADATA_EXIF.getTypeID()) {
|
||||||
drawableDB.addExifCache(art.getObjectID());
|
drawableDB.addExifCache(art.getObjectID());
|
||||||
}
|
} else if (artifactAddedEvent.getBlackboardArtifactType().getTypeID() == ARTIFACT_TYPE.TSK_HASHSET_HIT.getTypeID()) {
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (mde.getBlackboardArtifactType().getTypeID() == ARTIFACT_TYPE.TSK_HASHSET_HIT.getTypeID()) {
|
|
||||||
DrawableDB drawableDB = controller.getDatabase();
|
|
||||||
if (mde.getArtifacts() != null) {
|
|
||||||
for (BlackboardArtifact art : mde.getArtifacts()) {
|
|
||||||
drawableDB.addHashSetCache(art.getObjectID());
|
drawableDB.addHashSetCache(art.getObjectID());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Listener for case events.
|
* A listener for case application events.
|
||||||
*/
|
*/
|
||||||
|
// RJCTODO: This code would be easier to read if there were two case event
|
||||||
|
// listeners, one that handled CURRENT_CASE events and one that handled
|
||||||
|
// the other events. Or event better, move the handling of Case events other
|
||||||
|
// than CURRENT_CASE into ImageGalleryController.
|
||||||
static private class CaseEventListener implements PropertyChangeListener {
|
static private class CaseEventListener implements PropertyChangeListener {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void propertyChange(PropertyChangeEvent evt) {
|
public void propertyChange(PropertyChangeEvent event) {
|
||||||
if (RuntimeProperties.runningWithGUI() == false) {
|
// RJCTODO: DO we need to handle any events at all on an auot ingest node?
|
||||||
/*
|
Case.Events eventType = Case.Events.valueOf(event.getPropertyName());
|
||||||
* Running in "headless" mode, no need to process any events.
|
if (eventType == Case.Events.CURRENT_CASE) {
|
||||||
* This cannot be done earlier because the switch to core
|
|
||||||
* components inactive may not have been made at start up.
|
|
||||||
*/
|
|
||||||
Case.removePropertyChangeListener(this);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
ImageGalleryController con;
|
|
||||||
try {
|
|
||||||
con = getController();
|
|
||||||
} catch (NoCurrentCaseException ex) {
|
|
||||||
logger.log(Level.SEVERE, "Attempted to access ImageGallery with no case open.", ex); //NON-NLS
|
|
||||||
return;
|
|
||||||
} catch (TskCoreException ex) {
|
|
||||||
logger.log(Level.SEVERE, "Error getting ImageGalleryController.", ex); //NON-NLS
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
switch (Case.Events.valueOf(evt.getPropertyName())) {
|
|
||||||
case CURRENT_CASE:
|
|
||||||
synchronized (controllerLock) {
|
synchronized (controllerLock) {
|
||||||
// case has changes: close window, reset everything
|
if (event.getNewValue() != null) {
|
||||||
SwingUtilities.invokeLater(ImageGalleryTopComponent::closeTopComponent);
|
/*
|
||||||
if (controller != null) {
|
* CURRENT_CASE(_OPENED) event.
|
||||||
controller.reset();
|
*/
|
||||||
}
|
Case newCase = (Case) event.getNewValue();
|
||||||
controller = null;
|
|
||||||
|
|
||||||
Case newCase = (Case) evt.getNewValue();
|
|
||||||
if (newCase != null) {
|
|
||||||
// a new case has been opened: connect db, groupmanager, start worker thread
|
|
||||||
try {
|
try {
|
||||||
controller = new ImageGalleryController(newCase);
|
controller = new ImageGalleryController(newCase);
|
||||||
} catch (TskCoreException ex) {
|
} catch (TskCoreException ex) {
|
||||||
logger.log(Level.SEVERE, "Error changing case in ImageGallery.", ex);
|
logger.log(Level.SEVERE, String.format("Failed to construct controller for new case %s (%s)", newCase.getDisplayName(), newCase.getName()), ex);
|
||||||
|
}
|
||||||
|
} else if (event.getOldValue() != null) {
|
||||||
|
/*
|
||||||
|
* CURRENT_CASE(_CLOSED) event.
|
||||||
|
*/
|
||||||
|
SwingUtilities.invokeLater(ImageGalleryTopComponent::closeTopComponent);
|
||||||
|
controller.shutDown();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
ImageGalleryController currentController;
|
||||||
|
try {
|
||||||
|
currentController = getController();
|
||||||
|
// RJCTODO: I think it would be best to move handling of these
|
||||||
|
// case events into the controller class and have the controller
|
||||||
|
// instance register/unregister as a listener when it is
|
||||||
|
// contructed and shuts down. This will improve the encapsulation
|
||||||
|
// of ImageGalleryController and allow it to check its own open/closed
|
||||||
|
// state before handling an event.
|
||||||
|
} catch (TskCoreException ex) {
|
||||||
|
logger.log(Level.SEVERE, String.format("Failed to handle %s event", event.getPropertyName()), ex); //NON-NLS
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
|
switch (eventType) {
|
||||||
case DATA_SOURCE_ADDED:
|
case DATA_SOURCE_ADDED:
|
||||||
//For a data source added on the local node, prepopulate all file data to drawable database
|
if (((AutopsyEvent) event).getSourceType() == AutopsyEvent.SourceType.LOCAL) {
|
||||||
if (((AutopsyEvent) evt).getSourceType() == AutopsyEvent.SourceType.LOCAL) {
|
Content newDataSource = (Content) event.getNewValue();
|
||||||
Content newDataSource = (Content) evt.getNewValue();
|
if (currentController.isListeningEnabled()) {
|
||||||
if (con.isListeningEnabled()) {
|
currentController.getDatabase().insertOrUpdateDataSource(newDataSource.getId(), DrawableDB.DrawableDbBuildStatusEnum.UNKNOWN);
|
||||||
controller.getDatabase().insertOrUpdateDataSource(newDataSource.getId(), DrawableDB.DrawableDbBuildStatusEnum.UNKNOWN);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case CONTENT_TAG_ADDED:
|
case CONTENT_TAG_ADDED:
|
||||||
final ContentTagAddedEvent tagAddedEvent = (ContentTagAddedEvent) evt;
|
final ContentTagAddedEvent tagAddedEvent = (ContentTagAddedEvent) event;
|
||||||
|
|
||||||
long objId = tagAddedEvent.getAddedTag().getContent().getId();
|
long objId = tagAddedEvent.getAddedTag().getContent().getId();
|
||||||
|
DrawableDB drawableDB = currentController.getDatabase();
|
||||||
// update the cache
|
drawableDB.addTagCache(objId); // RJCTODO: Why add the tag to the cache before doing the in DB check?
|
||||||
DrawableDB drawableDB = controller.getDatabase();
|
if (drawableDB.isInDB(objId)) {
|
||||||
drawableDB.addTagCache(objId);
|
currentController.getTagsManager().fireTagAddedEvent(tagAddedEvent);
|
||||||
|
|
||||||
if (con.getDatabase().isInDB(objId)) {
|
|
||||||
con.getTagsManager().fireTagAddedEvent(tagAddedEvent);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case CONTENT_TAG_DELETED:
|
case CONTENT_TAG_DELETED:
|
||||||
final ContentTagDeletedEvent tagDeletedEvent = (ContentTagDeletedEvent) evt;
|
final ContentTagDeletedEvent tagDeletedEvent = (ContentTagDeletedEvent) event;
|
||||||
if (con.getDatabase().isInDB(tagDeletedEvent.getDeletedTagInfo().getContentID())) {
|
if (currentController.getDatabase().isInDB(tagDeletedEvent.getDeletedTagInfo().getContentID())) {
|
||||||
con.getTagsManager().fireTagDeletedEvent(tagDeletedEvent);
|
currentController.getTagsManager().fireTagDeletedEvent(tagDeletedEvent);
|
||||||
}
|
} // RJCTODO: Why not remove the tag from the cache?
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
//we don't need to do anything for other events.
|
logger.log(Level.SEVERE, String.format("Received %s event with no subscription", event.getPropertyName())); //NON-NLS
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Listener for Ingest Job events.
|
* A listener for ingest job application events.
|
||||||
*/
|
*/
|
||||||
static private class IngestJobEventListener implements PropertyChangeListener {
|
static private class IngestJobEventListener implements PropertyChangeListener {
|
||||||
|
|
||||||
@ -319,52 +324,78 @@ public class ImageGalleryModule {
|
|||||||
"ImageGalleryController.dataSourceAnalyzed.confDlg.title=Image Gallery"
|
"ImageGalleryController.dataSourceAnalyzed.confDlg.title=Image Gallery"
|
||||||
})
|
})
|
||||||
@Override
|
@Override
|
||||||
public void propertyChange(PropertyChangeEvent evt) {
|
public void propertyChange(PropertyChangeEvent event) {
|
||||||
IngestJobEvent eventType = IngestJobEvent.valueOf(evt.getPropertyName());
|
/*
|
||||||
|
* Only handling data source analysis events.
|
||||||
|
*/
|
||||||
|
// RJCTODO: Do we need to handle any events at all on an auto ingest node?
|
||||||
|
// RJCTODO: This would be less messy if IngestManager supported
|
||||||
|
// subscribing for a subset of events the way case does, and it the
|
||||||
|
// conditional blocks became method calls.
|
||||||
|
if (!(event instanceof DataSourceAnalysisEvent)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ImageGalleryController controller;
|
||||||
try {
|
try {
|
||||||
ImageGalleryController controller = getController();
|
controller = getController();
|
||||||
|
// RJCTODO: I think it would be best to move handling of these
|
||||||
|
// case events into the controller class and have the controller
|
||||||
|
// instance register/unregister as a listener when it is
|
||||||
|
// contructed and shuts down. This will improve the encapsulation
|
||||||
|
// of ImageGalleryController and allow it to check its own open/closed
|
||||||
|
// state before handling an event.
|
||||||
|
} catch (TskCoreException ex) {
|
||||||
|
logger.log(Level.SEVERE, String.format("Failed to handle %s event", event.getPropertyName()), ex); //NON-NLS
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (eventType == IngestJobEvent.DATA_SOURCE_ANALYSIS_STARTED) {
|
DataSourceAnalysisEvent dataSourceEvent = (DataSourceAnalysisEvent) event;
|
||||||
|
Content dataSource = dataSourceEvent.getDataSource();
|
||||||
if (((AutopsyEvent) evt).getSourceType() == AutopsyEvent.SourceType.LOCAL) {
|
long dataSourceObjId = dataSource.getId();
|
||||||
|
String eventType = dataSourceEvent.getPropertyName();
|
||||||
|
try {
|
||||||
|
switch (IngestManager.IngestJobEvent.valueOf(eventType)) {
|
||||||
|
case DATA_SOURCE_ANALYSIS_STARTED:
|
||||||
|
if (((AutopsyEvent) event).getSourceType() == AutopsyEvent.SourceType.LOCAL) {
|
||||||
if (controller.isListeningEnabled()) {
|
if (controller.isListeningEnabled()) {
|
||||||
DataSourceAnalysisStartedEvent dataSourceAnalysisStartedEvent = (DataSourceAnalysisStartedEvent) evt;
|
|
||||||
Content dataSource = dataSourceAnalysisStartedEvent.getDataSource();
|
|
||||||
|
|
||||||
DrawableDB drawableDb = controller.getDatabase();
|
DrawableDB drawableDb = controller.getDatabase();
|
||||||
// Don't update status if it is is already marked as COMPLETE
|
// Don't update status if it is is already marked as COMPLETE
|
||||||
if (drawableDb.getDataSourceDbBuildStatus(dataSource.getId()) != DrawableDB.DrawableDbBuildStatusEnum.COMPLETE) {
|
if (drawableDb.getDataSourceDbBuildStatus(dataSourceObjId) != DrawableDB.DrawableDbBuildStatusEnum.COMPLETE) {
|
||||||
drawableDb.insertOrUpdateDataSource(dataSource.getId(), DrawableDB.DrawableDbBuildStatusEnum.IN_PROGRESS);
|
drawableDb.insertOrUpdateDataSource(dataSource.getId(), DrawableDB.DrawableDbBuildStatusEnum.IN_PROGRESS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (eventType == IngestJobEvent.DATA_SOURCE_ANALYSIS_COMPLETED) {
|
break;
|
||||||
|
case DATA_SOURCE_ANALYSIS_COMPLETED:
|
||||||
if (((AutopsyEvent) evt).getSourceType() == AutopsyEvent.SourceType.LOCAL) {
|
if (((AutopsyEvent) event).getSourceType() == AutopsyEvent.SourceType.LOCAL) {
|
||||||
|
/*
|
||||||
|
* This node just completed analysis of a data
|
||||||
|
* source. Set the state of the local drawables
|
||||||
|
* database.
|
||||||
|
*/
|
||||||
if (controller.isListeningEnabled()) {
|
if (controller.isListeningEnabled()) {
|
||||||
DataSourceAnalysisCompletedEvent dataSourceAnalysisCompletedEvent = (DataSourceAnalysisCompletedEvent) evt;
|
|
||||||
Content dataSource = dataSourceAnalysisCompletedEvent.getDataSource();
|
|
||||||
|
|
||||||
DrawableDB drawableDb = controller.getDatabase();
|
DrawableDB drawableDb = controller.getDatabase();
|
||||||
if (drawableDb.getDataSourceDbBuildStatus(dataSource.getId()) == DrawableDB.DrawableDbBuildStatusEnum.IN_PROGRESS) {
|
if (drawableDb.getDataSourceDbBuildStatus(dataSourceObjId) == DrawableDB.DrawableDbBuildStatusEnum.IN_PROGRESS) {
|
||||||
|
|
||||||
// If at least one file in CaseDB has mime type, then set to COMPLETE
|
// If at least one file in CaseDB has mime type, then set to COMPLETE
|
||||||
// Otherwise, back to UNKNOWN since we assume file type module was not run
|
// Otherwise, back to UNKNOWN since we assume file type module was not run
|
||||||
DrawableDB.DrawableDbBuildStatusEnum datasourceDrawableDBStatus =
|
DrawableDB.DrawableDbBuildStatusEnum datasourceDrawableDBStatus
|
||||||
controller.hasFilesWithMimeType(dataSource.getId()) ?
|
= controller.hasFilesWithMimeType(dataSourceObjId)
|
||||||
DrawableDB.DrawableDbBuildStatusEnum.COMPLETE :
|
? DrawableDB.DrawableDbBuildStatusEnum.COMPLETE
|
||||||
DrawableDB.DrawableDbBuildStatusEnum.UNKNOWN;
|
: DrawableDB.DrawableDbBuildStatusEnum.UNKNOWN;
|
||||||
|
|
||||||
controller.getDatabase().insertOrUpdateDataSource(dataSource.getId(), datasourceDrawableDBStatus);
|
controller.getDatabase().insertOrUpdateDataSource(dataSource.getId(), datasourceDrawableDBStatus);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
} else if (((AutopsyEvent) event).getSourceType() == AutopsyEvent.SourceType.REMOTE) {
|
||||||
}
|
/*
|
||||||
|
* A remote node just completed analysis of a data
|
||||||
if (((AutopsyEvent) evt).getSourceType() == AutopsyEvent.SourceType.REMOTE) {
|
* source. The local drawables database is therefore
|
||||||
// A remote node added a new data source and just finished ingest on it.
|
* stale. If the image gallery top component is
|
||||||
//drawable db is stale, and if ImageGallery is open, ask user what to do
|
* open, give the user an opportunity to update the
|
||||||
|
* drawables database now.
|
||||||
|
*/
|
||||||
controller.setCaseStale(true);
|
controller.setCaseStale(true);
|
||||||
if (controller.isListeningEnabled()) {
|
if (controller.isListeningEnabled()) {
|
||||||
SwingUtilities.invokeLater(() -> {
|
SwingUtilities.invokeLater(() -> {
|
||||||
@ -373,7 +404,6 @@ public class ImageGalleryModule {
|
|||||||
Bundle.ImageGalleryController_dataSourceAnalyzed_confDlg_msg(),
|
Bundle.ImageGalleryController_dataSourceAnalyzed_confDlg_msg(),
|
||||||
Bundle.ImageGalleryController_dataSourceAnalyzed_confDlg_title(),
|
Bundle.ImageGalleryController_dataSourceAnalyzed_confDlg_title(),
|
||||||
JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE);
|
JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE);
|
||||||
|
|
||||||
switch (showAnswer) {
|
switch (showAnswer) {
|
||||||
case JOptionPane.YES_OPTION:
|
case JOptionPane.YES_OPTION:
|
||||||
controller.rebuildDB();
|
controller.rebuildDB();
|
||||||
@ -381,18 +411,18 @@ public class ImageGalleryModule {
|
|||||||
case JOptionPane.NO_OPTION:
|
case JOptionPane.NO_OPTION:
|
||||||
case JOptionPane.CANCEL_OPTION:
|
case JOptionPane.CANCEL_OPTION:
|
||||||
default:
|
default:
|
||||||
break; //do nothing
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
catch (NoCurrentCaseException ex) {
|
|
||||||
logger.log(Level.SEVERE, "Attempted to access ImageGallery with no case open.", ex); //NON-NLS
|
|
||||||
} catch (TskCoreException ex) {
|
} catch (TskCoreException ex) {
|
||||||
logger.log(Level.SEVERE, "Error getting ImageGalleryController.", ex); //NON-NLS
|
logger.log(Level.SEVERE, String.format("Failed to handle %s event for %s (objId=%d)", dataSourceEvent.getPropertyName(), dataSource.getName(), dataSourceObjId), ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -199,7 +199,7 @@ final class ImageGalleryOptionsPanel extends javax.swing.JPanel {
|
|||||||
} catch (NoCurrentCaseException ex) {
|
} catch (NoCurrentCaseException ex) {
|
||||||
// It's not an error if there's no case open
|
// It's not an error if there's no case open
|
||||||
} catch (TskCoreException ex) {
|
} catch (TskCoreException ex) {
|
||||||
logger.log(Level.SEVERE, "Error getting ImageGalleryController.", ex); //NON-NLS
|
logger.log(Level.SEVERE, "Failed to get image gallery controller", ex); //NON-NLS
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Autopsy Forensic Browser
|
* Autopsy Forensic Browser
|
||||||
*
|
*
|
||||||
* Copyright 2011-2018 Basis Technology Corp.
|
* Copyright 2013-2018 Basis Technology Corp.
|
||||||
* Contact: carrier <at> sleuthkit <dot> org
|
* Contact: carrier <at> sleuthkit <dot> org
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
@ -49,6 +49,7 @@ import javafx.scene.layout.StackPane;
|
|||||||
import javafx.scene.layout.VBox;
|
import javafx.scene.layout.VBox;
|
||||||
import javafx.scene.paint.Color;
|
import javafx.scene.paint.Color;
|
||||||
import javafx.stage.Modality;
|
import javafx.stage.Modality;
|
||||||
|
import javax.annotation.concurrent.GuardedBy;
|
||||||
import javax.swing.SwingUtilities;
|
import javax.swing.SwingUtilities;
|
||||||
import static org.apache.commons.collections4.CollectionUtils.isNotEmpty;
|
import static org.apache.commons.collections4.CollectionUtils.isNotEmpty;
|
||||||
import static org.apache.commons.lang3.ObjectUtils.notEqual;
|
import static org.apache.commons.lang3.ObjectUtils.notEqual;
|
||||||
@ -61,7 +62,6 @@ import org.openide.windows.Mode;
|
|||||||
import org.openide.windows.RetainLocation;
|
import org.openide.windows.RetainLocation;
|
||||||
import org.openide.windows.TopComponent;
|
import org.openide.windows.TopComponent;
|
||||||
import org.openide.windows.WindowManager;
|
import org.openide.windows.WindowManager;
|
||||||
import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
|
|
||||||
import org.sleuthkit.autopsy.coreutils.Logger;
|
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||||
import org.sleuthkit.autopsy.coreutils.ThreadConfined;
|
import org.sleuthkit.autopsy.coreutils.ThreadConfined;
|
||||||
import org.sleuthkit.autopsy.imagegallery.datamodel.DrawableAttribute;
|
import org.sleuthkit.autopsy.imagegallery.datamodel.DrawableAttribute;
|
||||||
@ -81,16 +81,11 @@ import org.sleuthkit.datamodel.DataSource;
|
|||||||
import org.sleuthkit.datamodel.TskCoreException;
|
import org.sleuthkit.datamodel.TskCoreException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Top component which displays ImageGallery interface.
|
* The singleton Image Gallery top component.
|
||||||
*
|
|
||||||
* Although ImageGallery doesn't currently use the explorer manager, this
|
|
||||||
* TopComponent provides one through the getExplorerManager method. However,
|
|
||||||
* this does not seem to function correctly unless a Netbeans provided explorer
|
|
||||||
* view is present in the TopComponenet, even if it is invisible/ zero sized
|
|
||||||
*/
|
*/
|
||||||
@TopComponent.Description(
|
@TopComponent.Description(
|
||||||
preferredID = "ImageGalleryTopComponent",
|
preferredID = "ImageGalleryTopComponent",
|
||||||
//iconBase = "org/sleuthkit/autopsy/imagegallery/images/lightbulb.png" use this to put icon in window title area,
|
//iconBase = "org/sleuthkit/autopsy/imagegallery/images/lightbulb.png", /*use this to put icon in window title area*/
|
||||||
persistenceType = TopComponent.PERSISTENCE_NEVER)
|
persistenceType = TopComponent.PERSISTENCE_NEVER)
|
||||||
@RetainLocation("ImageGallery")
|
@RetainLocation("ImageGallery")
|
||||||
@TopComponent.Registration(mode = "ImageGallery", openAtStartup = false)
|
@TopComponent.Registration(mode = "ImageGallery", openAtStartup = false)
|
||||||
@ -101,13 +96,15 @@ import org.sleuthkit.datamodel.TskCoreException;
|
|||||||
@SuppressWarnings("PMD.SingularField") // UI widgets cause lots of false positives
|
@SuppressWarnings("PMD.SingularField") // UI widgets cause lots of false positives
|
||||||
public final class ImageGalleryTopComponent extends TopComponent implements ExplorerManager.Provider, Lookup.Provider {
|
public final class ImageGalleryTopComponent extends TopComponent implements ExplorerManager.Provider, Lookup.Provider {
|
||||||
|
|
||||||
public final static String PREFERRED_ID = "ImageGalleryTopComponent"; // NON-NLS
|
private static final long serialVersionUID = 1L;
|
||||||
|
public final static String PREFERRED_ID = "ImageGalleryTopComponent"; // NON-NLS // RJCTODO: This should not be public, clients should call getTopComponent instead
|
||||||
private static final Logger logger = Logger.getLogger(ImageGalleryTopComponent.class.getName());
|
private static final Logger logger = Logger.getLogger(ImageGalleryTopComponent.class.getName());
|
||||||
private static volatile boolean topComponentInitialized = false;
|
|
||||||
|
|
||||||
private final ExplorerManager em = new ExplorerManager();
|
private final ExplorerManager em = new ExplorerManager();
|
||||||
private final Lookup lookup = (ExplorerUtils.createLookup(em, getActionMap()));
|
private final Lookup lookup = (ExplorerUtils.createLookup(em, getActionMap()));
|
||||||
|
|
||||||
|
private final Object controllerLock = new Object();
|
||||||
|
@GuardedBy("controllerLock")
|
||||||
private ImageGalleryController controller;
|
private ImageGalleryController controller;
|
||||||
|
|
||||||
private SplitPane splitPane;
|
private SplitPane splitPane;
|
||||||
@ -125,148 +122,82 @@ public final class ImageGalleryTopComponent extends TopComponent implements Expl
|
|||||||
private final Region infoOverLayBackground = new TranslucentRegion();
|
private final Region infoOverLayBackground = new TranslucentRegion();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether the ImageGallery window is open or not.
|
* Queries whether the singleton Image Gallery top component's window is
|
||||||
|
* open. Note that calling this method will cause the top component to be
|
||||||
|
* constructed if it does not already exist.
|
||||||
*
|
*
|
||||||
* @return true, if Image gallery is opened, false otherwise
|
* @return True or false.
|
||||||
*/
|
*/
|
||||||
public static boolean isImageGalleryOpen() {
|
public static boolean isImageGalleryOpen() {
|
||||||
|
return getTopComponent().isOpened();
|
||||||
final TopComponent topComponent = WindowManager.getDefault().findTopComponent(PREFERRED_ID);
|
|
||||||
if (topComponent != null) {
|
|
||||||
return topComponent.isOpened();
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the top component window.
|
* Gets the singleton Image Gallery top component. Note that calling this
|
||||||
|
* method will cause the top component to be constructed if it does not
|
||||||
|
* already exist.
|
||||||
*
|
*
|
||||||
* @return Image gallery top component window, null if it's not open
|
* @return The top component.
|
||||||
*/
|
*/
|
||||||
public static TopComponent getTopComponent() {
|
public static ImageGalleryTopComponent getTopComponent() {
|
||||||
return WindowManager.getDefault().findTopComponent(PREFERRED_ID);
|
return (ImageGalleryTopComponent) WindowManager.getDefault().findTopComponent(PREFERRED_ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Open the ImageGalleryTopComponent.
|
* Creates the Image Gallery top component if it does not already exist and
|
||||||
|
* opens its window.
|
||||||
*
|
*
|
||||||
* @throws NoCurrentCaseException If there is no case open.
|
* @throws TskCoreException If there is a problem opening the top component.
|
||||||
* @throws TskCoreException If there is a problem accessing the case
|
|
||||||
* db.
|
|
||||||
*/
|
*/
|
||||||
@ThreadConfined(type = ThreadConfined.ThreadType.AWT)
|
@ThreadConfined(type = ThreadConfined.ThreadType.AWT)
|
||||||
@Messages({
|
public static void openTopComponent() throws TskCoreException {
|
||||||
"ImageGalleryTopComponent.chooseDataSourceDialog.headerText=Choose a data source to view.",
|
final ImageGalleryTopComponent topComponent = getTopComponent();
|
||||||
"ImageGalleryTopComponent.chooseDataSourceDialog.contentText=Data source:",
|
|
||||||
"ImageGalleryTopComponent.chooseDataSourceDialog.all=All",
|
|
||||||
"ImageGalleryTopComponent.chooseDataSourceDialog.titleText=Image Gallery",})
|
|
||||||
public static void openTopComponent() throws NoCurrentCaseException, TskCoreException {
|
|
||||||
|
|
||||||
// This creates the top component and adds the UI widgets (via the constructor) if it has not yet been opened
|
|
||||||
final TopComponent topComponent = WindowManager.getDefault().findTopComponent(PREFERRED_ID);
|
|
||||||
if (topComponent == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (topComponent.isOpened()) {
|
if (topComponent.isOpened()) {
|
||||||
showTopComponent(topComponent);
|
showTopComponent();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Wait until the FX UI has been created. This way, we can always
|
|
||||||
// show the gray progress screen
|
|
||||||
// TODO: do this in a more elegant way.
|
|
||||||
while (topComponentInitialized == false) {
|
|
||||||
}
|
|
||||||
|
|
||||||
ImageGalleryController controller = ImageGalleryModule.getController();
|
|
||||||
ImageGalleryTopComponent igTopComponent = (ImageGalleryTopComponent) topComponent;
|
|
||||||
igTopComponent.setController(controller);
|
|
||||||
|
|
||||||
//gather information about datasources and the groupmanager in a bg thread.
|
|
||||||
new Thread(new Task<Void>() {
|
|
||||||
@Override
|
|
||||||
protected Void call() throws Exception {
|
|
||||||
Map<DataSource, Boolean> dataSourcesTooManyFiles = new HashMap<>();
|
|
||||||
List<DataSource> dataSources = controller.getSleuthKitCase().getDataSources();
|
|
||||||
|
|
||||||
/*
|
|
||||||
* If there is only one datasource or the grouping is already
|
|
||||||
* set to something other than path , don't bother to ask for
|
|
||||||
* datasource.
|
|
||||||
*/
|
|
||||||
if (dataSources.size() <= 1
|
|
||||||
|| controller.getGroupManager().getGroupBy() != DrawableAttribute.PATH) {
|
|
||||||
// null represents all datasources, which is only one in this case.
|
|
||||||
dataSourcesTooManyFiles.put(null, controller.hasTooManyFiles(null));
|
|
||||||
igTopComponent.showDataSource(null, dataSourcesTooManyFiles);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Else there is more than one data source and the grouping is
|
|
||||||
* PATH (the default): open a dialog prompting the user to pick
|
|
||||||
* a datasource.
|
|
||||||
*/
|
|
||||||
dataSources.add(0, null); //null represents all datasources
|
|
||||||
//first, while still on background thread, gather viewability info for the datasources.
|
|
||||||
for (DataSource dataSource : dataSources) {
|
|
||||||
dataSourcesTooManyFiles.put(dataSource, controller.hasTooManyFiles(dataSource));
|
|
||||||
}
|
|
||||||
|
|
||||||
Platform.runLater(() -> {
|
|
||||||
//configure the dialog
|
|
||||||
List<Optional<DataSource>> dataSourceOptionals = dataSources.stream().map(Optional::ofNullable).collect(Collectors.toList());
|
|
||||||
ChoiceDialog<Optional<DataSource>> datasourceDialog = new ChoiceDialog<>(null, dataSourceOptionals);
|
|
||||||
datasourceDialog.setTitle(Bundle.ImageGalleryTopComponent_chooseDataSourceDialog_titleText());
|
|
||||||
datasourceDialog.setHeaderText(Bundle.ImageGalleryTopComponent_chooseDataSourceDialog_headerText());
|
|
||||||
datasourceDialog.setContentText(Bundle.ImageGalleryTopComponent_chooseDataSourceDialog_contentText());
|
|
||||||
datasourceDialog.initModality(Modality.APPLICATION_MODAL);
|
|
||||||
GuiUtils.setDialogIcons(datasourceDialog);
|
|
||||||
//get the combobox by its css class... this is hacky but should be safe.
|
|
||||||
@SuppressWarnings(value = "unchecked")
|
|
||||||
ComboBox<Optional<DataSource>> comboBox = (ComboBox<Optional<DataSource>>) datasourceDialog.getDialogPane().lookup(".combo-box");
|
|
||||||
//set custom cell renderer
|
|
||||||
comboBox.setCellFactory((ListView<Optional<DataSource>> param) -> new DataSourceCell(dataSourcesTooManyFiles, controller.getAllDataSourcesDrawableDBStatus()));
|
|
||||||
comboBox.setButtonCell(new DataSourceCell(dataSourcesTooManyFiles, controller.getAllDataSourcesDrawableDBStatus()));
|
|
||||||
|
|
||||||
DataSource dataSource = datasourceDialog.showAndWait().orElse(Optional.empty()).orElse(null);
|
|
||||||
try {
|
|
||||||
|
|
||||||
igTopComponent.showDataSource(dataSource, dataSourcesTooManyFiles);
|
|
||||||
} catch (TskCoreException ex) {
|
|
||||||
if (dataSource != null) {
|
|
||||||
logger.log(Level.SEVERE, "Error showing data source " + dataSource.getName() + ":" + dataSource.getId() + " in Image Gallery", ex);
|
|
||||||
} else {
|
} else {
|
||||||
logger.log(Level.SEVERE, "Error showing all data sources in Image Gallery.", ex);
|
topComponent.getCurrentControllerAndOpen();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}).start();
|
|
||||||
}
|
|
||||||
|
|
||||||
synchronized private void showDataSource(DataSource datasource, Map<DataSource, Boolean> dataSourcesTooManyFiles) throws TskCoreException {
|
/**
|
||||||
if (dataSourcesTooManyFiles.get(datasource)) {
|
* Configures the groups manager for the selected data source(s) and opens
|
||||||
|
* this top component's window.
|
||||||
|
*
|
||||||
|
* @param selectedDataSource The data source selected, null if all data
|
||||||
|
* sources are selected.
|
||||||
|
* @param dataSourcesTooManyFiles A map of data sources to flags indicating
|
||||||
|
* whether or not the data source has to many
|
||||||
|
* files to actually be displayed.
|
||||||
|
*/
|
||||||
|
private void openWithSelectedDataSources(DataSource selectedDataSource, Map<DataSource, Boolean> dataSourcesTooManyFiles) {
|
||||||
|
if (dataSourcesTooManyFiles.get(selectedDataSource)) {
|
||||||
Platform.runLater(ImageGalleryTopComponent::showTooManyFiles);
|
Platform.runLater(ImageGalleryTopComponent::showTooManyFiles);
|
||||||
return;
|
} else {
|
||||||
}
|
SwingUtilities.invokeLater(() -> showTopComponent());
|
||||||
// Display the UI so that they can see the progress screen
|
synchronized (controllerLock) {
|
||||||
SwingUtilities.invokeLater(() -> showTopComponent(this));
|
|
||||||
GroupManager groupManager = controller.getGroupManager();
|
GroupManager groupManager = controller.getGroupManager();
|
||||||
|
// RJCTODO: Why are there potentially hazardous nested synchronized
|
||||||
|
// blocks here (note: method used to be synchronized, my
|
||||||
|
// dedicated controllerLock lock just makes the nesting more obvious)?
|
||||||
|
// Why is the groups manager not taking responsibility for its own thread
|
||||||
|
// safety policy?
|
||||||
synchronized (groupManager) {
|
synchronized (groupManager) {
|
||||||
groupManager.regroup(datasource, groupManager.getGroupBy(), groupManager.getSortBy(), groupManager.getSortOrder(), true);
|
groupManager.regroup(selectedDataSource, groupManager.getGroupBy(), groupManager.getSortBy(), groupManager.getSortOrder(), true);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Displays a dialog box informing the user that the data source(s) selected
|
||||||
|
* to have their images displayed have too many image files and will not be
|
||||||
|
* displayed.
|
||||||
|
*/
|
||||||
@NbBundle.Messages({"ImageGallery.dialogTitle=Image Gallery",
|
@NbBundle.Messages({"ImageGallery.dialogTitle=Image Gallery",
|
||||||
"ImageGallery.showTooManyFiles.contentText=There are too many files in the selected datasource(s) to ensure reasonable performance.",
|
"ImageGallery.showTooManyFiles.contentText=There are too many files in the selected datasource(s) to ensure reasonable performance.",
|
||||||
"ImageGallery.showTooManyFiles.headerText="})
|
"ImageGallery.showTooManyFiles.headerText="})
|
||||||
public static void showTooManyFiles() {
|
private static void showTooManyFiles() {
|
||||||
Alert dialog = new Alert(Alert.AlertType.INFORMATION,
|
Alert dialog = new Alert(Alert.AlertType.INFORMATION, Bundle.ImageGallery_showTooManyFiles_contentText(), ButtonType.OK);
|
||||||
Bundle.ImageGallery_showTooManyFiles_contentText(), ButtonType.OK);
|
|
||||||
dialog.initModality(Modality.APPLICATION_MODAL);
|
dialog.initModality(Modality.APPLICATION_MODAL);
|
||||||
dialog.setTitle(Bundle.ImageGallery_dialogTitle());
|
dialog.setTitle(Bundle.ImageGallery_dialogTitle());
|
||||||
GuiUtils.setDialogIcons(dialog);
|
GuiUtils.setDialogIcons(dialog);
|
||||||
@ -274,8 +205,14 @@ public final class ImageGalleryTopComponent extends TopComponent implements Expl
|
|||||||
dialog.showAndWait();
|
dialog.showAndWait();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Opens the singleton top component's window, brings it to the front and
|
||||||
|
* gives it focus. Note that calling this method will cause the top
|
||||||
|
* component to be constructed if it does not already exist.
|
||||||
|
*/
|
||||||
@ThreadConfined(type = ThreadConfined.ThreadType.AWT)
|
@ThreadConfined(type = ThreadConfined.ThreadType.AWT)
|
||||||
public static void showTopComponent(TopComponent topComponent) {
|
private static void showTopComponent() {
|
||||||
|
final ImageGalleryTopComponent topComponent = getTopComponent();
|
||||||
if (topComponent.isOpened() == false) {
|
if (topComponent.isOpened() == false) {
|
||||||
topComponent.open();
|
topComponent.open();
|
||||||
}
|
}
|
||||||
@ -283,46 +220,77 @@ public final class ImageGalleryTopComponent extends TopComponent implements Expl
|
|||||||
topComponent.requestActive();
|
topComponent.requestActive();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Closes the singleton Image Gallery top component. Note that calling this
|
||||||
|
* method will cause the top component to be constructed if it does not
|
||||||
|
* already exist.
|
||||||
|
*/
|
||||||
public static void closeTopComponent() {
|
public static void closeTopComponent() {
|
||||||
if (topComponentInitialized) {
|
// RJCTODO: Could add the flag that used to be used for the busy wait on
|
||||||
final TopComponent etc = WindowManager.getDefault().findTopComponent(PREFERRED_ID);
|
// the initial JavaFX thread task to avoid superfluous construction here.
|
||||||
if (etc != null) {
|
getTopComponent().close();
|
||||||
try {
|
|
||||||
etc.close();
|
|
||||||
} catch (Exception e) {
|
|
||||||
logger.log(Level.SEVERE, "failed to close " + PREFERRED_ID, e); // NON-NLS
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Contructs the singleton Image Gallery top component. Called by the
|
||||||
|
* NetBeans WindowManager.
|
||||||
|
*/
|
||||||
public ImageGalleryTopComponent() {
|
public ImageGalleryTopComponent() {
|
||||||
setName(Bundle.CTL_ImageGalleryTopComponent());
|
setName(Bundle.CTL_ImageGalleryTopComponent());
|
||||||
initComponents();
|
initComponents();
|
||||||
try {
|
|
||||||
setController(ImageGalleryModule.getController());
|
|
||||||
} catch (NoCurrentCaseException ex) {
|
|
||||||
logger.log(Level.SEVERE, "Attempted to access ImageGallery with no case open.", ex); //NON-NLS
|
|
||||||
} catch (TskCoreException ex) {
|
|
||||||
logger.log(Level.SEVERE, "Error getting ImageGalleryController.", ex); //NON-NLS
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
synchronized private void setController(ImageGalleryController controller) {
|
/**
|
||||||
if (notEqual(this.controller, controller)) {
|
* Gets the current controller, allows the user to select the data sources
|
||||||
if (this.controller != null) {
|
* for which images are to be displayed and opens the top component's
|
||||||
this.controller.reset();
|
* window.
|
||||||
}
|
*
|
||||||
this.controller = controller;
|
* @throws TskCoreException If there is an error getting the current
|
||||||
|
* controller.
|
||||||
|
*/
|
||||||
|
@Messages({
|
||||||
|
"ImageGalleryTopComponent.chooseDataSourceDialog.headerText=Choose a data source to view.",
|
||||||
|
"ImageGalleryTopComponent.chooseDataSourceDialog.contentText=Data source:",
|
||||||
|
"ImageGalleryTopComponent.chooseDataSourceDialog.all=All",
|
||||||
|
"ImageGalleryTopComponent.chooseDataSourceDialog.titleText=Image Gallery",})
|
||||||
|
private void getCurrentControllerAndOpen() throws TskCoreException {
|
||||||
|
ImageGalleryController currentController = ImageGalleryModule.getController();
|
||||||
|
/*
|
||||||
|
* Dispatch a task to run in the JavaFX thread. This task will swap the
|
||||||
|
* new controller, if there is one, into this top component and its
|
||||||
|
* child UI components. This task also queues another JavaFX thread task
|
||||||
|
* to check for analyzed groups, which has the side effect of starting
|
||||||
|
* the spinner(s) that take the place of a wait cursor. Finally, this
|
||||||
|
* task starts a background thread to query the case database. This
|
||||||
|
* background task may dispatch a JavaFX thread task to do a data source
|
||||||
|
* selection dialog. Ultimately, there is a final task that either opens
|
||||||
|
* the window in the AWT EDT or displays a "too many files" dialog in
|
||||||
|
* the JFX thread.
|
||||||
|
*/
|
||||||
|
// RJCTODO: Verify the side effect remark above.
|
||||||
Platform.runLater(new Runnable() {
|
Platform.runLater(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
//initialize jfx ui
|
synchronized (controllerLock) {
|
||||||
fullUIStack = new StackPane(); //this is passed into controller
|
if (notEqual(controller, currentController)) {
|
||||||
|
controller = currentController;
|
||||||
|
/*
|
||||||
|
* Create or re-create the top component's child UI
|
||||||
|
* components. This is currently done every time a new
|
||||||
|
* controller is created (i.e., a new case is opened).
|
||||||
|
* It could be done by resetting the controller in the
|
||||||
|
* child UI components instead.
|
||||||
|
*/
|
||||||
|
// RJCTODO: Construction of these components can perhaps
|
||||||
|
// be separated from opening the window again so that
|
||||||
|
// a setController implementation could be called from
|
||||||
|
// the case opened event handler in the ImageGalleryModule
|
||||||
|
// object.
|
||||||
|
fullUIStack = new StackPane();
|
||||||
myScene = new Scene(fullUIStack);
|
myScene = new Scene(fullUIStack);
|
||||||
jfxPanel.setScene(myScene);
|
jfxPanel.setScene(myScene);
|
||||||
groupPane = new GroupPane(controller);
|
groupPane = new GroupPane(controller);
|
||||||
centralStack = new StackPane(groupPane); //this is passed into controller
|
centralStack = new StackPane(groupPane);
|
||||||
fullUIStack.getChildren().add(borderPane);
|
fullUIStack.getChildren().add(borderPane);
|
||||||
splitPane = new SplitPane();
|
splitPane = new SplitPane();
|
||||||
borderPane.setCenter(splitPane);
|
borderPane.setCenter(splitPane);
|
||||||
@ -343,16 +311,86 @@ public final class ImageGalleryTopComponent extends TopComponent implements Expl
|
|||||||
splitPane.getItems().addAll(leftPane, centralStack, metaDataTable);
|
splitPane.getItems().addAll(leftPane, centralStack, metaDataTable);
|
||||||
splitPane.setDividerPositions(0.1, 1.0);
|
splitPane.setDividerPositions(0.1, 1.0);
|
||||||
|
|
||||||
controller.regroupDisabledProperty().addListener((Observable observable) -> checkForGroups());
|
/*
|
||||||
controller.getGroupManager().getAnalyzedGroups().addListener((Observable observable) -> Platform.runLater(() -> checkForGroups()));
|
* Set up for a call to checkForGroups to happen
|
||||||
|
* whenever the controller's regrouping disabled
|
||||||
|
* property or the group manager's analyzed groups
|
||||||
|
* property changes.
|
||||||
|
*/
|
||||||
|
controller.regroupDisabledProperty().addListener((Observable unused) -> Platform.runLater(() -> checkForAnalyzedGroups()));
|
||||||
|
controller.getGroupManager().getAnalyzedGroups().addListener((Observable unused) -> Platform.runLater(() -> checkForAnalyzedGroups()));
|
||||||
|
|
||||||
topComponentInitialized = true;
|
/*
|
||||||
|
* Dispatch a later task to call check for groups. Note
|
||||||
// This will cause the UI to show the progress dialog
|
* that this method displays one or more spinner(s) that
|
||||||
Platform.runLater(() -> checkForGroups());
|
* take the place of a wait cursor if there are no
|
||||||
|
* analyzed groups yet, ingest is running, etc.
|
||||||
|
*/
|
||||||
|
// RJCTODO: Is there a race condition here, since this task could be
|
||||||
|
// executed before the task to actually open the top component window?
|
||||||
|
// It seems like this might be a sort of a hack and I am wondering
|
||||||
|
// why this can't be done in openWithSelectedDataSources instead.
|
||||||
|
Platform.runLater(() -> checkForAnalyzedGroups());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Kick off a background task to query the case database for
|
||||||
|
* data sources. This task may queue another task for the
|
||||||
|
* JavaFX thread to allow the user to select which data
|
||||||
|
* sources for which to display images. Ultimately, a task
|
||||||
|
* will be queued for the AWT EDT that will show the top
|
||||||
|
* component window.
|
||||||
|
*/
|
||||||
|
new Thread(new Task<Void>() {
|
||||||
|
@Override
|
||||||
|
protected Void call() throws Exception {
|
||||||
|
synchronized (controllerLock) {
|
||||||
|
/*
|
||||||
|
* If there is only one datasource or the
|
||||||
|
* grouping criterion is already set to
|
||||||
|
* something other than by path (the default),
|
||||||
|
* proceed to open this top component.
|
||||||
|
* Otherwise, do a dialog to allow the user to
|
||||||
|
* select the data sources for which images are
|
||||||
|
* to be displayed, then open the top component.
|
||||||
|
*/
|
||||||
|
List<DataSource> dataSources = controller.getSleuthKitCase().getDataSources();
|
||||||
|
Map<DataSource, Boolean> dataSourcesWithTooManyFiles = new HashMap<>();
|
||||||
|
// RJCTODO: At least some of this designation of "all data sources" with null seems uneccessary;
|
||||||
|
// in any case, the use of nulls and zeros here is
|
||||||
|
// very confusing and should be reworked.
|
||||||
|
if (dataSources.size() <= 1
|
||||||
|
|| controller.getGroupManager().getGroupBy() != DrawableAttribute.PATH) {
|
||||||
|
dataSourcesWithTooManyFiles.put(null, controller.hasTooManyFiles(null));
|
||||||
|
openWithSelectedDataSources(null, dataSourcesWithTooManyFiles);
|
||||||
|
} else {
|
||||||
|
dataSources.add(0, null);
|
||||||
|
for (DataSource dataSource : dataSources) {
|
||||||
|
dataSourcesWithTooManyFiles.put(dataSource, controller.hasTooManyFiles(dataSource));
|
||||||
|
}
|
||||||
|
Platform.runLater(() -> {
|
||||||
|
List<Optional<DataSource>> dataSourceOptionals = dataSources.stream().map(Optional::ofNullable).collect(Collectors.toList());
|
||||||
|
ChoiceDialog<Optional<DataSource>> datasourceDialog = new ChoiceDialog<>(null, dataSourceOptionals);
|
||||||
|
datasourceDialog.setTitle(Bundle.ImageGalleryTopComponent_chooseDataSourceDialog_titleText());
|
||||||
|
datasourceDialog.setHeaderText(Bundle.ImageGalleryTopComponent_chooseDataSourceDialog_headerText());
|
||||||
|
datasourceDialog.setContentText(Bundle.ImageGalleryTopComponent_chooseDataSourceDialog_contentText());
|
||||||
|
datasourceDialog.initModality(Modality.APPLICATION_MODAL);
|
||||||
|
GuiUtils.setDialogIcons(datasourceDialog);
|
||||||
|
@SuppressWarnings(value = "unchecked")
|
||||||
|
ComboBox<Optional<DataSource>> comboBox = (ComboBox<Optional<DataSource>>) datasourceDialog.getDialogPane().lookup(".combo-box");
|
||||||
|
comboBox.setCellFactory((ListView<Optional<DataSource>> unused) -> new DataSourceCell(dataSourcesWithTooManyFiles, controller.getAllDataSourcesDrawableDBStatus()));
|
||||||
|
comboBox.setButtonCell(new DataSourceCell(dataSourcesWithTooManyFiles, controller.getAllDataSourcesDrawableDBStatus()));
|
||||||
|
DataSource dataSource = datasourceDialog.showAndWait().orElse(Optional.empty()).orElse(null);
|
||||||
|
openWithSelectedDataSources(dataSource, dataSourcesWithTooManyFiles);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}).start();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -387,7 +425,6 @@ public final class ImageGalleryTopComponent extends TopComponent implements Expl
|
|||||||
* to indicate this method is effectively deprecated. A break point
|
* to indicate this method is effectively deprecated. A break point
|
||||||
* placed here was never hit.
|
* placed here was never hit.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
return modes.stream().filter(mode -> mode.getName().equals("timeline") || mode.getName().equals("ImageGallery"))
|
return modes.stream().filter(mode -> mode.getName().equals("timeline") || mode.getName().equals("ImageGallery"))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
@ -409,11 +446,10 @@ public final class ImageGalleryTopComponent extends TopComponent implements Expl
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if there are any fully analyzed groups available from the
|
* Checks if there are any fully analyzed groups available from the groups
|
||||||
* GroupManager and remove blocking progress spinners if there are. If there
|
* manager and removes the blocking progress spinner if there are analyzed
|
||||||
* aren't, add a blocking progress spinner with appropriate message.
|
* groups; otherwise adds a blocking progress spinner with an appropriate
|
||||||
*
|
* message.
|
||||||
* This gets called when any group becomes analyzed and when started.
|
|
||||||
*/
|
*/
|
||||||
@ThreadConfined(type = ThreadConfined.ThreadType.JFX)
|
@ThreadConfined(type = ThreadConfined.ThreadType.JFX)
|
||||||
@NbBundle.Messages({
|
@NbBundle.Messages({
|
||||||
@ -427,11 +463,13 @@ public final class ImageGalleryTopComponent extends TopComponent implements Expl
|
|||||||
"ImageGalleryController.noGroupsDlg.msg6=There are no fully analyzed groups to display:"
|
"ImageGalleryController.noGroupsDlg.msg6=There are no fully analyzed groups to display:"
|
||||||
+ " the current Group By setting resulted in no groups, "
|
+ " the current Group By setting resulted in no groups, "
|
||||||
+ "or no groups are fully analyzed but ingest is not running."})
|
+ "or no groups are fully analyzed but ingest is not running."})
|
||||||
private void checkForGroups() {
|
private void checkForAnalyzedGroups() {
|
||||||
|
synchronized (controllerLock) {
|
||||||
GroupManager groupManager = controller.getGroupManager();
|
GroupManager groupManager = controller.getGroupManager();
|
||||||
|
|
||||||
// if there are groups to display, then display them
|
// if there are groups to display, then display them
|
||||||
// @@@ Need to check timing on this and make sure we have only groups for the selected DS. Seems like rebuild can cause groups to be created for a DS that is not later selected...
|
// @@@ Need to check timing on this and make sure we have only groups for the selected DS. Seems like rebuild can cause groups to be created for a DS that is not later selected...
|
||||||
|
// RJCTODO: Get Brian's TODO resolved.
|
||||||
if (isNotEmpty(groupManager.getAnalyzedGroups())) {
|
if (isNotEmpty(groupManager.getAnalyzedGroups())) {
|
||||||
clearNotification();
|
clearNotification();
|
||||||
return;
|
return;
|
||||||
@ -480,6 +518,7 @@ public final class ImageGalleryTopComponent extends TopComponent implements Expl
|
|||||||
new NoGroupsDialog(Bundle.ImageGalleryController_noGroupsDlg_msg6()));
|
new NoGroupsDialog(Bundle.ImageGalleryController_noGroupsDlg_msg6()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@ThreadConfined(type = ThreadConfined.ThreadType.JFX)
|
@ThreadConfined(type = ThreadConfined.ThreadType.JFX)
|
||||||
private void replaceNotification(StackPane stackPane, Node newNode) {
|
private void replaceNotification(StackPane stackPane, Node newNode) {
|
||||||
@ -491,17 +530,17 @@ public final class ImageGalleryTopComponent extends TopComponent implements Expl
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes the spinner(s).
|
||||||
|
*/
|
||||||
@ThreadConfined(type = ThreadConfined.ThreadType.JFX)
|
@ThreadConfined(type = ThreadConfined.ThreadType.JFX)
|
||||||
private void clearNotification() {
|
private void clearNotification() {
|
||||||
//remove the ingest spinner
|
|
||||||
fullUIStack.getChildren().remove(infoOverlay);
|
fullUIStack.getChildren().remove(infoOverlay);
|
||||||
//remove the ingest spinner
|
|
||||||
centralStack.getChildren().remove(infoOverlay);
|
centralStack.getChildren().remove(infoOverlay);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Region with partialy opacity used to block out parts of the UI behind a
|
* A partially opaque region used to block out parts of the UI behind a
|
||||||
* pseudo dialog.
|
* pseudo dialog.
|
||||||
*/
|
*/
|
||||||
static final private class TranslucentRegion extends Region {
|
static final private class TranslucentRegion extends Region {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Autopsy Forensic Browser
|
* Autopsy Forensic Browser
|
||||||
*
|
*
|
||||||
* Copyright 2015-2018 Basis Technology Corp.
|
* Copyright 2013-2018 Basis Technology Corp.
|
||||||
* Contact: carrier <at> sleuthkit <dot> org
|
* Contact: carrier <at> sleuthkit <dot> org
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
@ -148,17 +148,18 @@ public final class OpenAction extends CallableSystemAction {
|
|||||||
try {
|
try {
|
||||||
currentCase = Case.getCurrentCaseThrows();
|
currentCase = Case.getCurrentCaseThrows();
|
||||||
} catch (NoCurrentCaseException ex) {
|
} catch (NoCurrentCaseException ex) {
|
||||||
logger.log(Level.SEVERE, "Exception while getting open case.", ex);
|
logger.log(Level.SEVERE, "No current case", ex);
|
||||||
return;
|
|
||||||
}
|
|
||||||
ImageGalleryController controller;
|
|
||||||
try {
|
|
||||||
controller = ImageGalleryModule.getController();
|
|
||||||
} catch (TskCoreException | NoCurrentCaseException ex) {
|
|
||||||
logger.log(Level.SEVERE, "Exception while getting ImageGalleryController for current case.", ex);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Platform.runLater(() -> {
|
Platform.runLater(() -> {
|
||||||
|
ImageGalleryController controller;
|
||||||
|
try {
|
||||||
|
controller = ImageGalleryModule.getController();
|
||||||
|
} catch (TskCoreException ex) {
|
||||||
|
logger.log(Level.SEVERE, "Failed to get ImageGalleryController", ex);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (currentCase.getCaseType() == Case.CaseType.MULTI_USER_CASE
|
if (currentCase.getCaseType() == Case.CaseType.MULTI_USER_CASE
|
||||||
&& ImageGalleryPreferences.isMultiUserCaseInfoDialogDisabled() == false) {
|
&& ImageGalleryPreferences.isMultiUserCaseInfoDialogDisabled() == false) {
|
||||||
Alert dialog = new Alert(Alert.AlertType.INFORMATION);
|
Alert dialog = new Alert(Alert.AlertType.INFORMATION);
|
||||||
@ -192,7 +193,6 @@ public final class OpenAction extends CallableSystemAction {
|
|||||||
|
|
||||||
addFXCallback(dataSourceStatusMapFuture,
|
addFXCallback(dataSourceStatusMapFuture,
|
||||||
dataSourceStatusMap -> {
|
dataSourceStatusMap -> {
|
||||||
|
|
||||||
int numStale = 0;
|
int numStale = 0;
|
||||||
int numNoAnalysis = 0;
|
int numNoAnalysis = 0;
|
||||||
// NOTE: There is some overlapping code here with Controller.getStaleDataSourceIds(). We could possibly just use
|
// NOTE: There is some overlapping code here with Controller.getStaleDataSourceIds(). We could possibly just use
|
||||||
@ -239,7 +239,8 @@ public final class OpenAction extends CallableSystemAction {
|
|||||||
// NOTE: There could be no data....
|
// NOTE: There could be no data....
|
||||||
} else if (answer == ButtonType.YES) {
|
} else if (answer == ButtonType.YES) {
|
||||||
if (controller.getAutopsyCase().getCaseType() == Case.CaseType.SINGLE_USER_CASE) {
|
if (controller.getAutopsyCase().getCaseType() == Case.CaseType.SINGLE_USER_CASE) {
|
||||||
/* For a single-user case, we favor user
|
/*
|
||||||
|
* For a single-user case, we favor user
|
||||||
* experience, and rebuild the database as soon
|
* experience, and rebuild the database as soon
|
||||||
* as Image Gallery is enabled for the case.
|
* as Image Gallery is enabled for the case.
|
||||||
*
|
*
|
||||||
@ -285,10 +286,9 @@ public final class OpenAction extends CallableSystemAction {
|
|||||||
SwingUtilities.invokeLater(() -> {
|
SwingUtilities.invokeLater(() -> {
|
||||||
try {
|
try {
|
||||||
ImageGalleryTopComponent.openTopComponent();
|
ImageGalleryTopComponent.openTopComponent();
|
||||||
} catch (NoCurrentCaseException ex) {
|
|
||||||
logger.log(Level.SEVERE, "Attempted to access ImageGallery with no case open.", ex);//NON-NLS
|
|
||||||
} catch (TskCoreException ex) {
|
} catch (TskCoreException ex) {
|
||||||
logger.log(Level.SEVERE, "Error getting ImageGalleryController.", ex); //NON-NLS}
|
logger.log(Level.SEVERE, "Failed to open Image Gallery top component", ex); //NON-NLS}
|
||||||
|
// RJCTODO: Give the user some feedback here
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Autopsy Forensic Browser
|
* Autopsy Forensic Browser
|
||||||
*
|
*
|
||||||
* Copyright 2013-18 Basis Technology Corp.
|
* Copyright 2013-2018 Basis Technology Corp.
|
||||||
* Contact: carrier <at> sleuthkit <dot> org
|
* Contact: carrier <at> sleuthkit <dot> org
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
@ -31,9 +31,7 @@ import javafx.beans.property.ReadOnlyBooleanWrapper;
|
|||||||
import javafx.beans.property.ReadOnlyLongProperty;
|
import javafx.beans.property.ReadOnlyLongProperty;
|
||||||
import javafx.beans.property.ReadOnlyLongWrapper;
|
import javafx.beans.property.ReadOnlyLongWrapper;
|
||||||
import javafx.collections.FXCollections;
|
import javafx.collections.FXCollections;
|
||||||
import javafx.collections.ListChangeListener;
|
|
||||||
import javafx.collections.ObservableList;
|
import javafx.collections.ObservableList;
|
||||||
import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
|
|
||||||
import org.sleuthkit.autopsy.coreutils.Logger;
|
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||||
import org.sleuthkit.autopsy.imagegallery.ImageGalleryModule;
|
import org.sleuthkit.autopsy.imagegallery.ImageGalleryModule;
|
||||||
import org.sleuthkit.autopsy.imagegallery.datamodel.CategoryManager;
|
import org.sleuthkit.autopsy.imagegallery.datamodel.CategoryManager;
|
||||||
@ -120,10 +118,8 @@ public class DrawableGroup implements Comparable<DrawableGroup> {
|
|||||||
.map(ImageGalleryModule.getController().getHashSetManager()::isInAnyHashSet)
|
.map(ImageGalleryModule.getController().getHashSetManager()::isInAnyHashSet)
|
||||||
.filter(Boolean::booleanValue)
|
.filter(Boolean::booleanValue)
|
||||||
.count());
|
.count());
|
||||||
} catch (NoCurrentCaseException ex) {
|
|
||||||
logger.log(Level.WARNING, "Could not access case during getFilesWithHashSetHitsCount()"); //NON-NLS
|
|
||||||
} catch (TskCoreException ex) {
|
} catch (TskCoreException ex) {
|
||||||
logger.log(Level.SEVERE, "Error getting ImageGalleryController.", ex); //NON-NLS
|
logger.log(Level.SEVERE, "Failed to get image gallery controller", ex); //NON-NLS
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return hashSetHitsCount.get();
|
return hashSetHitsCount.get();
|
||||||
@ -138,12 +134,10 @@ public class DrawableGroup implements Comparable<DrawableGroup> {
|
|||||||
if (uncatCount.get() < 0) {
|
if (uncatCount.get() < 0) {
|
||||||
try {
|
try {
|
||||||
uncatCount.set(ImageGalleryModule.getController().getDatabase().getUncategorizedCount(fileIDs));
|
uncatCount.set(ImageGalleryModule.getController().getDatabase().getUncategorizedCount(fileIDs));
|
||||||
|
} catch (TskCoreException ex) {
|
||||||
} catch (TskCoreException | NoCurrentCaseException ex) {
|
logger.log(Level.SEVERE, "Failed to get image gallery controller", ex); //NON-NLS
|
||||||
logger.log(Level.WARNING, "Could not access case during getFilesWithHashSetHitsCount()"); //NON-NLS
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return uncatCount.get();
|
return uncatCount.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Autopsy Forensic Browser
|
* Autopsy Forensic Browser
|
||||||
*
|
*
|
||||||
* Copyright 2013-18 Basis Technology Corp.
|
* Copyright 2013-2018 Basis Technology Corp.
|
||||||
* Contact: carrier <at> sleuthkit <dot> org
|
* Contact: carrier <at> sleuthkit <dot> org
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Autopsy Forensic Browser
|
* Autopsy Forensic Browser
|
||||||
*
|
*
|
||||||
* Copyright 2013-18 Basis Technology Corp.
|
* Copyright 2013-2018 Basis Technology Corp.
|
||||||
* Contact: carrier <at> sleuthkit <dot> org
|
* Contact: carrier <at> sleuthkit <dot> org
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
@ -20,9 +20,7 @@ package org.sleuthkit.autopsy.imagegallery.gui.drawableviews;
|
|||||||
|
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
import static com.google.common.collect.Lists.transform;
|
import static com.google.common.collect.Lists.transform;
|
||||||
import com.google.common.util.concurrent.ListenableFuture;
|
|
||||||
import com.google.common.util.concurrent.ListeningExecutorService;
|
import com.google.common.util.concurrent.ListeningExecutorService;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
@ -35,7 +33,6 @@ import java.util.Map;
|
|||||||
import static java.util.Objects.isNull;
|
import static java.util.Objects.isNull;
|
||||||
import static java.util.Objects.nonNull;
|
import static java.util.Objects.nonNull;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.function.Consumer;
|
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.stream.IntStream;
|
import java.util.stream.IntStream;
|
||||||
import javafx.animation.Interpolator;
|
import javafx.animation.Interpolator;
|
||||||
@ -135,18 +132,15 @@ import org.sleuthkit.autopsy.imagegallery.datamodel.DrawableFile;
|
|||||||
import org.sleuthkit.autopsy.imagegallery.datamodel.grouping.DrawableGroup;
|
import org.sleuthkit.autopsy.imagegallery.datamodel.grouping.DrawableGroup;
|
||||||
import org.sleuthkit.autopsy.imagegallery.datamodel.grouping.GroupViewMode;
|
import org.sleuthkit.autopsy.imagegallery.datamodel.grouping.GroupViewMode;
|
||||||
import org.sleuthkit.autopsy.imagegallery.datamodel.grouping.GroupViewState;
|
import org.sleuthkit.autopsy.imagegallery.datamodel.grouping.GroupViewState;
|
||||||
import org.sleuthkit.autopsy.imagegallery.gui.GuiUtils;
|
|
||||||
import static org.sleuthkit.autopsy.imagegallery.gui.GuiUtils.createAutoAssigningMenuItem;
|
import static org.sleuthkit.autopsy.imagegallery.gui.GuiUtils.createAutoAssigningMenuItem;
|
||||||
import org.sleuthkit.autopsy.imagegallery.utils.TaskUtils;
|
import org.sleuthkit.autopsy.imagegallery.utils.TaskUtils;
|
||||||
import static org.sleuthkit.autopsy.imagegallery.utils.TaskUtils.addFXCallback;
|
import static org.sleuthkit.autopsy.imagegallery.utils.TaskUtils.addFXCallback;
|
||||||
import org.sleuthkit.datamodel.TagName;
|
|
||||||
import org.sleuthkit.datamodel.TskCoreException;
|
import org.sleuthkit.datamodel.TskCoreException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A GroupPane displays the contents of a DrawableGroup. It supports both
|
* A GroupPane displays the contents of a DrawableGroup. It supports both
|
||||||
* GridView and SlideShowView modes by swapping out its internal components.
|
* GridView and SlideShowView modes by swapping out its internal components.
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* TODO: Extract the The GridView instance to a separate class analogous to the
|
* TODO: Extract the The GridView instance to a separate class analogous to the
|
||||||
* SlideShow.
|
* SlideShow.
|
||||||
*
|
*
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#Updated by build script
|
#Updated by build script
|
||||||
#Tue, 13 Nov 2018 17:30:09 -0500
|
#Thu, 29 Nov 2018 12:23:03 -0500
|
||||||
LBL_splash_window_title=Starting Autopsy
|
LBL_splash_window_title=Starting Autopsy
|
||||||
SPLASH_HEIGHT=314
|
SPLASH_HEIGHT=314
|
||||||
SPLASH_WIDTH=538
|
SPLASH_WIDTH=538
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#Updated by build script
|
#Updated by build script
|
||||||
#Tue, 13 Nov 2018 17:30:09 -0500
|
#Thu, 29 Nov 2018 12:23:03 -0500
|
||||||
CTL_MainWindow_Title=Autopsy 4.9.1
|
CTL_MainWindow_Title=Autopsy 4.9.1
|
||||||
CTL_MainWindow_Title_No_Project=Autopsy 4.9.1
|
CTL_MainWindow_Title_No_Project=Autopsy 4.9.1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user