Humboldt Alignment Editor 2.5.0

eu.esdihumboldt.cst.functions.core.merge
Class AbstractMergeHandler<T,K>

java.lang.Object
  extended by eu.esdihumboldt.cst.functions.core.merge.AbstractMergeHandler<T,K>
Type Parameters:
T - the merge configuration type
K - the merge key type
All Implemented Interfaces:
InstanceHandler<TransformationEngine>
Direct Known Subclasses:
PropertiesMergeHandler

public abstract class AbstractMergeHandler<T,K>
extends Object
implements InstanceHandler<TransformationEngine>

Abstract merge handler implementation based on a merge index of instance references.

Author:
Simon Templer

Nested Class Summary
 class AbstractMergeHandler.MergedIterator
          Resource iterator over the merged instances
 
Constructor Summary
AbstractMergeHandler()
           
 
Method Summary
protected abstract  T createMergeConfiguration(String transformationIdentifier, com.google.common.collect.ListMultimap<String,String> transformationParameters, Map<String,String> executionParameters, TransformationLog log)
          Create the merge configuration from the transformation configuration.
protected  InstanceFactory getInstanceFactory()
          Get the instance factory
protected abstract  K getMergeKey(Instance instance, T mergeConfig)
          Get the merge key for a given instance.
protected abstract  Instance merge(Collection<Instance> instances, TypeDefinition type, K mergeKey, T mergeConfig)
          Merge multiple instance into one.
 ResourceIterator<FamilyInstance> partitionInstances(InstanceCollection instances, String transformationIdentifier, TransformationEngine engine, com.google.common.collect.ListMultimap<String,String> transformationParameters, Map<String,String> executionParameters, TransformationLog log)
          Partition the given instances.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractMergeHandler

public AbstractMergeHandler()
Method Detail

partitionInstances

public ResourceIterator<FamilyInstance> partitionInstances(InstanceCollection instances,
                                                           String transformationIdentifier,
                                                           TransformationEngine engine,
                                                           com.google.common.collect.ListMultimap<String,String> transformationParameters,
                                                           Map<String,String> executionParameters,
                                                           TransformationLog log)
                                                    throws TransformationException
Description copied from interface: InstanceHandler
Partition the given instances.

Specified by:
partitionInstances in interface InstanceHandler<TransformationEngine>
Parameters:
instances - the instances
transformationIdentifier - the transformation function identifier
engine - the transformation engine that may be used for the function execution
transformationParameters - the transformation parameters, may be null
executionParameters - additional parameters for the execution, may be null
log - the transformation log to report any information about the execution of the transformation to
Returns:
a resource iterator over partitioned instances instances
Throws:
TransformationException - if an unrecoverable error occurs during transformation
See Also:
InstanceHandler.partitionInstances(InstanceCollection, String, TransformationEngine, ListMultimap, Map, TransformationLog)

getInstanceFactory

protected InstanceFactory getInstanceFactory()
Get the instance factory

Returns:
the instance factory

createMergeConfiguration

protected abstract T createMergeConfiguration(String transformationIdentifier,
                                              com.google.common.collect.ListMultimap<String,String> transformationParameters,
                                              Map<String,String> executionParameters,
                                              TransformationLog log)
                                       throws TransformationException
Create the merge configuration from the transformation configuration. The merge configuration may be then used in getMergeKey(Instance, Object) and merge(Collection, TypeDefinition, Object, Object)

Parameters:
transformationIdentifier - the transformation identifier
transformationParameters - the transformation parameters
executionParameters - the execution parameters
log - the transformation log
Returns:
the merge configuration
Throws:
TransformationException - if the merge configuration cannot be created

getMergeKey

protected abstract K getMergeKey(Instance instance,
                                 T mergeConfig)
Get the merge key for a given instance. Instances with an equal merge key will be merged.

Parameters:
instance - the instance
mergeConfig - the merge configuration
Returns:
the instance merge key
See Also:
merge(Collection, TypeDefinition, Object, Object)

merge

protected abstract Instance merge(Collection<Instance> instances,
                                  TypeDefinition type,
                                  K mergeKey,
                                  T mergeConfig)
Merge multiple instance into one.

Parameters:
instances - the instances to merge
type - the type definition of the instances to merge
mergeKey - the merge key associated to the instances
mergeConfig - the merge configuration
Returns:
the merged instance

Humboldt Alignment Editor 2.5.0

Build 2012-12-03_12-30-59
Revision 9d2dd4b0318cda9f1393b1ddd390f7f792d70a2d