Class Scorm12Manifest

java.lang.Object
dev.jcputney.elearning.parser.input.scorm12.Scorm12Manifest
All Implemented Interfaces:
PackageManifest, Serializable

public final class Scorm12Manifest extends Object implements PackageManifest
Represents the SCORM IMS Content Packaging (IMSCP) elements according to the imscp_rootv1p1p2 schema.

This class encapsulates properties and structure for SCORM content packages, including manifest, metadata, organizations, resources, and dependencies. It is designed to conform to the IMS Content Packaging specification, enabling SCORM-compliant content to be organized and referenced in an LMS.

The IMSCP namespace is specified by NAMESPACE_URI, and this class is designed to align with the SCORM 1.2 specification.

The following schema snippet shows the structure of a "manifest" element:

 <?xml version="1.0"?>
 <xsd:schema xmlns="http://www.imsproject.org/xsd/imscp_rootv1p1p2"
             targetNamespace="http://www.imsproject.org/xsd/imscp_rootv1p1p2"
             xmlns:xml="http://www.w3.org/XML/1998/namespace"
             xmlns:xsd="http://www.w3.org/2001/XMLSchema"
             elementFormDefault="unqualified" version="IMS CP 1.1.2">

    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="ims_xml.xsd"/>

    <xsd:attributeGroup name="attr.base">
       <xsd:attribute ref="xml:base" use="optional"/>
    </xsd:attributeGroup>

    <xsd:attributeGroup name="attr.default">
       <xsd:attribute name="default" type="xsd:IDREF" use="optional"/>
    </xsd:attributeGroup>

    <xsd:attributeGroup name="attr.href">
       <xsd:attribute name="href" use="optional">
          <xsd:simpleType>
             <xsd:restriction base="xsd:anyURI">
                <xsd:maxLength value="2000"/>
             </xsd:restriction>
          </xsd:simpleType>
       </xsd:attribute>
    </xsd:attributeGroup>

    <xsd:attributeGroup name="attr.href.req">
       <xsd:attribute name="href" use="required">
          <xsd:simpleType>
             <xsd:restriction base="xsd:anyURI">
                <xsd:maxLength value="2000"/>
             </xsd:restriction>
          </xsd:simpleType>
       </xsd:attribute>
    </xsd:attributeGroup>

    <xsd:attributeGroup name="attr.identifier.req">
       <xsd:attribute name="identifier" type="xsd:ID" use="required"/>
    </xsd:attributeGroup>

    <xsd:attributeGroup name="attr.identifier">
       <xsd:attribute name="identifier" type="xsd:ID" use="optional"/>
    </xsd:attributeGroup>

    <xsd:attributeGroup name="attr.isvisible">
       <xsd:attribute name="isvisible" type="xsd:boolean" use="optional"/>
    </xsd:attributeGroup>

    <xsd:attributeGroup name="attr.parameters">
       <xsd:attribute name="parameters" use="optional">
          <xsd:simpleType>
             <xsd:restriction base="xsd:string">
                <xsd:maxLength value="1000"/>
             </xsd:restriction>
          </xsd:simpleType>
       </xsd:attribute>
    </xsd:attributeGroup>

    <xsd:attributeGroup name="attr.identifierref">
       <xsd:attribute name="identifierref" use="optional">
          <xsd:simpleType>
             <xsd:restriction base="xsd:string">
                <xsd:maxLength value="2000"/>
             </xsd:restriction>
          </xsd:simpleType>
       </xsd:attribute>
    </xsd:attributeGroup>

    <xsd:attributeGroup name="attr.identifierref.req">
       <xsd:attribute name="identifierref" use="required">
          <xsd:simpleType>
             <xsd:restriction base="xsd:string">
                <xsd:maxLength value="2000"/>
             </xsd:restriction>
          </xsd:simpleType>
       </xsd:attribute>
    </xsd:attributeGroup>

    <xsd:attributeGroup name="attr.resourcetype.req">
       <xsd:attribute name="type" use="required">
          <xsd:simpleType>
             <xsd:restriction base="xsd:string">
                <xsd:maxLength value="1000"/>
             </xsd:restriction>
          </xsd:simpleType>
       </xsd:attribute>
    </xsd:attributeGroup>

    <xsd:attributeGroup name="attr.structure.req">
       <xsd:attribute name="structure" use="optional" default="hierarchical">
          <xsd:simpleType>
             <xsd:restriction base="xsd:string">
                <xsd:maxLength value="200"/>
             </xsd:restriction>
          </xsd:simpleType>
       </xsd:attribute>
    </xsd:attributeGroup>

    <xsd:attributeGroup name="attr.version">
       <xsd:attribute name="version" use="optional">
          <xsd:simpleType>
             <xsd:restriction base="xsd:string">
                <xsd:maxLength value="20"/>
             </xsd:restriction>
          </xsd:simpleType>
       </xsd:attribute>
    </xsd:attributeGroup>

    <xsd:annotation>
        <xsd:documentation>element groups</xsd:documentation>
    </xsd:annotation>

    <xsd:group name="grp.any">
       <xsd:annotation>
          <xsd:documentation>Any namespaced element from any namespace may be included within an "any" element.  The namespace for the imported element must be defined in the instance, and the schema must be imported.  </xsd:documentation>
       </xsd:annotation>
       <xsd:sequence>
          <xsd:any namespace="##other" processContents="strict" minOccurs="0" maxOccurs="unbounded"/>
       </xsd:sequence>
    </xsd:group>

    <xsd:element name="dependency" type="dependencyType"/>
    <xsd:element name="file" type="fileType"/>
    <xsd:element name="item" type="itemType"/>
    <xsd:element name="manifest" type="manifestType"/>
    <xsd:element name="metadata" type="metadataType"/>
    <xsd:element name="organization" type="organizationType"/>
    <xsd:element name="organizations" type="organizationsType"/>
    <xsd:element name="resource" type="resourceType"/>
    <xsd:element name="resources" type="resourcesType"/>
    <xsd:element name="schema" type="schemaType"/>
    <xsd:element name="schemaversion" type="schemaversionType"/>
    <xsd:element name="title" type="titleType"/>

    <xsd:complexType name="dependencyType">
       <xsd:sequence>
          <xsd:group ref="grp.any"/>
       </xsd:sequence>
       <xsd:attributeGroup ref="attr.identifierref.req"/>
       <xsd:anyAttribute namespace="##other" processContents="strict"/>
    </xsd:complexType>

    <xsd:complexType name="fileType">
       <xsd:sequence>
          <xsd:element ref="metadata" minOccurs="0"/>
          <xsd:group ref="grp.any"/>
       </xsd:sequence>
       <xsd:attributeGroup ref="attr.href.req"/>
       <xsd:anyAttribute namespace="##other" processContents="strict"/>
    </xsd:complexType>

    <xsd:complexType name="itemType">
       <xsd:sequence>
          <xsd:element ref="title" minOccurs="0"/>
          <xsd:element ref="item" minOccurs="0" maxOccurs="unbounded"/>
          <xsd:element ref="metadata" minOccurs="0"/>
          <xsd:group ref="grp.any"/>
       </xsd:sequence>
       <xsd:attributeGroup ref="attr.identifier.req"/>
       <xsd:attributeGroup ref="attr.identifierref"/>
       <xsd:attributeGroup ref="attr.isvisible"/>
       <xsd:attributeGroup ref="attr.parameters"/>
       <xsd:anyAttribute namespace="##other" processContents="strict"/>
    </xsd:complexType>

    <xsd:complexType name="manifestType">
       <xsd:sequence>
          <xsd:element ref="metadata" minOccurs="0"/>
          <xsd:element ref="organizations"/>
          <xsd:element ref="resources"/>
          <xsd:element ref="manifest" minOccurs="0" maxOccurs="unbounded"/>
          <xsd:group ref="grp.any"/>
       </xsd:sequence>
       <xsd:attributeGroup ref="attr.identifier.req"/>
       <xsd:attributeGroup ref="attr.version"/>
       <xsd:attribute ref="xml:base"/>
       <xsd:anyAttribute namespace="##other" processContents="strict"/>
    </xsd:complexType>

    <xsd:complexType name="metadataType">
       <xsd:sequence>
          <xsd:element ref="schema" minOccurs="0"/>
          <xsd:element ref="schemaversion" minOccurs="0"/>
          <xsd:group ref="grp.any"/>
       </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="organizationsType">
       <xsd:sequence>
          <xsd:element ref="organization" minOccurs="0" maxOccurs="unbounded"/>
          <xsd:group ref="grp.any"/>
       </xsd:sequence>
       <xsd:attributeGroup ref="attr.default"/>
       <xsd:anyAttribute namespace="##other" processContents="strict"/>
    </xsd:complexType>

    <xsd:complexType name="organizationType">
       <xsd:sequence>
          <xsd:element ref="title" minOccurs="0"/>
          <xsd:element ref="item" minOccurs="0" maxOccurs="unbounded"/>
          <xsd:element ref="metadata" minOccurs="0"/>
          <xsd:group ref="grp.any"/>
       </xsd:sequence>
       <xsd:attributeGroup ref="attr.identifier.req"/>
       <xsd:attributeGroup ref="attr.structure.req"/>
       <xsd:anyAttribute namespace="##other" processContents="strict"/>
    </xsd:complexType>

    <xsd:complexType name="resourcesType">
       <xsd:sequence>
           <xsd:element ref="resource" minOccurs="0" maxOccurs="unbounded"/>
           <xsd:group ref="grp.any"/>
       </xsd:sequence>
       <xsd:attributeGroup ref="attr.base"/>
       <xsd:anyAttribute namespace="##other" processContents="strict"/>
    </xsd:complexType>

    <xsd:complexType name="resourceType">
       <xsd:sequence>
          <xsd:element ref="metadata" minOccurs="0"/>
          <xsd:element ref="file" minOccurs="0" maxOccurs="unbounded"/>
          <xsd:element ref="dependency" minOccurs="0" maxOccurs="unbounded"/>
          <xsd:group ref="grp.any"/>
       </xsd:sequence>
       <xsd:attributeGroup ref="attr.identifier.req"/>
       <xsd:attributeGroup ref="attr.resourcetype.req"/>
       <xsd:attributeGroup ref="attr.base"/>
       <xsd:attributeGroup ref="attr.href"/>
       <xsd:anyAttribute namespace="##other" processContents="strict"/>
    </xsd:complexType>

    <xsd:simpleType name="schemaType">
       <xsd:restriction base="xsd:string">
          <xsd:maxLength value="100"/>
       </xsd:restriction>
    </xsd:simpleType>

    <xsd:simpleType name="schemaversionType">
       <xsd:restriction base="xsd:string">
          <xsd:maxLength value="20"/>
       </xsd:restriction>
    </xsd:simpleType>

    <xsd:simpleType name="titleType">
       <xsd:restriction base="xsd:string">
          <xsd:maxLength value="200"/>
       </xsd:restriction>
    </xsd:simpleType>

 </xsd:schema>
 
