org.objectweb.kilim.model.mapping
Interface MappingStrategy

All Known Implementing Classes:
DefaultMappingStrategy

public interface MappingStrategy

This class is a simple container dedicated to the definition of mapping strategies. It is used at run time to find the mapper to be associated to each application component. It is possible to redefine a default mapper, and to define per template mappers and per instance mappers. The run time uses the following look up strategy. The search is stopped as soon as a mapper is found. the runtime first looks for a mapper explicitely associated to the component. If none can be found, it then looks for a mapper explicitely associated to the component template. If none can be found, it recursively looks for a mapper explicitely associated to super templates. If none can be found it looks for a default mapper. No null value can be returned, since this class defines a default mapper and no null value is accepted by the setDefaultMapper() method

Author:
horn

Method Summary
 Mapper getDefaultMapper()
          Method getDefaultMapper returns the default mapper.
 Mapper getPerInstanceMapper(java.lang.String aName)
          Method getPerInstanceMapper.
 Mapper getPerTemplateMapper(java.lang.String aName)
          Method getPerTemplateMapper
 void setDefaultMapper(Mapper aMapper)
          Method setDefaultMapper.
 void setPerInstanceMapper(java.lang.String aName, Mapper aMapper)
          Method setPerInstanceMger sets the mapper to be used for a given instance.
 void setPerTemplateMapper(java.lang.String aName, Mapper aMapper)
          Method setPerTemplateMapper sets the mapper to be used when the component is an instance of a template or one of its subtemplates.
 

Method Detail

setDefaultMapper

public void setDefaultMapper(Mapper aMapper)
                      throws KilimException
Method setDefaultMapper.

Parameters:
aMapper - : a default mapper (this ctor just contains a call to setDefaultManager(aMapper). This value cannot be null. A NullMapper should be used if no action should be performed at instanciation time.
Throws:
KilimException - : generated if the reference is null.

getDefaultMapper

public Mapper getDefaultMapper()
Method getDefaultMapper returns the default mapper.

Returns:
Mapper

setPerTemplateMapper

public void setPerTemplateMapper(java.lang.String aName,
                                 Mapper aMapper)
                          throws KilimException
Method setPerTemplateMapper sets the mapper to be used when the component is an instance of a template or one of its subtemplates.

Parameters:
aName - is name of the template.
aMapper - is the mapper to be used.
Throws:
KilimException - : generated when aName is null.

getPerTemplateMapper

public Mapper getPerTemplateMapper(java.lang.String aName)
                            throws KilimException
Method getPerTemplateMapper

Parameters:
aName - : the name of the template.
Returns:
Mapper
Throws:
KilimException - : generated when aName is null

setPerInstanceMapper

public void setPerInstanceMapper(java.lang.String aName,
                                 Mapper aMapper)
                          throws KilimException
Method setPerInstanceMger sets the mapper to be used for a given instance.

Parameters:
aName - : the name of the component.
aMapper - : the mapper to be used
Throws:
KilimException - : generated when aName is null.

getPerInstanceMapper

public Mapper getPerInstanceMapper(java.lang.String aName)
                            throws KilimException
Method getPerInstanceMapper.

Parameters:
aName - : the name of the component
Returns:
Mapper :
Throws:
KilimException - : generated when aName is null.