org.alfresco.repo.content.metadata.xml
Class XmlMetadataExtracter

java.lang.Object
  extended by org.alfresco.repo.content.metadata.AbstractMappingMetadataExtracter
      extended by org.alfresco.repo.content.metadata.xml.XmlMetadataExtracter
All Implemented Interfaces:
ContentWorker, MetadataExtracter

public class XmlMetadataExtracter
extends AbstractMappingMetadataExtracter

A metadata extractor that selects an appropiate workder for the extraction.

The selectors are used to find an extracter most appropriate of a given XML document. The chosen extracter is then asked to extract the values, passing through the overwrite policy as AbstractMappingMetadataExtracter.setOverwritePolicy(String) on this instance. The overwrite policy of the embedded extracters is not relevant unless they are used separately in another context.

Since:
2.1
See Also:
ContentWorkerSelector, MetadataExtracter

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.alfresco.repo.content.metadata.MetadataExtracter
MetadataExtracter.OverwritePolicy
 
Field Summary
static java.lang.String[] SUPPORTED_MIMETYPES
           
 
Fields inherited from class org.alfresco.repo.content.metadata.AbstractMappingMetadataExtracter
NAMESPACE_PROPERTY_PREFIX, supportedDateFormats
 
Constructor Summary
XmlMetadataExtracter()
          Default constructor
 
Method Summary
 java.util.Map extract(org.alfresco.service.cmr.repository.ContentReader reader, MetadataExtracter.OverwritePolicy overwritePolicy, java.util.Map destination, java.util.Map mapping)
          Selects and extracter to perform the work and redirects to it.
protected  java.util.Map extractRaw(org.alfresco.service.cmr.repository.ContentReader reader)
          This is not required as the
protected  java.util.Map getDefaultMapping()
          It is not possible to have any default mappings, but something has to be returned.
protected  void init()
          Provides a hook point for implementations to perform initialization.
 void setSelectors(java.util.List selectors)
          Sets the list of metadata selectors to use to find the extracter to use, given some content.
 
Methods inherited from class org.alfresco.repo.content.metadata.AbstractMappingMetadataExtracter
checkIsSupported, extract, extract, filterSystemProperties, getExtractionTime, getMapping, getMimetypeService, getReliability, isSupported, makeDate, newRawMap, putRawValue, readMappingProperties, readMappingProperties, register, setDictionaryService, setFailOnTypeConversion, setInheritDefaultMapping, setMapping, setMappingProperties, setMimetypeService, setOverwritePolicy, setOverwritePolicy, setRegistry, setSupportedDateFormats, setSupportedMimetypes
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SUPPORTED_MIMETYPES

public static java.lang.String[] SUPPORTED_MIMETYPES
Constructor Detail

XmlMetadataExtracter

public XmlMetadataExtracter()
Default constructor

Method Detail

setSelectors

public void setSelectors(java.util.List selectors)
Sets the list of metadata selectors to use to find the extracter to use, given some content. The evaluations are done in the order that they occur in the list.

Parameters:
selectors - A list of selectors

init

protected void init()
Description copied from class: AbstractMappingMetadataExtracter
Provides a hook point for implementations to perform initialization. The base implementation must be invoked or the extracter will fail during extraction. The default mappings will be requested during initialization.

Overrides:
init in class AbstractMappingMetadataExtracter

getDefaultMapping

protected java.util.Map getDefaultMapping()
It is not possible to have any default mappings, but something has to be returned.

Overrides:
getDefaultMapping in class AbstractMappingMetadataExtracter
Returns:
Returns an empty map
See Also:
AbstractMappingMetadataExtracter.setInheritDefaultMapping(boolean inherit)

extract

public java.util.Map extract(org.alfresco.service.cmr.repository.ContentReader reader,
                             MetadataExtracter.OverwritePolicy overwritePolicy,
                             java.util.Map destination,
                             java.util.Map mapping)
Selects and extracter to perform the work and redirects to it.

Specified by:
extract in interface MetadataExtracter
Overrides:
extract in class AbstractMappingMetadataExtracter
Parameters:
reader - the source of the content
overwritePolicy - the policy stipulating how the system properties must be overwritten if present
destination - the map of properties to populate (essentially a return value)
mapping - a mapping of document-specific properties to system properties.
Returns:
Returns a map of all properties on the destination map that were added or modified. If the return map is empty, then no properties were modified.
See Also:
MetadataExtracter.extract(ContentReader, Map)

extractRaw

protected java.util.Map extractRaw(org.alfresco.service.cmr.repository.ContentReader reader)
                            throws java.lang.Throwable
This is not required as the

Specified by:
extractRaw in class AbstractMappingMetadataExtracter
Parameters:
reader - the document to extract the values from. This stream provided by the reader must be closed if accessed directly.
Returns:
Returns a map of document property values keyed by property name.
Throws:
java.lang.Throwable
See Also:
AbstractMappingMetadataExtracter.getDefaultMapping()


Copyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.