<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE mule-configuration PUBLIC "-//SymphonySoft //DTD mule-configuration XML V1.0//EN"
                                "http://www.symphonysoft.com/dtds/mule/mule-configuration.dtd">

<!--
	This file defines the configuration for the hello sample application.  The application
	has two components -
	1. The Greeter component that adds a greeting to the event it receives
	2. The ChitChater component that adds some additional conversation to the event it receives
	An event is triggered by input through the system console and the outbound event is
	aslo written out through the system console.
-->
<mule-configuration id="helloSampleProperties" version="1.0">

    <!--
        The VMConnector is used to send events between components within the ame VM
    -->
    <!--connector name="VMConnector" className="org.mule.providers.vm.VMConnector"/-->

    <!--
    	The system stream connector is used to send and receive information via the
    	System.in and System.out. Note this connector is only really useful for testing
    	purposes.
    	promptMessage - is what is written to the console
    	messageDelayTime - is the time in milliseconds before the user is prompted again.
    	These properties are set as bean properties on the connector.
    -->
    <connector name="SystemStreamConnector" className="org.mule.providers.stream.SystemStreamConnector">
        <properties>
            <property name="promptMessage" value="Please enter your name: "/>
            <property name="messageDelayTime" value="1000"/>
        </properties>
    </connector>

    <!--
    	All transformers must be defined here.  For this example we have two transformers
    	used to transform the inbound events for the Greeter and Chatter components into
    	objects they understand.  The entryPointResolver configured on the Model below will
    	determine which method to call on our components based on the return types of these
    	transformers.
    -->
    <transformers>
        <transformer name="StringToNameString" className="org.mule.samples.hello.StringToNameString"
            returnClass="org.mule.samples.hello.NameString"/>
        <transformer name="NameStringToChatString" className="org.mule.samples.hello.NameStringToChatString"
            returnClass="org.mule.samples.hello.ChatString"/>
        <transformer name="ChatStringToString" className="org.mule.samples.hello.ChatStringToString"
            returnClass="java.lang.String"/>
    </transformers>

    <!--
        These define global providers that can be referenced by all components in the system. Message
        Providers can be declared here or within a mule-descriptor declaration. Proivders declared in
        a mule-descriptor declaration are only visible to the descriptor they define in.
        Note that global Message Providers are cloned when requested from the Mule server so that the
        calling code can alter their instance without affecting other components.

    -->
    <!--global-message-providers>
        <message-provider name="stream" endpointUri="system" connector="SystemStreamConnector"/>
        <message-provider name="chitchatProvider" endpointUri="chitchatter" connector="VMConnector"/>
    </global-message-providers-->

    <!--
        An interceptor is a peice of code that can be configued to execute
        before and/or after an event is received for a component.
        You can define a stack of interceptors that will be executed in sequence.
        You can then configure the stack on your components.
    -->
    <interceptor-stack name="default">
        <interceptor className="org.mule.interceptors.LoggingInterceptor"/>
        <interceptor className="org.mule.interceptors.TimerInterceptor"/>
    </interceptor-stack>
    <!--
        The Mule model initialises and manages your UMO components
    -->
    <model name="helloSample">
        <!--
            A Mule descriptor defines all the necessary information about how your components will
            interact with the framework, other components in the system and external sources.
            Please refer to the Configuration Guide for a full description of all the parameters.
        -->
        <mule-descriptor name="GreeterUMO"
            inboundEndpoint="stream://localhost?transformers=StringToNameString"
            outboundEndpoint="vm://localhost/chitchatter"
            implementation="org.mule.samples.hello.Greeter">
            <!--
            Here we tell this component to use the interceptor stack defined above
            -->
            <interceptor name="default"/>
        </mule-descriptor>

        <mule-descriptor name="ChitChatUMO"
            inboundEndpoint="vm://localhost/chitchatter?transformers=NameStringToChatString"
            outboundEndpoint="stream://system.out?transformers=ChatStringToString"
            implementation="org.mule.samples.hello.ChitChatter">

            <interceptor name="default"/>
        </mule-descriptor>
    </model>
</mule-configuration>
