...
The limitation here is whether a transformation can be constructed to match the formats on either end. If one exists then great, but as the number increases then developing n-squared transforms becomes impractical. A better approach would be to pick the most common formats and require bindings and containers to support those at a minimum, with other point-to-point transforms being added as warranted. (Source: http://mail-archives.apache.org/mod_mbox/ws-tuscany-dev/200603.mbox/%3c4418A53D.2080606@apache.org%3e)
Usage Scenarios
The data model
Let's look at a scenario with various databindings involved. We need to retrieve all the orders for a given customer. The source side uses SDO to represent the Customer and Orders. The target side uses JAXB to represent customer and Orders. The order retrival function is exposed as a web service.
Data transformation between SCA components
- Data transformation can be performed on wire for mappable and remotable interfaces
- Data transformation can happen between interfaces defined using different IDLs such as Java or WSDL.
Data transformation for composite services
- <interface.xxx> defines the outbound service contract (SC2) which can be wired to a target component, reference or service (SC3).
- <binding.xxx> can optionally hint a service contract for the inbound data from the binding protocol layer.
Data transformation for composite references
- <interface.xxx> defines the inbound service contract (SC2) which can be wired from a source component, reference or service (SC1).
- <binding.xxx> can optionally hint a service contract (SC3) for the outbound data to the binding protocol layer.
Data transformation for property values
- Property values are loaded from SCDLs as DOM documents
- The DOM Document can be transformed into a java object under a databinding, such as SDO, JAXB so that the component implementation code can work with the databinding directly instead of DOM.
The data model
Code Block |
---|
<schema targetNamespace="http://www.example.com/Customer" xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:cust="http://www.example.com/Customer">
<element name="customer |
Code Block |
<schema targetNamespace="http://www.example.com/Customer" xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:cust="http://www.example.com/Customer">
<element name="customer" type="cust:Customer" />
<complexType name="Customer">
<sequence>
<element name="customerId" type="string" />
<element name="name" type="string" />
<element name="billingAddress" type="cust:Address" />
<element name="mailingAddress" type="cust:Address" />
</sequence>
</complexType>
<complexType name="Address">
<sequence>
<element name="street" type="string" />
<element name="city" type="string" />
<element name="state" type="string" />
<element name="zipCode" type="string" />
</sequence>
</complexType>
</schema>
|
Source Concrete Type | Source Declared Type | Target Concrete Type | Target Declared Type | Support | |||||
---|---|---|---|---|---|---|---|---|---|
JAXBCustomer | java.lang.Object | SDOCustomer | java.lang.Object | Y | |||||
JAXBCustomer | customer.Customer | SDOCustomer | customer.Customer |
| |||||
|
|
|
|
| |||||
|
|
|
|
| |||||
|
|
|
|
| |||||
|
|
|
|
| |||||
|
|
|
|
| |||||
|
|
|
|
| |||||
|
|
|
|
|
|
Operation-level transformations
Operation:
InputType
OutputType
FaultTypes
Parameter-level transformations
Logical Type vs. Physical Type
The runtime's main job is to connect user components together so typically the actual type used would be determined by the user code that implements the source or target. The databinding framework's role here is to convert from the type used by the source to the type used by the target. The internal types used by the runtime should not influence this - which is an essential separation to maintain given the components and the wire connecting them need to work on different runtimes (implemented in different languages).
Where runtime types do matter is in the conversion between some serialized form and an in-memory representation and the two places where that occurs are in the configuration properties and in the binding implementations. To handle configuration properties (with the XPath requirement) we use DOM in the Java runtime; I believe the C++ runtime uses SDO. Each transport binding also tends to deserialize using a specific technology - for example, AXIOM for Axis2, JAXB for JAX-WS, Serializable for RMI and so the databinding framework is used to convert between the form generated by the binding and the form used by the component.
The logical type represents the data type the user thinks is flowing across a wire. This could be a Java type, a XML type, a CORBA type, whatever depending on the /logical/ service contract defined in the assembly.
The physical type is the actual representation of that type that is flowed by the runtime. In the Java runtime this will always be a Java type (i.e. some subclass of Object). In some cases it will be the same as the logical type - e.g. when a Java component calls another Java component over a local wire using a Java interface then both logical and physical types will be the same. In many cases though they will be different - for example, if the service contract was WSDL then the logical type would be the XML type used by the WSDL.
Within the runtime the same logical type may have different physical forms. For example, the same XML document could be represented physically as a DOM, a StAX stream, an SDO, a JAXB object, or an AXIOM stream. The framework supports conversion between these different physical forms.
1. A component (A) consumes a service provided by another component (B). The implementation of A prefers SDO while the implementation of B prefers JAXB.
In the SCA term, A is wired to B using a reference.
- Data is represented by an interface which is independent of the databinding
- Data is represented by an interface or class which is databinding-specific (either generated or dynamic)
2. A component (A) consumes a web service using axis2. Axis2 engine expects to handle AXIOM objects.
3. A component is exposed as a service over a transport/protocol.
Where runtime types do matter is in the conversion between some serialized form and an in-memory representation and the two places where that occurs are in the configuration properties and in the binding implementations. To handle configuration properties (with the XPath requirement) we use DOM in the Java runtime; I believe the C++ runtime uses SDO. Each transport binding also tends to deserialize using a specific technology - for example, AXIOM for Axis2, JAXB for JAX-WS, Serializable for RMI and so the databinding framework is used to convert between the form generated by the binding and the form used by the component.
interfaces for services and references are the contracts for SCA assembly.
1. Incoming data for component implementation
2. Interace mapping
- interface.java <--> interface.java
- interface.wsdl <--> interface.java
- interface.wsdl <--> interface.wsdl
- interface.* <--> other
Mapping from interface.wsdl to interface.java
JaxbAddress getAddress(JaxbCustomer customer)
SdoAddress getAddress(SdoCustomer customer)
What's a databinding?
A databinding represents a specific data format in the Tuscany runtime. Each databinding has a unique name which identifies the data format.
Typical databindings
- XML/Java databinding frameworks
- SDO
- JAXB
- XMLBeans
- Castor
- Axiom
- JavaBeans
- XML Parsing Technologies
- SAX (InputSource, ContentHandler)
- DOM (Node)
- StAX (XMLStreamReader/XMLStreamWriter/XMLEventReader/XMLEventWriter)
- I/O
- InputStream/OutputStream
- Reader/Writer
What's a transformer?
Usage Scenarios
Data transformation between SCA components
- Data transformation can be performed on wire for mappable and remotable interfaces
- Data transformation can happen between interfaces defined using different IDLs such as Java or WSDL.
Data transformation for composite services
- <interface.xxx> defines the outbound service contract (SC2) which can be wired to a target component, reference or service (SC3).
- <binding.xxx> can optionally hint a service contract for the inbound data from the binding protocol layer.
Data transformation for composite references
- <interface.xxx> defines the inbound service contract (SC2) which can be wired from a source component, reference or service (SC1).
- <binding.xxx> can optionally hint a service contract (SC3) for the outbound data to the binding protocol layer.
Data transformation for property values
- Property values are loaded from SCDLs as DOM documents
- The DOM Document can be transformed into a java object under a databinding, such as SDO, JAXB so that the component implementation code can work with the databinding directly instead of DOM.
...
|
Operation-level transformations
Operation:
InputType
OutputType
FaultTypes
Parameter-level transformations
Logical Type vs. Physical Type
The runtime's main job is to connect user components together so typically the actual type used would be determined by the user code that implements the source or target. The databinding framework's role here is to convert from the type used by the source to the type used by the target. The internal types used by the runtime should not influence this - which is an essential separation to maintain given the components and the wire connecting them need to work on different runtimes (implemented in different languages).
Where runtime types do matter is in the conversion between some serialized form and an in-memory representation and the two places where that occurs are in the configuration properties and in the binding implementations. To handle configuration properties (with the XPath requirement) we use DOM in the Java runtime; I believe the C++ runtime uses SDO. Each transport binding also tends to deserialize using a specific technology - for example, AXIOM for Axis2, JAXB for JAX-WS, Serializable for RMI and so the databinding framework is used to convert between the form generated by the binding and the form used by the component.
The logical type represents the data type the user thinks is flowing across a wire. This could be a Java type, a XML type, a CORBA type, whatever depending on the /logical/ service contract defined in the assembly.
The physical type is the actual representation of that type that is flowed by the runtime. In the Java runtime this will always be a Java type (i.e. some subclass of Object). In some cases it will be the same as the logical type - e.g. when a Java component calls another Java component over a local wire using a Java interface then both logical and physical types will be the same. In many cases though they will be different - for example, if the service contract was WSDL then the logical type would be the XML type used by the WSDL.
Within the runtime the same logical type may have different physical forms. For example, the same XML document could be represented physically as a DOM, a StAX stream, an SDO, a JAXB object, or an AXIOM stream. The framework supports conversion between these different physical forms.
1. A component (A) consumes a service provided by another component (B). The implementation of A prefers SDO while the implementation of B prefers JAXB.
In the SCA term, A is wired to B using a reference.
- Data is represented by an interface which is independent of the databinding
- Data is represented by an interface or class which is databinding-specific (either generated or dynamic)
2. A component (A) consumes a web service using axis2. Axis2 engine expects to handle AXIOM objects.
3. A component is exposed as a service over a transport/protocol.
Where runtime types do matter is in the conversion between some serialized form and an in-memory representation and the two places where that occurs are in the configuration properties and in the binding implementations. To handle configuration properties (with the XPath requirement) we use DOM in the Java runtime; I believe the C++ runtime uses SDO. Each transport binding also tends to deserialize using a specific technology - for example, AXIOM for Axis2, JAXB for JAX-WS, Serializable for RMI and so the databinding framework is used to convert between the form generated by the binding and the form used by the component.
interfaces for services and references are the contracts for SCA assembly.
1. Incoming data for component implementation
2. Interace mapping
- interface.java <--> interface.java
- interface.wsdl <--> interface.java
- interface.wsdl <--> interface.wsdl
- interface.* <--> other
Mapping from interface.wsdl to interface.java
JaxbAddress getAddress(JaxbCustomer customer)
SdoAddress getAddress(SdoCustomer customer)
What's a databinding?
A databinding represents a specific data format in the Tuscany runtime. Each databinding has a unique name which identifies the data format.
Typical databindings
- XML/Java databinding frameworks
- SDO
- JAXB
- XMLBeans
- Castor
- Axiom
- JavaBeans
- XML Parsing Technologies
- SAX (InputSource, ContentHandler)
- DOM (Node)
- StAX (XMLStreamReader/XMLStreamWriter/XMLEventReader/XMLEventWriter)
- I/O
- InputStream/OutputStream
- Reader/Writer
What's a transformer?
Data Transformations
How to transform data across databindings
...