<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns="http://www.mulesource.org/schema/mule/core/2.0"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:vm="http://www.mulesource.org/schema/mule/vm/2.0"
	xmlns:spring="http://www.springframework.org/schema/beans"
	xmlns:cxf="http://www.mulesource.org/schema/mule/cxf/2.0"
	xmlns:http="http://www.mulesource.org/schema/mule/http/2.0"
	xmlns:file="http://www.mulesource.org/schema/mule/file/2.0"
	xmlns:xm="http://www.mulesource.org/schema/mule/xml/2.0"
	xsi:schemaLocation="
		http://www.mulesource.org/schema/mule/core/2.0 http://www.mulesource.org/schema/mule/core/2.0/mule.xsd
		http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
		http://www.mulesource.org/schema/mule/cxf/2.0 http://www.mulesource.org/schema/mule/cxf/2.0/mule-cxf.xsd
		http://www.mulesource.org/schema/mule/http/2.0 http://www.mulesource.org/schema/mule/http/2.0/mule-http.xsd
		http://www.mulesource.org/schema/mule/file/2.0 http://www.mulesource.org/schema/mule/file/2.0/mule-file.xsd
		http://www.mulesource.org/schema/mule/xml/2.0 http://www.mulesource.org/schema/mule/xml/2.0/mule-xml.xsd
		http://www.mulesource.org/schema/mule/vm/2.0 http://www.mulesource.org/schema/mule/vm/2.0/mule-vm.xsd">


	<custom-transformer name="CustomTransformer"
		class="media.service.consumer.bcs.gateway.StringToPayload" />
	<custom-transformer name="StringToMdxTransformer"
		class="media.service.consumer.bcs.gateway.transformers.StringToMdxTransformer" />
		
		
	<custom-transformer name="XmlToMdxTransformer"
		class="media.mdx.common.mule.transformers.jaxb.JaxbXmlToObject">
		
		<spring:property name="jaxbContextFactoryClass"
			value="media.mdx.common.mule.transformers.jaxb.MDXJaxbContextFactory" />
	</custom-transformer>

	<!-- request transformers -->
	<custom-transformer name="MdxToGetAccountInfoRequestTransformer"
		class="media.service.consumer.bcs.gateway.transformers.requests.MdxToGetAccountInfoRequestTransformation" />
	<custom-transformer name="MdxToSMSNotificationRequestTransformer" 
		class="media.service.consumer.bcs.gateway.transformers.requests.MdxToSMSNotificationRequestTransformation" />
	<custom-transformer name="MdxToGetSubscriptionInfoRequestTransformer" 
		class="media.service.consumer.bcs.gateway.transformers.requests.MdxToGetSubscriptionInfoRequestTransformation"/>
		
	<!-- request transformers -->	
	
	<custom-transformer name="AccountInfoResponseToMdx" class="media.service.consumer.bcs.gateway.transformer.response.AccountInfoResponseToMdx"/>
	
		

	<file:file-to-string-transformer name="FileToStringTransformer" />


	<model name="Sample">
	
	<default-connector-exception-strategy enableNotifications="true">
		<vm:outbound-endpoint address="vm://error.queue"/>
	</default-connector-exception-strategy>
	
	<!-- 
	<default-service-exception-strategy enableNotifications="true" >
		<vm:outbound-endpoint address="vm://error.queue"/>
	</default-service-exception-strategy>
	 -->
		 
		<service name="ExceptionHandlingException">
			<inbound>
				<vm:inbound-endpoint address="vm://error.queue"/>
			</inbound>
			<log-component />
			<outbound>
				<outbound-pass-through-router>
					<file:outbound-endpoint address="file:///tmp/test/err"/> 
				</outbound-pass-through-router>
			</outbound>
		</service>
		
		<service name="FileMonitorService">
			<inbound>

				<file:inbound-endpoint
					address="file:///tmp/test"
					pollingFrequency="10000"
					moveToDirectory="/tmp/test/out" />

			</inbound>
			<outbound>

				<outbound-pass-through-router>
					<vm:outbound-endpoint path="processQ" 
						transformer-refs="FileToStringTransformer"/>
				</outbound-pass-through-router>
			</outbound>
		</service>
		
		<service name="FilterRequestByCall">
			<inbound>
				<inbound-endpoint address="vm://processQ"/>
			</inbound>
			<component class="media.service.consumer.bcs.gateway.App"/>
			<outbound>
				<filtering-router>
					<outbound-endpoint  address="vm://sendSmsNotifyQ"/>
					<xm:jxpath-filter pattern="//MDX/SERVICE"
					expectedValue="SMS" />
				</filtering-router>
				<filtering-router>
					<outbound-endpoint  address="vm://getAccountInfoQ"/>
					<xm:jxpath-filter pattern="//MDX/SERVICE"
					expectedValue="QUERY" />
				</filtering-router>
				<filtering-router>
					<outbound-endpoint  address="vm://getSubscriptionInfoHandlerQ"/>
					<xm:jxpath-filter pattern="//MDX/SERVICE"
					expectedValue="QUERY_SUBSRIPTION_INFO" />
				</filtering-router>
				
				
				
			</outbound>
			
		</service>	
		
		<!--
		SEND SMS 
		 -->
		<service name="SendSmsNotification">
			<inbound>
				<vm:inbound-endpoint address="vm://sendSmsNotifyQ" 
					transformer-refs="XmlToMdxTransformer MdxToSMSNotificationRequestTransformer"/>
			</inbound>
			<outbound>
				<outbound-pass-through-router>
					<cxf:outbound-endpoint
						address="http://spt-vzw-bcsg-vip.vzw.mflo-eng.com:39101/mf-bcsgateway/"
						clientClass="com.qualcomm.mf.mds.gateway.MDSGatewayService"
						wsdlPort="MDSGatewayPort"
						wsdlLocation="http://spt-vzw-bcsg-vip.vzw.mflo-eng.com:39101/mf-bcsgateway/?wsdl"
						operation="sendSMSNotification"
						/>
					
				</outbound-pass-through-router>
			</outbound>
		</service>
		<service name="GetAccountInfo">
			<inbound>
				<vm:inbound-endpoint address="vm://getAccountInfoQ" 
					transformer-refs="XmlToMdxTransformer MdxToGetAccountInfoRequestTransformer"
					responseTransformer-refs="AccountInfoResponseToMdx"/>
					
			</inbound>
			<outbound>
				<outbound-pass-through-router>
					<cxf:outbound-endpoint
						address="http://spt-vzw-bcsg-vip.vzw.mflo-eng.com:39101/mf-bcsgateway/"
						clientClass="com.qualcomm.mf.mds.gateway.MDSGatewayService"
						wsdlPort="MDSGatewayPort"
						wsdlLocation="http://spt-vzw-bcsg-vip.vzw.mflo-eng.com:39101/mf-bcsgateway/?wsdl"
						operation="getAccountInfo"
						/>
					
				</outbound-pass-through-router>
			</outbound>
		</service>
		
		<service name="GetSubscriptionInfoHandler">
		<inbound>
				<vm:inbound-endpoint address="vm://getSubscriptionInfoHandlerQ" 
					transformer-refs="XmlToMdxTransformer" 
					/>
					
			</inbound>
			<component class="media.service.consumer.bcs.gateway.GetSubscriptionInfoComponent" />
			<outbound>
				<outbound-pass-through-router>
					<outbound-endpoint address="vm://getSubscriptionInfoQ"/>
				</outbound-pass-through-router>
			</outbound>
		</service>
		
		<service name="GetSubscriptionInfo">
			<inbound>
				<vm:inbound-endpoint address="vm://getSubscriptionInfoQ" 
					transformer-refs="MdxToGetSubscriptionInfoRequestTransformer" 
					/>
					
			</inbound>
			<outbound>
				<outbound-pass-through-router>
					<cxf:outbound-endpoint
						address="http://spt-vzw-bcsg-vip.vzw.mflo-eng.com:39101/mf-bcsgateway/"
						clientClass="com.qualcomm.mf.mds.gateway.MDSGatewayService"
						wsdlPort="MDSGatewayPort"
						wsdlLocation="http://spt-vzw-bcsg-vip.vzw.mflo-eng.com:39101/mf-bcsgateway/?wsdl"
						operation="getSubscriptionInfo"
						/>
					
				</outbound-pass-through-router>
			</outbound>
		</service>		
	</model>

</mule>