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 Cmi5MetadataextractMetadata(Cmi5Manifest manifest, ValidationResult validation) Extracts metadata from a parsed and validated manifest.protected Class<Cmi5Manifest>Returns the class type of the Cmi5 manifest used by this parser.protected StringAbstract method to return the filename of the manifest for the specific parser.protected ValidationResultvalidateManifest(Cmi5Manifest manifest) Validates a parsed manifest and returns validation results.Methods inherited from class dev.jcputney.elearning.parser.parsers.BaseParser
checkForXapi, getModuleType, getOptions, loadExternalMetadataIntoMetadata, parseAndValidate, parseManifest, parseOnly, 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
-
validateManifest
Description copied from class:BaseParserValidates a parsed manifest and returns validation results. Subclasses implement this to use their parser-specific validators.- Specified by:
validateManifestin classBaseParser<Cmi5Metadata,Cmi5Manifest> - Parameters:
manifest- The parsed manifest to validate- Returns:
- ValidationResult containing any errors or warnings
-
extractMetadata
protected Cmi5Metadata extractMetadata(Cmi5Manifest manifest, ValidationResult validation) throws ModuleException Description copied from class:BaseParserExtracts metadata from a parsed and validated manifest.- Specified by:
extractMetadatain classBaseParser<Cmi5Metadata,Cmi5Manifest> - Parameters:
manifest- The parsed manifestvalidation- The validation result (for reference during extraction)- Returns:
- Module-specific metadata
- Throws:
ModuleException- if metadata extraction fails
-
getManifestFileName
Description copied from class:BaseParserAbstract method to return the filename of the manifest for the specific parser.- Specified by:
getManifestFileNamein classBaseParser<Cmi5Metadata,Cmi5Manifest> - Returns:
- The manifest filename (e.g., "imsmanifest.xml", "cmi5.xml")
-
getManifestClass
Returns the class type of the Cmi5 manifest used by this parser.- Specified by:
getManifestClassin classBaseParser<Cmi5Metadata,Cmi5Manifest> - Returns:
- The
Classobject representing theCmi5Manifesttype.
-