...
Databindings and transformers can be plugged into Tuscany runtime following the Tuscany extensibility story. It can be achieved in the following steps:
Add a new databinding:
1. Provide a java class which implements the DataBinding interface. You can subclass the DataBindingExtensionBaseDataBinding.
2. Register your databindings against the DataBindingExtensionPoint.
Add a new transformer:
1. Provide a java class which implements the Transformer interface. You can subclass the TransformerExtensionBasePullTransformer or BasePushTransformer.
3 2. Register your databindings and transformers as system components in the extension compositetransformers against the TransformerExtensionPoint.
The DataBinding SPI:
Code Block |
---|
/** * DataBinding represents a data representation, for example, SDO, JAXB and AXIOM */ public interface DataBinding { /** * A special databinding for input message of an operation */ String IDL_INPUT = "idl:input"; /** * A special databinding for output message of an operation */ String IDL_OUTPUT = "idl:output"; /** * A special databinding for fault message of an operation */ String IDL_FAULT = "idl:fault"; /** * The name of a databinding should be case-insensitive and unique * * @return The name of the databinding */ String getName(); /** * Get the aliases for the databinding * * @return An array of aliases */ String[] getAliases(); /** * Introspect and populate information to a DataType model * * @param javaType The java class or interface to be introspected * @param annotations The java annotations * @return true if the databinding has recognized the given data type */ boolean introspect(DataType dataType, Annotation[] annotations); /** * Introspect the data to figure out the corresponding data type * * @param value The object to be checked * @return The DataType or null if the java type is not supported by this databinding */ DataType introspect(Object value); /** * Provide a WrapperHandler for this databinding * @return A wrapper handler which can handle wrapping/wrapping for this databinding */ WrapperHandler getWrapperHandler(); /** * Make a copy of the object for "pass-by-value" semantics * @param source object to copy * @return copy of the object passed in as argument */ Object copy(Object object); /** * Get the type mapper for simple types * @return The databinding-specific simple type mapper */ SimpleTypeMapper getSimpleTypeMapper(); /** * Get the handler that can handle exceptions/faults in the * databinding-specific way * * @return An instance of the exception handler */ ExceptionHandler getExceptionHandler(); } |
...