<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
    "http://www.springframework.org/dtd/spring-beans.dtd">

<beans>

	<!--
		Objeto Facade de la aplicacion <bean id="applicationManager"
		class="es.valencia.proyeduca.ApplicationManager"> </bean>
	-->
	<bean id="log4jDirectConfigurer" class="es.dalocar.software.utils.Log4JavaConfigurer">
		<property name="location" value="classpath:log4j.properties" />
		<property name="refreshInterval" value="0" />
	</bean>

	<bean id="applicationManager" class="es.dalocar.software.ApplicationManager" />

	<!-- Contexto donde almacenar objetos de datos -->
	<bean id="context" class="es.dalocar.software.DefaultContextImpl"></bean>

	<bean id="myDataSource" class="org.apache.commons.dbcp.BasicDataSource"
		destroy-method="close">
		<property name="driverClassName" value="org.hsqldb.jdbcDriver" />
		<property name="url" value="jdbc:hsqldb:hsql://localhost/facturacion" />
		<property name="username" value="sa" />
		<property name="password" value="" />
	</bean>

	<bean id="mySessionFactory"
		class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
		<property name="dataSource" ref="myDataSource" />
		<property name="mappingResources">
			<list>
				<value>./es/dalocar/software/beans/Cliente.hbm.xml</value>
				<value>./es/dalocar/software/beans/Factura.hbm.xml</value>
				<value>./es/dalocar/software/beans/LineaFactura.hbm.xml</value>
			</list>
		</property>
		<property name="hibernateProperties">
			<props>
				<prop key="hibernate.dialect">org.hibernate.dialect.HSQLDialect</prop>
				<prop key="hibernate.default_schema">FACTURACION</prop>
				<prop key="hibernate.show_sql">false</prop>
				<prop key="hibernate.jdbc.batch_size">0</prop>
			</props>
		</property>
	</bean>

	<bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate">
		<property name="sessionFactory">
			<ref bean="mySessionFactory" />
		</property>
	</bean>

	<bean id="clienteDAO" class="es.dalocar.software.daos.ClienteDAO">
		<property name="hibernateTemplate">
			<ref bean="hibernateTemplate" />
		</property>
	</bean>

	<bean id="facturaDAO" class="es.dalocar.software.daos.FacturaDAO">
		<property name="hibernateTemplate">
			<ref bean="hibernateTemplate" />
		</property>
	</bean>
	
	<bean id="lineaFacturaDAO" class="es.dalocar.software.daos.LineaFacturaDAO">
		<property name="hibernateTemplate">
			<ref bean="hibernateTemplate" />
		</property>
	</bean>
	
	
  <bean id="ClienteDelegate" class="es.dalocar.software.delegates.ClienteDelegate" singleton="false">
    <constructor-arg ref="applicationManager"></constructor-arg>
  </bean>

	<!-- Herramienta de validacion -->
	<bean id="validator" class="es.dalocar.software.validator.ValidatorTool"
		init-method="configure">
		<constructor-arg index="0">
			<value>true</value>
		</constructor-arg>
		<property name="hyphen" value="- "></property>
		<property name="resourceList">
			<list>
				<value>es/dalocar/software/validator/validation-linea.xml</value>
			</list>
		</property>
	</bean>



</beans>