xmlgraphics-commons 1.3.1

org.apache.xmlgraphics.xmp
Class XMPSchemaAdapter

java.lang.Object
  extended by org.apache.xmlgraphics.xmp.XMPSchemaAdapter
Direct Known Subclasses:
AdobePDFAdapter, DublinCoreAdapter, PDFAAdapter, XMPBasicAdapter

public class XMPSchemaAdapter
extends java.lang.Object

Base class for schema-specific adapters that provide user-friendly access to XMP values.


Field Summary
protected  Metadata meta
          the Metadata object this schema instance operates on
 
Constructor Summary
XMPSchemaAdapter(Metadata meta, XMPSchema schema)
          Main constructor.
 
Method Summary
protected  void addDateToSeq(java.lang.String propName, java.util.Date value)
          Adds a date value to an ordered array.
protected  void addStringToBag(java.lang.String propName, java.lang.String value)
          Adds a String value to an unordered array.
protected  void addStringToSeq(java.lang.String propName, java.lang.String value)
          Adds a String value to an ordered array.
static java.lang.String formatISO8601Date(java.util.Date dt)
          Formats a Date using ISO 8601 format in the default time zone.
static java.lang.String formatISO8601Date(java.util.Date dt, java.util.TimeZone tz)
          Formats a Date using ISO 8601 format in the given time zone.
protected  java.util.Date getDateValue(java.lang.String propName)
          Returns a date value.
protected  java.lang.String getLangAlt(java.lang.String lang, java.lang.String propName)
          Returns a language-dependent value.
protected  java.lang.Object[] getObjectArray(java.lang.String propName)
          Returns an object array representation of the property's values.
protected  QName getQName(java.lang.String propName)
          Returns the QName for a given property
 XMPSchema getSchema()
           
protected  java.lang.String[] getStringArray(java.lang.String propName)
          Returns a String array representation of the property's values.
protected  java.lang.String getValue(java.lang.String propName)
          Returns a simple value.
static java.util.Date parseISO8601Date(java.lang.String dt)
          Parses an ISO 8601 date and time value.
protected  void removeLangAlt(java.lang.String lang, java.lang.String propName)
          Removes a language-dependent value from an alternative array.
protected  void setDateValue(java.lang.String propName, java.util.Date value)
          Set a date value.
protected  void setLangAlt(java.lang.String propName, java.lang.String lang, java.lang.String value)
          Sets a language-dependent value.
protected  void setValue(java.lang.String propName, java.lang.String value)
          Sets a simple value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

meta

protected Metadata meta
the Metadata object this schema instance operates on

Constructor Detail

XMPSchemaAdapter

public XMPSchemaAdapter(Metadata meta,
                        XMPSchema schema)
Main constructor.

Parameters:
meta - the Metadata object to wrao
schema - the XMP schema for which this adapter was written
Method Detail

getSchema

public XMPSchema getSchema()
Returns:
the XMP schema associated with this adapter

getQName

protected QName getQName(java.lang.String propName)
Returns the QName for a given property

Parameters:
propName - the property name
Returns:
the resulting QName

addStringToSeq

protected void addStringToSeq(java.lang.String propName,
                              java.lang.String value)
Adds a String value to an ordered array.

Parameters:
propName - the property name
value - the String value

addStringToBag

protected void addStringToBag(java.lang.String propName,
                              java.lang.String value)
Adds a String value to an unordered array.

Parameters:
propName - the property name
value - the String value

formatISO8601Date

public static java.lang.String formatISO8601Date(java.util.Date dt)
Formats a Date using ISO 8601 format in the default time zone.

Parameters:
dt - the date
Returns:
the formatted date

formatISO8601Date

public static java.lang.String formatISO8601Date(java.util.Date dt,
                                                 java.util.TimeZone tz)
Formats a Date using ISO 8601 format in the given time zone.

Parameters:
dt - the date
tz - the time zone
Returns:
the formatted date

parseISO8601Date

public static java.util.Date parseISO8601Date(java.lang.String dt)
Parses an ISO 8601 date and time value.

Parameters:
dt - the date and time value as an ISO 8601 string
Returns:
the parsed date/time
To do:
Parse formats other than yyyy-mm-ddThh:mm:ssZ

addDateToSeq

protected void addDateToSeq(java.lang.String propName,
                            java.util.Date value)
Adds a date value to an ordered array.

Parameters:
propName - the property name
value - the date value

setDateValue

protected void setDateValue(java.lang.String propName,
                            java.util.Date value)
Set a date value.

Parameters:
propName - the property name
value - the date value

getDateValue

protected java.util.Date getDateValue(java.lang.String propName)
Returns a date value.

Parameters:
propName - the property name
Returns:
the date value or null if the value is not set

setLangAlt

protected void setLangAlt(java.lang.String propName,
                          java.lang.String lang,
                          java.lang.String value)
Sets a language-dependent value.

Parameters:
propName - the property name
lang - the language ("x-default" or null for the default language)
value - the value

setValue

protected void setValue(java.lang.String propName,
                        java.lang.String value)
Sets a simple value.

Parameters:
propName - the property name
value - the value

getValue

protected java.lang.String getValue(java.lang.String propName)
Returns a simple value.

Parameters:
propName - the property name
Returns:
the requested value or null if it isn't set

removeLangAlt

protected void removeLangAlt(java.lang.String lang,
                             java.lang.String propName)
Removes a language-dependent value from an alternative array.

Parameters:
lang - the language ("x-default" for the default language)
propName - the property name

getLangAlt

protected java.lang.String getLangAlt(java.lang.String lang,
                                      java.lang.String propName)
Returns a language-dependent value. If the value in the requested language is not available the value for the default language is returned.

Parameters:
lang - the language ("x-default" for the default language)
propName - the property name
Returns:
the requested value

getObjectArray

protected java.lang.Object[] getObjectArray(java.lang.String propName)
Returns an object array representation of the property's values.

Parameters:
propName - the property name
Returns:
the object array or null if the property isn't set

getStringArray

protected java.lang.String[] getStringArray(java.lang.String propName)
Returns a String array representation of the property's values. Complex values to converted to Strings using the toString() method.

Parameters:
propName - the property name
Returns:
the String array or null if the property isn't set

xmlgraphics-commons 1.3.1

Copyright 1999-2008 The Apache Software Foundation. All Rights Reserved.