Class Cmi5Parser
java.lang.Object
dev.jcputney.elearning.parser.parsers.BaseParser<Cmi5Metadata,Cmi5Manifest>
dev.jcputney.elearning.parser.parsers.Cmi5Parser
- All Implemented Interfaces:
ModuleParser<Cmi5Manifest>
Cmi5Parser is responsible for parsing cmi5-specific metadata from the cmi5.xml file.
The "cmi5" xAPI-based specification includes Assignable Units (AUs) as discrete learning objects with metadata for LMS tracking and reporting. This parser extracts metadata such as the title, launch URL, prerequisites, dependencies, detailed AU information, and custom metadata.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe name of the cmi5 XML file that contains the module metadata.Fields inherited from class dev.jcputney.elearning.parser.parsers.BaseParser
moduleFileProvider, options, XAPI_JS_FILE, XAPI_SEND_STATEMENT_FILE -
Constructor Summary
ConstructorsConstructorDescriptionCmi5Parser(FileAccess fileAccess) Constructs a Cmi5Parser with the specified FileAccess instance.Cmi5Parser(FileAccess fileAccess, ParserOptions options) Constructs a Cmi5Parser with the specified FileAccess instance and parser options. -
Method Summary
Modifier and TypeMethodDescriptionprotected Class<Cmi5Manifest>Returns the class type of the Cmi5 manifest used by this parser.parse()Parses the cmi5 module located at the specified modulePath.validate()Validates the cmi5 module without fully parsing it.Methods inherited from class dev.jcputney.elearning.parser.parsers.BaseParser
checkForXapi, getOptions, loadExternalMetadataIntoMetadata, parseManifest, parseXmlToObject
-
Field Details
-
CMI5_XML
The name of the cmi5 XML file that contains the module metadata.- See Also:
-
-
Constructor Details
-
Cmi5Parser
Constructs a Cmi5Parser with the specified FileAccess instance.- Parameters:
fileAccess- An instance of FileAccess for reading files in the module package.
-
Cmi5Parser
Constructs a Cmi5Parser with the specified FileAccess instance and parser options.- Parameters:
fileAccess- An instance of FileAccess for reading files in the module package.options- The parser options to control validation and calculation behavior.
-
-
Method Details
-
validate
Validates the cmi5 module without fully parsing it. This method provides efficient validation by only parsing the manifest file and running structural validation checks.- Specified by:
validatein interfaceModuleParser<Cmi5Manifest>- Overrides:
validatein classBaseParser<Cmi5Metadata,Cmi5Manifest> - Returns:
- ValidationResult containing any errors or warnings found
-
parse
Parses the cmi5 module located at the specified modulePath.This method reads the cmi5.xml file to extract metadata such as the title, launch URL, prerequisites, dependencies, list of Assignable Units (AUs), and custom data for LMS tracking. Since cmi5 is always xAPI-enabled, the isXapiEnabled flag is set to true for all cmi5 modules.
- Specified by:
parsein interfaceModuleParser<Cmi5Manifest>- Specified by:
parsein classBaseParser<Cmi5Metadata,Cmi5Manifest> - Returns:
- A Cmi5Metadata object containing the parsed metadata.
- Throws:
ModuleParsingException- If the module's manifest cannot be parsed or if required fields are missing.ModuleException- If the module type can't be determined or there's an error parsing.
-
getManifestClass
Returns the class type of the Cmi5 manifest used by this parser.- Specified by:
getManifestClassin classBaseParser<Cmi5Metadata,Cmi5Manifest> - Returns:
- The
Classobject representing theCmi5Manifesttype.
-