2518 moved startDataSourceProcessing call to AddImageWizardIterator

This commit is contained in:
William Schaefer 2017-04-05 11:52:12 -04:00
parent 28a706efde
commit 3aad466133
3 changed files with 40 additions and 41 deletions

View File

@ -61,7 +61,7 @@ class AddImageWizardAddingProgressPanel extends ShortcutWizardDescriptorPanel {
private final AddImageAction addImageAction;
private DataSourceProcessor dsProcessor;
private DataSourceProcessor dsProcessor = null;
private boolean cancelled;
/**
* flag to indicate that the image adding process is finished and this panel
@ -307,38 +307,40 @@ class AddImageWizardAddingProgressPanel extends ShortcutWizardDescriptorPanel {
* DataSourceProcessor
*/
void startDataSourceProcessing(DataSourceProcessor dsp) {
final UUID dataSourceId = UUID.randomUUID();
newContents.clear();
cleanupTask = null;
readyToIngest = false;
dsProcessor = dsp;
if (dsProcessor == null) { //this can only be run once
final UUID dataSourceId = UUID.randomUUID();
newContents.clear();
cleanupTask = null;
readyToIngest = false;
dsProcessor = dsp;
// Add a cleanup task to interrupt the background process if the
// wizard exits while the background process is running.
cleanupTask = addImageAction.new CleanupTask() {
@Override
void cleanup() throws Exception {
cancelDataSourceProcessing(dataSourceId);
cancelled = true;
}
};
// Add a cleanup task to interrupt the background process if the
// wizard exits while the background process is running.
cleanupTask = addImageAction.new CleanupTask() {
@Override
void cleanup() throws Exception {
cancelDataSourceProcessing(dataSourceId);
cancelled = true;
}
};
cleanupTask.enable();
cleanupTask.enable();
new Thread(() -> {
Case.getCurrentCase().notifyAddingDataSource(dataSourceId);
}).start();
DataSourceProcessorCallback cbObj = new DataSourceProcessorCallback() {
@Override
public void doneEDT(DataSourceProcessorCallback.DataSourceProcessorResult result, List<String> errList, List<Content> contents) {
dataSourceProcessorDone(dataSourceId, result, errList, contents);
}
};
new Thread(() -> {
Case.getCurrentCase().notifyAddingDataSource(dataSourceId);
}).start();
DataSourceProcessorCallback cbObj = new DataSourceProcessorCallback() {
@Override
public void doneEDT(DataSourceProcessorCallback.DataSourceProcessorResult result, List<String> errList, List<Content> contents) {
dataSourceProcessorDone(dataSourceId, result, errList, contents);
}
};
setStateStarted();
setStateStarted();
// Kick off the DSProcessor
dsProcessor.run(getDSPProgressMonitorImpl(), cbObj);
// Kick off the DSProcessor
dsProcessor.run(getDSPProgressMonitorImpl(), cbObj);
}
}
/*

View File

@ -47,12 +47,9 @@ class AddImageWizardDataSourceSettingsPanel extends ShortcutWizardDescriptorPane
*/
private AddImageWizardDataSourceSettingsVisual component;
private boolean isNextEnable = false;
private final AddImageWizardAddingProgressPanel progressPanel;
private boolean processingStarted = false;
// paths to any set hash lookup databases (can be null)
AddImageWizardDataSourceSettingsPanel(AddImageWizardAddingProgressPanel proPanel) {
this.progressPanel = proPanel;
AddImageWizardDataSourceSettingsPanel() {
}
/**
@ -199,13 +196,7 @@ class AddImageWizardDataSourceSettingsPanel extends ShortcutWizardDescriptorPane
* @param settings the setting to be stored to
*/
@Override
public void storeSettings(WizardDescriptor settings) {
// Start processing the data source by handing it off to the selected DSP,
// so it gets going in the background while the user is still picking the Ingest modules
if (!processingStarted) { //storeSettings is called twice
processingStarted = true;
progressPanel.startDataSourceProcessing(component.getCurrentDSProcessor());
}
public void storeSettings(WizardDescriptor settings) {
}
/**

View File

@ -58,7 +58,7 @@ class AddImageWizardIterator implements WizardDescriptor.Iterator<WizardDescript
panels.add(dspSelection);
AddImageWizardAddingProgressPanel progressPanel = new AddImageWizardAddingProgressPanel(action);
AddImageWizardDataSourceSettingsPanel dsPanel = new AddImageWizardDataSourceSettingsPanel(progressPanel);
AddImageWizardDataSourceSettingsPanel dsPanel = new AddImageWizardDataSourceSettingsPanel();
AddImageWizardIngestConfigPanel ingestConfigPanel = new AddImageWizardIngestConfigPanel(progressPanel);
panels.add(dsPanel);
List<IngestProfiles.IngestProfile> profiles = IngestProfiles.getIngestProfiles();
@ -174,7 +174,13 @@ class AddImageWizardIterator implements WizardDescriptor.Iterator<WizardDescript
if (!hasNext()) {
throw new NoSuchElementException();
}
// Start processing the data source by handing it off to the selected DSP,
// so it gets going in the background while the user is still picking the Ingest modules
// This will occur when the next button is clicked on the panel where you have chosen your data to process
if (index == dsPanelIndex) {
((AddImageWizardAddingProgressPanel) panels.get(progressPanelIndex)).
startDataSourceProcessing(((AddImageWizardDataSourceSettingsPanel) panels.get(dsPanelIndex)).getComponent().getCurrentDSProcessor());
}
boolean panelEnablesSkipping = current().panelEnablesSkipping();
boolean skipNextPanel = current().skipNextPanel();
index++;