19 package org.sleuthkit.autopsy.imagewriter;
21 import java.util.ArrayList;
22 import java.util.List;
23 import org.openide.DialogDescriptor;
24 import org.openide.DialogDisplayer;
25 import org.openide.NotifyDescriptor;
26 import org.openide.util.NbBundle;
27 import org.openide.util.lookup.ServiceProvider;
36 @ServiceProvider(service = AutopsyService.class)
39 private static final List<ImageWriter> imageWriters =
new ArrayList<>();
40 private static final Object imageWritersLock =
new Object();
53 synchronized (imageWritersLock) {
54 ImageWriter writer =
new ImageWriter(imageId, settings);
55 writer.subscribeToEvents();
56 imageWriters.add(writer);
62 return NbBundle.getMessage(this.getClass(),
"ImageWriterService.serviceName");
67 synchronized (imageWritersLock) {
68 if (imageWriters.isEmpty()) {
72 context.getProgressIndicator().progress(NbBundle.getMessage(
this.getClass(),
"ImageWriterService.waitingForVHDs"));
79 for (ImageWriter writer : imageWriters) {
80 writer.cancelIfNotStarted();
84 boolean jobsAreInProgress =
false;
85 for (ImageWriter writer : imageWriters) {
86 if (writer.jobIsInProgress()) {
87 jobsAreInProgress =
true;
92 if (jobsAreInProgress) {
94 NotifyDescriptor descriptor =
new NotifyDescriptor.Confirmation(
95 NbBundle.getMessage(
this.getClass(),
"ImageWriterService.shouldWait"),
96 NbBundle.getMessage(
this.getClass(),
"ImageWriterService.localDisk"),
97 NotifyDescriptor.YES_NO_OPTION,
98 NotifyDescriptor.WARNING_MESSAGE);
99 descriptor.setValue(NotifyDescriptor.NO_OPTION);
100 Object response = DialogDisplayer.getDefault().notify(descriptor);
102 if (response == DialogDescriptor.NO_OPTION) {
104 for (ImageWriter writer : imageWriters) {
111 for (ImageWriter writer : imageWriters) {
112 writer.waitForJobToFinish();
118 for (ImageWriter writer : imageWriters) {
119 writer.unsubscribeFromEvents();
123 imageWriters.clear();
void closeCaseResources(CaseContext context)
static void createImageWriter(Long imageId, ImageWriterSettings settings)