-
Notifications
You must be signed in to change notification settings - Fork 100
/
datalayer.xml
176 lines (151 loc) · 7.21 KB
/
datalayer.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util-2.0.xsd"
default-lazy-init="true">
<!--
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# $Id$
#
# Copyright 2006 University of Dundee. All rights reserved.
# Use is subject to license terms supplied in LICENSE.txt
#
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-->
<!--
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Written by: Josh Moore <josh.moore@gmx.de>
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-->
<description>
Configuration for standalone properties and general database access.
The beans in this configuration file should NOT be generally accessed.
In general, this entire file should be considered to have a "private" scope.
Note: As other forms of data access (caching esp. distributed, Freeze, etc.
are added, they should also be configured at this level)
</description>
<!--
Unique identifier for this Spring context. This is important to
distinguish multiple uses of the same database, for example in clustering.
This value may also be used as the internal session for this server instance
-->
<bean id="uuid_object" class="java.util.UUID" factory-method="randomUUID"/>
<bean id="uuid" factory-bean="uuid_object" factory-method="toString"/>
<bean id="databaseIdentity" class="ome.services.db.DatabaseIdentity">
<constructor-arg index="0" value="${omero.db.authority}"/>
<constructor-arg index="1">
<!-- This inline bean takes the place of the previous isolatedSqlAction
which should be avoided. It's needed here because the check is taking
place before server startup, i.e. not in a connected thread.
See #3253 and #3697 -->
<bean class="${omero.db.sql_action_class}">
<constructor-arg>
<bean class="org.springframework.jdbc.core.simple.SimpleJdbcTemplate">
<constructor-arg ref="selfCorrectingDataSource"/>
</bean>
</constructor-arg>
</bean>
</constructor-arg>
</bean>
<bean id="omero.db.uuid" factory-bean="databaseIdentity" factory-method="getUuid"/>
<!-- Scope: private -->
<bean id="cacheManager" class="ome.tools.spring.ShutdownSafeEhcacheManagerFactoryBean"/>
<bean id="transactionAttributeSource" class="org.springframework.transaction.interceptor.CompositeTransactionAttributeSource">
<constructor-arg>
<list>
<!-- This stack first will return readOnly=true for all share activities,
then will use the @Transactional annotation on any implementation method (or class),
and finally will throw an InternalException if all other return values have
been null. -->
<bean class="ome.services.sharing.ShareRestrictionTransactionAttributeSource">
<constructor-arg ref="currentDetails"/>
<constructor-arg ref="sessionCache"/>
</bean>
<bean class="org.springframework.transaction.annotation.AnnotationTransactionAttributeSource"/>
<bean class="ome.tools.spring.ForceTransactionAttributeSource"/>
</list>
</constructor-arg>
</bean>
<bean id="transactionHandler"
class="org.springframework.transaction.interceptor.TransactionInterceptor">
<description>
Scope: private
</description>
<property name="transactionManager" ref="transactionManager"/>
<property name="transactionAttributeSource" ref="transactionAttributeSource"/>
</bean>
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource"/>
</bean>
<!-- Properties and actions: chooses between concrete implementations for
all JDBC calls -->
<alias alias="simpleSqlAction" name="sqlActionWrapper"/>
<bean id="loggingSqlAction" class="ome.util.SqlAction$LoggingSqlAction"/>
<bean id="sqlActionWrapper" class="org.springframework.aop.framework.ProxyFactoryBean">
<property name="interceptorNames">
<list>
<value>loggingSqlAction</value>
</list>
</property>
<property name="proxyInterfaces">
<list>
<value>ome.util.SqlAction</value>
</list>
</property>
<property name="target" ref="simpleSqlActionImpl"/>
</bean>
<bean id="simpleSqlActionImpl" class="${omero.db.sql_action_class}">
<description>
Takes part in any currently running Hibernate transaction.
Where necessary, implementations can using PROPAGATION
settings to temporarily run in an autonomous transaction.
</description>
<constructor-arg>
<bean class="org.springframework.jdbc.core.simple.SimpleJdbcTemplate">
<constructor-arg ref="dataSource"/>
</bean>
</constructor-arg>
</bean>
<!--
DATA SOURCE:
====================================================================
The TableIdGenerator used by all model objects assumes the following
three data source wrapping one another
-->
<alias name="txAwareDataSource" alias="dataSource"/>
<bean id="txAwareDataSource" class="org.springframework.jdbc.datasource.TransactionAwareDataSourceProxy">
<property name="targetDataSource" ref="selfCorrectingDataSource"/>
</bean>
<bean id="selfCorrectingDataSource" class="ome.services.db.SelfCorrectingDataSource">
<constructor-arg ref="nonXaDataSource"/>
<constructor-arg value="300000"/> <!--5 minutes of errors -->
</bean>
<alias alias="dataSourceProperties" name="${omero.db.profile}DataSourceProperties"/>
<bean id="psqlDataSourceProperties" class="org.springframework.beans.factory.config.PropertiesFactoryBean">
<property name="properties">
<props>
<prop key="driverClassName">${omero.db.driver}</prop>
<prop key="url">jdbc:postgresql://${omero.db.host}:${omero.db.port}/${omero.db.name}</prop>
<prop key="user">${omero.db.user}</prop>
<prop key="password">${omero.db.pass}</prop>
</props>
</property>
</bean>
<bean id="nonXaDataSource" class="bitronix.tm.resource.jdbc.PoolingDataSource">
<property name="className" value="bitronix.tm.resource.jdbc.lrc.LrcXADataSource"/>
<property name="uniqueName" ref="uuid"/>
<property name="maxPoolSize" value="${omero.db.poolsize}"/>
<!-- NPE ?? property name="loginTimeout" value="5" -->
<property name="allowLocalTransactions" value="true"/>
<property name="testQuery" value="select 1"/>
<property name="driverProperties" ref="dataSourceProperties"/>
<property name="preparedStatementCacheSize" value="${omero.db.prepared_statement_cache_size}"/>
</bean>
<alias alias="lobHandler" name="${omero.db.lob_handler}"/>
<bean id="org.springframework.jdbc.support.lob.DefaultLobHandler" class="org.springframework.jdbc.support.lob.DefaultLobHandler"/>
</beans>