mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-12 16:06:15 +00:00
Updated branch.
This commit is contained in:
commit
c97025c85f
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Autopsy Forensic Browser
|
* Autopsy Forensic Browser
|
||||||
*
|
*
|
||||||
* Copyright 2011-2016 Basis Technology Corp.
|
* Copyright 2016-2019 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");
|
||||||
|
@ -0,0 +1,91 @@
|
|||||||
|
/*
|
||||||
|
* Autopsy Forensic Browser
|
||||||
|
*
|
||||||
|
* Copyright 2019 Basis Technology Corp.
|
||||||
|
* Contact: carrier <at> sleuthkit <dot> org
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package org.sleuthkit.autopsy.imagegallery;
|
||||||
|
|
||||||
|
import org.openide.util.NbBundle;
|
||||||
|
import org.openide.util.lookup.ServiceProvider;
|
||||||
|
import org.openide.util.lookup.ServiceProviders;
|
||||||
|
import org.sleuthkit.autopsy.appservices.AutopsyService;
|
||||||
|
import org.sleuthkit.autopsy.progress.ProgressIndicator;
|
||||||
|
import org.sleuthkit.datamodel.TskCoreException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An Autopsy service that creates/opens a local drawables database and
|
||||||
|
* creates/updates the Image Gallery tables in the case database.
|
||||||
|
*/
|
||||||
|
@ServiceProviders(value = {
|
||||||
|
@ServiceProvider(service = AutopsyService.class)
|
||||||
|
})
|
||||||
|
@NbBundle.Messages({
|
||||||
|
"ImageGalleryDatabaseUpdateService.serviceName=Image Gallery Database Update Service"
|
||||||
|
})
|
||||||
|
public class ImageGalleryDatabaseUpdateService implements AutopsyService {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getServiceName() {
|
||||||
|
return Bundle.ImageGalleryDatabaseUpdateService_serviceName();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates an image gallery controller for the current case. As a result,
|
||||||
|
* creates/opens a local drawables database and creates/updates the Image
|
||||||
|
* Gallery tables in the case database.
|
||||||
|
*
|
||||||
|
* @param context The case context which includes things such as the case, a
|
||||||
|
* progress indicator for the operation, a cancellation
|
||||||
|
* request flag, etc.
|
||||||
|
*
|
||||||
|
* @throws
|
||||||
|
* org.sleuthkit.autopsy.appservices.AutopsyService.AutopsyServiceException
|
||||||
|
*/
|
||||||
|
@NbBundle.Messages({
|
||||||
|
"ImageGalleryDatabaseUpdateService.openCaseResources.progressMessage.start=Opening Image Gallery databases...",
|
||||||
|
"ImageGalleryDatabaseUpdateService.openCaseResources.progressMessage.finish=Opened Image Gallery databases.",})
|
||||||
|
@Override
|
||||||
|
public void openCaseResources(CaseContext context) throws AutopsyServiceException {
|
||||||
|
if (context.cancelRequested()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ProgressIndicator progress = context.getProgressIndicator();
|
||||||
|
progress.start(Bundle.ImageGalleryDatabaseUpdateService_openCaseResources_progressMessage_start());
|
||||||
|
try {
|
||||||
|
ImageGalleryModule.createController(context.getCase());
|
||||||
|
} catch (TskCoreException ex) {
|
||||||
|
throw new AutopsyServiceException("Error opening Image Gallery databases", ex);
|
||||||
|
}
|
||||||
|
progress.progress(Bundle.ImageGalleryDatabaseUpdateService_openCaseResources_progressMessage_finish());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Shuts down the image gallery controller for the current case. As a
|
||||||
|
* result, closes the local drawables database.
|
||||||
|
*
|
||||||
|
* @param context The case context which includes things such as the case, a
|
||||||
|
* progress indicator for the operation, a cancellation
|
||||||
|
* request flag, etc.
|
||||||
|
*
|
||||||
|
* @throws
|
||||||
|
* org.sleuthkit.autopsy.appservices.AutopsyService.AutopsyServiceException
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void closeCaseResources(CaseContext context) throws AutopsyServiceException {
|
||||||
|
ImageGalleryModule.shutDownController();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -76,6 +76,32 @@ public class ImageGalleryModule {
|
|||||||
@GuardedBy("controllerLock")
|
@GuardedBy("controllerLock")
|
||||||
private static ImageGalleryController controller;
|
private static ImageGalleryController controller;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates an image gallery controller for a case, assumed to be the current
|
||||||
|
* case. As a result, creates/opens a local drawables database and
|
||||||
|
* creates/updates the Image Gallery tables in the case database.
|
||||||
|
*
|
||||||
|
* @param currentCase The current case.
|
||||||
|
*
|
||||||
|
* @throws TskCoreException
|
||||||
|
*/
|
||||||
|
static void createController(Case currentCase) throws TskCoreException {
|
||||||
|
synchronized (controllerLock) {
|
||||||
|
controller = new ImageGalleryController(currentCase);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Shuts down the current image gallery controller.
|
||||||
|
*/
|
||||||
|
static void shutDownController() {
|
||||||
|
synchronized (controllerLock) {
|
||||||
|
if (controller != null) {
|
||||||
|
controller.shutDown();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the per case image gallery controller for the current case. The
|
* Gets the per case image gallery controller for the current case. The
|
||||||
* controller is changed in the case event listener.
|
* controller is changed in the case event listener.
|
||||||
@ -88,10 +114,9 @@ public class ImageGalleryModule {
|
|||||||
synchronized (controllerLock) {
|
synchronized (controllerLock) {
|
||||||
if (controller == null) {
|
if (controller == null) {
|
||||||
try {
|
try {
|
||||||
Case currentCase = Case.getCurrentCaseThrows();
|
createController(Case.getCurrentCaseThrows());
|
||||||
controller = new ImageGalleryController(currentCase);
|
|
||||||
} catch (NoCurrentCaseException ex) {
|
} catch (NoCurrentCaseException ex) {
|
||||||
throw new TskCoreException("Failed to get ", ex);
|
throw new TskCoreException("Failed to get current case", ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return controller;
|
return controller;
|
||||||
@ -178,7 +203,6 @@ public class ImageGalleryModule {
|
|||||||
* node that is running the ingest job. On a remote node, image
|
* node that is running the ingest job. On a remote node, image
|
||||||
* files are processed as a group when the ingest job is complete.
|
* files are processed as a group when the ingest job is complete.
|
||||||
*/
|
*/
|
||||||
// RJCTODO: DO we need to handle any events at all on an auot ingest node?
|
|
||||||
if (((AutopsyEvent) event).getSourceType() != AutopsyEvent.SourceType.LOCAL) {
|
if (((AutopsyEvent) event).getSourceType() != AutopsyEvent.SourceType.LOCAL) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -245,28 +269,9 @@ public class ImageGalleryModule {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void propertyChange(PropertyChangeEvent event) {
|
public void propertyChange(PropertyChangeEvent event) {
|
||||||
// RJCTODO: DO we need to handle any events at all on an auot ingest node?
|
|
||||||
Case.Events eventType = Case.Events.valueOf(event.getPropertyName());
|
Case.Events eventType = Case.Events.valueOf(event.getPropertyName());
|
||||||
if (eventType == Case.Events.CURRENT_CASE) {
|
if (eventType == Case.Events.CURRENT_CASE && event.getOldValue() != null) {
|
||||||
synchronized (controllerLock) {
|
|
||||||
if (event.getNewValue() != null) {
|
|
||||||
/*
|
|
||||||
* CURRENT_CASE(_OPENED) event.
|
|
||||||
*/
|
|
||||||
Case newCase = (Case) event.getNewValue();
|
|
||||||
try {
|
|
||||||
controller = new ImageGalleryController(newCase);
|
|
||||||
} catch (TskCoreException 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);
|
SwingUtilities.invokeLater(ImageGalleryTopComponent::closeTopComponent);
|
||||||
controller.shutDown();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
ImageGalleryController currentController;
|
ImageGalleryController currentController;
|
||||||
try {
|
try {
|
||||||
@ -330,7 +335,6 @@ public class ImageGalleryModule {
|
|||||||
/*
|
/*
|
||||||
* Only handling data source analysis events.
|
* 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
|
// RJCTODO: This would be less messy if IngestManager supported
|
||||||
// subscribing for a subset of events the way case does, and it the
|
// subscribing for a subset of events the way case does, and it the
|
||||||
// conditional blocks became method calls.
|
// conditional blocks became method calls.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user