org.daisy.zedval.engine
Class SmilFile

java.lang.Object
  extended byjava.io.File
      extended byorg.daisy.zedval.engine.ZedFile
          extended byorg.daisy.zedval.engine.ManifestFile
              extended byorg.daisy.zedval.engine.XmlFile
                  extended byorg.daisy.zedval.engine.SmilFile
All Implemented Interfaces:
java.lang.Comparable, org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler, org.xml.sax.ext.LexicalHandler, Referring, java.io.Serializable

public class SmilFile
extends XmlFile

A SmilFile object represents a DTB synchronization file

Author:
James Pritchett, Markus Gylling
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.daisy.zedval.engine.ManifestFile
MIME_JPEG, MIME_MP3, MIME_NCX, MIME_PACKAGE, MIME_PNG, MIME_RESOURCE, MIME_SMIL, MIME_SVG, MIME_TEXT, MIME_WAV, MIME_AAC
 
Fields inherited from class java.io.File
pathSeparator, pathSeparatorChar, separator, separatorChar
 
Constructor Summary
SmilFile(java.lang.String fullPath, java.lang.String id, java.lang.String mimeType)
           
 
Method Summary
 void endElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName)
          Looks for end of to set total duration
 org.daisy.util.xml.SmilClock expectedDuration()
          Returns actual total duration of this SMIL file
 java.util.HashMap getAudioFileRefs()
          Returns a HashMap of all audio files referenced by this file
 java.util.Set getCustomTestElements()
           
 org.daisy.util.xml.SmilClock getDuration()
          Returns declared total duration of this SMIL file
 java.util.HashSet getEscapableElements()
           
 java.util.HashMap getFileRefs()
          Returns a HashMap of all files referenced by this file
 java.util.HashMap getImageFileRefs()
          Returns a HashMap of all image files referenced by this file
 java.util.HashMap getLinkFileRefs()
          Returns a HashMap of all files referenced by links in this file
 java.util.HashSet getSkippableElements()
           
 java.util.HashMap getTextFileRefs()
          Returns a HashMap of all text files referenced by this file
 org.daisy.util.xml.SmilClock getTotalElapsedTime()
          Returns declared total elapsed time prior to this SMIL file (dtb:totalElapsedTime metadata item)
 java.lang.String getUid()
          Returns the declared unique identifier value for this SMIL file (value of "dtb:uid" metadata item)
 boolean hasEscapableStructures()
           
 boolean hasSkippableStructures()
           
 boolean isValidDuration()
          Is the declared total duration correct?
 void startElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes atts)
          Grabs all incoming elements and looks for properties to set
 java.lang.String toString()
           
 
Methods inherited from class org.daisy.zedval.engine.XmlFile
characters, comment, endCDATA, endDocument, endDTD, endEntity, endPrefixMapping, error, fatalError, getAllValidationErrors, getDoctypeName, getDoctypePublicId, getDoctypeSystemId, getRootElementLocalName, getRootElementNsURI, getValidationErrors, getValidationFatalErrors, getValidationWarnings, getXmlFileElementById, getXmlFileElements, hasIDValue, ignorableWhitespace, initialize, isParsed, isValid, isValidated, isWellFormed, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startCDATA, startDocument, startDTD, startEntity, startPrefixMapping, unparsedEntityDecl, warning
 
Methods inherited from class org.daisy.zedval.engine.ManifestFile
getId, getMimeType, getPackage, setID, setMimeType, setPackage
 
Methods inherited from class org.daisy.zedval.engine.ZedFile
getName
 
Methods inherited from class java.io.File
canRead, canWrite, compareTo, compareTo, createNewFile, createTempFile, createTempFile, delete, deleteOnExit, equals, exists, getAbsoluteFile, getAbsolutePath, getCanonicalFile, getCanonicalPath, getParent, getParentFile, getPath, hashCode, isAbsolute, isDirectory, isFile, isHidden, lastModified, length, list, list, listFiles, listFiles, listFiles, listRoots, mkdir, mkdirs, renameTo, setLastModified, setReadOnly, toURI, toURL
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SmilFile

