Class DefaultModuleTypeDetector
java.lang.Object
dev.jcputney.elearning.parser.impl.detector.DefaultModuleTypeDetector
- All Implemented Interfaces:
ModuleTypeDetector
Default implementation of the ModuleTypeDetector interface.
This class determines the type of eLearning module based on the files present in the file system. It uses a plugin system where each plugin is responsible for detecting a specific module type. Plugins are called in order of priority until one of them successfully detects a module type.
By default, the following plugins are registered:
ScormDetectorPlugin- Detects SCORM 1.2 and SCORM 2004 modulesCmi5DetectorPlugin- Detects cmi5 modulesXapiDetectorPlugin- Detects xAPI/TinCan modulesAiccDetectorPlugin- Detects AICC modules
Additional plugins can be registered using the registerPlugin(ModuleTypeDetectorPlugin)
method.
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultModuleTypeDetector(FileAccess fileAccess) Constructs a new DefaultModuleTypeDetector with the specified FileAccess implementation. -
Method Summary
Modifier and TypeMethodDescriptionDetects the type of eLearning module based on the files present in the file system.Returns an unmodifiable list of the registered plugins.voidRegisters a module type detector plugin.booleanUnregisters a module type detector plugin.
-
Constructor Details
-
DefaultModuleTypeDetector
Constructs a new DefaultModuleTypeDetector with the specified FileAccess implementation.- Parameters:
fileAccess- the FileAccess implementation to use for accessing module files- Throws:
IllegalArgumentException- if fileAccess is null
-
-
Method Details
-
registerPlugin
Registers a module type detector plugin.- Specified by:
registerPluginin interfaceModuleTypeDetector- Parameters:
plugin- the plugin to register- Throws:
IllegalArgumentException- if the plugin is null
-
unregisterPlugin
Unregisters a module type detector plugin.- Specified by:
unregisterPluginin interfaceModuleTypeDetector- Parameters:
plugin- the plugin to unregister- Returns:
- true if the plugin was unregistered, false if it wasn't registered
- Throws:
IllegalArgumentException- if the plugin is null
-
getPlugins
Returns an unmodifiable list of the registered plugins.- Specified by:
getPluginsin interfaceModuleTypeDetector- Returns:
- an unmodifiable list of the registered plugins
-
detectModuleType
Detects the type of eLearning module based on the files present in the file system.This method calls each registered plugin in order of priority until one of them successfully detects a module type.
- Specified by:
detectModuleTypein interfaceModuleTypeDetector- Returns:
- the detected
ModuleType - Throws:
ModuleDetectionException- if the module type cannot be detected, or if there's an error during the detection process
-