forked from sakaiproject/sakai
-
Notifications
You must be signed in to change notification settings - Fork 0
/
db-components.xml
502 lines (418 loc) · 20.3 KB
/
db-components.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
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
<?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.xsd">
<!-- database beans -->
<bean id="org.sakaiproject.db.impl.BasicSqlServiceSqlDefault" class="org.sakaiproject.db.impl.BasicSqlServiceSqlDefault"/>
<bean id="org.sakaiproject.db.impl.BasicSqlServiceSqlHSql" class="org.sakaiproject.db.impl.BasicSqlServiceSqlHSql"/>
<bean id="org.sakaiproject.db.impl.BasicSqlServiceSqlMySql" class="org.sakaiproject.db.impl.BasicSqlServiceSqlMySql"/>
<bean id="org.sakaiproject.db.impl.BasicSqlServiceSqlOracle" class="org.sakaiproject.db.impl.BasicSqlServiceSqlOracle"/>
<bean id="org.sakaiproject.db.api.SqlService"
class="org.sakaiproject.db.impl.BasicSqlService"
init-method="init" destroy-method="destroy">
<lookup-method name="usageSessionService" bean="org.sakaiproject.event.api.UsageSessionService" />
<lookup-method name="threadLocalManager" bean="org.sakaiproject.thread_local.api.ThreadLocalManager" />
<property name="defaultDataSource">
<ref bean="javax.sql.DataSource" />
</property>
<property name="autoDdl">
<value>${auto.ddl}</value>
</property>
<property name="commitAfterRead">
<value>false</value>
</property>
<!-- HSQLDB configuration -->
<property name="vendor">
<value>hsqldb</value>
</property>
<property name="databaseBeans">
<map>
<entry key="default"><ref bean="org.sakaiproject.db.impl.BasicSqlServiceSqlDefault"/></entry>
<entry key="hsqldb" ><ref bean="org.sakaiproject.db.impl.BasicSqlServiceSqlHSql" /></entry>
<entry key="mysql" ><ref bean="org.sakaiproject.db.impl.BasicSqlServiceSqlMySql" /></entry>
<entry key="oracle" ><ref bean="org.sakaiproject.db.impl.BasicSqlServiceSqlOracle" /></entry>
</map>
</property>
</bean>
<!-- Base DataSource for all pooled database connections -->
<!-- See http://jakarta.apache.org/commons/dbcp/configuration.html -->
<bean id="javax.sql.dbcp.BaseDataSource" abstract="true"
class="org.apache.commons.dbcp.SakaiBasicDataSource"
destroy-method="close">
<!-- The fully qualified Java class name of the JDBC driver to be used. -->
<property name="driverClassName">
<value>org.hsqldb.jdbcDriver</value>
</property>
<!-- The connection URL to be passed to our JDBC driver to establish a connection. -->
<property name="url">
<value>jdbc:hsqldb:mem:sakai</value>
</property>
<!-- The connection username to be passed to our JDBC driver to establish a connection. -->
<property name="username">
<value>sa</value>
</property>
<!-- The connection password to be passed to our JDBC driver to establish a connection. -->
<property name="password">
<value></value>
</property>
<!-- The initial number of connections that are created when the pool is started. -->
<property name="initialSize">
<value>10</value>
</property>
<!-- The maximum number of active connections that can be allocated from this pool at the same time, or negative for no limit. -->
<property name="maxActive">
<value>50</value>
</property>
<!-- The maximum number of active connections that can remain idle in the pool, without extra ones being released, or negative for no limit. -->
<property name="maxIdle">
<value>10</value>
</property>
<!-- The minimum number of active connections that can remain idle in the pool, without extra ones being created, or 0 to create none. -->
<property name="minIdle">
<value>0</value>
</property>
<!-- The maximum number of milliseconds that the pool will wait (when there
are no available connections) for a connection to be returned before
throwing an exception, or -1 to wait indefinitely. -->
<property name="maxWait">
<value>300000</value>
</property>
<!-- The number of objects to examine during each run of the idle object
evictor thread (if any). -->
<property name="numTestsPerEvictionRun">
<value>3</value>
</property>
<!-- The indication of whether objects will be validated before being
borrowed from the pool. If the object fails to validate, it will be
dropped from the pool, and we will attempt to borrow another.
Note: this has been shown to cause performance problems with Oracle (leave it false) -->
<property name="testOnBorrow">
<value>true</value>
</property>
<!-- The indication of whether objects will be validated before being
returned to the pool. -->
<property name="testOnReturn">
<value>false</value>
</property>
<!-- The indication of whether objects will be validated by the idle object
evictor (if any). If an object fails to validate, it will be dropped from
the pool. -->
<property name="testWhileIdle">
<value>false</value>
</property>
<!-- The SQL query that will be used to validate connections from this pool
before returning them to the caller. If specified, this query MUST be a
SQL SELECT statement that returns at least one row.
Note: This has been shown to cause performance problems under Oracle: leave it unset. -->
<property name="validationQuery">
<value>select 1 from INFORMATION_SCHEMA.SYSTEM_USERS</value>
</property>
<!-- The default auto-commit state of connections created by this pool. -->
<property name="defaultAutoCommit">
<value>false</value>
</property>
<!-- The default read-only state of connections created by this pool. -->
<property name="defaultReadOnly">
<value>false</value>
</property>
<!-- Use TRANSACTION_READ_COMMITTED for MySQL -->
<!-- DO NOT SET for Oracle (the default TRANSACTION_READ_COMMITTED is fine, and setting it causes performance problems) -->
<!-- Up to and including 1.7.1, HSQLDB supports only Connection.TRANSACTION_READ_UNCOMMITTED. -->
<property name="defaultTransactionIsolationString">
<value>TRANSACTION_READ_UNCOMMITTED</value>
</property>
<!-- Prepared statement pooling for this pool. -->
<property name="poolPreparedStatements">
<value>false</value>
</property>
<!-- The maximum number of open statements that can be allocated from the
statement pool at the same time, or zero for no limit. Since a connection
usually only uses one or two statements at a time, this is mostly used to
help detect resource leaks. -->
<property name="maxOpenPreparedStatements">
<value>0</value>
</property>
<!-- The minimum amount of time an object may sit idle in the pool before it
is eligable for eviction by the idle object evictor (if any). -->
<property name="minEvictableIdleTimeMillis">
<value>1800000</value>
</property>
<!-- The number of milliseconds to sleep between runs of the idle object
evictor thread. When non-positive, no idle object evictor thread will be
run. -->
<property name="timeBetweenEvictionRunsMillis">
<value>900000</value>
</property>
</bean>
<bean id="javax.sql.hikaricp.BaseDataSource" abstract="true"
class="org.sakaiproject.hikaricp.jdbc.pool.SakaiBasicDataSource"
init-method="init"
destroy-method="close">
<!-- The fully qualified Java class name of the JDBC driver to be used. -->
<property name="driverClassName">
<value>org.hsqldb.jdbcDriver</value>
</property>
<!-- The connection URL to be passed to our JDBC driver to establish a connection. -->
<property name="url">
<value>jdbc:hsqldb:mem:sakai</value>
</property>
<!-- The connection username to be passed to our JDBC driver to establish a connection. -->
<property name="username">
<value>sa</value>
</property>
<!-- The connection password to be passed to our JDBC driver to establish a connection. -->
<property name="password">
<value></value>
</property>
<!-- Use TRANSACTION_READ_COMMITTED for MySQL -->
<!-- DO NOT SET for Oracle (the default TRANSACTION_READ_COMMITTED is fine, and setting it causes performance problems) -->
<!-- Up to and including 1.7.1, HSQLDB supports only Connection.TRANSACTION_READ_UNCOMMITTED. -->
<property name="defaultTransactionIsolationString">
<value>TRANSACTION_READ_UNCOMMITTED</value>
</property>
<!-- Whether or not to autocommit, setting to true is causing an error in content, so might not be a great idea -->
<property name="autoCommit">
<value>false</value>
</property>
<!-- These are some of the additional hikari properties. See the webpage for more info https://github.com/brettwooldridge/HikariCP
Note: There *may* be some other much less commonly used beans that cannot or are not currently defined here. Check the webpage if you want to see them. -->
<!-- Number of ms to wait for a connection, default 30 seconds -->
<property name="connectionTimeout">
<value>30000</value>
</property>
<!-- Time that a connection is allowed to sit idle, default 10 minutes -->
<property name="idleTimeout">
<value>600000</value>
</property>
<!-- This property controls the maximum lifetime of a connection in the pool, default 30 minutes -->
<property name="maxLifetime">
<value>1800000</value>
</property>
<!-- If your driver supports JDBC4 we strongly recommend not setting this property. This is for "legacy" databases that do not support the JDBC4 Connection.isValid() API. Default null (important). -->
<!-- This seems like it might need to be specified with MySQL to something like "SELECT 1" depending on the driver: https://github.com/brettwooldridge/HikariCP/issues/206 -->
<property name="connectionTestQuery">
<null />
</property>
<!-- This property controls the minimum number of idle connections that HikariCP tries to maintain in the pool. Default 10 -->
<property name="minimumIdle">
<value>10</value>
</property>
<!-- This property controls the maximum size of the pool for idle and in use. Default 50 -->
<property name="maximumPoolSize">
<value>50</value>
</property>
<!-- Register MBeans -->
<property name="registerMbeans">
<value>true</value>
</property>
<!-- The default name of the pool -->
<property name="poolName">
<value>sakai</value>
</property>
<!-- The timeout for running validation query. Must be less than connectionTimeout. Default is 5000 (5 sec). Cannot be less than 1000 (1 sec). -->
<property name="validationTimeout">
<value>5000</value>
</property>
<!-- Additional data source properties -->
<property name="dataSourceProperties">
<props>
<prop key="cachePrepStmts">true</prop>
<prop key="prepStmtCacheSize">250</prop>
<prop key="prepStmtCacheSqlLimit">2048</prop>
<prop key="useServerPrepStmts">true</prop>
</props>
</property>
</bean>
<bean id="javax.sql.tomcat.BaseDataSource" abstract="true"
class="org.sakaiproject.tomcat.jdbc.pool.SakaiBasicDataSource"
init-method="init"
destroy-method="close">
<!-- The fully qualified Java class name of the JDBC driver to be used. -->
<property name="driverClassName">
<value>org.hsqldb.jdbcDriver</value>
</property>
<!-- The connection URL to be passed to our JDBC driver to establish a connection. -->
<property name="url">
<value>jdbc:hsqldb:mem:sakai</value>
</property>
<!-- The connection username to be passed to our JDBC driver to establish a connection. -->
<property name="username">
<value>sa</value>
</property>
<!-- The connection password to be passed to our JDBC driver to establish a connection. -->
<property name="password">
<value></value>
</property>
<!-- The initial number of connections that are created when the pool is started. -->
<property name="initialSize">
<value>10</value>
</property>
<!-- The maximum number of active connections that can be allocated from this pool at the same time, or negative for no limit. -->
<property name="maxActive">
<value>50</value>
</property>
<!-- The maximum number of active connections that can remain idle in the pool, without extra ones being released, or negative for no limit. -->
<property name="maxIdle">
<value>10</value>
</property>
<!-- The minimum number of active connections that can remain idle in the pool, without extra ones being created, or 0 to create none. -->
<property name="minIdle">
<value>0</value>
</property>
<!-- The maximum number of milliseconds that the pool will wait (when there
are no available connections) for a connection to be returned before
throwing an exception, or -1 to wait indefinitely. -->
<property name="maxWait">
<value>300000</value>
</property>
<!-- The number of objects to examine during each run of the idle object
evictor thread (if any). -->
<property name="numTestsPerEvictionRun">
<value>3</value>
</property>
<!-- The indication of whether objects will be validated before being
borrowed from the pool. If the object fails to validate, it will be
dropped from the pool, and we will attempt to borrow another.
Note: this has been shown to cause performance problems with Oracle (leave it false) -->
<property name="testOnBorrow">
<value>true</value>
</property>
<!-- The indication of whether objects will be validated before being
returned to the pool. -->
<property name="testOnReturn">
<value>false</value>
</property>
<!-- The indication of whether objects will be validated by the idle object
evictor (if any). If an object fails to validate, it will be dropped from
the pool. -->
<property name="testWhileIdle">
<value>false</value>
</property>
<!-- The SQL query that will be used to validate connections from this pool
before returning them to the caller. If specified, this query MUST be a
SQL SELECT statement that returns at least one row.
Note: This has been shown to cause performance problems under Oracle: leave it unset. -->
<property name="validationQuery">
<value>select 1 from INFORMATION_SCHEMA.SYSTEM_USERS</value>
</property>
<!-- The default auto-commit state of connections created by this pool. -->
<property name="defaultAutoCommit">
<value>false</value>
</property>
<!-- The default read-only state of connections created by this pool. -->
<property name="defaultReadOnly">
<value>false</value>
</property>
<!-- Use TRANSACTION_READ_COMMITTED for MySQL -->
<!-- DO NOT SET for Oracle (the default TRANSACTION_READ_COMMITTED is fine, and setting it causes performance problems) -->
<!-- Up to and including 1.7.1, HSQLDB supports only Connection.TRANSACTION_READ_UNCOMMITTED. -->
<property name="defaultTransactionIsolationString">
<value>TRANSACTION_READ_UNCOMMITTED</value>
</property>
<!-- Prepared statement pooling for this pool. -->
<property name="poolPreparedStatements">
<value>false</value>
</property>
<!-- The maximum number of open statements that can be allocated from the
statement pool at the same time, or zero for no limit. Since a connection
usually only uses one or two statements at a time, this is mostly used to
help detect resource leaks. -->
<property name="maxOpenPreparedStatements">
<value>0</value>
</property>
<!-- The minimum amount of time an object may sit idle in the pool before it
is eligable for eviction by the idle object evictor (if any). -->
<property name="minEvictableIdleTimeMillis">
<value>1800000</value>
</property>
<!-- The number of milliseconds to sleep between runs of the idle object
evictor thread. When non-positive, no idle object evictor thread will be
run. -->
<property name="timeBetweenEvictionRunsMillis">
<value>900000</value>
</property>
</bean>
<!-- Backward property compatibility -->
<bean id="javax.sql.BaseDataSource" parent="javax.sql.hikaricp.BaseDataSource">
</bean>
<!-- Shared DataSource for all pooled database connections -->
<bean id="javax.sql.DataSource" parent="javax.sql.BaseDataSource">
</bean>
<!-- Proxy which will keep only get the connection if one is actually needed,
this is especially helpful when using hibernate or wrapping transactions around requests
because it keeps the connection from being opened and held if it is not needed -->
<bean id="javax.sql.LazyDataSource" class="org.springframework.jdbc.datasource.LazyConnectionDataSourceProxy">
<property name="targetDataSource" ref="javax.sql.DataSource" />
</bean>
<bean id="org.sakaiproject.springframework.orm.hibernate.SakaiPersistenceUnitManager"
class="org.sakaiproject.springframework.orm.hibernate.SakaiPersistenceUnitManager">
<property name="dataSource" ref="javax.sql.LazyDataSource"/>
<property name="persistenceUnitPostProcessors">
<list>
<bean class="org.sakaiproject.springframework.orm.hibernate.AddablePersistenceUnit"/>
</list>
</property>
<property name="serverConfigurationService" ref="org.sakaiproject.component.api.ServerConfigurationService"/>
</bean>
<!-- The "Global" JPA Entity Manager Factory -->
<bean id="entityManagerFactory"
class="org.sakaiproject.ignite.IgniteEntityManagerFactoryBean">
<property name="ignite" ref="org.sakaiproject.ignite.SakaiIgniteConfiguration" />
<property name="jpaVendorAdapter">
<bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter" />
</property>
<property name="jpaDialect">
<bean class="org.springframework.orm.jpa.vendor.HibernateJpaDialect" />
</property>
<property name="persistenceUnitManager" ref="org.sakaiproject.springframework.orm.hibernate.SakaiPersistenceUnitManager" />
<property name="jpaProperties">
<props>
<prop key="hibernate.dialect">${hibernate.dialect}</prop>
<prop key="hibernate.show_sql">${hibernate.show_sql}</prop>
<prop key="hibernate.query.substitutions">true 1, false 0, yes 'Y', no 'N'</prop>
<prop key="hibernate.jdbc.use_streams_for_binary">true</prop>
<prop key="hibernate.cache.use_query_cache">true</prop>
<prop key="hibernate.use_second_level_cache">true</prop>
<prop key="hibernate.cache.region.factory_class">org.apache.ignite.cache.hibernate.HibernateRegionFactory</prop>
<prop key="hibernate.generate_statistics">${hibernate.generate_statistics}</prop>
<prop key="hibernate.enable_lazy_load_no_trans">true</prop>
<prop key="hibernate.current_session_context_class">org.springframework.orm.hibernate5.SpringSessionContext</prop>
<prop key="org.apache.ignite.hibernate.default_access_type">READ_ONLY</prop>
<prop key="hibernate.id.new_generator_mappings">false</prop>
<prop key="javax.persistence.query.timeout">30000</prop>
</props>
</property>
</bean>
<!-- The "Global" Session Factory -->
<bean id="org.sakaiproject.springframework.orm.hibernate.GlobalSessionFactory"
class="org.springframework.orm.jpa.vendor.HibernateJpaSessionFactoryBean">
<property name="entityManagerFactory" ref="entityManagerFactory"/>
</bean>
<!-- The "Global" Transaction Manager -->
<bean id="org.sakaiproject.springframework.orm.hibernate.GlobalTransactionManager"
class="org.springframework.orm.hibernate5.HibernateTransactionManager">
<property name="sessionFactory" ref="org.sakaiproject.springframework.orm.hibernate.GlobalSessionFactory"/>
</bean>
<!-- The "Global" JPA Transaction Manager -->
<bean id="org.sakaiproject.springframework.orm.jpa.GlobalJpaTransactionManager"
class="org.springframework.orm.jpa.JpaTransactionManager">
<constructor-arg ref="entityManagerFactory"/>
</bean>
<!-- Alias for the GlobalTransactionManager to follow the springs default naming convention -->
<alias name="org.sakaiproject.springframework.orm.hibernate.GlobalTransactionManager"
alias="transactionManager"/>
<!-- Alias for the GlobalJpaTransactionManager to follow the springs default naming convention -->
<alias name="org.sakaiproject.springframework.orm.jpa.GlobalJpaTransactionManager"
alias="jpaTransactionManager"/>
<!-- enables JMX on hibernate -->
<bean id="org.sakaiproject.springframework.orm.hibernate.GlobalSessionFactory.statistics"
factory-bean="org.sakaiproject.springframework.orm.hibernate.GlobalSessionFactory"
factory-method="getStatistics"/>
<bean id="org.sakaiproject.springframework.orm.hibernate.jmxExporter" class="org.springframework.jmx.export.MBeanExporter">
<property name="beans">
<map>
<entry key="Hibernate:type=statistics" value-ref="org.sakaiproject.springframework.orm.hibernate.GlobalSessionFactory.statistics"/>
</map>
</property>
</bean>
</beans>