VdexReload 1.1.3 API

uk.ac.reload.moonunit.dom.contentpackaging
Class ContentPackageCore

java.lang.Object
  extended byuk.ac.reload.moonunit.dom.contentpackaging.ContentPackageCore
Direct Known Subclasses:
SCORM1_2Core

public class ContentPackageCore
extends java.lang.Object

Core IMS Content Package Methods and Functionality


Field Summary
protected  ReloadDocument _doc
          The JDOM Document that forms the Content Package that we shall be working on
static java.lang.String BASE
           
static java.lang.String DEFAULT
           
static java.lang.String DEPENDENCY
           
static java.lang.String FILE
           
static java.lang.String HREF
           
static java.lang.String IDENTIFIER
           
static java.lang.String IDENTIFIERREF
           
static java.lang.String ITEM
           
static java.lang.String MANIFEST
           
static java.lang.String METADATA
           
static java.lang.String ORGANIZATION
           
static java.lang.String ORGANIZATIONS
           
static java.lang.String PARAMETERS
           
static java.lang.String RESOURCE
           
static java.lang.String RESOURCES
           
static java.lang.String SCHEMA
           
static java.lang.String SCHEMAVERSION
           
static java.lang.String TITLE
           
static java.lang.String TYPE
           
static java.lang.String VERSION
           
 
Constructor Summary
ContentPackageCore(ReloadDocument doc)
          Constructor
 
Method Summary
protected  void _getElementsInManifest(org.jdom.Element parent, java.util.Vector v, java.lang.String elementName, org.jdom.Namespace ns)
           
protected  void _getResourceFiles(org.jdom.Element manifestElement, java.util.Vector v)
           
 org.jdom.Element getDefaultOrganization(org.jdom.Element orgsElement)
           
 java.lang.String getElementBase(org.jdom.Element element)
           
 org.jdom.Element getElementByIdentifier(org.jdom.Element parent, java.lang.String identifier)
           
 java.lang.String getElementHREF(org.jdom.Element element)
           
 org.jdom.Element[] getElementsInManifest(org.jdom.Element manifestElement, java.lang.String elementName, org.jdom.Namespace ns)
           
 org.jdom.Element getFile(java.lang.String href, org.jdom.Element resourceElement)
           
 org.jdom.Namespace getMetadataNamespace()
           
 org.jdom.Element[] getOrganizations(org.jdom.Element orgsElement)
           
 org.jdom.Element[] getOrganizationsAllowed(org.jdom.Element orgsElement)
           
 java.lang.String getParameters(org.jdom.Element element)
           
 org.jdom.Element getParentManifestElement(org.jdom.Element element)
          Find the local parent "manifest" Element for a given Element If element is the manifest, will return that
 java.io.File getProjectFolder()
           
 org.jdom.Element getReferencedElement(org.jdom.Element sourceElement)
           
 org.jdom.Element[] getReferencedElementsAllowed(org.jdom.Element element)
           
 java.lang.String[] getReferencedIdentifersAllowed(org.jdom.Element element)
           
 org.jdom.Element getResource(java.lang.String href, org.jdom.Element resourcesElement)
           
 java.io.File getResourceFile(org.jdom.Element element)
           
 java.io.File[] getResourceFiles(org.jdom.Element manifestElement)
           
 org.jdom.Element getResourcesElement(org.jdom.Element element)
          Find the local "resources" Element for a given Element position.
 java.lang.String getURL(org.jdom.Element element)
           
 boolean isMetadataElement(java.lang.String name)
          Return whether we have the "metadata" element
 boolean isMetadataRoot(java.lang.String name)
          Return whether we have the MD root name of any embedded Metadata "lom"
 boolean isReferencingElement(org.jdom.Element element)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MANIFEST

public static final java.lang.String MANIFEST
See Also:
Constant Field Values

ORGANIZATIONS

public static final java.lang.String ORGANIZATIONS
See Also:
Constant Field Values

RESOURCES

public static final java.lang.String RESOURCES
See Also:
Constant Field Values

DEFAULT

public static final java.lang.String DEFAULT
See Also:
Constant Field Values

ORGANIZATION

public static final java.lang.String ORGANIZATION
See Also:
Constant Field Values

ITEM

public static final java.lang.String ITEM
See Also:
Constant Field Values

PARAMETERS

public static final java.lang.String PARAMETERS
See Also:
Constant Field Values

RESOURCE

public static final java.lang.String RESOURCE
See Also:
Constant Field Values

BASE

public static final java.lang.String BASE
See Also:
Constant Field Values

FILE

public static final java.lang.String FILE
See Also:
Constant Field Values

TYPE

public static final java.lang.String TYPE
See Also:
Constant Field Values

HREF

public static final java.lang.String HREF
See Also:
Constant Field Values

METADATA

public static final java.lang.String METADATA
See Also:
Constant Field Values

IDENTIFIER

public static final java.lang.String IDENTIFIER
See Also:
Constant Field Values

IDENTIFIERREF

public static final java.lang.String IDENTIFIERREF
See Also:
Constant Field Values

TITLE

public static final java.lang.String TITLE
See Also:
Constant Field Values

DEPENDENCY

