org.objectweb.kilim.model.mapping
Interface Mapper

All Known Implementing Classes:
JavaLoggerMapper, JavaRuntimeMapper, NullMapper, TextAreaMapper, TreeModelMapper

public interface Mapper

The Kilim architecture enforces a clear separation between the mechanims implementing the generic Kilim model semantics (mechanisms controlling the execution of providers and transformers in accordance with dependancy rules, trigger rules, etc....) and the mechanisms implementing the effective tasks described by the providers and the transformers (mechanisms to execute constructors, methods, ....). This architecture allows thus different implementations for the action of providers and transformers : effective instantiation of the system through method and constructor calls,simulation (without effective instantiation) of the system, code generation of launchers, .... A Mapper implements the effective task associated to providers (through getValue()). Mappers should be written in order to be used as interceptors and to be combined in pipe fashion. and transformers (through execute()).

Author:
horn

Method Summary
 void enterContext(MappingContext aContext)
          Method enterContext.
 void executeConstructor(java.lang.Class aClass, java.lang.Object[] paramObjects, java.lang.String[] typeNames, MappingContext aContext)
          Method executeConstructor.
 void executeMethod(java.lang.Object aSupport, boolean isStatic, java.lang.String aMethodName, java.lang.Object[] paramObjects, java.lang.String[] typeNames, MappingContext aContext)
          Method executeMethod.
 void executeNullElement(MappingContext aContext)
          Method executeNullElement.
 void executeSetter(java.lang.Object aSupport, boolean isStatic, java.lang.String fieldName, java.lang.Object toBeSet, MappingContext aContext)
          Method executeSetter.
 java.lang.Object getClassValue(java.lang.String aClassName, MappingContext aContext)
          Method getClassSourceValue.
 java.lang.Object getConstructorValue(java.lang.Class aClass, java.lang.Object[] paramObjects, java.lang.String[] typeNames, MappingContext aContext)
          Method getConstructorValue.
 java.lang.Object getEventSourceValue(MappingContext aContext)
          Method getEventSourceValue.....
 java.lang.Object getExternalValue(java.lang.Object value, MappingContext aContext)
          Method getExternalValue.
 java.lang.Object getGetterValue(java.lang.Object aSupport, boolean isStatic, java.lang.String fieldName, MappingContext aContext)
          Method getGetterValue.
 java.lang.Object getMethodValue(java.lang.Object aSupport, boolean isStatic, java.lang.String aMethodName, java.lang.Object[] paramObjects, java.lang.String[] typeNames, MappingContext aContext)
          Method getMethodValue.
 java.lang.Object getNullElementValue(MappingContext aContext)
          Method getNullElementValue.
 java.lang.Object getPropertyValue(java.lang.Object aValue, MappingContext aContext)
          Method getPropertyValue.
 void leaveContext(MappingContext aContext)
          Method leaveContext.
 

Method Detail

enterContext

public void enterContext(MappingContext aContext)
                  throws KilimException
Method enterContext. Mappers have access to a shared context that stores a global view of the system. the Kilim infrastructure updates this context according to a stack policy (it is updated every time it invokes the method getValue() or execute()). Method enterContext is a callBack provided by mappers invoked by the Kilim infrastructure when invoking the method getValue() or execute(). This callback exists because the execution of the effective task associated to these methods does not necessarily folow immediately the invocation: they can only be applied on "instanciated" components.and ew getValue() calls and execute() may be recursively introduced by instanciation managers.

Parameters:
aContext - : the mapping context
Throws:
KilimException - : generated by a specific mapper to indicate a (specific problem).

leaveContext

public void leaveContext(MappingContext aContext)
                  throws KilimException
Method leaveContext. This method is invoked by the Kilim infrastructure when leaving the method getValue() or execute(). This method is invoked just after the execution of the effective task associated to the provider or transformer.

Parameters:
aContext - : the mapping context.
Throws:
KilimException - : generated by a specific mapper to indicate a (specific problem).

getGetterValue

public java.lang.Object getGetterValue(java.lang.Object aSupport,
                                       boolean isStatic,
                                       java.lang.String fieldName,
                                       MappingContext aContext)
                                throws KilimException
Method getGetterValue. This method performs the effective task associated to the method getValue() of a getter.

Parameters:
aSupport - : the support of the getter
isStatic - : true if the getter is static
fieldName - : the name of the field to be accessed
aContext - : the mapping context
Returns:
Object : the value returned by getValue()
Throws:
KilimException - : generated if aSupport is null, if fieldName is null or if no getter corresponding to the signature exists. Also generated by a specific mapper to indicate a (specific problem).

executeSetter

public void executeSetter(java.lang.Object aSupport,
                          boolean isStatic,
                          java.lang.String fieldName,
                          java.lang.Object toBeSet,
                          MappingContext aContext)
                   throws KilimException
Method executeSetter. This method performs the effective task associated to the method execute() of a getter.

Parameters:
aSupport - : the support of the getter
isStatic - : true if the getter is static
fieldName - : the name of the field to be accessed
toBeSet - : the value to be set.
aContext - : the mapping context
Throws:
KilimException - : generated if aSupport is null, if fieldName is null or if no getter corresponding to the signature exists. Also generated by a specific mapper to indicate a (specific problem).

getMethodValue

