mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-17 02:07:42 +00:00
Implement a short-term alphabetical sort of non-core Java ingest modules
This commit is contained in:
parent
2feccdd361
commit
edf91c0630
@ -40,31 +40,13 @@ final class DataSourceIngestPipeline {
|
||||
this.context = context;
|
||||
|
||||
// Create an ingest module instance from each data source ingest module
|
||||
// template. Put the modules in a map of module class names to module
|
||||
// instances to facilitate loading the modules into the pipeline in the
|
||||
// sequence indicated by the ordered list of module class names that
|
||||
// will be obtained from the data source ingest pipeline configuration.
|
||||
Map<String, DataSourceIngestModuleDecorator> modulesByClass = new HashMap<>();
|
||||
// template.
|
||||
for (IngestModuleTemplate template : moduleTemplates) {
|
||||
if (template.isDataSourceIngestModuleTemplate()) {
|
||||
DataSourceIngestModuleDecorator module = new DataSourceIngestModuleDecorator(template.createDataSourceIngestModule(), template.getModuleName());
|
||||
modulesByClass.put(module.getClassName(), module);
|
||||
modules.add(module);
|
||||
}
|
||||
}
|
||||
|
||||
// Add the ingest modules to the pipeline in the order indicated by the
|
||||
// data source ingest pipeline configuration, adding any additional
|
||||
// modules found in the global lookup, but not mentioned in the
|
||||
// configuration, to the end of the pipeline in arbitrary order.
|
||||
List<String> pipelineConfig = IngestPipelinesConfiguration.getInstance().getDataSourceIngestPipelineConfig();
|
||||
for (String moduleClassName : pipelineConfig) {
|
||||
if (modulesByClass.containsKey(moduleClassName)) {
|
||||
modules.add(modulesByClass.remove(moduleClassName));
|
||||
}
|
||||
}
|
||||
for (DataSourceIngestModuleDecorator module : modulesByClass.values()) {
|
||||
modules.add(module);
|
||||
}
|
||||
}
|
||||
|
||||
boolean isEmpty() {
|
||||
|
@ -37,34 +37,12 @@ final class FileIngestPipeline {
|
||||
|
||||
// Create an ingest module instance from each file ingest module
|
||||
// template.
|
||||
// current code uses the order pased in.
|
||||
// Commented out code relied on the XML configuration file for ordering.
|
||||
//Map<String, FileIngestModuleDecorator> modulesByClass = new HashMap<>();
|
||||
for (IngestModuleTemplate template : moduleTemplates) {
|
||||
if (template.isFileIngestModuleTemplate()) {
|
||||
FileIngestModuleDecorator module = new FileIngestModuleDecorator(template.createFileIngestModule(), template.getModuleName());
|
||||
modules.add(module);
|
||||
//modulesByClass.put(module.getClassName(), module);
|
||||
}
|
||||
}
|
||||
|
||||
// Add the ingest modules to the pipeline in the order indicated by the
|
||||
// data source ingest pipeline configuration, adding any additional
|
||||
// modules found in the global lookup, but not mentioned in the
|
||||
// configuration, to the end of the pipeline in arbitrary order.
|
||||
/*List<String> pipelineConfig = IngestPipelinesConfiguration.getInstance().getFileIngestPipelineConfig();
|
||||
for (String moduleClassName : pipelineConfig) {
|
||||
if (modulesByClass.containsKey(moduleClassName)) {
|
||||
modules.add(modulesByClass.remove(moduleClassName));
|
||||
}
|
||||
else {
|
||||
// @@@ add error message to flag renamed / removed modules
|
||||
}
|
||||
}
|
||||
for (FileIngestModuleDecorator module : modulesByClass.values()) {
|
||||
modules.add(module);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
boolean isEmpty() {
|
||||
|
@ -22,6 +22,7 @@ import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.TreeMap;
|
||||
import java.util.logging.Level;
|
||||
import org.openide.DialogDisplayer;
|
||||
import org.openide.NotifyDescriptor;
|
||||
@ -41,7 +42,7 @@ import org.sleuthkit.autopsy.modules.sevenzip.ArchiveFileExtractorModuleFactory;
|
||||
import org.sleuthkit.autopsy.python.JythonModuleLoader;
|
||||
|
||||
/**
|
||||
* Discovers ingest module factories implemented in Java or Jython.
|
||||
* Discovers and instantiates ingest module factories.
|
||||
*/
|
||||
final class IngestModuleFactoryLoader {
|
||||
|
||||
@ -111,9 +112,13 @@ final class IngestModuleFactoryLoader {
|
||||
}
|
||||
}
|
||||
|
||||
// Add any remaining non-core factories discovered. Order is not
|
||||
// guaranteed!
|
||||
factories.addAll(javaFactoriesByClass.values());
|
||||
// Add any remaining non-core factories discovered. Order with an
|
||||
// alphabetical sort by module display name.
|
||||
TreeMap<String, IngestModuleFactory> javaFactoriesSortedByName = new TreeMap<>();
|
||||
for (IngestModuleFactory factory : javaFactoriesByClass.values()) {
|
||||
javaFactoriesSortedByName.put(factory.getModuleDisplayName(), factory);
|
||||
}
|
||||
factories.addAll(javaFactoriesSortedByName.values());
|
||||
|
||||
// Add any ingest module factories implemented using Jython. Order is
|
||||
// not guaranteed!
|
||||
|
Loading…
x
Reference in New Issue
Block a user