org.alfresco.repo.content.metadata
Class MappingMetadataExtracterTest.DummyMappingMetadataExtracter
java.lang.Object
org.alfresco.repo.content.metadata.AbstractMappingMetadataExtracter
org.alfresco.repo.content.metadata.MappingMetadataExtracterTest.DummyMappingMetadataExtracter
- All Implemented Interfaces:
- ContentWorker, MetadataExtracter
- Enclosing class:
- MappingMetadataExtracterTest
public static class MappingMetadataExtracterTest.DummyMappingMetadataExtracter
- extends AbstractMappingMetadataExtracter
A spoofed-up extracter that extracts the following:
a: - A --> my:a1, my:a2
b: - B --> my:b
c: - C
d: - D
Field Summary |
static java.lang.String |
NAMESPACE_MY
|
static java.lang.String |
PROP_A
|
static java.lang.String |
PROP_B
|
static java.lang.String |
PROP_C
|
static java.lang.String |
PROP_D
|
static java.lang.String |
PROP_E
|
static java.lang.String |
PROP_IMG
|
static org.alfresco.service.namespace.QName |
QNAME_A1
|
static org.alfresco.service.namespace.QName |
QNAME_A2
|
static org.alfresco.service.namespace.QName |
QNAME_A3
|
static org.alfresco.service.namespace.QName |
QNAME_B
|
static org.alfresco.service.namespace.QName |
QNAME_C
|
static org.alfresco.service.namespace.QName |
QNAME_D
|
static org.alfresco.service.namespace.QName |
QNAME_E
|
static org.alfresco.service.namespace.QName |
QNAME_IMG
|
static java.lang.String |
VALUE_A
|
static java.lang.String |
VALUE_B
|
static java.lang.String |
VALUE_C
|
static java.lang.String |
VALUE_D
|
static java.lang.String |
VALUE_IMG
|
Method Summary |
protected java.util.Map |
extractRaw(org.alfresco.service.cmr.repository.ContentReader reader)
Override to provide the raw extracted metadata values. |
protected java.util.Map |
getDefaultMapping()
This method provides a best guess of where to store the values extracted
from the documents. |
protected void |
init()
Provides a hook point for implementations to perform initialization. |
Methods inherited from class org.alfresco.repo.content.metadata.AbstractMappingMetadataExtracter |
checkIsSupported, extract, 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 |
PROP_A
public static final java.lang.String PROP_A
- See Also:
- Constant Field Values
PROP_B
public static final java.lang.String PROP_B
- See Also:
- Constant Field Values
PROP_C
public static final java.lang.String PROP_C
- See Also:
- Constant Field Values
PROP_D
public static final java.lang.String PROP_D
- See Also:
- Constant Field Values
PROP_E
public static final java.lang.String PROP_E
- See Also:
- Constant Field Values
PROP_IMG
public static final java.lang.String PROP_IMG
- See Also:
- Constant Field Values
VALUE_A
public static final java.lang.String VALUE_A
- See Also:
- Constant Field Values
VALUE_B
public static final java.lang.String VALUE_B
- See Also:
- Constant Field Values
VALUE_C
public static final java.lang.String VALUE_C
- See Also:
- Constant Field Values
VALUE_D
public static final java.lang.String VALUE_D
- See Also:
- Constant Field Values
VALUE_IMG
public static final java.lang.String VALUE_IMG
- See Also:
- Constant Field Values
NAMESPACE_MY
public static final java.lang.String NAMESPACE_MY
- See Also:
- Constant Field Values
QNAME_A1
public static final org.alfresco.service.namespace.QName QNAME_A1
QNAME_A2
public static final org.alfresco.service.namespace.QName QNAME_A2
QNAME_A3
public static final org.alfresco.service.namespace.QName QNAME_A3
QNAME_B
public static final org.alfresco.service.namespace.QName QNAME_B
QNAME_C
public static final org.alfresco.service.namespace.QName QNAME_C
QNAME_D
public static final org.alfresco.service.namespace.QName QNAME_D
QNAME_E
public static final org.alfresco.service.namespace.QName QNAME_E
QNAME_IMG
public static final org.alfresco.service.namespace.QName QNAME_IMG
MappingMetadataExtracterTest.DummyMappingMetadataExtracter
public MappingMetadataExtracterTest.DummyMappingMetadataExtracter()
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()
- Description copied from class:
AbstractMappingMetadataExtracter
- This method provides a best guess of where to store the values extracted
from the documents. The list of properties mapped by default need not
include all properties extracted from the document; just the obvious set of mappings
need be supplied.
Implementations must either provide the default mapping properties in the expected
location or override the method to provide the default mapping.
The default implementation looks for the default mapping file in the location
given by the class name and .properties. If the extracter's class is
x.y.z.MyExtracter then the default properties will be picked up at
classpath:/x/y/z/MyExtracter.properties.
Inner classes are supported, but the '$' in the class name is replaced with '-', so
default properties for x.y.z.MyStuff$MyExtracter will be located using
x.y.z.MyStuff-MyExtracter.properties.
The default mapping implementation should include thorough Javadocs so that the
system administrators can accurately determine how to best enhance or override the
default mapping.
If the default mapping is declared in a properties file other than the one named after
the class, then the AbstractMappingMetadataExtracter.readMappingProperties(String)
method can be used to quickly
generate the return value:
protected Map<> getDefaultMapping()
{
return readMappingProperties(DEFAULT_MAPPING);
}
The map can also be created in code either statically or during the call.
- Overrides:
getDefaultMapping
in class AbstractMappingMetadataExtracter
- Returns:
- Returns the default, static mapping. It may not be null.
- See Also:
AbstractMappingMetadataExtracter.setInheritDefaultMapping(boolean inherit)
extractRaw
protected java.util.Map extractRaw(org.alfresco.service.cmr.repository.ContentReader reader)
- Description copied from class:
AbstractMappingMetadataExtracter
- 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
- Null: Removed
- Empty String: Passed to the
OverwritePolicy
- Non Serializable: Converted to String or fails if that is not possible
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 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.
- See Also:
AbstractMappingMetadataExtracter.getDefaultMapping()
Copyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.