<?xml version="1.0" encoding="UTF-8"?>
<!-- 
   - $Id$
   - 
   - $Log$
   - Revision 1.16  2007/09/23 05:42:38  dick
   - Add validateUser.  baseUrl becomes appName.
   -
   - Revision 1.15  2007/09/23 04:22:50  dick
   - Move BSAccount stuff to it's own xml file.
   -
   - Revision 1.14  2007/09/12 19:39:55  dick
   - sessionPageController needs ref to cutthroat.
   -
   - Revision 1.13  2007/09/11 05:56:39  dick
   - BSAccount Integration.
   -
   - Revision 1.12  2007/05/14 06:39:03  dick
   - Whitespace.
   -
   - Revision 1.11  2007/05/10 04:44:42  dick
   - Don't need the database base declarations (included by jdbc decls).
   -
   - Revision 1.10  2005/11/22 20:36:53  dick
   - Add Session Editing
   -
   - Revision 1.9  2005/11/22 05:22:23  dick
   - org.pinscores.cutthroat.web becomes org.pinscores.web.cutthroat
   - so other 'web' implementations will line up nicer.
   -
   - Revision 1.8  2005/11/20 21:19:32  dick
   - cutthroat needs the pinScoresDatabaseJdbc drivers
   -
   - Revision 1.7  2005/11/10 06:56:56  dick
   - Add the 3 validators as properties to the machineEditFormController.
   -
   - Revision 1.6  2005/10/31 06:26:51  dick
   - Playing with displaying sessions
   -
   - Revision 1.5  2005/10/26 02:28:08  dick
   - pinScoresDatabase moves to his own directory
   -
   - Revision 1.4  2005/10/26 01:50:36  dick
   - Move the validators to pinScoresDatabase
   -
   - Revision 1.3  2005/10/25 15:35:52  dick
   - Activate PlayerValidator.  The validators should be moved to pinScoresDatabase.xml as they live in that tree.
   -
   - Revision 1.2  2005/10/25 05:01:13  dick
   - Add the Account Editor.
   - home and players don't need a logged in session; CutThroat supports anon content.
   -
   - Revision 1.1  2005/10/23 17:20:24  dick
   - First Spring enabled PinScores CutThroat checkin (skeleton running)
   -
   -->
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
	<import resource="jsp/BSAccount/bsaccountBeans.xml"/>
	<import resource="pinScoresDatabase/pinScoresDatabaseJdbc.xml"/>

	<!-- ========================= UNPROTECTED COMMAND MAPPING ========================= -->
    <bean id="urlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
        <property name="mappings">
            <props>
            	<!--  Basically, you get hello and login.  Everything else is protected by session -->
                <prop key="/hello.do">helloPageController</prop>
	 			<prop key="/home.do">homePageController</prop>
	 			<prop key="/machines.do">machinePageController</prop>
	 			<prop key="/players.do">playerPageController</prop>
	 			<prop key="/sessions.do">sessionPageController</prop>

				<!-- BSAccount mappings -->
                <prop key="/login.do">signonController</prop>
                <prop key="/privacy.do">privacyPageController</prop>
	 			<prop key="/registerUser.do">registerUserFormController</prop>
                <prop key="/validateUser.do">validateUserFormController</prop>
            </props>
        </property>
    </bean>

	<!-- ========================= DEFINITIONS OF PROTECTED CONTROLLERS ========================= -->

	<bean id="secureHandlerMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
		<property name="interceptors">
			<list>
				<ref bean="signonInterceptor"/>
			</list>
		</property>
		<property name="urlMap">
			<map>
	 			<entry key="/playerEdit.do"><ref local="playerEditFormController"/></entry>
	 			<entry key="/newPlayer.do"><ref local="playerEditFormController"/></entry>
	 			<entry key="/editPlayer.do"><ref local="playerEditFormController"/></entry>
	 			<entry key="/sessionEdit.do"><ref local="sessionEditFormController"/></entry>
	 			<entry key="/machineEdit.do"><ref local="machineEditFormController"/></entry>
	 			<entry key="/newMachine.do"><ref local="machineEditFormController"/></entry>
	 			<entry key="/editMachine.do"><ref local="machineEditFormController"/></entry>
	 			<entry key="/machineTypeEdit.do"><ref local="machineEditFormController"/></entry>
	 			<entry key="/newMachineType.do"><ref local="machineEditFormController"/></entry>
	 			<entry key="/editMachineType.do"><ref local="machineEditFormController"/></entry>

				<!-- BSAccount mappings -->
				<entry key="/editAccount.do"><ref bean="accountFormController"/></entry>
	 			<entry key="/signoff.do"><ref bean="signoffController"/></entry>

			</map>
		</property>
	</bean>

	<!-- ========================= INDIVIDUAL CONTROLLERS ========================= -->

	<!-- ========== Player controls ========== -->
    <!--  Controller for the Player page -->
	<bean id="playerPageController" class="org.pinscores.web.cutthroat.PlayerPageController">
		<property name="bsAccountMan" ref="bsAccountMan" />
		<property name="pinScoresDatabase"><ref bean="pinScoresDatabase"/></property>
	</bean>

	<!-- Controller for the Player Editing form -->
	<bean id="playerEditFormController" class="org.pinscores.web.cutthroat.PlayerEditFormController">
		<property name="bsAccountMan" ref="bsAccountMan" />
		<property name="pinScoresDatabase"><ref bean="pinScoresDatabase"/></property>
 		<property name="validator" ref="playerValidator"/>
		<property name="successView" value="index"/>
	</bean>

	<!-- ========== Machine controls ========== -->
    <!--  Controller for the Machine page -->
	<bean id="machinePageController" class="org.pinscores.web.cutthroat.MachinePageController">
		<property name="bsAccountMan" ref="bsAccountMan" />
		<property name="pinScoresDatabase"><ref bean="pinScoresDatabase"/></property>
	</bean>

	<!-- Controller for the Machine Editing form -->
	<bean id="machineEditFormController" class="org.pinscores.web.cutthroat.MachineEditFormController">
		<property name="bsAccountMan" ref="bsAccountMan" />
		<property name="pinScoresDatabase" ref="pinScoresDatabase"/>
 		<!-- <property name="validator" ref="machineValidator"/> -->
		<property name="successView" value="index"/>
		<property name="locationValidator" ref="locationValidator"/>
		<property name="machineValidator" ref="machineValidator"/>
		<property name="machineTypeValidator" ref="machineTypeValidator"/>
	</bean>

	<!-- ========== Session controls ========== -->
    <!--  Controller for the Player page -->
	<bean id="sessionPageController" class="org.pinscores.web.cutthroat.SessionPageController">
		<property name="bsAccountMan" ref="bsAccountMan" />
		<property name="pinScoresDatabase"><ref bean="pinScoresDatabase"/></property>
		<property name="cutthroat" ref="cutthroat"/>
	</bean>

	<!-- Controller for the Machine Editing form -->
	<bean id="sessionEditFormController" class="org.pinscores.web.cutthroat.SessionEditFormController">
		<property name="pinScoresDatabase" ref="pinScoresDatabase"/>
 		<property name="validator" ref="sessionValidator"/>
	</bean>

	<!-- ========================= BSAccount Controllers ========================= -->
	<!--  Controller for the initial "Hello" page -->
	<!--  Overridden from BSAccount -->
