org.ow2.weblab.service.normaliser.tika.metadatawriter
Class MappingDescription

java.lang.Object
  extended by org.ow2.weblab.service.normaliser.tika.metadatawriter.MappingDescription
Direct Known Subclasses:
MappingDescriptionWithUnit

public class MappingDescription
extends java.lang.Object

This class aims to provide a mapping between a Tika metadata and an annotation represented by an URI. Currently only Date and URI are used, others are mapped as text properties. See Property.ValueType for more info.

Author:
Frédéric Praca
See Also:
PoKHelper, Metadata, URI, Property

Field Summary
protected  org.apache.commons.logging.Log logger
          The logger to be used inside this class.
 
Constructor Summary
MappingDescription(Property property, java.net.URI uri)
          Constructor that take a XMP Property as argument and the URI that should map it.
 
Method Summary
protected  java.net.URI getAnnotation_URI()
          Protected getter for destination URI
protected  Property getPropertyLinked()
          Protected getter for property to map
 void write(Metadata metadataToWrite, PoKHelper pokHelperToWriteInto, java.net.URI documentUri)
          This method is a delegate for MetadataWriter.write(Metadata, PoKHelper, URI).
protected  void writeDate(Metadata metadataToWrite, PoKHelper pokHelperToWriteInto, java.net.URI documentUri)
          This method defines how to write a Date metadata.
protected  void writeText(Metadata metadataToWrite, PoKHelper pokHelperToWriteInto, java.net.URI documentUri)
          This method defines how to write a Text metadata.
protected  void writeURI(Metadata metadataToWrite, PoKHelper pokHelperToWriteInto, java.net.URI documentUri)
          This method defines how to write an URI metadata.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected final org.apache.commons.logging.Log logger
The logger to be used inside this class.

Constructor Detail

MappingDescription

public MappingDescription(Property property,
                          java.net.URI uri)
Constructor that take a XMP Property as argument and the URI that should map it. For Tika metadata not represented with a Property object, it should be represented as Text property

Parameters:
property - the Tika property to map
uri - The URI representing the mapping
Method Detail

write

public void write(Metadata metadataToWrite,
                  PoKHelper pokHelperToWriteInto,
                  java.net.URI documentUri)
This method is a delegate for MetadataWriter.write(Metadata, PoKHelper, URI).

Parameters:
metadataToWrite - Metadata set to write
pokHelperToWriteInto - PokHelper to write into
documentUri - The document URI that will be used for reference

writeText

protected void writeText(Metadata metadataToWrite,
                         PoKHelper pokHelperToWriteInto,
                         java.net.URI documentUri)
This method defines how to write a Text metadata. It's called from write and simply writes the text as is. It should only be overridden in subclasses that needs to modify or add some text value to the property.

Parameters:
metadataToWrite - Metadata set to write
pokHelperToWriteInto - PokHelper to write into
documentUri - The document URI that will be used for reference

writeURI

protected void writeURI(Metadata metadataToWrite,
                        PoKHelper pokHelperToWriteInto,
                        java.net.URI documentUri)
This method defines how to write an URI metadata. It's called from write and writes the URI using createResStat of PokHelper. It should only be overridden in subclasses that needs to modify the URI of the property.

Parameters:
metadataToWrite - Metadata set to write
pokHelperToWriteInto - PokHelper to write into
documentUri - The document URI that will be used for reference

writeDate

protected void writeDate(Metadata metadataToWrite,
                         PoKHelper pokHelperToWriteInto,
                         java.net.URI documentUri)
This method defines how to write a Date metadata. It's called from write and writes the Date using Joda Time. It should only be overridden in subclasses that needs to modify, for example, the Date format of the property.

Parameters:
metadataToWrite - Metadata set to write
pokHelperToWriteInto - PokHelper to write into
documentUri - The document URI that will be used for reference

getAnnotation_URI

protected java.net.URI getAnnotation_URI()
Protected getter for destination URI

Returns:
the URI to map to

getPropertyLinked

protected Property getPropertyLinked()
Protected getter for property to map

Returns:
the Property to map from


Copyright © 2004-2012. All Rights Reserved.