blob: 4f7d23b295946be2f7014a33d1d912b264b3802c [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"
Michael Hanl72c7b832015-09-03 08:42:15 +02003 xmlns:p="http://www.springframework.org/schema/p"
Michael Hanlca740d72015-06-16 10:04:58 +02004 xmlns:util="http://www.springframework.org/schema/util"
Michael Hanl72c7b832015-09-03 08:42:15 +02005 xmlns:aop="http://www.springframework.org/schema/aop"
6 xmlns:tx="http://www.springframework.org/schema/tx"
Michael Hanlca740d72015-06-16 10:04:58 +02007 xmlns="http://www.springframework.org/schema/beans"
Michael Hanl72c7b832015-09-03 08:42:15 +02008 xmlns:cache="http://www.springframework.org/schema/cache"
Michael Hanlca740d72015-06-16 10:04:58 +02009 xsi:schemaLocation="http://www.springframework.org/schema/beans
10 http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
Michael Hanl72c7b832015-09-03 08:42:15 +020011 http://www.springframework.org/schema/tx
12 http://www.springframework.org/schema/tx/spring-tx-4.0.xsd
13 http://www.springframework.org/schema/aop
14 http://www.springframework.org/schema/aop/spring-aop-4.0.xsd
15 http://www.springframework.org/schema/cache
16 http://www.springframework.org/schema/cache/spring-cache-4.0.xsd
17
18
Michael Hanlca740d72015-06-16 10:04:58 +020019 http://www.springframework.org/schema/util
20 http://www.springframework.org/schema/util/spring-util-4.0.xsd">
21
Michael Hanl72c7b832015-09-03 08:42:15 +020022 <cache:annotation-driven/>
Michael Hanlca740d72015-06-16 10:04:58 +020023 <util:properties id="props" location="classpath:kustvakt.conf"/>
24
Michael Hanl72c7b832015-09-03 08:42:15 +020025 <bean id="jdbc_props"
26 class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
27 <property name="locations" value="classpath:jdbc.properties"/>
Michael Hanlca740d72015-06-16 10:04:58 +020028 </bean>
29
Michael Hanl72c7b832015-09-03 08:42:15 +020030 <bean id='cacheManager'
31 class='org.springframework.cache.ehcache.EhCacheCacheManager'
32 p:cacheManager-ref='ehcache'/>
33
34 <bean id='ehcache'
35 class='org.springframework.cache.ehcache.EhCacheManagerFactoryBean'
36 p:configLocation='classpath:ehcache.xml'
37 p:shared='true'/>
38
39 <!-- props are injected from default-config.xml -->
Michael Hanl1e18cb42015-08-06 20:57:35 +020040 <bean id="kustvakt_config"
Michael Hanl72c7b832015-09-03 08:42:15 +020041 class="de.ids_mannheim.korap.ext.config.ExtConfiguration">
Michael Hanlca740d72015-06-16 10:04:58 +020042 <property name="properties" ref="props"/>
43 </bean>
44
Michael Hanl72c7b832015-09-03 08:42:15 +020045 <bean id="dataSource"
46 class="org.springframework.jdbc.datasource.SingleConnectionDataSource"
47 lazy-init="true">
48 <property name="driverClassName" value="${jdbc.driverClassName}"/>
49 <property name="url" value="${jdbc.url}"/>
50 <property name="username" value="${jdbc.username}"/>
51 <property name="password" value="${jdbc.password}"/>
52 <!-- relevant for single connection datasource and sqlite -->
53 <property name="suppressClose">
54 <value>true</value>
55 </property>
56 </bean>
57
58 <!-- to configure database for sqlite, mysql, etc. migrations -->
59 <bean id="flyway" class="org.flywaydb.core.Flyway" init-method="migrate">
60 <property name="baselineOnMigrate" value="false"/>
61 <property name="locations"
62 value="classpath:${jdbc.schemaPath}"/>
63 <property name="dataSource" ref="dataSource"/>
64 </bean>
65
66 <bean id="kustvakt_db"
Michael Hanl482f30d2015-09-25 12:39:46 +020067 class="de.ids_mannheim.korap.handlers.JDBCClient">
Michael Hanl72c7b832015-09-03 08:42:15 +020068 <constructor-arg index="0" ref="dataSource"/>
69 <!-- deprecated property -->
70 <property name="database" value="${jdbc.database}"/>
71 </bean>
72
73 <bean id="kustvakt_auditing"
Michael Hanl482f30d2015-09-25 12:39:46 +020074 class="de.ids_mannheim.korap.handlers.JDBCAuditing">
Michael Hanl72c7b832015-09-03 08:42:15 +020075 <constructor-arg ref="kustvakt_db"/>
76 </bean>
77
78 <bean id="kustvakt_userdb"
Michael Hanl482f30d2015-09-25 12:39:46 +020079 class="de.ids_mannheim.korap.handlers.EntityDao">
Michael Hanl72c7b832015-09-03 08:42:15 +020080 <constructor-arg ref="kustvakt_db"/>
81 </bean>
82
Michael Hanl482f30d2015-09-25 12:39:46 +020083 <!--fixme: change name according to convention -->
Michael Hanl72c7b832015-09-03 08:42:15 +020084 <bean id="collectionProvider"
Michael Hanl482f30d2015-09-25 12:39:46 +020085 class="de.ids_mannheim.korap.handlers.CollectionDao">
Michael Hanl72c7b832015-09-03 08:42:15 +020086 <constructor-arg ref="kustvakt_db"/>
87 </bean>
88
Michael Hanl482f30d2015-09-25 12:39:46 +020089 <!--fixme: change name according to convention -->
Michael Hanl72c7b832015-09-03 08:42:15 +020090 <bean id="resourceProvider"
Michael Hanl482f30d2015-09-25 12:39:46 +020091 class="de.ids_mannheim.korap.handlers.ResourceDao">
Michael Hanl72c7b832015-09-03 08:42:15 +020092 <constructor-arg ref="kustvakt_db"/>
93 </bean>
94
95 <bean id="kustvakt_policies"
96 class="de.ids_mannheim.korap.ext.security.dataAccess.PolicyDao">
97 <constructor-arg ref="kustvakt_db"/>
98 </bean>
99
Michael Hanl1e18cb42015-08-06 20:57:35 +0200100 <bean name="kustvakt_encryption"
Michael Hanl72c7b832015-09-03 08:42:15 +0200101 class="de.ids_mannheim.korap.ext.security.encryption.KorAPEncryption">
102 <constructor-arg ref="kustvakt_config"/>
103 </bean>
104
Michael Hanl72c7b832015-09-03 08:42:15 +0200105 <!-- authentication providers to use -->
Michael Hanl72c7b832015-09-03 08:42:15 +0200106 <bean id="api_auth"
107 class="de.ids_mannheim.korap.ext.security.authentication.APIAuthentication">
108 <constructor-arg
109 type="de.ids_mannheim.korap.config.KustvaktConfiguration"
110 ref="kustvakt_config"/>
111 </bean>
112
113 <bean id="openid_auth"
114 class="de.ids_mannheim.korap.ext.security.authentication.OpenIDconnectAuthentication">
115 <constructor-arg
116 type="de.ids_mannheim.korap.config.KustvaktConfiguration"
117 ref="kustvakt_config"/>
118 <constructor-arg
119 type="de.ids_mannheim.korap.interfaces.PersistenceClient"
120 ref="kustvakt_db"/>
121 </bean>
122
123 <bean id="basic_auth"
124 class="de.ids_mannheim.korap.ext.security.authentication.BasicHttpAuth"/>
125
126
127 <bean id="session_auth"
128 class="de.ids_mannheim.korap.ext.security.authentication.SessionAuthentication">
129 <constructor-arg
130 type="de.ids_mannheim.korap.config.KustvaktConfiguration"
131 ref="kustvakt_config"/>
132 <constructor-arg
133 type="de.ids_mannheim.korap.interfaces.EncryptionIface"
134 ref="kustvakt_encryption"/>
135 </bean>
136
137 <util:list id="auth_providers"
138 value-type="de.ids_mannheim.korap.interfaces.AuthenticationIface">
139 <ref bean="basic_auth"/>
140 <ref bean="session_auth"/>
141 <ref bean="api_auth"/>
142 <ref bean="openid_auth"/>
143 </util:list>
144
145 <!-- specify type for constructor argument -->
146 <bean id="kustvakt_authenticationmanager"
147 class="de.ids_mannheim.korap.ext.security.authentication.KustvaktAuthenticationManager">
148 <constructor-arg
149 type="de.ids_mannheim.korap.interfaces.EntityHandlerIface"
150 ref="kustvakt_userdb"/>
151 <constructor-arg type="de.ids_mannheim.korap.interfaces.EncryptionIface"
152 ref="kustvakt_encryption"/>
153 <constructor-arg ref="kustvakt_config"/>
154 <constructor-arg type="de.ids_mannheim.korap.interfaces.AuditingIface"
155 ref="kustvakt_auditing"/>
156 <!-- inject authentication providers to use -->
157 <property name="providers" ref="auth_providers"/>
158 </bean>
159
Michael Hanl72c7b832015-09-03 08:42:15 +0200160 <!-- todo: if db interfaces not loaded via spring, does transaction even work then? -->
161 <!-- the transactional advice (i.e. what 'happens'; see the <aop:advisor/> bean below) -->
162 <tx:advice id="txAdvice" transaction-manager="txManager">
163 <!-- the transactional semantics... -->
164 <tx:attributes>
165 <!-- all methods starting with 'get' are read-only -->
166 <tx:method name="get*" read-only="true"
167 rollback-for="KorAPException"/>
168 <!-- other methods use the default transaction settings (see below) -->
169 <tx:method name="*" rollback-for="KorAPException"/>
170 </tx:attributes>
171 </tx:advice>
172
173 <!-- ensure that the above transactional advice runs for any execution
174 of an operation defined by the service interface -->
175 <aop:config>
176 <aop:pointcut id="service"
177 expression="execution(* de.ids_mannheim.korap.interfaces.*.*(..))"/>
178 <aop:advisor advice-ref="txAdvice" pointcut-ref="service"/>
179 </aop:config>
180
181 <!-- similarly, don't forget the PlatformTransactionManager -->
182 <bean id="txManager"
183 class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
184 <property name="dataSource" ref="dataSource"/>
Michael Hanlca740d72015-06-16 10:04:58 +0200185 </bean>
186</beans>