org.alfresco.repo.bulkimport.metadataloaders
Class PropertiesFileMetadataLoader

java.lang.Object
  extended by org.alfresco.repo.bulkimport.metadataloaders.PropertiesFileMetadataLoader
All Implemented Interfaces:
MetadataLoader

public final class PropertiesFileMetadataLoader
extends java.lang.Object

MetadataLoader that loads metadata from an (optional) "shadow" properties file. This shadow properties file must have exactly the same name and extension as the file for whom it is storing metadata, but with the suffix ".metadata.properties". So for example, if there is a file called "IMG_1967.jpg", the "shadow" properties metadata file for it would be called "IMG_1967.jpg.metadata.properties". The metadata file itself follows the usual rules for Java properties files, with a property with the key "type" containing the qualified name of the content type to use for the file, a property with the key "aspects" containing a comma-delimited list of qualified names of the aspects to attach to the file, and then one Java property per metadata property, with the key being the Alfresco property QName and the value being the value of that property. For example (note escaping rules for namespace separator!): type=cm:content aspects=cm:versionable, custom:myAspect cm\:title=This is the value of the cm:title field. cm\:description=This is the value of the cm:description field. cm\:taggable=workspace://SpacesStore/3da6c395-3a4b-4a57-836d-8e5 custom\:myProperty=This is the value of the custom:myProperty field. custom\:aDateProperty=2001-01-01T12:00:00.000+01:00 Notes:

Since:
4.0
See Also:
MetadataLoader

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.alfresco.repo.bulkimport.MetadataLoader
MetadataLoader.Metadata
 
Field Summary
protected  org.alfresco.service.cmr.dictionary.DictionaryService dictionaryService
           
protected  java.lang.String metadataFileExtension
           
protected  java.lang.String multiValuedSeparator
           
protected  org.alfresco.service.namespace.NamespaceService namespaceService
           
 
Fields inherited from interface org.alfresco.repo.bulkimport.MetadataLoader
METADATA_SUFFIX
 
Constructor Summary
PropertiesFileMetadataLoader(ServiceRegistry serviceRegistry)
           
PropertiesFileMetadataLoader(ServiceRegistry serviceRegistry, java.lang.String multiValuedSeparator)
           
 
Method Summary
 java.lang.String getMetadataFileExtension()
           
 void loadMetadata(ImportableItem.ContentAndMetadata contentAndMetadata, MetadataLoader.Metadata metadata)
          Method that populates the type, aspects and properties to attach to a given file or space.
protected  java.util.Map loadMetadataFromFile(java.io.File metadataFile)
          Method that actually loads the properties from the file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

namespaceService

protected final org.alfresco.service.namespace.NamespaceService namespaceService

dictionaryService

protected final org.alfresco.service.cmr.dictionary.DictionaryService dictionaryService

multiValuedSeparator

protected final java.lang.String multiValuedSeparator

metadataFileExtension

protected final java.lang.String metadataFileExtension
Constructor Detail

PropertiesFileMetadataLoader

public PropertiesFileMetadataLoader(ServiceRegistry serviceRegistry)

PropertiesFileMetadataLoader

public PropertiesFileMetadataLoader(ServiceRegistry serviceRegistry,
                                    java.lang.String multiValuedSeparator)
Method Detail

loadMetadataFromFile

protected java.util.Map loadMetadataFromFile(java.io.File metadataFile)
Method that actually loads the properties from the file.

Parameters:
metadataFile - The file to load the properties from (must not be null).
Returns:
A new Properties object loaded from that file.
See Also:
org.alfresco.extension.bulkfilesystemimport.metadataloaders.AbstractMapBasedMetadataLoader#loadMetadataFromFile(java.io.File)

getMetadataFileExtension

public final java.lang.String getMetadataFileExtension()
Specified by:
getMetadataFileExtension in interface MetadataLoader
Returns:
The extension for files used to store this metadata, minus the stop character (.) e.g. "properties", "xml", "json", etc.
See Also:
org.alfresco.extension.bulkfilesystemimport.MetadataLoader#getMetadataFileExtension()

loadMetadata

public final void loadMetadata(ImportableItem.ContentAndMetadata contentAndMetadata,
                               MetadataLoader.Metadata metadata)
Description copied from interface: MetadataLoader
Method that populates the type, aspects and properties to attach to a given file or space.

Specified by:
loadMetadata in interface MetadataLoader
Parameters:
contentAndMetadata - The contentAndMetadata from which to obtain the metadata (will not be null).
metadata - The metadata object to populate (will not be null, and may already be partially populated).
See Also:
org.alfresco.extension.bulkfilesystemimport.MetadataLoader#loadMetadata(org.alfresco.extension.bulkfilesystemimport.ImportableItem.ContentAndMetadata, org.alfresco.extension.bulkfilesystemimport.MetadataLoader.Metadata)


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