org.alfresco.repo.content.metadata
Class AbstractMetadataExtracter

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

Deprecated. Use the AbstractMappingMetadataExtracter

public abstract class AbstractMetadataExtracter
extends java.lang.Object
implements MetadataExtracter

Support class for metadata extracters.


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.alfresco.repo.content.metadata.MetadataExtracter
MetadataExtracter.OverwritePolicy
 
Field Summary
protected static org.apache.commons.logging.Log logger
          Deprecated.  
 
Constructor Summary
protected AbstractMetadataExtracter(java.util.Set supportedMimetypes, double reliability, long extractionTime)
          Deprecated.  
protected AbstractMetadataExtracter(java.lang.String supportedMimetype, double reliability, long extractionTime)
          Deprecated.  
 
Method Summary
protected  void checkReliability(org.alfresco.service.cmr.repository.ContentReader reader)
          Deprecated. Checks if the mimetype is supported.
 java.util.Map extract(org.alfresco.service.cmr.repository.ContentReader reader, java.util.Map destination)
          Deprecated. Extracts the metadata values from the content provided by the reader and source mimetype to the supplied map.
 java.util.Map extract(org.alfresco.service.cmr.repository.ContentReader reader, MetadataExtracter.OverwritePolicy overwritePolicy, java.util.Map destination)
          Deprecated. Extracts the metadata values from the content provided by the reader and source mimetype to the supplied map.
 java.util.Map extract(org.alfresco.service.cmr.repository.ContentReader reader, MetadataExtracter.OverwritePolicy overwritePolicy, java.util.Map destination, java.util.Map propertyMapping)
          Deprecated. Extracts the metadata from the content provided by the reader and source mimetype to the supplied map.
protected abstract  void extractInternal(org.alfresco.service.cmr.repository.ContentReader reader, java.util.Map destination)
          Deprecated. Consider deriving from the more configurable AbstractMappingMetadataExtracter
 long getExtractionTime()
          Deprecated. Provides an estimate, usually a worst case guess, of how long an extraction will take.
protected  org.alfresco.service.cmr.repository.MimetypeService getMimetypeService()
          Deprecated.  
 double getReliability(java.lang.String mimetype)
          Deprecated. Default reliability check that returns the reliability as configured by the contstructor if the mimetype is in the list of supported mimetypes.
 boolean isSupported(java.lang.String mimetype)
          Deprecated. Determines if the extracter works against the given mimetype.
 void register()
          Deprecated. Registers this instance of the extracter with the registry.
 void setMimetypeService(org.alfresco.service.cmr.repository.MimetypeService mimetypeService)
          Deprecated. Helper setter of the mimetype service.
 void setRegistry(MetadataExtracterRegistry registry)
          Deprecated. Set the registry to register with
protected  boolean trimPut(org.alfresco.service.namespace.QName prop, java.lang.Object value, java.util.Map destination)
          Deprecated. Examines a value or string for nulls and adds it to the map (if non-empty)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected static org.apache.commons.logging.Log logger
Deprecated. 
Constructor Detail

AbstractMetadataExtracter

protected AbstractMetadataExtracter(java.lang.String supportedMimetype,
                                    double reliability,
                                    long extractionTime)
Deprecated. 

AbstractMetadataExtracter

protected AbstractMetadataExtracter(java.util.Set supportedMimetypes,
                                    double reliability,
                                    long extractionTime)
Deprecated. 
Method Detail

setRegistry

public void setRegistry(MetadataExtracterRegistry registry)
Deprecated. 
Set the registry to register with

Parameters:
registry - a metadata extracter registry

setMimetypeService

public void setMimetypeService(org.alfresco.service.cmr.repository.MimetypeService mimetypeService)
Deprecated. 
Helper setter of the mimetype service. This is not always required.

Parameters:
mimetypeService -

getMimetypeService

protected org.alfresco.service.cmr.repository.MimetypeService getMimetypeService()
Deprecated. 
Returns:
Returns the mimetype helper

register

public void register()
Deprecated. 
Registers this instance of the extracter with the registry.

See Also:
AbstractMetadataExtracter.setRegistry(MetadataExtracterRegistry)

getReliability

public double getReliability(java.lang.String mimetype)
Deprecated. 
Default reliability check that returns the reliability as configured by the contstructor if the mimetype is in the list of supported mimetypes.

Specified by:
getReliability in interface MetadataExtracter
Parameters:
mimetype - the mimetype to check
Returns:
Returns a reliability indicator from 0.0 to 1.0

