2 Replies Latest reply on Feb 23, 2011 2:30 AM by dward

    Transformation configuration

    kcbabo

      Kicking off a conversation around SWITCHYARD-107.

       

      We need a new child element of <switchyard> that will hold transformer definitions for the application.  I propose something like this:

       

      <switchyard>
         <composite>
            ...
         </composite>
         <transformers>
            <java:transform from="ns1:msgA" to="ns2:msgB" class="org.examples.transform.AtoBTransform">
            <smooks:transform from="ns1:msgC" to="ns2:msgD">
               <smooks:config>
                    <!-- Smooks stuff -->
               </smooks:config>
            </smooks:transform>
         </transformers>
      </switchyard>
      

       

      In the above example, I'm assuming that there is a base complexType called TransformType that is extended by the Smooks and Java XSDs:

       

      <xsd:complexType name="TransformType>
         <xsd:sequence>
            <xsd:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
         </xsd:sequence>
         <xsd:attribute name="from" type="xsd:QName"/>
         <xsd:attribute name="to" type="xsd:QName"/>
         <xsd:anyAttribute namespace="##other" processContents="lax"/>
      </xsd:complexType>
      

       

      The Java transformer should be fairly straightforward to discover and automatically create a configuration fragment based on whether a class implements the Transformer<F,T> interface.

       

      Tom had defined an annotation some time back for declaring transformer methods.  We can use something like that after M1 (or before if we have loads of spare time):

       

      class MyTransform {
         @Transform(from="ns1:msgA", to="ns2:msgB")
         public MessageB transformAtoB(MessageA msg) {
             ...
         }
      }
      

       

      Not sure what form the Smooks stuff will take.  Tom F?