org.apache.tika.xmp.convert
Class AbstractConverter

java.lang.Object
  extended by org.apache.tika.xmp.convert.AbstractConverter
All Implemented Interfaces:
ITikaToXMPConverter
Direct Known Subclasses:
GenericConverter, MSOfficeBinaryConverter, MSOfficeXMLConverter, OpenDocumentConverter, RTFConverter

public abstract class AbstractConverter
extends Object
implements ITikaToXMPConverter

Base class for Tika Metadata to XMP converter which provides some needed common functionality.


Field Summary
protected  com.adobe.xmp.XMPMeta meta
           
 
Constructor Summary
AbstractConverter()
           
 
Method Summary
protected  void createArrayProperty(Property metadataProperty, String nsDc, String arrayProperty, int arrayType)
           
protected  void createArrayProperty(String tikaKey, String ns, String propertyName, int arrayType)
          Creates an array property from a list of values.
protected  void createCommaSeparatedArray(Property metadataProperty, String nsDc, String arrayProperty, int arrayType)
           
protected  void createCommaSeparatedArray(String tikaKey, String ns, String propertyName, int arrayType)
          Creates an array property from a comma separated list.
protected  void createLangAltProperty(Property metadataProperty, String ns, String propertyName)
           
protected  void createLangAltProperty(String tikaKey, String ns, String propertyName)
          Creates a language alternative property in the x-default language
protected  void createProperty(Property metadataProperty, String ns, String propertyName)
           
protected  void createProperty(String tikaKey, String ns, String propertyName)
          Creates a simple property.
protected abstract  Set<Namespace> getAdditionalNamespaces()
          Every Converter has to provide information about namespaces that are used additionally to the core set of XMP namespaces.
 com.adobe.xmp.XMPMeta getXMPMeta()
           
abstract  com.adobe.xmp.XMPMeta process(Metadata metadata)
          Converts a Tika Metadata-object into an XMPMeta containing the useful properties.
protected  void registerNamespaces(Set<Namespace> namespaces)
          Registers a number Namespace information with XMPCore.
 void setMetadata(Metadata metadata)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

meta

protected com.adobe.xmp.XMPMeta meta
Constructor Detail

AbstractConverter

public AbstractConverter()
                  throws TikaException
Throws:
TikaException
Method Detail

process

public abstract com.adobe.xmp.XMPMeta process(Metadata metadata)
                                       throws com.adobe.xmp.XMPException
Description copied from interface: ITikaToXMPConverter
Converts a Tika Metadata-object into an XMPMeta containing the useful properties.

Specified by:
process in interface ITikaToXMPConverter
Parameters:
metadata - a Tika Metadata object
Returns:
Returns an XMPMeta object.
Throws:
com.adobe.xmp.XMPException - If an error occurs during the creation of the XMP object.

getAdditionalNamespaces

protected abstract Set<Namespace> getAdditionalNamespaces()
Every Converter has to provide information about namespaces that are used additionally to the core set of XMP namespaces.

Returns:
the additional namespace information

setMetadata

public void setMetadata(Metadata metadata)

getXMPMeta

public com.adobe.xmp.XMPMeta getXMPMeta()

registerNamespaces

protected void registerNamespaces(Set<Namespace> namespaces)
                           throws TikaException
Registers a number Namespace information with XMPCore. Any already registered namespace is not registered again.

Parameters:
namespaces - the list of namespaces to be registered
Throws:
TikaException - in case a namespace oculd not be registered

createProperty

protected void createProperty(Property metadataProperty,
                              String ns,
                              String propertyName)
                       throws com.adobe.xmp.XMPException
Throws:
com.adobe.xmp.XMPException
See Also:
createProperty(String, String, String)

createProperty

protected void createProperty(String tikaKey,
                              String ns,
                              String propertyName)
                       throws com.adobe.xmp.XMPException
Creates a simple property.

Parameters:
tikaKey - Key in the Tika metadata map
ns - namespace the property should be created in
propertyName - name of the property
Throws:
com.adobe.xmp.XMPException - if the property could not be created

createLangAltProperty

protected void createLangAltProperty(Property metadataProperty,
                                     String ns,
                                     String propertyName)
                              throws com.adobe.xmp.XMPException
Throws:
com.adobe.xmp.XMPException
See Also:
createLangAltProperty(String, String, String)

createLangAltProperty

protected void createLangAltProperty(String tikaKey,
                                     String ns,
                                     String propertyName)
                              throws com.adobe.xmp.XMPException
Creates a language alternative property in the x-default language

Parameters:
tikaKey - Key in the Tika metadata map
ns - namespace the property should be created in
propertyName - name of the property
Throws:
com.adobe.xmp.XMPException - if the property could not be created

createArrayProperty

protected void createArrayProperty(Property metadataProperty,
                                   String nsDc,
                                   String arrayProperty,
                                   int arrayType)
                            throws com.adobe.xmp.XMPException
Throws:
com.adobe.xmp.XMPException

createArrayProperty

protected void createArrayProperty(String tikaKey,
                                   String ns,
                                   String propertyName,
                                   int arrayType)
                            throws com.adobe.xmp.XMPException
Creates an array property from a list of values.

Parameters:
tikaKey - Key in the Tika metadata map
ns - namespace the property should be created in
propertyName - name of the property
arrayType - depicts which kind of array shall be created
Throws:
com.adobe.xmp.XMPException - if the property could not be created

createCommaSeparatedArray

protected void createCommaSeparatedArray(Property metadataProperty,
                                         String nsDc,
                                         String arrayProperty,
                                         int arrayType)
                                  throws com.adobe.xmp.XMPException
Throws:
com.adobe.xmp.XMPException

createCommaSeparatedArray

protected void createCommaSeparatedArray(String tikaKey,
                                         String ns,
                                         String propertyName,
                                         int arrayType)
                                  throws com.adobe.xmp.XMPException
Creates an array property from a comma separated list.

Parameters:
tikaKey - Key in the Tika metadata map
ns - namespace the property should be created in
propertyName - name of the property
arrayType - depicts which kind of array shall be created
Throws:
com.adobe.xmp.XMPException - if the property could not be created


Copyright © 2007-2012 The Apache Software Foundation. All Rights Reserved.