blob: 8466d6a3ceca8127244b49d3211d4b3714a0e719 [file] [log] [blame]
Michael Hanlca740d72015-06-16 10:04:58 +02001<?xml version="1.0" encoding="UTF-8"?>
2<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
margaretha14503cd2017-09-08 15:35:24 +02003 xmlns:p="http://www.springframework.org/schema/p"
4 xmlns:util="http://www.springframework.org/schema/util"
5 xmlns:aop="http://www.springframework.org/schema/aop"
6 xmlns:tx="http://www.springframework.org/schema/tx"
7 xmlns="http://www.springframework.org/schema/beans"
8 xmlns:context="http://www.springframework.org/schema/context"
margaretha543f2002017-07-14 00:27:15 +02009 xmlns:cache="http://www.springframework.org/schema/cache"
10 xsi:schemaLocation="http://www.springframework.org/schema/beans
11 http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
12 http://www.springframework.org/schema/tx
13 http://www.springframework.org/schema/tx/spring-tx-4.0.xsd
14 http://www.springframework.org/schema/aop
15 http://www.springframework.org/schema/aop/spring-aop-4.0.xsd
16 http://www.springframework.org/schema/context
17 http://www.springframework.org/schema/context/spring-context-4.0.xsd
18 http://www.springframework.org/schema/util
19 http://www.springframework.org/schema/util/spring-util-4.0.xsd">
20
21 <context:component-scan base-package="de.ids_mannheim.korap" />
22 <context:annotation-config />
23
margarethaade7d4a2017-07-20 19:53:35 +020024 <!-- <bean id="test" class="de.ids_mannheim.korap.web.Test">
25 <property name="config" ref="kustvakt_config" />
26 </bean> -->
27
margaretha543f2002017-07-14 00:27:15 +020028 <bean id="props"
29 class="org.springframework.beans.factory.config.PropertiesFactoryBean">
30 <property name="ignoreResourceNotFound" value="true" />
31 <property name="locations">
32 <array>
33 <value>classpath:kustvakt.conf</value>
34 <value>file:./kustvakt.conf</value>
35 </array>
36 </property>
37 </bean>
38
39 <bean id="placeholders"
40 class="org.springframework.context.support.PropertySourcesPlaceholderConfigurer">
41 <property name="ignoreResourceNotFound" value="true" />
42 <property name="locations">
43 <array>
margarethac9f1dfa2018-02-07 17:50:33 +010044 <value>classpath:*/jdbc.properties</value>
margarethaea68a0a2017-09-21 03:09:49 +020045 <value>file:./jdbc.properties</value>
margarethac9f1dfa2018-02-07 17:50:33 +010046 <value>classpath:*/hibernate.properties</value>
margarethaade7d4a2017-07-20 19:53:35 +020047 <value>classpath:kustvakt.conf</value>
margaretha14503cd2017-09-08 15:35:24 +020048 <value>file:./kustvakt.conf</value>
margaretha543f2002017-07-14 00:27:15 +020049 </array>
50 </property>
51 </bean>
52
53 <bean id='cacheManager' class='org.springframework.cache.ehcache.EhCacheCacheManager'
54 p:cacheManager-ref='ehcache' />
55
56 <bean id='ehcache'
57 class='org.springframework.cache.ehcache.EhCacheManagerFactoryBean'
58 p:configLocation='classpath:ehcache.xml' p:shared='true' />
59
60 <!-- props are injected from default-config.xml -->
margaretha56e8e552017-12-05 16:31:21 +010061 <bean id="kustvakt_config" class="de.ids_mannheim.korap.config.FullConfiguration">
margarethaf68daa62017-09-21 02:11:24 +020062 <constructor-arg name="properties" ref="props" />
margaretha543f2002017-07-14 00:27:15 +020063 </bean>
64
65 <!--class="org.apache.commons.dbcp2.BasicDataSource" -->
66 <!-- org.springframework.jdbc.datasource.SingleConnectionDataSource -->
67 <bean id="dataSource" class="org.apache.commons.dbcp2.BasicDataSource"
68 lazy-init="true">
69 <property name="driverClassName" value="${jdbc.driverClassName}" />
70 <property name="url" value="${jdbc.url}" />
71 <property name="username" value="${jdbc.username}" />
72 <property name="password" value="${jdbc.password}" />
73 <!-- relevant for single connection datasource and sqlite -->
74 <!-- <property name="suppressClose"> <value>true</value> </property> -->
75 <!--<property name="initialSize" value="2"/> -->
76 <property name="maxTotal" value="4" />
77 <property name="maxIdle" value="2" />
78 <property name="minIdle" value="1" />
79 <property name="maxWaitMillis" value="15000" />
80 <!--<property name="poolPreparedStatements" value="true"/> -->
81 </bean>
82
83 <bean id="sqliteDataSource"
84 class="org.springframework.jdbc.datasource.SingleConnectionDataSource"
85 lazy-init="true">
86 <property name="driverClassName" value="${jdbc.driverClassName}" />
87 <property name="url" value="${jdbc.url}" />
88 <property name="username" value="${jdbc.username}" />
89 <property name="password" value="${jdbc.password}" />
margarethae6c711b2018-02-06 21:55:04 +010090 <property name="connectionProperties">
91 <props>
92 <prop key="date_string_format">yyyy-MM-dd HH:mm:ss</prop>
93 </props>
94 </property>
95
margaretha543f2002017-07-14 00:27:15 +020096 <!-- relevant for single connection datasource and sqlite -->
97 <property name="suppressClose">
98 <value>true</value>
99 </property>
100 <!--<property name="initialSize" value="2"/> -->
101 <!--<property name="poolPreparedStatements" value="true"/> -->
102 </bean>
103
104 <!-- to configure database for sqlite, mysql, etc. migrations -->
105 <bean id="flyway" class="org.flywaydb.core.Flyway" init-method="migrate">
margarethaf6d5a822017-10-19 19:51:20 +0200106 <property name="baselineOnMigrate" value="true" />
margarethaecbe72d2017-07-26 17:13:32 +0200107 <!-- <property name="validateOnMigrate" value="false" /> -->
108 <!-- <property name="cleanOnValidationError" value="true" /> -->
margaretha543f2002017-07-14 00:27:15 +0200109 <property name="locations" value="${jdbc.schemaPath}" />
margaretha894a7d72017-11-08 19:24:20 +0100110 <!-- <property name="dataSource" ref="dataSource" /> -->
111 <property name="dataSource" ref="sqliteDataSource" />
margaretha543f2002017-07-14 00:27:15 +0200112 </bean>
margarethaf18298b2017-09-14 22:14:32 +0200113
114
margaretha543f2002017-07-14 00:27:15 +0200115 <bean id="kustvakt_db" class="de.ids_mannheim.korap.handlers.JDBCClient">
116 <constructor-arg index="0" ref="dataSource" />
117 <!-- deprecated property -->
118 <property name="database" value="${jdbc.database}" />
119 </bean>
120
121 <bean id="entityManagerFactory"
122 class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
margaretha894a7d72017-11-08 19:24:20 +0100123 <!-- <property name="dataSource" ref="dataSource" /> -->
124 <property name="dataSource" ref="sqliteDataSource" />
125
margaretha543f2002017-07-14 00:27:15 +0200126 <property name="packagesToScan" value="de.ids_mannheim.korap.entity" />
127 <property name="jpaVendorAdapter">
128 <bean id="jpaVendorAdapter"
129 class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
130 <property name="databasePlatform" value="${hibernate.dialect}" />
131 </bean>
132 </property>
133 <property name="jpaProperties">
134 <props>
135 <prop key="hibernate.dialect">${hibernate.dialect}</prop>
136 <prop key="hibernate.hbm2ddl.auto">${hibernate.hbm2ddl.auto}</prop>
137 <prop key="hibernate.show_sql">${hibernate.show_sql}</prop>
138 <prop key="hibernate.cache.use_query_cache">${hibernate.cache.use_query_cache}</prop>
139 <prop key="hibernate.cache.use_second_level_cache">${hibernate.cache.use_second_level_cache}
140 </prop>
141 <prop key="hibernate.cache.provider_class">${hibernate.cache.provider}</prop>
142 <prop key="hibernate.cache.region.factory_class">${hibernate.cache.region.factory}</prop>
143 <!-- <prop key="net.sf.ehcache.configurationResourceName">classpath:ehcache.xml</prop> -->
144 </props>
145 </property>
146 </bean>
147
148 <tx:annotation-driven proxy-target-class="true"
149 transaction-manager="transactionManager" />
margaretha894a7d72017-11-08 19:24:20 +0100150
margaretha543f2002017-07-14 00:27:15 +0200151 <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
152 <property name="entityManagerFactory" ref="entityManagerFactory" />
153 </bean>
154
155 <bean id="transactionTemplate"
156 class="org.springframework.transaction.support.TransactionTemplate">
157 <constructor-arg ref="transactionManager" />
158 </bean>
159
margarethaade7d4a2017-07-20 19:53:35 +0200160 <!-- Data access objects -->
161 <bean id="resourceDao" class="de.ids_mannheim.korap.dao.ResourceDao"/>
162 <!-- <bean id="annotationDao" class="de.ids_mannheim.korap.dao.AnnotationDao"/> -->
163
164 <!-- Krill -->
165 <bean id="search_krill" class="de.ids_mannheim.korap.web.SearchKrill">
166 <constructor-arg value="${krill.indexDir}"/>
margaretha543f2002017-07-14 00:27:15 +0200167 </bean>
168
margaretha56e8e552017-12-05 16:31:21 +0100169
170 <bean id="kustvakt_rewrite" class="de.ids_mannheim.korap.rewrite.FullRewriteHandler">
171 <constructor-arg ref="kustvakt_config" />
172 </bean>
173
margaretha543f2002017-07-14 00:27:15 +0200174 <bean id="kustvakt_auditing" class="de.ids_mannheim.korap.handlers.JDBCAuditing">
175 <constructor-arg ref="kustvakt_db" />
176 </bean>
177
margaretha894a7d72017-11-08 19:24:20 +0100178 <bean id="kustvakt_response"
margaretha56e8e552017-12-05 16:31:21 +0100179 class="de.ids_mannheim.korap.web.FullResponseHandler">
margaretha894a7d72017-11-08 19:24:20 +0100180 <constructor-arg index="0" name="iface" ref="kustvakt_auditing"/>
181 </bean>
182
margaretha543f2002017-07-14 00:27:15 +0200183 <bean id="kustvakt_userdb" class="de.ids_mannheim.korap.handlers.EntityDao">
184 <constructor-arg ref="kustvakt_db" />
185 </bean>
186
187 <bean id="kustvakt_admindb" class="de.ids_mannheim.korap.handlers.AdminDao">
188 <constructor-arg ref="kustvakt_db" />
189 </bean>
190
191 <bean id="resource_provider" class="de.ids_mannheim.korap.handlers.ResourceDao">
192 <constructor-arg ref="kustvakt_db" />
193 </bean>
194
195 <bean id="document_provider" class="de.ids_mannheim.korap.handlers.DocumentDao">
196 <constructor-arg ref="kustvakt_db" />
197 </bean>
198
199 <bean id="kustvakt_policies" class="de.ids_mannheim.korap.security.ac.PolicyDao">
200 <constructor-arg ref="kustvakt_db" />
201 </bean>
202
203 <bean name="kustvakt_encryption"
204 class="de.ids_mannheim.korap.interfaces.defaults.KustvaktEncryption">
205 <constructor-arg ref="kustvakt_config" />
206 </bean>
207
208 <!-- authentication providers to use -->
margaretha4de41192017-11-15 11:47:11 +0100209 <!-- <bean id="api_auth" class="de.ids_mannheim.korap.authentication.APIAuthentication">
210 <constructor-arg type="de.ids_mannheim.korap.config.KustvaktConfiguration"
211 ref="kustvakt_config" />
212 </bean> -->
213
214 <bean id="ldap_auth" class="de.ids_mannheim.korap.authentication.LdapAuth3">
margaretha543f2002017-07-14 00:27:15 +0200215 <constructor-arg type="de.ids_mannheim.korap.config.KustvaktConfiguration"
216 ref="kustvakt_config" />
217 </bean>
218
219 <bean id="openid_auth"
margaretha139d0f72017-11-14 18:56:22 +0100220 class="de.ids_mannheim.korap.authentication.OpenIDconnectAuthentication">
margaretha543f2002017-07-14 00:27:15 +0200221 <constructor-arg type="de.ids_mannheim.korap.config.KustvaktConfiguration"
222 ref="kustvakt_config" />
223 <constructor-arg
224 type="de.ids_mannheim.korap.interfaces.db.PersistenceClient" ref="kustvakt_db" />
225 </bean>
226
margaretha4b5c1412017-11-15 20:55:04 +0100227 <bean id="basic_auth" class="de.ids_mannheim.korap.authentication.BasicAuthentication" />
Michael Hanle4fc7752016-02-17 11:41:18 +0100228
229
margaretha543f2002017-07-14 00:27:15 +0200230 <bean id="session_auth"
margaretha139d0f72017-11-14 18:56:22 +0100231 class="de.ids_mannheim.korap.authentication.SessionAuthentication">
margaretha543f2002017-07-14 00:27:15 +0200232 <constructor-arg type="de.ids_mannheim.korap.config.KustvaktConfiguration"
233 ref="kustvakt_config" />
234 <constructor-arg type="de.ids_mannheim.korap.interfaces.EncryptionIface"
235 ref="kustvakt_encryption" />
236 </bean>
Michael Hanlca740d72015-06-16 10:04:58 +0200237
margaretha543f2002017-07-14 00:27:15 +0200238 <util:list id="kustvakt_authproviders"
239 value-type="de.ids_mannheim.korap.interfaces.AuthenticationIface">
240 <ref bean="basic_auth" />
margaretha4de41192017-11-15 11:47:11 +0100241 <ref bean="ldap_auth" />
margaretha543f2002017-07-14 00:27:15 +0200242 <ref bean="session_auth" />
margaretha4de41192017-11-15 11:47:11 +0100243 <!-- <ref bean="api_auth" /> -->
margaretha543f2002017-07-14 00:27:15 +0200244 <ref bean="openid_auth" />
245 </util:list>
Michael Hanl72c7b832015-09-03 08:42:15 +0200246
247
margaretha543f2002017-07-14 00:27:15 +0200248 <bean id="userdata_details" class="de.ids_mannheim.korap.handlers.UserDetailsDao">
249 <constructor-arg ref="kustvakt_db" />
250 </bean>
Michael Hanl72c7b832015-09-03 08:42:15 +0200251
margaretha543f2002017-07-14 00:27:15 +0200252 <bean id="userdata_settings" class="de.ids_mannheim.korap.handlers.UserSettingsDao">
253 <constructor-arg ref="kustvakt_db" />
254 </bean>
255
256 <util:list id="kustvakt_userdata"
257 value-type="de.ids_mannheim.korap.interfaces.db.UserdataDbIface">
258 <ref bean="userdata_details" />
259 <ref bean="userdata_settings" />
260 </util:list>
Michael Hanl72c7b832015-09-03 08:42:15 +0200261
Michael Hanldaf86602016-05-12 14:31:52 +0200262
margaretha543f2002017-07-14 00:27:15 +0200263 <util:list id="kustvakt_resources"
264 value-type="de.ids_mannheim.korap.interfaces.db.ResourceOperationIface">
265 <ref bean="document_provider" />
266 <ref bean="resource_provider" />
267 </util:list>
Michael Hanlf8fcc7a2016-06-03 17:41:07 +0200268
margaretha543f2002017-07-14 00:27:15 +0200269 <!-- specify type for constructor argument -->
270 <bean id="kustvakt_authenticationmanager"
margaretha139d0f72017-11-14 18:56:22 +0100271 class="de.ids_mannheim.korap.authentication.KustvaktAuthenticationManager">
margaretha543f2002017-07-14 00:27:15 +0200272 <constructor-arg
273 type="de.ids_mannheim.korap.interfaces.db.EntityHandlerIface" ref="kustvakt_userdb" />
274 <constructor-arg
275 type="de.ids_mannheim.korap.interfaces.db.AdminHandlerIface" ref="kustvakt_admindb" />
276 <constructor-arg type="de.ids_mannheim.korap.interfaces.EncryptionIface"
277 ref="kustvakt_encryption" />
278 <constructor-arg ref="kustvakt_config" />
279 <constructor-arg type="de.ids_mannheim.korap.interfaces.db.AuditingIface"
280 ref="kustvakt_auditing" />
281 <constructor-arg ref="kustvakt_userdata" />
282 <!-- inject authentication providers to use -->
283 <property name="providers" ref="kustvakt_authproviders" />
284 </bean>
Michael Hanldaf86602016-05-12 14:31:52 +0200285
margaretha543f2002017-07-14 00:27:15 +0200286 <!-- todo: if db interfaces not loaded via spring, does transaction even
287 work then? -->
288 <!-- the transactional advice (i.e. what 'happens'; see the <aop:advisor/>
289 bean below) -->
290 <tx:advice id="txAdvice" transaction-manager="txManager">
291 <!-- the transactional semantics... -->
292 <tx:attributes>
293 <!-- all methods starting with 'get' are read-only -->
294 <tx:method name="get*" read-only="true" rollback-for="KorAPException" />
295 <!-- other methods use the default transaction settings (see below) -->
296 <tx:method name="*" rollback-for="KorAPException" />
297 </tx:attributes>
298 </tx:advice>
Michael Hanldaf86602016-05-12 14:31:52 +0200299
margaretha543f2002017-07-14 00:27:15 +0200300 <!-- ensure that the above transactional advice runs for any execution of
301 an operation defined by the service interface -->
302 <aop:config>
303 <aop:pointcut id="service"
304 expression="execution(* de.ids_mannheim.korap.interfaces.db.*.*(..))" />
305 <aop:advisor advice-ref="txAdvice" pointcut-ref="service" />
306 </aop:config>
Michael Hanlf8fcc7a2016-06-03 17:41:07 +0200307
margaretha543f2002017-07-14 00:27:15 +0200308 <!-- similarly, don't forget the PlatformTransactionManager -->
309 <bean id="txManager"
310 class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
margaretha894a7d72017-11-08 19:24:20 +0100311 <!-- <property name="dataSource" ref="dataSource" /> -->
312 <property name="dataSource" ref="sqliteDataSource" />
margaretha543f2002017-07-14 00:27:15 +0200313 </bean>
margarethaf68daa62017-09-21 02:11:24 +0200314
margarethac9f1dfa2018-02-07 17:50:33 +0100315 <!-- mail -->
316 <!-- <bean id="smtpSession" class="org.springframework.jndi.JndiObjectFactoryBean">
317 <property name="jndiName" value="java:comp/env/mail/jetty" />
318 </bean>
319 <bean id="mailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl">
320 <property name="session" ref="smtpSession" />
321 </bean>
322 <bean id="velocityEngine" class="org.apache.velocity.app.VelocityEngine">
323 <constructor-arg index="0">
324 <props>
325 <prop key="resource.loader">class</prop>
326 <prop key="class.resource.loader.class">org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
327 </prop>
328 </props>
329 </constructor-arg>
330 </bean> -->
Michael Hanlca740d72015-06-16 10:04:58 +0200331</beans>