org.apache.chemistry.opencmis.client.mapper
Interface PropertyMapper

All Known Implementing Classes:
AbstractPropertyMapper, PropertyMapperExif, PropertyMapperTika

public interface PropertyMapper

A property mapper is a class being responsible to map a Content-Type (e.g. image/jpeg) to a CMIS type id and to map and convert properties. Extracted tags are mapped to CMIS property ids and sometimes type conversion is required (e.g. a string to a date). Classes implementing this interface are not responsible for extracting the metadata (see MetadataParser). It only reads a configuration and maps properties. The Configurator will read the configuration properties and instantiate implementations of this interface (one instance per CMIS type)

Author:
Jens

Method Summary
 Object convertValue(String id, PropertyDefinition<?> propDef, String strValue)
          Convert a value parsed from the file to the type the corresponding property expects
 String[] getContentTypes()
          get all content types handled by this parser
 String getMappedPropertyId(String key)
          return the CMIS property id for a found tag in a file
 String getMappedTypeId()
          return the CMIS type id used for this mapper
 boolean initialize(String cfgPrefix, String typeKey, Properties properties)
          initialize a property mapper
 void reset()
          Reset all internal data to get ready for a new parsing process
 

Method Detail

initialize

boolean initialize(String cfgPrefix,
                   String typeKey,
                   Properties properties)
initialize a property mapper

Parameters:
cfgPrefix - prefix for all configuration entries in properties file
typeKey - type key in configuration used to identify this type
properties - all properties read from resource mapping.properties
Returns:
true, if processing should continue, false if not

reset

void reset()
Reset all internal data to get ready for a new parsing process


getMappedTypeId

String getMappedTypeId()
return the CMIS type id used for this mapper

Returns:
CMIS type id to map this content type to or null if not mappable

getMappedPropertyId

String getMappedPropertyId(String key)
return the CMIS property id for a found tag in a file

Parameters:
key - tag (usually parsed from Tika) found in file
Returns:
CMIS property this tag gets mapped to, null if not mapped

convertValue

Object convertValue(String id,
                    PropertyDefinition<?> propDef,
                    String strValue)
Convert a value parsed from the file to the type the corresponding property expects

Parameters:
id - CMIS property id
propertyType - property type from type definition
strValue - value read from file (Tika always gives a string)
Returns:
converted value conforming to the mapped property

getContentTypes

String[] getContentTypes()
get all content types handled by this parser

Returns:
array with content types


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