<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:util="http://www.springframework.org/schema/util" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd">
	<import resource="classpath:org/codehaus/xfire/spring/xfire.xml"/>
	<import resource="classpath:gov/va/med/cds/audit/persistence/jms/jmsAuditLogContext.xml"/>
	<!--
		This was based on trial to deploy only a WEB APP - trying to get annotations working however, this may be useful
		moving forward and having the web app and the ejb app share the pojo
	-->
	
	<!--  This bean sets up property replacement so that variables can be externalized to system properties -->
	<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
		<property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE"/>
		<property name="locations">
			<list>
				<value>classpath:gov/va/med/mediator/config/properties/defaultWeblogic.properties
				</value>
			</list>
		</property>
	</bean>
	
	<bean id="cdsAppName" class="java.lang.String">
		<constructor-arg value="${cdsAppName}" />
	</bean>
	
	<bean id="pathwaysAppName" class="java.lang.String">
		<constructor-arg value="${cdsAppName}" />
	</bean>

	<!-- WEB APP ANNOTATIONS  -->
	<!--
		<bean id="webAnnotations" class="org.codehaus.xfire.annotations.jsr181.Jsr181WebAnnotations" /> <bean
		id="handlerMapping" class="org.codehaus.xfire.spring.remoting.Jsr181HandlerMapping"> <property
		name="typeMappingRegistry" ref="xfire.typeMappingRegistry" /> <property name="xfire" ref="xfire" /> <property
		name="webAnnotations" ref="webAnnotations" /> </bean>
	-->
	<bean id="topLevelUrlHandler" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
		<property name="urlMap">
			<map>
				<!-- Soap WS related -->
				<!--
					currently only this url is supported - (cds-wsclient/mediator-service?wsdl)since SOAP calls are handled through
					.NET business delegate
				-->
				<entry key="/mediator-service">
					<ref bean="mediatorSoapExporterWS"/>
				</entry>
				
			</map>
		</property>
	</bean>

	<!-- SOAP web service using XFire -->
	<bean id="mediatorSoapExporterWS" class="org.codehaus.xfire.spring.remoting.XFireExporter">
		<property name="style">
			<value>rpc</value>
		</property>
		<property name="use">
			<value>literal</value>
		</property>
		<property name="serviceFactory">
			<ref bean="xfire.serviceFactory"/>
		</property>
		<property name="xfire">
			<ref bean="xfire"/>
		</property>
		<property name="serviceBean">
			<ref bean="mediatorStatelessSession"/>
		</property>
		<property name="serviceClass" value="gov.va.med.mediator.client.messagemediator.MessageMediatorInterface"/>
		<property name="serviceInterface" value="gov.va.med.mediator.client.messagemediator.MessageMediatorInterface"/>
	</bean>
	<!--
		Create a proxy to the local stateless session bean. Call it from the XFire SOAP exporter and from the servlet
		controllers.
	-->
	<bean id="mediatorStatelessSession" class="org.springframework.ejb.access.LocalStatelessSessionProxyFactoryBean"
		lazy-init="true">
		<!--
			For some reason the web module wants to load before the EJB module in weblogic. This property keeps the EJB local
			home look up from happening during the web module deployment phase. It will get looked up on the first method call.
		-->
		<property name="lookupHomeOnStartup" value="false"/>
		<property name="jndiName">
			<value>comp/env/ejb/local/gov/va/med/cds/messagemediator/SynchronousMessageBean</value>
		</property>
		<property name="jndiEnvironment">
			<props>
				<prop key="java.naming.factory.initial">weblogic.jndi.WLInitialContextFactory</prop>
			</props>
		</property>
		<property name="businessInterface">
			<value>gov.va.med.mediator.client.messagemediator.MessageMediatorInterface</value>
		</property>
	</bean>

	<bean id="xsltHelper" class="gov.va.med.cds.xml.transform.XsltHelper">
		<property name="xsltLocations">
			<list>
				<value>classpath:gov/va/med/cds/xslt/*.xsl</value>
				<value>classpath:gov/va/med/cds/xslt/filter/*.xsl</value>
			</list>
		</property>
	</bean>
</beans>