See Also:
  • Field Details

    • NAMESPACE_URI

      public static final String NAMESPACE_URI
      The namespace URI for the SCORM 1.2 manifest, as defined in the IMS Content Packaging specification.
      See Also:
  • Constructor Details

    • Scorm12Manifest

      public Scorm12Manifest()
      Default constructor for the Scorm12Manifest class. This constructor initializes an instance of the Scorm12Manifest class without performing any operations. Designed primarily for scenarios where explicit initialization of fields is not required.
  • Method Details

    • getTitle

      public String getTitle()
      Retrieves the title of the SCORM 1.2 manifest. The title is determined based on the following logic: 1. If the default organization's title is available and non-empty, it is returned. 2. Otherwise, the title from the metadata (LOM structure) is returned if present. 3. If neither is available, the method returns null.
      Specified by:
      getTitle in interface PackageManifest
      Returns:
      The title of the SCORM 1.2 manifest, or null if no title is found.
    • getDescription

      public String getDescription()
      Retrieves the description from the SCORM 1.2 metadata LOM structure if available. If the metadata or the LOM description is not present, returns null.
      Specified by:
      getDescription in interface PackageManifest
      Returns:
      The description text from the SCORM 1.2 metadata, or null if no description is found.
    • getLaunchUrl

      public String getLaunchUrl()
      Retrieves the launch URL of the SCORM 1.2 resource. The method attempts to identify the first non-empty launchable resource by finding items with a non-null `identifierRef` in the organization hierarchy, then resolving it to a resource URL using the resource collection.
      Specified by:
      getLaunchUrl in interface PackageManifest
      Returns:
      The launch URL as a string if a valid resource is found, or null if no launchable resource exists.
    • getDuration

      public Duration getDuration()
      Retrieves the duration of the SCORM 1.2 resource. The method resolves the duration by navigating through the metadata hierarchy. If the metadata, LOM, technical details, or duration fields are not present, it defaults to Duration.ZERO.
      Specified by:
      getDuration in interface PackageManifest
      Returns:
      A Duration object representing the duration of the resource, or Duration.ZERO if not available.
    • getIdentifier

      public String getIdentifier()
      Retrieves the identifier of the SCORM 1.2 manifest. The identifier is a unique string that represents this specific manifest.
      Specified by:
      getIdentifier in interface PackageManifest
      Returns:
      the identifier of the SCORM 1.2 manifest
    • setIdentifier

      public void setIdentifier(String identifier)
      Sets the identifier for the SCORM 1.2 manifest. The identifier is a unique string used to represent this specific manifest.
      Parameters:
      identifier - the unique identifier for the SCORM 1.2 manifest
    • getVersion

      public String getVersion()
      Retrieves the version of the SCORM 1.2 manifest. The version is a string representing the specific version information associated with this manifest.
      Specified by:
      getVersion in interface PackageManifest
      Returns:
      the version of the SCORM 1.2 manifest
    • setVersion

      public void setVersion(String version)
      Sets the version of the SCORM 1.2 manifest. The version represents a string that indicates the specific version of this manifest.
      Parameters:
      version - the version string to set for the SCORM 1.2 manifest
    • getBase

      public String getBase()
      Retrieves the base URL or path specified in the SCORM 1.2 manifest. The base value is typically used for resolving relative paths within the manifest.
      Returns:
      the base value of the SCORM 1.2 manifest, or null if not set
    • setBase

      public void setBase(String base)
      Sets the base URL or path for the SCORM 1.2 manifest. The base value is used to resolve relative paths within the manifest.
      Parameters:
      base - the base URL or path to set for the SCORM 1.2 manifest
    • getMetadata

      public Scorm12Metadata getMetadata()
      Retrieves the metadata of the SCORM 1.2 manifest. The metadata contains information such as title, description, and other relevant details defined within the SCORM 1.2 specification.
      Returns:
      The Scorm12Metadata object representing the metadata of the SCORM 1.2 manifest.
    • setMetadata

      public void setMetadata(Scorm12Metadata metadata)
      Sets the metadata for the SCORM 1.2 manifest. The metadata includes information such as title, description, and other relevant details defined within the SCORM 1.2 specification.
      Parameters:
      metadata - the Scorm12Metadata object representing the metadata to be assigned to the SCORM 1.2 manifest
    • getOrganizations

      public Scorm12Organizations getOrganizations()
      Retrieves the organizations defined within the SCORM 1.2 manifest. The organizations represent the hierarchical structure of the learning resources, such as courses, lessons, or modules, as specified in the SCORM 1.2 manifest.
      Returns:
      A Scorm12Organizations object representing the organizations within the SCORM 1.2 manifest.
    • setOrganizations

      public void setOrganizations(Scorm12Organizations organizations)
      Sets the organizations for the SCORM 1.2 manifest. The organizations define the hierarchical structure of learning resources, which may include courses, lessons, or modules as specified in the SCORM 1.2 manifest.
      Parameters:
      organizations - the Scorm12Organizations object representing the organizational hierarchy to be assigned to the SCORM 1.2 manifest
    • getResources

      public Scorm12Resources getResources()
      Retrieves the resources defined in the SCORM 1.2 manifest. The resources typically consist of the content and assets associated with the SCORM package, such as files, dependencies, or other resources required for the learning experience.
      Returns:
      A Scorm12Resources object representing the resources within the SCORM 1.2 manifest.
    • setResources

      public void setResources(Scorm12Resources resources)
      Sets the resources for the SCORM 1.2 manifest. The resources represent the content and associated assets required for the SCORM package, such as files, dependencies, or other structures.
      Parameters:
      resources - the Scorm12Resources object representing the resources to be assigned to the SCORM 1.2 manifest
    • equals

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

      public int hashCode()
      Overrides:
      hashCode in class Object