Removed custom ingest settings from python example

This commit is contained in:
Ann Priestman 2018-12-18 10:03:16 -05:00
parent 2bf92ad219
commit c9a7e5d514

View File

@ -48,6 +48,7 @@ from org.sleuthkit.autopsy.casemodule import Case
from org.sleuthkit.autopsy.casemodule.services import Services from org.sleuthkit.autopsy.casemodule.services import Services
from org.sleuthkit.autopsy.ingest import DataSourceIngestModule from org.sleuthkit.autopsy.ingest import DataSourceIngestModule
from org.sleuthkit.autopsy.ingest import FileIngestModule from org.sleuthkit.autopsy.ingest import FileIngestModule
from org.sleuthkit.autopsy.ingest import GenericIngestModuleJobSettings
from org.sleuthkit.autopsy.ingest import IngestMessage from org.sleuthkit.autopsy.ingest import IngestMessage
from org.sleuthkit.autopsy.ingest import IngestModule from org.sleuthkit.autopsy.ingest import IngestModule
from org.sleuthkit.autopsy.ingest.IngestModule import IngestModuleException from org.sleuthkit.autopsy.ingest.IngestModule import IngestModuleException
@ -82,7 +83,7 @@ class SampleFileIngestModuleWithUIFactory(IngestModuleFactoryAdapter):
# TODO: Update class name to one that you create below # TODO: Update class name to one that you create below
def getDefaultIngestJobSettings(self): def getDefaultIngestJobSettings(self):
return SampleFileIngestModuleWithUISettings() return GenericIngestModuleJobSettings()
# TODO: Keep enabled only if you need ingest job-specific settings UI # TODO: Keep enabled only if you need ingest job-specific settings UI
def hasIngestJobSettingsPanel(self): def hasIngestJobSettingsPanel(self):
@ -90,8 +91,8 @@ class SampleFileIngestModuleWithUIFactory(IngestModuleFactoryAdapter):
# TODO: Update class names to ones that you create below # TODO: Update class names to ones that you create below
def getIngestJobSettingsPanel(self, settings): def getIngestJobSettingsPanel(self, settings):
if not isinstance(settings, SampleFileIngestModuleWithUISettings): if not isinstance(settings, GenericIngestModuleJobSettings):
raise IllegalArgumentException("Expected settings argument to be instanceof SampleIngestModuleSettings") raise IllegalArgumentException("Expected settings argument to be instanceof GenericIngestModuleJobSettings")
self.settings = settings self.settings = settings
return SampleFileIngestModuleWithUISettingsPanel(self.settings) return SampleFileIngestModuleWithUISettingsPanel(self.settings)
@ -124,7 +125,7 @@ class SampleFileIngestModuleWithUI(FileIngestModule):
# TODO: Add any setup code that you need here. # TODO: Add any setup code that you need here.
def startUp(self, context): def startUp(self, context):
# As an example, determine if user configured a flag in UI # As an example, determine if user configured a flag in UI
if self.local_settings.getFlag(): if self.local_settings.getSetting("flag") == "true":
self.log(Level.INFO, "flag is set") self.log(Level.INFO, "flag is set")
else: else:
self.log(Level.INFO, "flag is not set") self.log(Level.INFO, "flag is not set")
@ -144,25 +145,6 @@ class SampleFileIngestModuleWithUI(FileIngestModule):
def shutDown(self): def shutDown(self):
pass pass
# Stores the settings that can be changed for each ingest job
# All fields in here must be serializable. It will be written to disk.
# TODO: Rename this class
class SampleFileIngestModuleWithUISettings(IngestModuleIngestJobSettings):
serialVersionUID = 1L
def __init__(self):
self.flag = False
def getVersionNumber(self):
return serialVersionUID
# TODO: Define getters and settings for data you want to store from UI
def getFlag(self):
return self.flag
def setFlag(self, flag):
self.flag = flag
# UI that is shown to user for each ingest job so they can configure the job. # UI that is shown to user for each ingest job so they can configure the job.
# TODO: Rename this # TODO: Rename this
@ -187,9 +169,9 @@ class SampleFileIngestModuleWithUISettingsPanel(IngestModuleIngestJobSettingsPan
# TODO: Update this for your UI # TODO: Update this for your UI
def checkBoxEvent(self, event): def checkBoxEvent(self, event):
if self.checkbox.isSelected(): if self.checkbox.isSelected():
self.local_settings.setFlag(True) self.local_settings.setSetting("flag", "true")
else: else:
self.local_settings.setFlag(False) self.local_settings.setSetting("flag", "false")
# TODO: Update this for your UI # TODO: Update this for your UI
def initComponents(self): def initComponents(self):
@ -199,7 +181,7 @@ class SampleFileIngestModuleWithUISettingsPanel(IngestModuleIngestJobSettingsPan
# TODO: Update this for your UI # TODO: Update this for your UI
def customizeComponents(self): def customizeComponents(self):
self.checkbox.setSelected(self.local_settings.getFlag()) self.checkbox.setSelected(self.local_settings.getSetting("flag") == "true")
# Return the settings used # Return the settings used
def getSettings(self): def getSettings(self):