<?xml version="1.0" encoding="UTF-8"?>
<!--
  Copyright 2013 The MITRE Corporation 
    and the MIT Kerberos and Internet Trust Consortium
  
  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at
  
    http://www.apache.org/licenses/LICENSE-2.0
  
  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->
<beans xmlns="http://www.springframework.org/schema/beans"
	   xmlns:jdbc="http://www.springframework.org/schema/jdbc"
       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-3.0.xsd
       						http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.0.xsd">

	<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
		<property name="driverClassName" value="org.hsqldb.jdbcDriver" />
		<property name="url" value="jdbc:hsqldb:mem:oic;sql.syntax_mys=true" />
<!-- 		<property name="url" value="jdbc:hsqldb:file:/tmp/oic;sql.syntax_mys=true" /> -->
		<property name="username" value="oic" />
		<property name="password" value="oic" />	
	</bean>
	
	<!-- Use the following to set up the OIC tables in the in-memory DB
		   If you are using a file based HSQLDB you should not run this every time. -->
	<jdbc:initialize-database data-source="dataSource">
		<jdbc:script location="classpath:/db/tables/hsql_database_tables.sql"/>
		<!-- The following file is for the jdbc-user-service spring security implementation -->
		<jdbc:script location="classpath:/db/tables/security-schema.sql"/>
		<!-- The following files are for safely bootstrapping users and clients into the database -->
		<jdbc:script location="classpath:/db/tables/loading_temp_tables.sql"/>
		<jdbc:script location="classpath:/db/users.sql"/>
		<jdbc:script location="classpath:/db/clients.sql"/>
		<jdbc:script location="classpath:/db/scopes.sql"/>
	</jdbc:initialize-database>
	
	<bean id="jpaAdapter" class="org.springframework.orm.jpa.vendor.EclipseLinkJpaVendorAdapter">
 		<property name="databasePlatform" value="org.eclipse.persistence.platform.database.HSQLPlatform" />
		<property name="showSql" value="true" />
	</bean>

	<!--  The following is for connecting to a MySQL database that has been initialized with 
			src/main/resources/db/tables/mysql_database_tables.sql -->
	<!-- 
	<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
		<property name="driverClassName" value="com.mysql.jdbc.Driver" />
		<property name="url" value="jdbc:mysql://localhost/oic" />
		<property name="username" value="oic" />
		<property name="password" value="oic" />		
	</bean>

	<bean id="jpaAdapter" class="org.springframework.orm.jpa.vendor.EclipseLinkJpaVendorAdapter">
		<property name="databasePlatform" value="org.eclipse.persistence.platform.database.MySQLPlatform" />
		<property name="showSql" value="true" />
	</bean>

	-->
</beans>
