org.daisy.zedval.engine
Class PackageFile

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.PackageFile
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 PackageFile
extends XmlFile

A PackageFile object represents a DTB package file

Author:
James Pritchett, Piotr Kiernicki, mgylling
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
PackageFile(java.lang.String fullPath)
           
PackageFile(java.lang.String fullPath, java.lang.String id, java.lang.String mimeType)
           
 
Method Summary
 java.lang.String audioFormat()
          Returns the list of audio formats for this package
 void characters(char[] ch, int start, int length)
          Grabs all text of current element and sets properties as needed.
 void endElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName)
           
 java.util.LinkedHashMap getAudioFiles()
          Returns the audio files for this package
 java.util.ArrayList getCreators()
          Returns array of book creator names
 java.util.LinkedHashMap getCssFiles()
          Returns the CSS files for this package
 java.lang.String getDtbMultimediaTypeAsComputed()
          Returns the computed DTB multimedia type (computed by checking fileset member types) Will only return the significant trio subset (audioOnly|audioFullText|textNCX) as the others are programatically undeterminable
 java.lang.String getDtbMultimediaTypeAsDeclared()
          Returns the declared DTB multimedia type (value of dtb:multimediaType metadata item)
 java.util.LinkedHashMap getDtdFiles()
          Returns the DTD files for this package (DTDs, Ents and Mods)
 java.util.HashMap getFileRefs()
           
 java.lang.String getIdentifier()
          Returns the unique identifier for this package
 java.util.LinkedHashMap getImageFiles()
          Returns the image files for this package
 java.util.LinkedHashMap getJpegFiles()
          Returns the JPEG image files for this package
 java.util.LinkedHashMap getManifest()
          Returns ZedFiles named in package manifest
 java.lang.String getMetaDtbMultimediaContent()
          Returns the declared DTB multimedia content (value of dtb:multimediaContent metadata item)
 java.util.LinkedHashMap getMp3Files()
          Returns the MP3 audio files for this package
 NcxFile getNcx()
          Returns the NCX file for this package
 java.util.LinkedHashMap getPngFiles()
          Returns the PNG image files for this package
 ResourceFile getResource()
          Returns the resource file for this package
 java.util.LinkedHashMap getSmilFiles()
          Returns the SMIL files for this package
 java.lang.String getSpecVersion()
          Returns version of Zed specification this book follows
 java.util.LinkedHashMap getSpine()
          Returns list of ZedFiles named in package spine
 java.util.LinkedHashMap getSvgFiles()
          Returns the SVG image files for this package
 java.util.LinkedHashMap getTextFiles()
          Returns the text files for this package
 java.lang.String getTitle()
          Returns the book title
 org.daisy.util.xml.SmilClock getTotalTime()
          Returns the declared total playback time of the book (value of dtb:totalTime metadata item)
 java.util.LinkedHashMap getWavFiles()
          Returns the WAV audio files for this package
 java.util.LinkedHashMap getAacFiles()
          Returns the AAC audio files for this package
 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
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

PackageFile

public PackageFile(java.lang.String fullPath)
Parameters:
fullPath - Full file path (including name)

PackageFile

