<archetype>
    <id>maven-archetype-mule-transport</id>
    <variables>
        <variable>
            <name>description</name>
            <description>Provide a description of what the transport does:</description>
            <defvalue></defvalue>
        </variable>
        <variable>
            <name>muleVersion</name>
            <description>Which version of Mule is this transport targeted at?</description>
            <defvalue>${muleVersion}</defvalue>
        </variable>
        <variable>
            <name>forgeProject</name>
            <description>Will This project be hosted on MuleForge? [y] or [n]</description>
            <defvalue>y</defvalue>
        </variable>
        <variable>
            <name>hasCustomSchema</name>
            <description>Will This transport have a custom schema for configuring the transport in Xml?</description>
            <defvalue>y</defvalue>
        </variable>
        <variable>
            <name>hasReceiver</name>
            <description>Can the transport receive inbound requests? [y] or [n]</description>
            <defvalue>y</defvalue>

            <variables>
                <variable>
                    <name>isPollingReceiver</name>
                    <description>Does the Message Receiver need to poll the underlying resource? [y] or [n]
                    </description>
                    <defvalue>n</defvalue>
                </variable>

                <variable>
                    <name>inboundTransformer</name>
                    <description>If this transport will have a default inbound transformer, enter the name of the
                        transformer? (i.e. JmsMessageToObject)
                    </description>
                    <defvalue>n</defvalue>
                </variable>
            </variables>
        </variable>

        <variable>
            <name>hasDispatcher</name>
            <description>Can the transport dispatch outbound requests?</description>
            <defvalue>y</defvalue>

            <variables>
                <variable>
                    <name>outboundTransformer</name>
                    <description>If this transport will have a default outbound transformer, enter the name of the
                        transformer? (i.e. ObjectToJmsMessage)
                    </description>
                    <defvalue>n</defvalue>
                </variable>
            </variables>
        </variable>

        <variable>
            <name>hasTransactions</name>
            <description>Does this transport support transactions? [y] or [n]</description>
            <defvalue>n</defvalue>

            <variables>
                <variable>
                    <name>hasCustomTransactions</name>
                    <description>Does this transport use a non-JTA Transaction manager? [y] or [n]
                        (i.e. needs to wrap proprietary transaction management)
                    </description>
                    <defvalue>n</defvalue>
                </variable>
            </variables>
        </variable>

        <variable>
            <name>endpointBuilder</name>
            <description>What type of Endpoints does this transport use?
                - [r]esource endpoints (i.e. jms://my.queue)
                - [u]rl endpoints (i.e. http://localhost:1234/context/foo?param=1)
                - [s]ocket endpoints (i.e. tcp://localhost:1234)
                - [c]ustom - parse your own
            </description>
            <defvalue>r</defvalue>
        </variable>
    </variables>

    <templates>
        <!-- the template pom should be run fisrt since it sets up some other variables -->
        <template>
            <file>pom.vm</file>
            <output>pom.xml</output>
        </template>
        <template>
            <file>assembly.xml.vm</file>
            <output>assembly.xml</output>
        </template>
        <template>
            <file>src/main/resources/META-INF/services/org/mule/providers/csd.vm</file>
            <output>src/main/resources/META-INF/services/org/mule/transport/${TransportNameLower}.properties</output>
        </template>
        <template>
            <file>src/main/java/org/mule/transport/Messages.vm</file>
            <output>
                src/main/java/org/mule/transport/${TransportNameLower}/i18n/${TransportName}Messages.java
            </output>
        </template>
        <template>
            <file>src/main/resources/META-INF/services/org/mule/i18n/messages.vm</file>
            <output>src/main/resources/META-INF/services/org/mule/i18n/${TransportNameLower}-messages.properties
            </output>
        </template>
        <template>
            <file>src/main/resources/META-INF/spring.handlers.vm</file>
            <output>src/main/resources/META-INF/spring.handlers</output>
            <dependsOnVar>hasCustomSchema=y</dependsOnVar>
        </template>
        <template>
            <file>src/main/resources/META-INF/spring.schemas.vm</file>
            <output>src/main/resources/META-INF/spring.schemas</output>
            <dependsOnVar>hasCustomSchema=y</dependsOnVar>
        </template>
        <template>
            <file>src/main/resources/META-INF/schema.vm</file>
            <output>src/main/resources/META-INF/mule-${TransportNameLower}.xsd</output>
            <dependsOnVar>hasCustomSchema=y</dependsOnVar>
        </template>
        <template>
            <file>src/main/java/org/mule/transport/Connector.vm</file>
            <output>
                src/main/java/org/mule/transport/${TransportNameLower}/${TransportName}Connector.java
            </output>
        </template>
        <template>
            <file>src/main/java/org/mule/transport/config/NamespaceHandler.vm</file>
            <output>
                src/main/java/org/mule/transport/${TransportNameLower}/config/${TransportName}NamespaceHandler.java
            </output>
            <dependsOnVar>hasCustomSchema=y</dependsOnVar>
        </template>
        <template>
            <file>src/main/java/org/mule/transport/MessageAdapter.vm</file>
            <output>
                src/main/java/org/mule/transport/${TransportNameLower}/${TransportName}MessageAdapter.java
            </output>
        </template>
        <template>
            <file>src/main/java/org/mule/transport/MessageDispatcher.vm</file>
            <output>
                src/main/java/org/mule/transport/${TransportNameLower}/${TransportName}MessageDispatcher.java
            </output>
            <dependsOnVar>hasDispatcher=y</dependsOnVar>
        </template>
        <template>
            <file>src/main/java/org/mule/transport/MessageDispatcherFactory.vm</file>
            <output>
                src/main/java/org/mule/transport/${TransportNameLower}/${TransportName}MessageDispatcherFactory.java
            </output>
            <dependsOnVar>hasDispatcher=y</dependsOnVar>
        </template>
        <template>
            <file>src/main/java/org/mule/transport/MessageReceiver.vm</file>
            <output>
                src/main/java/org/mule/transport/${TransportNameLower}/${TransportName}MessageReceiver.java
            </output>
            <dependsOnVar>hasReceiver=y</dependsOnVar>
        </template>
        <template>
            <file>src/main/java/org/mule/transport/TransactedMessageReceiver.vm</file>
            <output>
                src/main/java/org/mule/transport/${TransportNameLower}/${TransportName}TransactedMessageReceiver.java
            </output>
            <dependsOnVar>hasTransactions=y</dependsOnVar>
        </template>

        <template>
            <file>src/main/java/org/mule/transport/TransactionFactory.vm</file>
            <output>
                src/main/java/org/mule/transport/${TransportNameLower}/${TransportName}TransactionFactory.java
            </output>
            <dependsOnVar>hasCustomTransactions=y</dependsOnVar>
        </template>

        <template>
            <file>src/main/java/org/mule/transport/Transaction.vm</file>
            <output>
                src/main/java/org/mule/transport/${TransportNameLower}/${TransportName}Transaction.java
            </output>
            <dependsOnVar>hasCustomTransactions=y</dependsOnVar>
        </template>

        <template>
            <file>src/main/java/org/mule/transport/InboundTransformer.vm</file>
            <output>src/main/java/org/mule/transport/${TransportNameLower}/transformers/${inboundTransformer}.java
            </output>
            <dependsOnVar>inboundTransformer!=n</dependsOnVar>
        </template>

        <template>
            <file>src/main/java/org/mule/transport/OutboundTransformer.vm</file>
            <output>src/main/java/org/mule/transport/${TransportNameLower}/transformers/${outboundTransformer}.java
            </output>
            <dependsOnVar>outboundTransformer!=n</dependsOnVar>
        </template>

        <template>
            <file>src/main/java/org/mule/transport/EndpointBuilder.vm</file>
            <output>src/main/java/org/mule/transport/${TransportNameLower}/${TransportName}EndpointBuilder.java</output>
            <dependsOnVar>endpointBuilder=c</dependsOnVar>
        </template>

        <!-- Test Cases -->
        <template>
            <file>src/test/java/org/mule/transport/ConnectorFactoryTestCase.vm</file>
            <output>
                src/test/java/org/mule/transport/${TransportNameLower}/${TransportName}ConnectorFactoryTestCase.java
            </output>
        </template>
        <template>
            <file>src/test/java/org/mule/transport/ConnectorTestCase.vm</file>
            <output>
                src/test/java/org/mule/transport/${TransportNameLower}/${TransportName}ConnectorTestCase.java
            </output>
        </template>
        <template>
            <file>src/test/java/org/mule/transport/EndpointTestCase.vm</file>
            <output>
                src/test/java/org/mule/transport/${TransportNameLower}/${TransportName}EndpointTestCase.java
            </output>
        </template>
        <template>
            <file>src/test/java/org/mule/transport/MessageAdapterTestCase.vm</file>
            <output>
                src/test/java/org/mule/transport/${TransportNameLower}/${TransportName}MessageAdapterTestCase.java
            </output>
        </template>
        <template>
            <file>src/test/java/org/mule/transport/NamespaceHandlerTestCase.vm</file>
            <output>
                src/test/java/org/mule/transport/${TransportNameLower}/${TransportName}NamespaceHandlerTestCase.java
            </output>
            <dependsOnVar>hasCustomSchema=y</dependsOnVar>
        </template>
        <template>
            <file>src/test/resources/namespace-config.xml.vm</file>
            <output>
                src/test/resources/${TransportNameLower}-namespace-config.xml
            </output>
            <dependsOnVar>hasCustomSchema=y</dependsOnVar>
        </template>
        <template>
            <file>src/test/java/org/mule/transport/MessageReceiverTestCase.vm</file>
            <output>
                src/test/java/org/mule/transport/${TransportNameLower}/${TransportName}MessageReceiverTestCase.java
            </output>
            <dependsOnVar>hasReceiver=y</dependsOnVar>
        </template>
        <template>
            <file>src/test/java/org/mule/transport/TransformersTestCase.vm</file>
            <output>
                src/test/java/org/mule/transport/${TransportNameLower}/transformers/${TransportName}TransformersTestCase.java
            </output>
            <dependsOnVar>inboundTransformer!=n</dependsOnVar>
        </template>
        <template>
            <file>src/test/java/org/mule/transport/TransformersTestCase.vm</file>
            <output>
                src/test/java/org/mule/transport/${TransportNameLower}/transformers/${TransportName}TransformersTestCase.java
            </output>
            <dependsOnVar>outboundTransformer!=n</dependsOnVar>
        </template>
    </templates>
</archetype>

