<?xml version="1.0" encoding="UTF-8"?>
<!--
 - Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
 - 
 - Licensed under the Apache License, Version 2.0 (the "License");
 - you may not use this file except in compliance with the License.
 - You may obtain a copy of the License at
 - http://www.apache.org/licenses/LICENSE-2.0
 - Unless required by applicable law or agreed to in writing, software
 - distributed under the License is distributed on an "AS IS" BASIS,
 - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 - See the License for the specific language governing permissions and
 - limitations under the License.
 -->
<schema xmlns="http://www.w3.org/2001/XMLSchema"
        targetNamespace="urn:switchyard-config:transform:2.0"
        xmlns:swyd="urn:switchyard-config:switchyard:2.0"
        xmlns:trfm="urn:switchyard-config:transform:2.0"
        elementFormDefault="qualified">

    <import namespace="urn:switchyard-config:switchyard:2.0"/>

	<element name="transform.json" type="trfm:JsonTransformType" substitutionGroup="swyd:transform" />
	<complexType name="JsonTransformType">
        <annotation>
            <documentation xml:lang="en">
                JSON Transformer Configuration.
            </documentation>
        </annotation>
        <complexContent>
            <extension base="swyd:TransformType">
            </extension>
        </complexContent>
    </complexType>
    
    <element name="transform.xslt" type="trfm:XsltTransformType" substitutionGroup="swyd:transform" />
    <complexType name="XsltTransformType">
        <annotation>
            <documentation xml:lang="en">
                XSLT Transformer Configuration.
            </documentation>
        </annotation>
        <complexContent>
            <extension base="swyd:TransformType">
                <attribute name="xsltFile" type="string" use="required">
                    <annotation>
                        <documentation xml:lang="en">
                            Path to a file containing the XSL definition.
                        </documentation>
                    </annotation>
                </attribute>
                <attribute name="failOnWarning" type="string" use="optional">
                    <annotation>
                        <documentation xml:lang="en">
                            whether a warning should be reported as an SwitchYardException or just log. default is false
                        </documentation>
                    </annotation>
                </attribute>
            </extension>
        </complexContent>
    </complexType>
    
    <element name="transform.java" type="trfm:JavaTransformType" substitutionGroup="swyd:transform" />
    <complexType name="JavaTransformType">
        <annotation>
            <documentation xml:lang="en">
                Generic/Custom Java Transformer Configuration.
            </documentation>
        </annotation>
        <complexContent>
            <extension base="swyd:TransformType">
                <attribute name="class" type="string" use="optional">
                    <annotation>
                        <documentation xml:lang="en">
                            The name of the Java Transformer implementation class.
                        </documentation>
                    </annotation>
                </attribute>
                <attribute name="bean" type="string" use="optional">
                    <annotation>
                        <documentation xml:lang="en">
                            The name of the Java Transformer CDI bean.
                        </documentation>
                    </annotation>
                </attribute>
            </extension>
        </complexContent>
    </complexType>

    <element name="transform.smooks" type="trfm:SmooksTransformType" substitutionGroup="swyd:transform"/>
    <complexType name="SmooksTransformType">
        <annotation>
            <documentation xml:lang="en">
                Smooks Transformer Configuration.
            </documentation>
        </annotation>
        <complexContent>
            <extension base="swyd:TransformType">
                <attribute name="type" type="trfm:smooksTransformType" use="required">
                    <annotation>
                        <documentation xml:lang="en">
                            Smooks Configuration file path.
                        </documentation>
                    </annotation>
                </attribute>
                <attribute name="config" type="string" use="required">
                    <annotation>
                        <documentation xml:lang="en">
                            Smooks Configuration file path.
                        </documentation>
                    </annotation>
                </attribute>
                <attribute name="reportPath" type="string" use="optional">
                    <annotation>
                        <documentation xml:lang="en">
                            Smooks Execution Report filesystem path.
                            <p/>
                            An Execution Report is a HTML file showing how all the input message
                            fragments were processed by Smooks, including the contents of the Smooks
                            ExecutionContext at each stage in the processing.
                            <p/>
                            Use for debug purposes only.  Adds significant processing overhead.
                        </documentation>
                    </annotation>
                </attribute>
            </extension>
        </complexContent>
    </complexType>

    <simpleType name="smooksTransformType">
        <restriction base="string">
            <enumeration value="SMOOKS">
                <annotation>
                    <documentation xml:lang="en">
                        Basic Smooks Transformation.
                        <p/>
                        The result type is defined through the &lt;core:exports&gt;
                        section of the configuration.
                        <p/>
                        See the <a href="www.smooks.org">Smooks User Guide</a>.
                    </documentation>
                </annotation>
            </enumeration>
            <enumeration value="XML2JAVA">
                <annotation>
                    <documentation xml:lang="en">
                        XML to Java Transformation via Smooks Java Binding configurations.
                        <p/>
                        See the <a href="www.smooks.org">Smooks User Guide</a>.
                    </documentation>
                </annotation>
            </enumeration>
            <enumeration value="JAVA2XML">
                <annotation>
                    <documentation xml:lang="en">
                        Java to XML Transformation via Smooks Java Binding configurations.
                        <p/>
                        See the <a href="www.smooks.org">Smooks User Guide</a>.
                    </documentation>
                </annotation>
            </enumeration>
        </restriction>
    </simpleType>

    <simpleType name="javaTransformType">
        <restriction base="string">
            <enumeration value="XML2JAVA">
                <annotation>
                    <documentation xml:lang="en">
                        XML to Java Transformation.
                    </documentation>
                </annotation>
            </enumeration>
            <enumeration value="JAVA2XML">
                <annotation>
                    <documentation xml:lang="en">
                        Java to XML Transformation.
                    </documentation>
                </annotation>
            </enumeration>
        </restriction>
    </simpleType>

    <element name="transform.jaxb" type="trfm:JAXBTransformType" substitutionGroup="swyd:transform" />
    <complexType name="JAXBTransformType">
        <annotation>
            <documentation xml:lang="en">
                JAXB Transformer Configuration.
            </documentation>
        </annotation>
        <complexContent>
            <extension base="swyd:TransformType">
              <attribute name="contextPath" type="string" use="optional">
                  <annotation>
                      <documentation xml:lang="en">
                          The JAXB Context Path containing an ObjectFactory definition.
                      </documentation>
                  </annotation>
              </attribute>
            </extension>
        </complexContent>
    </complexType>

    <element name="transform.dozer" type="trfm:DozerTransformType" substitutionGroup="swyd:transform" />
    <complexType name="DozerTransformType">
        <annotation>
            <documentation xml:lang="en">
                Dozer Transformer Configuration.
            </documentation>
        </annotation>
        <complexContent>
            <extension base="swyd:TransformType">
                <sequence>
                    <element name="mappingFiles" type="trfm:dozerMappingFilesType" minOccurs="0" maxOccurs="1"/>
                </sequence>
            </extension>
        </complexContent>
    </complexType>
    <complexType name="dozerMappingFilesType">
        <annotation>
            <documentation xml:lang="en">
                Dozer mapping file configuration.
            </documentation>
        </annotation>
        <sequence>
            <element name="entry" type="trfm:dozerFileEntryType" minOccurs="0" maxOccurs="unbounded"/>
        </sequence>
    </complexType>
    <complexType name="dozerFileEntryType">
        <attribute name="file" type="string" use="required"/>
    </complexType>
</schema>