public SmilFile(java.lang.String fullPath,
                java.lang.String id,
                java.lang.String mimeType)
Parameters:
id - id from package file manifest
fullPath - File path
mimeType - File MIME type as given in package manifest
Method Detail

hasSkippableStructures

public boolean hasSkippableStructures()
Returns:
true if this SMIL file contains skippable structures (= customTest), false otherwise

hasEscapableStructures

public boolean hasEscapableStructures()
Returns:
true if this SMIL file contains escapable structures (@end contains 'DTBuserEscape;'), false otherwise

getTotalElapsedTime

public org.daisy.util.xml.SmilClock getTotalElapsedTime()
Returns declared total elapsed time prior to this SMIL file (dtb:totalElapsedTime metadata item)

Returns:
SmilClock object expressing declared total elapsed time

getDuration

public org.daisy.util.xml.SmilClock getDuration()
Returns declared total duration of this SMIL file

Returns:
SmilClock object expressing declared total duration of main

expectedDuration

public org.daisy.util.xml.SmilClock expectedDuration()
Returns actual total duration of this SMIL file

Returns:
SmilClock object expressing actual total duration of all audio clips

isValidDuration

public boolean isValidDuration()
Is the declared total duration correct?

Returns:
true if so

getUid

public java.lang.String getUid()
Returns the declared unique identifier value for this SMIL file (value of "dtb:uid" metadata item)

Returns:
The declared unique identifier value for this SMIL file (value of "dtb:uid" metadata item)

getFileRefs

public java.util.HashMap getFileRefs()
Returns a HashMap of all files referenced by this file

Returns:
A HashMap of File objects (key = absolute full path)

getTextFileRefs

public java.util.HashMap getTextFileRefs()
Returns a HashMap of all text files referenced by this file

Returns:
A HashMap of File objects (key = absolute path)

getAudioFileRefs

public java.util.HashMap getAudioFileRefs()
Returns a HashMap of all audio files referenced by this file

Returns:
A HashMap of File objects (key = absolute path)

getImageFileRefs

public java.util.HashMap getImageFileRefs()
Returns a HashMap of all image files referenced by this file

Returns:
A HashMap of File objects (key = absolute path)

getLinkFileRefs

public java.util.HashMap getLinkFileRefs()
Returns a HashMap of all files referenced by links in this file

Returns:
A HashMap of File objects (key = absolute path)

startElement

public void startElement(java.lang.String namespaceURI,
                         java.lang.String localName,
                         java.lang.String qName,
                         org.xml.sax.Attributes atts)
Grabs all incoming elements and looks for properties to set

Specified by:
startElement in interface org.xml.sax.ContentHandler
Overrides:
startElement in class XmlFile
Parameters:
namespaceURI - The namespace URI of the element
localName - The non-prefixed name of the element
qName - The qualified name of the element
atts - List of all element attributes

getCustomTestElements

public java.util.Set getCustomTestElements()
Returns:
a Set<XmlFileElement> of all SMIL head/customAttributes/customTest elements with local name "customTest", an empty Set if no such elements exist in this SMIL file.

getSkippableElements

public java.util.HashSet getSkippableElements()
Returns:
a Set<XmlFileElement> of all SMIL elements with an attribute "customTest", an empty Set if no such elements exist in this SMIL file.

getEscapableElements

public java.util.HashSet getEscapableElements()
Returns:
a Set<XmlFileElement> of all SMIL elements with an attribute "end" with a value containing "DTBuserEscape", an empty Set if no such elements exist in this SMIL file.

endElement

public void endElement(java.lang.String namespaceURI,
                       java.lang.String localName,
                       java.lang.String qName)
Looks for end of to set total duration

Specified by:
endElement in interface org.xml.sax.ContentHandler
Overrides:
endElement in class XmlFile
Parameters:
namespaceURI - The namespace URI of the element
localName - The non-prefixed name of the element
qName - The qualified name of the element

toString

public java.lang.String toString()
Overrides:
toString in class XmlFile