isSupported

public boolean isSupported(java.lang.String mimetype)
Deprecated. 
Determines if the extracter works against the given mimetype.

Specified by:
isSupported in interface MetadataExtracter
Parameters:
mimetype - the document mimetype
Returns:
Returns true if the reliability is greater than 0

getExtractionTime

public long getExtractionTime()
Deprecated. 
Description copied from interface: MetadataExtracter
Provides an estimate, usually a worst case guess, of how long an extraction will take.

This method is used to determine, up front, which of a set of equally reliant transformers will be used for a specific extraction.

Specified by:
getExtractionTime in interface MetadataExtracter
Returns:
Returns the approximate number of milliseconds per transformation

checkReliability

protected void checkReliability(org.alfresco.service.cmr.repository.ContentReader reader)
Deprecated. 
Checks if the mimetype is supported.

Parameters:
reader - the reader to check
Throws:
org.alfresco.error.AlfrescoRuntimeException - if the mimetype is not supported

extract

public java.util.Map extract(org.alfresco.service.cmr.repository.ContentReader reader,
                             java.util.Map destination)
Deprecated. 
Extracts the metadata values from the content provided by the reader and source mimetype to the supplied map. The internal mapping and overwrite policy between document metadata and system metadata will be used.

The extraction viability can be determined by an up front call to MetadataExtracter.isSupported(String).

The source mimetype must be available on the ContentAccessor.getMimetype() method of the reader.

A pragmatic overwrite policy will be applied.

Specified by:
extract in interface MetadataExtracter
Parameters:
reader - the source of the content
destination - the map of properties to populate (essentially a return value)
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, OverwritePolicy, Map, Map)

extract

public final java.util.Map extract(org.alfresco.service.cmr.repository.ContentReader reader,
                                   MetadataExtracter.OverwritePolicy overwritePolicy,
                                   java.util.Map destination)
                            throws org.alfresco.service.cmr.repository.ContentIOException
Deprecated. 
Extracts the metadata values from the content provided by the reader and source mimetype to the supplied map.

The extraction viability can be determined by an up front call to MetadataExtracter.isSupported(String).

The source mimetype must be available on the ContentAccessor.getMimetype() method of the reader.

Specified by:
extract in interface MetadataExtracter
Parameters:
propertyMapping - ignored
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.
Throws:
org.alfresco.service.cmr.repository.ContentIOException - if a detectable error occurs
See Also:
AbstractMetadataExtracter.extract(ContentReader, Map)

extract

public final java.util.Map extract(org.alfresco.service.cmr.repository.ContentReader reader,
                                   MetadataExtracter.OverwritePolicy overwritePolicy,
                                   java.util.Map destination,
                                   java.util.Map propertyMapping)
                            throws org.alfresco.service.cmr.repository.ContentIOException
Deprecated. 
Extracts the metadata from the content provided by the reader and source mimetype to the supplied map. The mapping from document metadata to system metadata is explicitly provided. The overwrite policy is also explictly set.

The extraction viability can be determined by an up front call to MetadataExtracter.isSupported(String).

The source mimetype must be available on the ContentAccessor.getMimetype() method of the reader.

Specified by:
extract in interface MetadataExtracter
Parameters:
overwritePolicy - ignored
propertyMapping - ignored
reader - the source of the content
destination - the map of properties to populate (essentially a return value)
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.
Throws:
org.alfresco.service.cmr.repository.ContentIOException - if a detectable error occurs
See Also:
AbstractMetadataExtracter.extract(ContentReader, Map)

extractInternal

protected abstract void extractInternal(org.alfresco.service.cmr.repository.ContentReader reader,
                                        java.util.Map destination)
                                 throws java.lang.Throwable
Deprecated. Consider deriving from the more configurable AbstractMappingMetadataExtracter

Override to provide the necessary extraction logic. Implementations must ensure that the reader is closed before the method exits.

Parameters:
reader - the source of the content
destination - the property map to fill
Throws:
java.lang.Throwable - an exception

trimPut

protected boolean trimPut(org.alfresco.service.namespace.QName prop,
                          java.lang.Object value,
                          java.util.Map destination)
Deprecated. 
Examines a value or string for nulls and adds it to the map (if non-empty)

Parameters:
prop - Alfresco's ContentModel.PROP_ to set.
value - Value to set it to
destination - Map into which to set it
Returns:
true, if set, false otherwise


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