<?xml version="1.0" encoding="UTF-8"?>
<beans 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.5.xsd">

	<!-- YOUR ENTRIES HERE -->

	<bean id="portfolioController" class="br.org.senacagil.tradding.web.PortfolioController">
		<constructor-arg index="0">
			<ref bean="portfolio" />
		</constructor-arg>
	</bean>

	<bean id="portfolio" class="br.org.senacagil.tradding.business.Portfolio">
		<constructor-arg index="0">
			<value>100000</value>
		</constructor-arg>
		<constructor-arg index="1">
			<map>
				<entry key="IBM">
					<value>50</value>
				</entry>
				<entry key="SUNW">
					<value>300</value>
				</entry>
				<entry key="DELL">
					<value>200</value>
				</entry>
			</map>
		</constructor-arg>
	</bean>

	<bean id="logonValidator" class="br.org.senacagil.tradding.web.LogonValidator" />
	
	<bean id="logonForm" class="br.org.senacagil.tradding.web.LogonFormController">
		<property name="sessionForm">
			<value>true</value>
		</property>
		<property name="commandName">
			<value>credentials</value>
		</property>
		<property name="commandClass">
			<value>br.org.senacagil.tradding.business.Credentials
			</value>
		</property>
		<property name="validator">
			<ref bean="logonValidator" />
		</property>
		<property name="formView">
			<value>logon</value>
		</property>
		<property name="successView">
			<value>portfolio.htm</value>
		</property>
	</bean>

	<bean id="messageSource"
		class="org.springframework.context.support.ResourceBundleMessageSource">
		<property name="basename">
			<value>messages</value>
		</property>
	</bean>

	<bean id="tradeForm" class="br.org.senacagil.tradding.web.TradeFormController">
		<constructor-arg index="0">
			<ref bean="portfolio" />
		</constructor-arg>
	</bean>

	<!-- you can have more than one handler defined -->
	<bean id="urlMapping"
		class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
		<property name="urlMap">
			<map>
				<entry key="/portfolio.htm">
					<ref bean="portfolioController" />
				</entry>
				<entry key="/logon.htm">
					<ref bean="logonForm" />
				</entry>
				<entry key="/trade.htm">
					<ref bean="tradeForm" />
				</entry>
			</map>
		</property>
	</bean>

	<bean id="viewResolver"
		class="org.springframework.web.servlet.view.InternalResourceViewResolver">
		<property name="viewClass">
			<value>org.springframework.web.servlet.view.JstlView
			</value>
		</property>
		<property name="prefix">
			<value>/WEB-INF/jsp/</value>
		</property>
		<property name="suffix">
			<value>.jsp</value>
		</property>
	</bean>
	
</beans>