<!-- 	<bean id="helloPageController" class="com.buckosoft.BSAccount.web.BSAccountHelloPageController">
		<property name="bsAccountMan" ref="bsAccountMan" />
	</bean>
-->
 	<bean id="helloPageController" class="org.pinscores.web.cutthroat.HelloPageController">
		<property name="bsAccountMan" ref="bsAccountMan" />
		<property name="pinScoresDatabase"><ref bean="pinScoresDatabase"/></property>
	</bean>

	<!--  Controller for the "Home" page -->
	<!--  Overridden from BSAccount -->

	<bean id="homePageController" class="org.pinscores.web.cutthroat.HomePageController">
		<property name="bsAccountMan" ref="bsAccountMan" />
		<property name="pinScoresDatabase"><ref bean="pinScoresDatabase"/></property>
	</bean>


	<bean id="userFactory" class="org.pinscores.business.cutthroat.UserFactory">
		<property name="bsAccountMan" ref="bsAccountMan" />
		<property name="pinScoresDatabase" ref="pinScoresDatabase"/>
	</bean>

	<!-- ================================================================================= -->
	<!-- The main business object -->
	<bean id="cutthroat" class="org.pinscores.business.cutthroat.CutThroatImpl">
		<property name="bsAccountMan" ref="bsAccountMan" />
		<property name="pinScoresDatabase" ref="pinScoresDatabase"/>
		<property name="smtpHost" value="shirley.buckosoft.com" />
		<property name="appName" value="cutthroat" />
	</bean>
</beans>
