Class XmlMetadataExtracter
- java.lang.Object
-
- org.alfresco.repo.content.metadata.AbstractMappingMetadataExtracter
-
- org.alfresco.repo.content.metadata.xml.XmlMetadataExtracter
-
- All Implemented Interfaces:
ContentWorker,MetadataEmbedder,MetadataExtracter,org.springframework.beans.factory.Aware,org.springframework.beans.factory.BeanNameAware,org.springframework.context.ApplicationContextAware
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
MetadataExtracter.OverwritePolicyas AbstractMappingMetadataExtracter.setOverwritePolicy(org.alfresco.repo.content.metadata.MetadataExtracter.OverwritePolicy) on this instance. The overwrite policy of the embedded extracters is not relevant unless they are used separately in another context.- Since:
- 2.1
- Author:
- Derek Hulley
- See Also:
ContentWorkerSelector,MetadataExtracter
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.alfresco.repo.content.metadata.MetadataExtracter
MetadataExtracter.OverwritePolicy
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String[]SUPPORTED_MIMETYPES-
Fields inherited from class org.alfresco.repo.content.metadata.AbstractMappingMetadataExtracter
MEGABYTE_SIZE, NAMESPACE_PROPERTY_PREFIX, PROPERTY_COMPONENT_EMBED, PROPERTY_COMPONENT_EXTRACT, PROPERTY_PREFIX_METADATA
-
-
Constructor Summary
Constructors Constructor Description XmlMetadataExtracter()Default constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Map<org.alfresco.service.namespace.QName,java.io.Serializable>extract(org.alfresco.service.cmr.repository.ContentReader reader, MetadataExtracter.OverwritePolicy overwritePolicy, java.util.Map<org.alfresco.service.namespace.QName,java.io.Serializable> destination, java.util.Map<java.lang.String,java.util.Set<org.alfresco.service.namespace.QName>> mapping)Selects and extracter to perform the work and redirects to it.protected java.util.Map<java.lang.String,java.io.Serializable>extractRaw(org.alfresco.service.cmr.repository.ContentReader reader)This is not required as theprotected java.util.Map<java.lang.String,java.util.Set<org.alfresco.service.namespace.QName>>getDefaultMapping()It is not possible to have any default mappings, but something has to be returned.protected voidinit()Provides a hook point for implementations to perform initialization.voidsetSelectors(java.util.List<ContentWorkerSelector<MetadataExtracter>> 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
checkIsEmbedSupported, checkIsSupported, embed, embedInternal, extract, extract, filterSystemProperties, getBeanName, getDefaultEmbedMapping, getEmbedMapping, getExecutorService, getLimits, getMapping, getMimetypeService, isEmbeddingSupported, isSupported, makeDate, newRawMap, putRawValue, readEmbedMappingProperties, readEmbedMappingProperties, readGlobalEmbedMappingProperties, readGlobalExtractMappingProperties, readMappingProperties, readMappingProperties, register, setApplicationContext, setBeanName, setDictionaryService, setEmbedMapping, setEmbedMappingProperties, setEnableStringTagging, setExecutorService, setFailOnTypeConversion, setInheritDefaultEmbedMapping, setInheritDefaultMapping, setMapping, setMappingProperties, setMimetypeLimits, setMimetypeService, setOverwritePolicy, setProperties, setRegistry, setSupportedDateFormats, setSupportedEmbedMimetypes, setSupportedMimetypes
-
-
-
-
Method Detail
-
setSelectors
public void setSelectors(java.util.List<ContentWorkerSelector<MetadataExtracter>> 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:AbstractMappingMetadataExtracterProvides a hook point for implementations to perform initialization. The base implementation must be invoked or the extracter will fail during extraction. Thedefault mappingswill be requested during initialization.- Overrides:
initin classAbstractMappingMetadataExtracter
-
getDefaultMapping
protected java.util.Map<java.lang.String,java.util.Set<org.alfresco.service.namespace.QName>> getDefaultMapping()
It is not possible to have any default mappings, but something has to be returned.- Overrides:
getDefaultMappingin classAbstractMappingMetadataExtracter- Returns:
- Returns an empty map
- See Also:
AbstractMappingMetadataExtracter.setInheritDefaultMapping(boolean inherit)
-
extract
public java.util.Map<org.alfresco.service.namespace.QName,java.io.Serializable> extract(org.alfresco.service.cmr.repository.ContentReader reader, MetadataExtracter.OverwritePolicy overwritePolicy, java.util.Map<org.alfresco.service.namespace.QName,java.io.Serializable> destination, java.util.Map<java.lang.String,java.util.Set<org.alfresco.service.namespace.QName>> mapping)Selects and extracter to perform the work and redirects to it.- Specified by:
extractin interfaceMetadataExtracter- Overrides:
extractin classAbstractMappingMetadataExtracter- Parameters:
reader- the source of the contentoverwritePolicy- the policy stipulating how the system properties must be overwritten if presentdestination- 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<java.lang.String,java.io.Serializable> extractRaw(org.alfresco.service.cmr.repository.ContentReader reader) throws java.lang.ThrowableThis is not required as the- Specified by:
extractRawin classAbstractMappingMetadataExtracter- 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- All exception conditions can be handled.- See Also:
AbstractMappingMetadataExtracter.getDefaultMapping()
-
-