Salome HOME
bc9b67ae74e53cb5ba99f3e06ce8a73f0aaf326d
[tools/siman.git] / Workspace / Siman-Common / src / spring / globalContext.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <beans xmlns="http://www.springframework.org/schema/beans"
3         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4         xmlns:aop="http://www.springframework.org/schema/aop"
5         xmlns:context="http://www.springframework.org/schema/context"
6         xmlns:tx="http://www.springframework.org/schema/tx"
7         xsi:schemaLocation="
8 http://www.springframework.org/schema/beans
9 http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
10 http://www.springframework.org/schema/aop
11 http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
12 http://www.springframework.org/schema/context
13 http://www.springframework.org/schema/context/spring-context-3.0.xsd
14 http://www.springframework.org/schema/tx
15 http://www.springframework.org/schema/tx/spring-tx-3.0.xsd">
16
17         <bean id="baseMessageSource" class="org.springframework.context.support.ResourceBundleMessageSource">
18                 <property name="basenames">
19                         <list>
20                                 <value>application</value>
21                                 <value>log-messages</value>
22                         </list>
23                 </property>
24         </bean>
25
26         <!--    <bean id="simanDataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
27                 <property name="jndiName" value="jdbc/ibatis"/>
28                 </bean> -->
29
30         <!--    <bean id="simanDatasource"
31                 class="org.springframework.jdbc.datasource.DriverManagerDataSource">
32                 <property name="driverClassName"
33                         value="${connection.driver_class}" />
34                 <property name="url" value="${connection.url}" />
35                 <property name="username" value="${connection.username}" />
36                 <property name="password" value="${connection.password}" />
37         </bean>
38         -->
39
40         <context:property-placeholder
41                 location="classpath:siman.properties,classpath:jdbc.properties"
42                 ignore-unresolvable="true" />
43
44         <bean id="simanDatasource"
45                 class="org.springframework.jdbc.datasource.SingleConnectionDataSource">
46                 <property name="driverClassName"
47                         value="${connection.driver_class}" />
48                 <property name="url" value="${connection.url}" />
49                 <property name="username" value="${connection.username}" />
50                 <property name="password" value="${connection.password}" />
51                 <property name="suppressClose" value="true" />
52                 <property name="autoCommit" value="false" />
53         </bean>
54
55         <bean id="p6spySimanDatasource"
56                 class="com.p6spy.engine.spy.P6DataSource">
57                 <constructor-arg>
58                         <ref local="simanDatasource" />
59                 </constructor-arg>
60         </bean>
61
62
63         <bean id="hibernateProperties"
64                 class="org.springframework.beans.factory.config.PropertiesFactoryBean">
65                 <property name="properties">
66                         <props>
67                                 <!-- normal properties -->
68                         </props>
69                 </property>
70                 <!-- hibernate.config should be defined somewhere in the spring.properties layers -->
71                 <property name="locations">
72                         <list>
73                                 <value>classpath:${hibernate.config.file}</value>
74                         </list>
75                 </property>
76         </bean>
77
78         <bean id="simanSessionFactory"
79                 class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
80                 <property name="dataSource" ref="simanDatasource" />
81                 <property name="mappingResources">
82                         <list>
83                                 <value>
84                                         org/splat/dal/bo/kernel/Persistent.hbm.xml
85                                 </value>
86                                 <value>org/splat/dal/bo/kernel/Any.hbm.xml</value>
87                                 <value>org/splat/dal/bo/kernel/Entity.hbm.xml</value>
88                                 <value>org/splat/dal/bo/kernel/Attribute.hbm.xml</value>
89                                 <value>org/splat/dal/bo/kernel/Relation.hbm.xml</value>
90                                 <value>
91                                         org/splat/dal/bo/kernel/TextAttribute.hbm.xml
92                                 </value>
93                                 <value>org/splat/dal/bo/kernel/User.hbm.xml</value>
94
95                                 <value>
96                                         org/splat/dal/bo/som/ProjectElement.hbm.xml
97                                 </value>
98                                 <value>org/splat/dal/bo/som/Study.hbm.xml</value>
99                                 <value>org/splat/dal/bo/som/Scenario.hbm.xml</value>
100                                 <value>org/splat/dal/bo/som/Attributes.hbm.xml</value>
101                                 <value>org/splat/dal/bo/som/Relations.hbm.xml</value>
102                                 <value>org/splat/dal/bo/som/File.hbm.xml</value>
103                                 <value>org/splat/dal/bo/som/Document.hbm.xml</value>
104                                 <value>org/splat/dal/bo/som/Publication.hbm.xml</value>
105                                 <value>
106                                         org/splat/dal/bo/som/ValidationCycle.hbm.xml
107                                 </value>
108                                 <value>org/splat/dal/bo/som/Timestamp.hbm.xml</value>
109                                 <value>
110                                         org/splat/dal/bo/som/SimulationContext.hbm.xml
111                                 </value>
112                                 <value>
113                                         org/splat/dal/bo/som/KnowledgeElement.hbm.xml
114                                 </value>
115                                 <value>org/splat/dal/bo/som/IDBuilder.hbm.xml</value>
116                         </list>
117                 </property>
118                 <!-- hibernate.connection.driver_class=com.p6spy.engine.spy.P6SpyDriver -->
119
120                 <property name="hibernateProperties">
121                         <ref local="hibernateProperties" />
122                 </property>
123                 <!-- The following property is used temporary to be able to manage transactions manually. -->
124                 <!-- TODO: use annotations to mark transaction methods 
125                         instead of programmatic transaction management  -->
126                 <property name="exposeTransactionAwareSessionFactory">
127                         <value>false</value>
128                 </property>
129         </bean>
130
131         <bean id="txManager"
132                 class="org.springframework.orm.hibernate3.HibernateTransactionManager">
133                 <property name="sessionFactory" ref="simanSessionFactory" />
134         </bean>
135
136         <tx:annotation-driven transaction-manager="txManager" />
137
138         <!-- TODO: Replace database by services and DAOs -->
139         <bean id="database" class="org.splat.dal.dao.som.Database">
140                 <property name="sessionFactory" ref="simanSessionFactory" />
141                 <property name="indexService" ref="indexService" />
142                 <property name="repositoryService" ref="repositoryService" />
143         </bean>
144
145 </beans>