<?xml version="1.0" encoding="UTF-8"?>
<beans default-lazy-init="false" 
	xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">


	<bean id="contextSourceReadTarget" class="org.springframework.ldap.core.support.LdapContextSource">
		<property name="urls" value="${ldapReadServerUrl1} ${ldapReadServerUrl2}" />
		<property name="base" value="DC=va,DC=gov" />
		<property name="userDn" value="${ldapUserId}" />
		<property name="password" value="${ldapPassword}" />
		<property name="dirObjectFactory"
			value="org.springframework.ldap.core.support.DefaultDirObjectFactory" />
		<!-- Dont use sun ldap pool. Use poolContextSource instead -->
		<property name="pooled" value="false" />
		<property name="baseEnvironmentProperties">
			<map>
				<entry key="java.naming.referral" value="ignore" />
			</map>
		</property>
	</bean>

	<bean id="contextSourceWriteTarget" class="org.springframework.ldap.core.support.LdapContextSource">
		<property name="urls"
			value="${ldapWriteServerUrl1} ${ldapWriteServerUrl2}" />
		<property name="base" value="DC=vha,DC=med,DC=va,DC=gov" />
		<property name="userDn" value="${ldapUserId}" />
		<property name="password" value="${ldapPassword}" />
		<!-- Dont use sun ldap pool. Use poolContextSource instead -->
		<property name="pooled" value="false" />
		<property name="baseEnvironmentProperties">
			<map>
				<entry key="java.naming.referral" value="ignore" />
			</map>
		</property>
	</bean>

	<bean id="contextSourceRead"
		class="org.springframework.ldap.transaction.compensating.manager.TransactionAwareContextSourceProxy">
		<constructor-arg ref="contextSourceReadTarget" />
	</bean>

	<bean id="contextSourceWrite"
		class="org.springframework.ldap.transaction.compensating.manager.TransactionAwareContextSourceProxy">
		<constructor-arg ref="contextSourceWriteTarget" />
	</bean>

<!--  	<bean id="ldapReadOperations" class="org.springframework.ldap.core.LdapTemplate">
		<constructor-arg ref="contextSourceRead" />
		<property name="ignorePartialResultException" value="true" />
	</bean>  -->

	<bean id="ldapWriteOperations" class="org.springframework.ldap.core.LdapTemplate">
		<constructor-arg ref="contextSourceWrite" />
		<property name="ignorePartialResultException" value="true" />
	</bean>   

</beans>

