mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-13 16:36:15 +00:00
commit
2d7f492046
@ -21,69 +21,70 @@ package org.sleuthkit.autopsy.corecomponentinterfaces;
|
|||||||
|
|
||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Defines an interface used by the Add DataSource wizard to discover different
|
* Interface used by the Add DataSource wizard to allow different
|
||||||
* Data SourceProcessors.
|
* types of data sources to be added to a case. Examples of data
|
||||||
|
* sources include disk images, local files, etc.
|
||||||
*
|
*
|
||||||
* Each data source may have its unique attributes and may need to be processed
|
* The interface provides a uniform mechanism for the Autopsy UI
|
||||||
* differently.
|
|
||||||
*
|
|
||||||
* The DataSourceProcessor interface defines a uniform mechanism for the Autopsy UI
|
|
||||||
* to:
|
* to:
|
||||||
* - collect details for the data source to be processed.
|
* - Collect details from the user about the data source to be processed.
|
||||||
* - Process the data source in the background
|
* - Process the data source in the background and add data to the database
|
||||||
* - Be notified when the processing is complete
|
* - Provides progress feedback to the user / UI.
|
||||||
*/
|
*/
|
||||||
public interface DataSourceProcessor {
|
public interface DataSourceProcessor {
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* The DSP Panel may fire Property change events
|
* The DSP Panel may fire Property change events
|
||||||
* The caller must enure to add itself as a listener and
|
* The caller must enure to add itself as a listener and
|
||||||
* then react appropriately to the events
|
* then react appropriately to the events
|
||||||
*/
|
*/
|
||||||
enum DSP_PANEL_EVENT {
|
enum DSP_PANEL_EVENT {
|
||||||
|
UPDATE_UI, ///< the content of JPanel has changed that MAY warrant updates to the caller UI
|
||||||
UPDATE_UI, // the content of JPanel has changed that MAY warrant updates to the caller UI
|
FOCUS_NEXT ///< the caller UI may move focus the the next UI element, following the panel.
|
||||||
FOCUS_NEXT // the caller UI may move focus the the next UI element, following the panel.
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the type of Data Source it handles.
|
* Returns the type of Data Source it handles.
|
||||||
* This name gets displayed in the drop-down listbox
|
* This name gets displayed in the drop-down listbox
|
||||||
**/
|
*/
|
||||||
String getDataSourceType();
|
String getDataSourceType();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the picker panel to be displayed along with any other
|
* Returns the picker panel to be displayed along with any other
|
||||||
* runtime options supported by the data source handler.
|
* runtime options supported by the data source handler. The
|
||||||
**/
|
* DSP is responsible for storing the settings so that a later
|
||||||
|
* call to run() will have the user-specified settings.
|
||||||
|
*
|
||||||
|
* Should be less than 544 pixels wide and 173 pixels high.
|
||||||
|
*/
|
||||||
JPanel getPanel();
|
JPanel getPanel();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called to validate the input data in the panel.
|
* Called to validate the input data in the panel.
|
||||||
* Returns true if no errors, or
|
* Returns true if no errors, or
|
||||||
* Returns false if there is an error.
|
* Returns false if there is an error.
|
||||||
**/
|
*/
|
||||||
boolean isPanelValid();
|
boolean isPanelValid();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called to invoke the handling of Data source in the background.
|
* Called to invoke the handling of data source in the background.
|
||||||
* Returns after starting the background thread
|
* Returns after starting the background thread.
|
||||||
* @param settings wizard settings to read/store properties
|
|
||||||
* @param progressPanel progress panel to be updated while processing
|
|
||||||
*
|
*
|
||||||
**/
|
* @param progressPanel progress panel to be updated while processing
|
||||||
|
* @param dspCallback Contains the callback method DataSourceProcessorCallback.done() that the DSP must call when the background thread finishes with errors and status.
|
||||||
|
*/
|
||||||
void run(DataSourceProcessorProgressMonitor progressPanel, DataSourceProcessorCallback dspCallback);
|
void run(DataSourceProcessorProgressMonitor progressPanel, DataSourceProcessorCallback dspCallback);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called to cancel the background processing.
|
* Called to cancel the background processing.
|
||||||
**/
|
*/
|
||||||
void cancel();
|
void cancel();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called to reset/reinitialize the DSP.
|
* Called to reset/reinitialize the DSP.
|
||||||
**/
|
*/
|
||||||
void reset();
|
void reset();
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,6 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.sleuthkit.autopsy.corecomponentinterfaces;
|
package org.sleuthkit.autopsy.corecomponentinterfaces;
|
||||||
|
|
||||||
import java.awt.EventQueue;
|
import java.awt.EventQueue;
|
||||||
@ -26,41 +25,51 @@ import org.sleuthkit.datamodel.Content;
|
|||||||
/**
|
/**
|
||||||
* Abstract class for a callback for a DataSourceProcessor.
|
* Abstract class for a callback for a DataSourceProcessor.
|
||||||
*
|
*
|
||||||
* Ensures that DSP invokes the caller overridden method, doneEDT(),
|
* Ensures that DSP invokes the caller overridden method, doneEDT(), in the EDT
|
||||||
* in the EDT thread.
|
* thread.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public abstract class DataSourceProcessorCallback {
|
public abstract class DataSourceProcessorCallback {
|
||||||
|
|
||||||
public enum DataSourceProcessorResult
|
public enum DataSourceProcessorResult {
|
||||||
{
|
NO_ERRORS, ///< No errors were encountered while ading the data source
|
||||||
NO_ERRORS,
|
CRITICAL_ERRORS, ///< No data was added to the database. There were fundamental errors processing the data (such as no data or system failure).
|
||||||
CRITICAL_ERRORS,
|
NONCRITICAL_ERRORS, ///< There was data added to the database, but there were errors from data corruption or a small number of minor issues.
|
||||||
NONCRITICAL_ERRORS,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
|
||||||
* Invoke the caller supplied callback function on the EDT thread
|
/**
|
||||||
|
* Called by a DSP implementation when it is done adding a data source
|
||||||
|
* to the database. Users of the DSP can override this method if they do
|
||||||
|
* not want to be notified on the EDT. Otherwise, this method will call
|
||||||
|
* doneEDT() with the same arguments.
|
||||||
|
* @param result Code for status
|
||||||
|
* @param errList List of error strings
|
||||||
|
* @param newContents List of root Content objects that were added to database. Typically only one is given.
|
||||||
*/
|
*/
|
||||||
public void done(DataSourceProcessorResult result, List<String> errList, List<Content> newContents)
|
public void done(DataSourceProcessorResult result, List<String> errList, List<Content> newContents) {
|
||||||
{
|
|
||||||
|
|
||||||
final DataSourceProcessorResult resultf = result;
|
final DataSourceProcessorResult resultf = result;
|
||||||
final List<String> errListf = errList;
|
final List<String> errListf = errList;
|
||||||
final List<Content> newContentsf = newContents;
|
final List<Content> newContentsf = newContents;
|
||||||
|
|
||||||
// Invoke doneEDT() that runs on the EDT .
|
// Invoke doneEDT() that runs on the EDT .
|
||||||
EventQueue.invokeLater(new Runnable() {
|
EventQueue.invokeLater(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
doneEDT(resultf, errListf, newContentsf );
|
doneEDT(resultf, errListf, newContentsf);
|
||||||
|
}
|
||||||
}
|
});
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* calling code overrides to provide its own calllback
|
* Called by done() if the default implementation is used. Users of DSPs
|
||||||
|
* that have UI updates to do after the DSP is finished adding the DS can
|
||||||
|
* implement this method to receive the updates on the EDT.
|
||||||
|
*
|
||||||
|
* @param result Code for status
|
||||||
|
* @param errList List of error strings
|
||||||
|
* @param newContents List of root Content objects that were added to database. Typically only one is given.
|
||||||
*/
|
*/
|
||||||
public abstract void doneEDT(DataSourceProcessorResult result, List<String> errList, List<Content> newContents);
|
public abstract void doneEDT(DataSourceProcessorResult result, List<String> errList, List<Content> newContents);
|
||||||
};
|
};
|
||||||
|
@ -18,10 +18,10 @@
|
|||||||
*/
|
*/
|
||||||
package org.sleuthkit.autopsy.corecomponentinterfaces;
|
package org.sleuthkit.autopsy.corecomponentinterfaces;
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* An GUI agnostic DataSourceProcessorProgressMonitor interface for DataSourceProcesssors to
|
* An GUI agnostic DataSourceProcessorProgressMonitor interface for DataSourceProcesssors to
|
||||||
* indicate progress.
|
* indicate progress.
|
||||||
* It models after a JProgressbar though it could use any underlying implementation
|
* It models after a JProgressbar though it could use any underlying implementation (or NoOps)
|
||||||
*/
|
*/
|
||||||
public interface DataSourceProcessorProgressMonitor {
|
public interface DataSourceProcessorProgressMonitor {
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user