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;
28 import org.openide.util.lookup.ServiceProviders;
32 @ServiceProviders(value = {@ServiceProvider(service = AutopsyService.class)})
43 private static final List<ImageWriter> imageWriters =
new ArrayList<>();
44 private static final Object imageWritersLock =
new Object();
55 synchronized(imageWritersLock){
56 ImageWriter writer =
new ImageWriter(imageId, settings);
57 writer.subscribeToEvents();
58 imageWriters.add(writer);
64 return NbBundle.getMessage(this.getClass(),
"ImageWriterService.serviceName");
69 context.getProgressIndicator().progress(NbBundle.getMessage(
this.getClass(),
"ImageWriterService.waitingForVHDs"));
71 synchronized(imageWritersLock){
77 for(ImageWriter writer: imageWriters){
78 writer.cancelIfNotStarted();
82 boolean jobsAreInProgress =
false;
83 for(ImageWriter writer: imageWriters){
84 if(writer.jobIsInProgress()){
85 jobsAreInProgress =
true;
90 if(jobsAreInProgress){
92 NotifyDescriptor descriptor =
new NotifyDescriptor.Confirmation(
93 NbBundle.getMessage(
this.getClass(),
"ImageWriterService.shouldWait"),
94 NbBundle.getMessage(
this.getClass(),
"ImageWriterService.localDisk"),
95 NotifyDescriptor.YES_NO_OPTION,
96 NotifyDescriptor.WARNING_MESSAGE);
97 descriptor.setValue(NotifyDescriptor.NO_OPTION);
98 Object response = DialogDisplayer.getDefault().notify(descriptor);
100 if(response == DialogDescriptor.NO_OPTION){
102 for(ImageWriter writer: imageWriters){
109 for(ImageWriter writer: imageWriters){
110 writer.waitForJobToFinish();
116 for(ImageWriter writer: imageWriters){
117 writer.unsubscribeFromEvents();
121 imageWriters.clear();
void closeCaseResources(CaseContext context)
static void createImageWriter(Long imageId, ImageWriterSettings settings)