Class ModuleMetadata<M extends PackageManifest>

java.lang.Object
dev.jcputney.elearning.parser.output.ModuleMetadata<M>
Type Parameters:
M - the type of the package manifest
All Implemented Interfaces:
PackageManifest, Serializable
Direct Known Subclasses:
BaseModuleMetadata, XapiMetadata

public abstract class ModuleMetadata<M extends PackageManifest> extends Object implements PackageManifest
Represents the core metadata for an eLearning module, providing common fields shared across various module types, such as SCORM, AICC, or cmi5.

Each module type can extend this class to include additional fields specific to that type.

See Also:
  • Field Details

    • manifest

      protected M extends PackageManifest manifest
      The package manifest for the module.
    • moduleType

      protected ModuleType moduleType
      The type of the module (for example, SCORM, AICC, cmi5).
    • moduleEditionType

      protected ModuleEditionType moduleEditionType
      The specific edition type of the module, including SCORM 2004 edition information.
    • xapiEnabled

      protected boolean xapiEnabled
      Indicates whether xAPI is enabled for the module.
    • sizeOnDisk

      protected long sizeOnDisk
      The total size of all files in the module in bytes. A value of -1 indicates the size is not available.
  • Constructor Details

    • ModuleMetadata

      protected ModuleMetadata(M manifest, ModuleType moduleType, ModuleEditionType moduleEditionType, boolean xapiEnabled)
      Constructor for ModuleMetadata.
      Parameters:
      manifest - the package manifest
      moduleType - the module type
      moduleEditionType - the module edition type
      xapiEnabled - whether xAPI is enabled
    • ModuleMetadata

      protected ModuleMetadata()
      Default constructor for the ModuleMetadata class.

      This constructor is protected and does not perform any specific initialization. It is intended for use by subclasses or internal processes where explicit instantiation of the ModuleMetadata class is required.

  • Method Details

    • getTitle

      public String getTitle()
      Retrieves the title of the module. This method delegates to the underlying manifest to obtain the human-readable name of the package.
      Specified by:
      getTitle in interface PackageManifest
      Returns:
      the title of the module as a String
    • getDescription

      public String getDescription()
      Retrieves the description of the module. This method delegates to the underlying manifest to obtain additional information about the module in the form of a description.
      Specified by:
      getDescription in interface PackageManifest
      Returns:
      the description of the module as a String
    • getLaunchUrl

      public String getLaunchUrl()
      Retrieves the launch URL for the module. This method delegates to the underlying manifest to obtain the URL used to start or launch the module.
      Specified by:
      getLaunchUrl in interface PackageManifest
      Returns:
      the launch URL of the module as a String
    • getIdentifier

      public String getIdentifier()
      Retrieves the unique identifier of the module. This method delegates to the underlying manifest to obtain the identifier.
      Specified by:
      getIdentifier in interface PackageManifest
      Returns:
      the unique identifier of the module as a String
    • getVersion

      public String getVersion()
      Retrieves the version of the module. This method delegates to the underlying manifest to obtain the version of the package.
      Specified by:
      getVersion in interface PackageManifest
      Returns:
      the version of the module as a String
    • getDuration

      public Duration getDuration()
      Retrieves the duration of the module. This method delegates to the underlying manifest to obtain the duration, indicating the expected time to complete the module.
      Specified by:
      getDuration in interface PackageManifest
      Returns:
      the duration of the module as a Duration
    • hasMultipleLaunchableUnits

      public abstract boolean hasMultipleLaunchableUnits()
      Determines whether this module contains multiple launchable units.

      This affects player configuration defaults such as navigation controls, table of contents display, and launch behavior. In Rustici Engine and similar LMS platforms, this flag is used to conditionally enable multi-SCO navigation features.

      • SCORM 1.2: Multiple resources with scormType="sco"
      • SCORM 2004: Multiple items in organization
      • AICC: Multiple assignable units
      • cmi5/xAPI: Always false (single AU/activity)
      Returns:
      true if the module contains multiple launchable units, false otherwise
    • getManifestFile

      public abstract String getManifestFile()
      Retrieves the filename of the manifest file for this module.

      For most module types, this is a constant defined by the specification (e.g., "imsmanifest.xml" for SCORM, "cmi5.xml" for cmi5). For AICC modules, the filename is discovered during parsing as the .crs file can have any name.

      Returns:
      the manifest filename (e.g., "imsmanifest.xml", "cmi5.xml", "course.crs")
    • setManifestFile

      public void setManifestFile(String manifestFile)
      Sets the name of the manifest file associated with the module.
      Parameters:
      manifestFile - the filename of the manifest, typically representing the module's metadata file (e.g., "imsmanifest.xml" for SCORM)
    • getSizeOnDisk

      public long getSizeOnDisk()
      Gets the total size of all files in the module on disk.
      Returns:
      Total size of all files in bytes, or -1 if not available
    • setSizeOnDisk

      public void setSizeOnDisk(long sizeOnDisk)
      Sets the total size of all files in the module on disk.
      Parameters:
      sizeOnDisk - The total size of the module's files in bytes.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • getManifest

      public M getManifest()
      Retrieves the manifest associated with this module metadata.
      Returns:
      the manifest of the module as an instance of type M
    • getModuleType

      public ModuleType getModuleType()
      Retrieves the type of the module.
      Returns:
      the module type as an instance of ModuleType
    • getModuleEditionType

      public ModuleEditionType getModuleEditionType()
      Retrieves the edition type of the module.
      Returns:
      the module edition type as an instance of ModuleEditionType
    • isXapiEnabled

      public boolean isXapiEnabled()
      Checks whether xAPI is enabled for the module.
      Returns:
      true if xAPI is enabled, false otherwise