diff --git a/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/DataSourceProcessorUtility.java b/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/DataSourceProcessorUtility.java index a8aafe4236..4878f7fa7d 100755 --- a/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/DataSourceProcessorUtility.java +++ b/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/DataSourceProcessorUtility.java @@ -47,11 +47,7 @@ class DataSourceProcessorUtility { * @throws * org.sleuthkit.autopsy.datasourceprocessors.AutoIngestDataSourceProcessor.AutoIngestDataSourceProcessorException */ - static Map getDataSourceProcessor(Path dataSourcePath) throws AutoIngestDataSourceProcessorException { - - // lookup all AutomatedIngestDataSourceProcessors - Collection processorCandidates = Lookup.getDefault().lookupAll(AutoIngestDataSourceProcessor.class); - + static Map getDataSourceProcessorForFile(Path dataSourcePath, Collection processorCandidates) throws AutoIngestDataSourceProcessorException { Map validDataSourceProcessorsMap = new HashMap<>(); for (AutoIngestDataSourceProcessor processor : processorCandidates) { int confidence = processor.canProcess(dataSourcePath); @@ -62,6 +58,49 @@ class DataSourceProcessorUtility { return validDataSourceProcessorsMap; } + + /** + * A utility method to find all Data Source Processors (DSP) that are able + * to process the input data source. Only the DSPs that implement + * AutoIngestDataSourceProcessor interface are used. Returns ordered list of + * data source processors. DSPs are ordered in descending order from highest + * confidence to lowest. + * + * @param dataSourcePath Full path to the data source + * + * @return Ordered list of data source processors. DSPs are ordered in + * descending order from highest confidence to lowest. + * + * @throws + * org.sleuthkit.autopsy.datasourceprocessors.AutoIngestDataSourceProcessor.AutoIngestDataSourceProcessorException + */ + static List getOrderedListOfDataSourceProcessors(Path dataSourcePath) throws AutoIngestDataSourceProcessorException { + // lookup all AutomatedIngestDataSourceProcessors + Collection processorCandidates = Lookup.getDefault().lookupAll(AutoIngestDataSourceProcessor.class); + return getOrderedListOfDataSourceProcessors(dataSourcePath, processorCandidates); + } + + /** + * A utility method to find all Data Source Processors (DSP) that are able + * to process the input data source. Only the DSPs that implement + * AutoIngestDataSourceProcessor interface are used. Returns ordered list of + * data source processors. DSPs are ordered in descending order from highest + * confidence to lowest. + * + * @param dataSourcePath Full path to the data source + * @param processorCandidates Collection of AutoIngestDataSourceProcessor objects to use + * + * @return Ordered list of data source processors. DSPs are ordered in + * descending order from highest confidence to lowest. + * + * @throws + * org.sleuthkit.autopsy.datasourceprocessors.AutoIngestDataSourceProcessor.AutoIngestDataSourceProcessorException + */ + static List getOrderedListOfDataSourceProcessors(Path dataSourcePath, Collection processorCandidates) throws AutoIngestDataSourceProcessorException { + Map validDataSourceProcessorsMap = getDataSourceProcessorForFile(dataSourcePath, processorCandidates); + return orderDataSourceProcessorsByConfidence(validDataSourceProcessorsMap); + } + /** * A utility method to get an ordered list of data source processors. DSPs