public static final java.lang.String DEPENDENCY
See Also:
Constant Field Values

VERSION

public static final java.lang.String VERSION
See Also:
Constant Field Values

SCHEMA

public static final java.lang.String SCHEMA
See Also:
Constant Field Values

SCHEMAVERSION

public static final java.lang.String SCHEMAVERSION
See Also:
Constant Field Values

_doc

protected ReloadDocument _doc
The JDOM Document that forms the Content Package that we shall be working on

Constructor Detail

ContentPackageCore

public ContentPackageCore(ReloadDocument doc)
Constructor

Method Detail

getProjectFolder

public java.io.File getProjectFolder()
Returns:
the CP Project Folder which is the containing folder of imsmanifest.xml

getReferencedElement

public org.jdom.Element getReferencedElement(org.jdom.Element sourceElement)
Returns:
The Element referenced by identifierref in sourceElement. The search digs downward from sourceElement - this is important. This will be either a Resource or a sub-Manifest.

isReferencingElement

public boolean isReferencingElement(org.jdom.Element element)
Returns:
true if element has an identifierref attribute

getReferencedIdentifersAllowed

public java.lang.String[] getReferencedIdentifersAllowed(org.jdom.Element element)
Returns:
all available Identifiers from Resources and sub-Manifests that an element can legally reference. For an Item this will be Resources and sub-manifests and for a Resource Dependency this will be another Resource

getReferencedElementsAllowed

public org.jdom.Element[] getReferencedElementsAllowed(org.jdom.Element element)
Returns:
all available Elements (Resources and sub-Manifests) that an element can legally reference. For an Item this will be Resources and sub-manifests and for a Resource Dependency this will be another Resource

getElementsInManifest

public org.jdom.Element[] getElementsInManifest(org.jdom.Element manifestElement,
                                                java.lang.String elementName,
                                                org.jdom.Namespace ns)
Returns:
all sub-Elements of type elementName from a given parent Manifest This does a deep recursive search

_getElementsInManifest

protected void _getElementsInManifest(org.jdom.Element parent,
                                      java.util.Vector v,
                                      java.lang.String elementName,
                                      org.jdom.Namespace ns)

getParentManifestElement

public org.jdom.Element getParentManifestElement(org.jdom.Element element)
Find the local parent "manifest" Element for a given Element If element is the manifest, will return that


getElementByIdentifier

public org.jdom.Element getElementByIdentifier(org.jdom.Element parent,
                                               java.lang.String identifier)
Returns:
an Element by its IDENTIFIER attribute starting at Parent element This will only search one-level deep from parent

getOrganizations

public org.jdom.Element[] getOrganizations(org.jdom.Element orgsElement)
Returns:
all ORGANIZATION elements in an ORGANIZATIONS element

getOrganizationsAllowed

public org.jdom.Element[] getOrganizationsAllowed(org.jdom.Element orgsElement)
Returns:
all ORGANIZATION elements in an ORGANIZATIONS element that can be referenced

getDefaultOrganization

public org.jdom.Element getDefaultOrganization(org.jdom.Element orgsElement)
Returns:
the default Organization for an ORGANIZATIONS element If there is a DEFAULT ref in the ORGANIZATIONS element will return that otherwise retunr first ORGANIZATION Element if found

getMetadataNamespace

public org.jdom.Namespace getMetadataNamespace()
Returns:
the MD Namespace for a CP Document or null if none declared

isMetadataRoot

public boolean isMetadataRoot(java.lang.String name)
Return whether we have the MD root name of any embedded Metadata "lom"


isMetadataElement

public boolean isMetadataElement(java.lang.String name)
Return whether we have the "metadata" element


getURL

public java.lang.String getURL(org.jdom.Element element)
Returns:
The URL string that an Element references

getElementHREF

public java.lang.String getElementHREF(org.jdom.Element element)
Returns:
An actual HREF reference from an Element's HREF taking into account xml:base

getElementBase

public java.lang.String getElementBase(org.jdom.Element element)
Returns:
An actual BASE reference for an Element taking into account xml:base

getParameters

public java.lang.String getParameters(org.jdom.Element element)
Returns:
the parameters attribute of an element

getResourceFile

public java.io.File getResourceFile(org.jdom.Element element)
Returns:
An actual File reference that an Element references. If it's not a local file or does not exist, return null

getResourceFiles

public java.io.File[] getResourceFiles(org.jdom.Element manifestElement)
Returns:
All File HREFs for a given Manifest Element taking into account xml:base

_getResourceFiles

protected void _getResourceFiles(org.jdom.Element manifestElement,
                                 java.util.Vector v)

getResource

public org.jdom.Element getResource(java.lang.String href,
                                    org.jdom.Element resourcesElement)
Returns:
a Resource Element given its HREF - the first one found

getFile

public org.jdom.Element getFile(java.lang.String href,
                                org.jdom.Element resourceElement)
Returns:
a File Element given its HREF - the first one found

getResourcesElement

public org.jdom.Element getResourcesElement(org.jdom.Element element)
Find the local "resources" Element for a given Element position. This is because there may be more than one with sub-manifests


VdexReload 1.1.3 API