<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
 "http://www.springframework.org/dtd/spring-beans.dtd">

<!--
  - Application context definition for "webra" DispatcherServlet.
  -->
<beans default-lazy-init="false" default-dependency-check="none" default-autowire="no">

	<!-- ========================= MESSAGE SOURCE DEFINITION ========================= -->
    <!--
      - Message source for this context, loaded from localized "messages_xx" files.
      -->
	<bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource" abstract="false" singleton="true" lazy-init="default" autowire="default" dependency-check="default">
		<property name="basename" value="messages"/>
	</bean>

	<!-- Configurer that replaces ${...} placeholders with values from a properties file
      - (in this case, JDBC-related settings for the dataSource definition below) 
	  - and other stuff 
	  -->
	<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer" abstract="false" singleton="true" lazy-init="default" autowire="default" dependency-check="default">
		<property name="locations">
			<list>
				<value>WEB-INF/classes/jaws.properties</value>
			</list>
		</property>
	</bean>

	<!-- mapping of all languages -->
        <bean id="languageMap" class="org.springframework.beans.factory.config.MapFactoryBean">
		<property name="sourceMap">
			<map>
				<entry key="nb_NO"> 
					<value type="java.lang.Integer">0</value>
				</entry>
				<entry key="nb-NO"> 
					<value type="java.lang.Integer">0</value>
				</entry>
				<entry key="no"> 
					<value type="java.lang.Integer">0</value>
				</entry>
				<entry key="NO"> 
					<value type="java.lang.Integer">0</value>
				</entry>
			</map>
		</property>
		<property name="targetMapClass"><value>java.util.HashMap</value></property>
	</bean>

        <!-- mapping of all locales -->
        <bean id="localeMap" class="org.springframework.beans.factory.config.MapFactoryBean">
                <property name="sourceMap">
                        <map>
                                <entry key="0" value="nb_NO"/>
                        </map>
                </property>
                <property name="targetMapClass"><value>java.util.HashMap</value></property>
        </bean>

	<!-- services property is a list ptisproxy host:port:timeout in secs  -->
	<bean id="jpProxyTarget" class="no.nsb.jaws.JPProxy" singleton="false">
                <property name="smallendian" value="${smallendian}" />
		<property name="services">
                  <list>
  		    <value>${host}:9000:${timeout}</value>
  		    <value>${host}:9200:${timeout}</value>
                  </list>
                </property>
		<property name="languageMap" ref="languageMap" />
		<property name="localeMap" ref="localeMap" />
		<property name="ms" ref="messageSource" />
	</bean>

	<bean id="poolTargetSource" class="org.springframework.aop.target.CommonsPoolTargetSource">
		<property name="targetBeanName" value="jpProxyTarget"/>
		<property name="maxSize" value="5"/>
	</bean>

	<bean id="jpProxy" class="org.springframework.aop.framework.ProxyFactoryBean">
		<property name="targetSource" ref="poolTargetSource"/>
	</bean>

</beans>