public java.lang.Object getMethodValue(java.lang.Object aSupport,
                                       boolean isStatic,
                                       java.lang.String aMethodName,
                                       java.lang.Object[] paramObjects,
                                       java.lang.String[] typeNames,
                                       MappingContext aContext)
                                throws KilimException
Method getMethodValue. This method performs the effective task associated to the method getValue() of a factory method.

Parameters:
aSupport - : the support of the method
isStatic - : true if the method is static
aMethodName - : the name of the method
paramObjects - : the ordered values of the method parameters
typeNames - : the ordered types of the method parameters.
aContext - : the mapping context.
Returns:
Object : the value returned by getValue()
Throws:
KilimException - :generated if aSupport is null, if methodName is null or if no method corresponding to the signature exists. Also generated by a specific mapper to indicate a (specific problem).

executeMethod

public void executeMethod(java.lang.Object aSupport,
                          boolean isStatic,
                          java.lang.String aMethodName,
                          java.lang.Object[] paramObjects,
                          java.lang.String[] typeNames,
                          MappingContext aContext)
                   throws KilimException
Method executeMethod. This method performs the effective task associated to the method execute() of a factory method (used as a transformer).

Parameters:
aSupport - : the support of the method
isStatic - : true if the method is static
aMethodName - : the name of the method
paramObjects - : the ordered values of the method parameters
typeNames - : the ordered types of the method parameters.
aContext - : the mapping context.
Throws:
KilimException - :generated if aSupport is null, if methodName is null or if no method corresponding to the signature exists. Also generated by a specific mapper to indicate a (specific problem).

getConstructorValue

public java.lang.Object getConstructorValue(java.lang.Class aClass,
                                            java.lang.Object[] paramObjects,
                                            java.lang.String[] typeNames,
                                            MappingContext aContext)
                                     throws KilimException
Method getConstructorValue. This method performs the effective task associated to the method getValue() of a constructor.

Parameters:
aClass - : the class for the constructor
paramObjects - : the ordered values of the method parameters
typeNames - : the ordered types of the method parameters.
aContext - : the mapping context.
Returns:
Object : the value returned by getValue().
Throws:
KilimException - :generated if aSupport is null, if methodName is null or if no method corresponding to the signature exists. Also generated by a specific mapper to indicate a (specific problem).

executeConstructor

public void executeConstructor(java.lang.Class aClass,
                               java.lang.Object[] paramObjects,
                               java.lang.String[] typeNames,
                               MappingContext aContext)
                        throws KilimException
Method executeConstructor. This method performs the effective task associated to the method execute() of a constructor.

Parameters:
aClass - : the class for the constructor
paramObjects - : the ordered values of the method parameters
typeNames - : the ordered types of the method parameters.
aContext - : the mapping context.
Throws:
KilimException - :generated if aSupport is null, if methodName is null or if no method corresponding to the signature exists. Also generated by a specific mapper to indicate a (specific problem).

getPropertyValue

public java.lang.Object getPropertyValue(java.lang.Object aValue,
                                         MappingContext aContext)
                                  throws KilimException
Method getPropertyValue. This method performs the effective task associated to the method getValue() of a property.

Parameters:
aValue - : the property identifier.
aContext - : the mapping context.
Returns:
Object : the value returned by getValue()
Throws:
KilimException - : generated if aValue is null. Also generated by a specific mapper to indicate a (specific problem).

getClassValue

public java.lang.Object getClassValue(java.lang.String aClassName,
                                      MappingContext aContext)
                               throws KilimException
Method getClassSourceValue. This method performs the effective task associated to the method getValue() of a ClassSource.

Parameters:
aClassName - : the name of the class
aContext - : the mapping context
Returns:
Object : the value returned by getValue() : generally the corresponding Class object.
Throws:
KilimException - : generated if aClassName is null or if no Class object can be found. Also generated by a specific mapper to indicate a (specific problem).

getExternalValue

public java.lang.Object getExternalValue(java.lang.Object value,
                                         MappingContext aContext)
                                  throws KilimException
Method getExternalValue. This method performs the effective task associated to the method getValue() of a external value. This method exists since the current implementation does not treat external values as properties. It should probably disappear in the next release.

Parameters:
value - : the external reference identifier.
aContext - : the mapping context.
Returns:
Object :the value returned by getValue() : generally a reference to the object designated by the external value.
Throws:
KilimException - : generated if value is null. Also generated by a specific mapper to indicate a (specific problem).

getNullElementValue

public java.lang.Object getNullElementValue(MappingContext aContext)
                                     throws KilimException
Method getNullElementValue. This method performs the effective task associated to the method getValue() of a null. This method exists since the current implementation does not treat null as a propertiy (null may be associated to a transformer).

Parameters:
aContext - : the mapping context.
Returns:
Object : the value returned by getValue()
Throws:
KilimException - : generated by a specific mapper to indicate a (specific problem).

executeNullElement

public void executeNullElement(MappingContext aContext)
                        throws KilimException
Method executeNullElement. This method performs the effective task associated to the method execute() of a null.

Parameters:
aContext - : the mapping context
Throws:
KilimException - : generated by a specific mapper to indicate a (specific problem).

getEventSourceValue

public java.lang.Object getEventSourceValue(MappingContext aContext)
                                     throws KilimException
Method getEventSourceValue.....

Parameters:
aContext - : the mapping context.
Returns:
Object :
Throws:
KilimException - : generated by a specific mapper to indicate a (specific problem).