Class Scorm2004Parser
java.lang.Object
dev.jcputney.elearning.parser.parsers.BaseParser<Scorm2004Metadata,Scorm2004Manifest>
dev.jcputney.elearning.parser.parsers.Scorm2004Parser
- All Implemented Interfaces:
ModuleParser<Scorm2004Manifest>
Parses SCORM 2004 modules by reading the imsmanifest.xml file and extracting core metadata,
including sequencing information, custom data (adlcp:data), prerequisites, mastery score, and any
additional metadata files referenced within the manifest.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe name of the manifest file for SCORM 2004 modules.Fields inherited from class dev.jcputney.elearning.parser.parsers.BaseParser
moduleFileProvider, options, XAPI_JS_FILE, XAPI_SEND_STATEMENT_FILE -
Constructor Summary
ConstructorsConstructorDescriptionScorm2004Parser(FileAccess fileAccess) Constructs a Scorm2004Parser with the specified FileAccess instance.Scorm2004Parser(FileAccess fileAccess, ParserOptions options) Constructs a Scorm2004Parser with the specified FileAccess instance and parser options.Scorm2004Parser(ModuleFileProvider moduleFileProvider) Constructs a Scorm2004Parser with the specified ModuleFileProvider instance. -
Method Summary
Modifier and TypeMethodDescriptionRetrieves the class type of the SCORM 2004 manifest.parse()Parses the SCORM 2004 module located at the specified modulePath.parseManifest(String manifestPath) Parses and optionally XSD-validates the SCORM 2004 manifest.validate()Validates the SCORM 2004 module without fully parsing it.Methods inherited from class dev.jcputney.elearning.parser.parsers.BaseParser
checkForXapi, getOptions, loadExternalMetadataIntoMetadata, parseXmlToObject
-
Field Details
-
MANIFEST_FILE
The name of the manifest file for SCORM 2004 modules.- See Also:
-
-
Constructor Details
-
Scorm2004Parser
Constructs a Scorm2004Parser with the specified FileAccess instance.- Parameters:
fileAccess- An instance of FileAccess for reading files in the module package.
-
Scorm2004Parser
Constructs a Scorm2004Parser 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.
-
Scorm2004Parser
Constructs a Scorm2004Parser with the specified ModuleFileProvider instance.- Parameters:
moduleFileProvider- An instance of ModuleFileProvider for reading files in the module package.
-
-
Method Details
-
validate
Validates the SCORM 2004 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<Scorm2004Manifest>- Overrides:
validatein classBaseParser<Scorm2004Metadata,Scorm2004Manifest> - Returns:
- ValidationResult containing any errors or warnings found
-
parse
Parses the SCORM 2004 module located at the specified modulePath. Extracts metadata, including title, description, identifier, launch URL, version, sequencing information, custom data, prerequisites, mastery score, and additional metadata from external files.- Specified by:
parsein interfaceModuleParser<Scorm2004Manifest>- Specified by:
parsein classBaseParser<Scorm2004Metadata,Scorm2004Manifest> - Returns:
- A populated ModuleMetadata object containing the extracted metadata.
- Throws:
ModuleParsingException- if an error occurs during parsing.ModuleException- If the module type can't be determined or there's an error parsing.
-
getManifestClass
Retrieves the class type of the SCORM 2004 manifest.- Specified by:
getManifestClassin classBaseParser<Scorm2004Metadata,Scorm2004Manifest> - Returns:
- The class type of Scorm2004Manifest.
-
parseManifest
public Scorm2004Manifest parseManifest(String manifestPath) throws IOException, XMLStreamException, ManifestParseException Parses and optionally XSD-validates the SCORM 2004 manifest.- Overrides:
parseManifestin classBaseParser<Scorm2004Metadata,Scorm2004Manifest> - Parameters:
manifestPath- the file path to the manifest file to be parsed. This cannot be null.- Returns:
- an object of type M representing the parsed manifest content.
- Throws:
IOException- if an error occurs while reading the manifest file.XMLStreamException- if an error occurs while parsing the XML content of the manifest.ManifestParseException- if the manifest file cannot be read or parsed.
-