public PackageFile(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

getTitle

public java.lang.String getTitle()
Returns the book title

Returns:
the book title

getCreators

public java.util.ArrayList getCreators()
Returns array of book creator names

Returns:
ArrayList of Strings

getSpecVersion

public java.lang.String getSpecVersion()
Returns version of Zed specification this book follows

Returns:
Value of dc:Format metadata item

getManifest

public java.util.LinkedHashMap getManifest()
Returns ZedFiles named in package manifest

Returns:
LinkedHashMap of ZedFiles named in package manifest (key = absolute file path)

getNcx

public NcxFile getNcx()
Returns the NCX file for this package

Returns:
The NcxFile for this package

getResource

public ResourceFile getResource()
Returns the resource file for this package

Returns:
The ResourceFile for this package

getTextFiles

public java.util.LinkedHashMap getTextFiles()
Returns the text files for this package

Returns:
LinkedHashMap of the TextFile objects (key = absolute file path)

getAudioFiles

public java.util.LinkedHashMap getAudioFiles()
Returns the audio files for this package

Returns:
LinkedHashMap of the AudioFile objects (key = absolute file path)

getAacFiles

public java.util.LinkedHashMap getAacFiles()
Returns the AAC audio files for this package

Returns:
LinkedHashMap of the AacFile objects (key = absolute file path)

getMp3Files

public java.util.LinkedHashMap getMp3Files()
Returns the MP3 audio files for this package

Returns:
LinkedHashMap of the Mp3File objects (key = absolute file path)

getWavFiles

public java.util.LinkedHashMap getWavFiles()
Returns the WAV audio files for this package

Returns:
LinkedHashMap of the WavFile objects (key = absolute file path)

getImageFiles

public java.util.LinkedHashMap getImageFiles()
Returns the image files for this package

Returns:
LinkedHashMap of the ImageFile objects (key = absolute file path)

getJpegFiles

public java.util.LinkedHashMap getJpegFiles()
Returns the JPEG image files for this package

Returns:
LinkedHashMap of the JpegFile objects (key = absolute file path)

getPngFiles

public java.util.LinkedHashMap getPngFiles()
Returns the PNG image files for this package

Returns:
LinkedHashMap of the PngFile objects (key = absolute file path)

getSvgFiles

public java.util.LinkedHashMap getSvgFiles()
Returns the SVG image files for this package

Returns:
LinkedHashMap of the SvgFile objects (key = absolute file path)

getSmilFiles

public java.util.LinkedHashMap getSmilFiles()
Returns the SMIL files for this package

Returns:
LinkedHashMap of the SmilFile objects (key = absolute file path)

getCssFiles

public java.util.LinkedHashMap getCssFiles()
Returns the CSS files for this package

Returns:
LinkedHashMap of the CssFile objects (key = absolute file path)

getDtdFiles

public java.util.LinkedHashMap getDtdFiles()
Returns the DTD files for this package (DTDs, Ents and Mods)

Returns:
LinkedHashMap of the CssFile objects (key = absolute file path)

getSpine

public java.util.LinkedHashMap getSpine()
Returns list of ZedFiles named in package spine

Returns:
LinkedHashMap of ZedFiles

getIdentifier

public java.lang.String getIdentifier()
Returns the unique identifier for this package

Returns:
the unique identifier for this package

getDtbMultimediaTypeAsDeclared

public java.lang.String getDtbMultimediaTypeAsDeclared()
Returns the declared DTB multimedia type (value of dtb:multimediaType metadata item)

Returns:
the declared DTB multimedia type (value of dtb:multimediaType metadata item)

getDtbMultimediaTypeAsComputed

public java.lang.String getDtbMultimediaTypeAsComputed()
Returns the computed DTB multimedia type (computed by checking fileset member types) Will only return the significant trio subset (audioOnly|audioFullText|textNCX) as the others are programatically undeterminable

Returns:
the computed DTB multimedia type (computed by checking fileset member types)

getMetaDtbMultimediaContent

public java.lang.String getMetaDtbMultimediaContent()
Returns the declared DTB multimedia content (value of dtb:multimediaContent metadata item)

Returns:
the declared DTB multimedia content (value of dtb:multimediaContent metadata item)

getTotalTime

public org.daisy.util.xml.SmilClock getTotalTime()
Returns the declared total playback time of the book (value of dtb:totalTime metadata item)

Returns:
SmilClock object expressing total declared playback time

audioFormat

public java.lang.String audioFormat()
Returns the list of audio formats for this package

Returns:
The content of the dtb:audioFormat metadata item (space-delimited list of formats)

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

characters

public void characters(char[] ch,
                       int start,
                       int length)
Grabs all text of current element and sets properties as needed.
If current element's text node contains entities, characters() will be called more than once for the element.

Specified by:
characters in interface org.xml.sax.ContentHandler
Overrides:
characters in class XmlFile
Parameters:
ch - Array of characters in document
start - Starting index of text in this element
length - Length of text in this element

endElement

public void endElement(java.lang.String namespaceURI,
                       java.lang.String localName,
                       java.lang.String qName)
Specified by:
endElement in interface org.xml.sax.ContentHandler
Overrides:
endElement in class XmlFile

toString

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

getFileRefs

public java.util.HashMap getFileRefs()