org.alfresco.repo.content.metadata
Class OpenOfficeMetadataExtracter

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

public class OpenOfficeMetadataExtracter
extends AbstractMappingMetadataExtracter
implements OpenOfficeMetadataWorker

Extracts values from Star Office documents into the following:

   author:                 --      cm:author
   title:                  --      cm:title
   description:            --      cm:description
 
Note - not converted to Apache Tika, as currently Tika lacks support for these older formats


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
logger, NAMESPACE_PROPERTY_PREFIX, supportedDateFormats
 
Constructor Summary
OpenOfficeMetadataExtracter()
           
 
Method Summary
 java.util.Map extractRaw(org.alfresco.service.cmr.repository.ContentReader reader)
          Override to provide the raw extracted metadata values.
 void init()
          Initialises the bean by establishing an UNO connection
 boolean isConnected()
          
 boolean isSupported(java.lang.String sourceMimetype)
          Perform the default check, but also check if the OpenOffice connection is good.
 void setWorker(OpenOfficeMetadataWorker worker)
           
 
Methods inherited from class org.alfresco.repo.content.metadata.AbstractMappingMetadataExtracter
checkIsSupported, extract, extract, extract, filterSystemProperties, getDefaultMapping, getExtractionTime, getMapping, getMimetypeService, getReliability, 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

OpenOfficeMetadataExtracter

public OpenOfficeMetadataExtracter()
Method Detail

setWorker

public void setWorker(OpenOfficeMetadataWorker worker)

init

public void init()
Initialises the bean by establishing an UNO connection

Overrides:
init in class AbstractMappingMetadataExtracter

isConnected

public boolean isConnected()

Specified by:
isConnected in interface OpenOfficeMetadataWorker
Returns:
Returns true if a connection to the Uno server could be established

isSupported

public boolean isSupported(java.lang.String sourceMimetype)
Perform the default check, but also check if the OpenOffice connection is good.

Specified by:
isSupported in interface MetadataExtracter
Overrides:
isSupported in class AbstractMappingMetadataExtracter
Parameters:
sourceMimetype - the document mimetype
Returns:
Returns true if the mimetype is supported, otherwise false.
See Also:
AbstractMappingMetadataExtracter.setSupportedMimetypes(Collection)

extractRaw

public java.util.Map extractRaw(org.alfresco.service.cmr.repository.ContentReader reader)
                         throws java.lang.Throwable
Override to provide the raw extracted metadata values. An extracter should extract as many of the available properties as is realistically possible. Even if the default mapping doesn't handle all properties, it is possible for each instance of the extracter to be configured differently and more or less of the properties may be used in different installations.

Raw values must not be trimmed or removed for any reason. Null values and empty strings are

Properties extracted and their meanings and types should be thoroughly described in the class-level javadocs of the extracter implementation, for example:

 editor: - the document editor        -->  cm:author
 title:  - the document title         -->  cm:title
 user1:  - the document summary
 user2:  - the document description   -->  cm:description
 user3:  -
 user4:  -
 

Specified by:
extractRaw in interface OpenOfficeMetadataWorker
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.