Michael Hanl | ca740d7 | 2015-06-16 10:04:58 +0200 | [diff] [blame] | 1 | <?xml version="1.0" encoding="UTF-8"?> |
| 2 | <beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
Michael Hanl | 72c7b83 | 2015-09-03 08:42:15 +0200 | [diff] [blame] | 3 | xmlns:p="http://www.springframework.org/schema/p" |
Michael Hanl | ca740d7 | 2015-06-16 10:04:58 +0200 | [diff] [blame] | 4 | xmlns:util="http://www.springframework.org/schema/util" |
Michael Hanl | 72c7b83 | 2015-09-03 08:42:15 +0200 | [diff] [blame] | 5 | xmlns:aop="http://www.springframework.org/schema/aop" |
| 6 | xmlns:tx="http://www.springframework.org/schema/tx" |
Michael Hanl | ca740d7 | 2015-06-16 10:04:58 +0200 | [diff] [blame] | 7 | xmlns="http://www.springframework.org/schema/beans" |
Michael Hanl | 72c7b83 | 2015-09-03 08:42:15 +0200 | [diff] [blame] | 8 | xmlns:cache="http://www.springframework.org/schema/cache" |
Michael Hanl | ca740d7 | 2015-06-16 10:04:58 +0200 | [diff] [blame] | 9 | xsi:schemaLocation="http://www.springframework.org/schema/beans |
| 10 | http://www.springframework.org/schema/beans/spring-beans-4.0.xsd |
Michael Hanl | 72c7b83 | 2015-09-03 08:42:15 +0200 | [diff] [blame] | 11 | http://www.springframework.org/schema/tx |
| 12 | http://www.springframework.org/schema/tx/spring-tx-4.0.xsd |
Michael Hanl | d6eadd5 | 2015-11-11 18:30:33 +0100 | [diff] [blame] | 13 | |
| 14 | |
Michael Hanl | 72c7b83 | 2015-09-03 08:42:15 +0200 | [diff] [blame] | 15 | http://www.springframework.org/schema/aop |
| 16 | http://www.springframework.org/schema/aop/spring-aop-4.0.xsd |
| 17 | http://www.springframework.org/schema/cache |
| 18 | http://www.springframework.org/schema/cache/spring-cache-4.0.xsd |
| 19 | |
| 20 | |
Michael Hanl | ca740d7 | 2015-06-16 10:04:58 +0200 | [diff] [blame] | 21 | http://www.springframework.org/schema/util |
| 22 | http://www.springframework.org/schema/util/spring-util-4.0.xsd"> |
| 23 | |
Michael Hanl | 72c7b83 | 2015-09-03 08:42:15 +0200 | [diff] [blame] | 24 | <cache:annotation-driven/> |
Michael Hanl | d6eadd5 | 2015-11-11 18:30:33 +0100 | [diff] [blame] | 25 | |
| 26 | <bean id="props" |
| 27 | class="org.springframework.beans.factory.config.PropertiesFactoryBean"> |
| 28 | <property name="ignoreResourceNotFound" value="true"/> |
| 29 | <property name="locations"> |
| 30 | <array> |
| 31 | <value>classpath:kustvakt.conf</value> |
Michael Hanl | 38399df | 2015-11-13 16:32:19 +0100 | [diff] [blame] | 32 | <value>file:./kustvakt.conf</value> |
Michael Hanl | d6eadd5 | 2015-11-11 18:30:33 +0100 | [diff] [blame] | 33 | </array> |
| 34 | </property> |
| 35 | </bean> |
Michael Hanl | ca740d7 | 2015-06-16 10:04:58 +0200 | [diff] [blame] | 36 | |
Michael Hanl | 72c7b83 | 2015-09-03 08:42:15 +0200 | [diff] [blame] | 37 | <bean id="jdbc_props" |
| 38 | class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> |
Michael Hanl | d6eadd5 | 2015-11-11 18:30:33 +0100 | [diff] [blame] | 39 | <property name="ignoreResourceNotFound" value="true"/> |
| 40 | <property name="locations"> |
| 41 | <array> |
| 42 | <value>classpath:jdbc.properties</value> |
Michael Hanl | 38399df | 2015-11-13 16:32:19 +0100 | [diff] [blame] | 43 | <value>file:./jdbc.properties</value> |
Michael Hanl | d6eadd5 | 2015-11-11 18:30:33 +0100 | [diff] [blame] | 44 | </array> |
| 45 | </property> |
Michael Hanl | ca740d7 | 2015-06-16 10:04:58 +0200 | [diff] [blame] | 46 | </bean> |
| 47 | |
Michael Hanl | 72c7b83 | 2015-09-03 08:42:15 +0200 | [diff] [blame] | 48 | <bean id='cacheManager' |
| 49 | class='org.springframework.cache.ehcache.EhCacheCacheManager' |
| 50 | p:cacheManager-ref='ehcache'/> |
| 51 | |
| 52 | <bean id='ehcache' |
| 53 | class='org.springframework.cache.ehcache.EhCacheManagerFactoryBean' |
| 54 | p:configLocation='classpath:ehcache.xml' |
| 55 | p:shared='true'/> |
| 56 | |
| 57 | <!-- props are injected from default-config.xml --> |
Michael Hanl | 1e18cb4 | 2015-08-06 20:57:35 +0200 | [diff] [blame] | 58 | <bean id="kustvakt_config" |
Michael Hanl | f21773f | 2015-10-16 23:02:31 +0200 | [diff] [blame] | 59 | class="de.ids_mannheim.korap.config.KustvaktConfiguration"> |
Michael Hanl | ca740d7 | 2015-06-16 10:04:58 +0200 | [diff] [blame] | 60 | <property name="properties" ref="props"/> |
| 61 | </bean> |
| 62 | |
Michael Hanl | f078532 | 2015-11-13 16:14:45 +0100 | [diff] [blame] | 63 | <!--class="org.apache.commons.dbcp2.BasicDataSource"--> |
Michael Hanl | 2760cc4 | 2015-11-16 19:30:01 +0100 | [diff] [blame] | 64 | <!-- org.springframework.jdbc.datasource.SingleConnectionDataSource --> |
Michael Hanl | 72c7b83 | 2015-09-03 08:42:15 +0200 | [diff] [blame] | 65 | <bean id="dataSource" |
Michael Hanl | 1939065 | 2016-01-16 11:01:24 +0100 | [diff] [blame^] | 66 | class="org.springframework.jdbc.datasource.SingleConnectionDataSource" |
Michael Hanl | 72c7b83 | 2015-09-03 08:42:15 +0200 | [diff] [blame] | 67 | lazy-init="true"> |
| 68 | <property name="driverClassName" value="${jdbc.driverClassName}"/> |
| 69 | <property name="url" value="${jdbc.url}"/> |
| 70 | <property name="username" value="${jdbc.username}"/> |
| 71 | <property name="password" value="${jdbc.password}"/> |
| 72 | <!-- relevant for single connection datasource and sqlite --> |
Michael Hanl | 1939065 | 2016-01-16 11:01:24 +0100 | [diff] [blame^] | 73 | <property name="suppressClose"> |
| 74 | <value>true</value> |
| 75 | </property> |
| 76 | <!--<property name="initialSize" value="2"/>--> |
| 77 | <!--<property name="maxIdle" value="2"/>--> |
| 78 | <!--<property name="poolPreparedStatements" value="true"/>--> |
Michael Hanl | 72c7b83 | 2015-09-03 08:42:15 +0200 | [diff] [blame] | 79 | </bean> |
| 80 | |
| 81 | <!-- to configure database for sqlite, mysql, etc. migrations --> |
| 82 | <bean id="flyway" class="org.flywaydb.core.Flyway" init-method="migrate"> |
| 83 | <property name="baselineOnMigrate" value="false"/> |
| 84 | <property name="locations" |
| 85 | value="classpath:${jdbc.schemaPath}"/> |
| 86 | <property name="dataSource" ref="dataSource"/> |
| 87 | </bean> |
| 88 | |
| 89 | <bean id="kustvakt_db" |
Michael Hanl | 482f30d | 2015-09-25 12:39:46 +0200 | [diff] [blame] | 90 | class="de.ids_mannheim.korap.handlers.JDBCClient"> |
Michael Hanl | 72c7b83 | 2015-09-03 08:42:15 +0200 | [diff] [blame] | 91 | <constructor-arg index="0" ref="dataSource"/> |
| 92 | <!-- deprecated property --> |
| 93 | <property name="database" value="${jdbc.database}"/> |
| 94 | </bean> |
| 95 | |
| 96 | <bean id="kustvakt_auditing" |
Michael Hanl | 482f30d | 2015-09-25 12:39:46 +0200 | [diff] [blame] | 97 | class="de.ids_mannheim.korap.handlers.JDBCAuditing"> |
Michael Hanl | 72c7b83 | 2015-09-03 08:42:15 +0200 | [diff] [blame] | 98 | <constructor-arg ref="kustvakt_db"/> |
| 99 | </bean> |
| 100 | |
| 101 | <bean id="kustvakt_userdb" |
Michael Hanl | 482f30d | 2015-09-25 12:39:46 +0200 | [diff] [blame] | 102 | class="de.ids_mannheim.korap.handlers.EntityDao"> |
Michael Hanl | 72c7b83 | 2015-09-03 08:42:15 +0200 | [diff] [blame] | 103 | <constructor-arg ref="kustvakt_db"/> |
| 104 | </bean> |
| 105 | |
Michael Hanl | 482f30d | 2015-09-25 12:39:46 +0200 | [diff] [blame] | 106 | <!--fixme: change name according to convention --> |
Michael Hanl | 72c7b83 | 2015-09-03 08:42:15 +0200 | [diff] [blame] | 107 | <bean id="collectionProvider" |
Michael Hanl | 482f30d | 2015-09-25 12:39:46 +0200 | [diff] [blame] | 108 | class="de.ids_mannheim.korap.handlers.CollectionDao"> |
Michael Hanl | 72c7b83 | 2015-09-03 08:42:15 +0200 | [diff] [blame] | 109 | <constructor-arg ref="kustvakt_db"/> |
| 110 | </bean> |
| 111 | |
Michael Hanl | 482f30d | 2015-09-25 12:39:46 +0200 | [diff] [blame] | 112 | <!--fixme: change name according to convention --> |
Michael Hanl | 72c7b83 | 2015-09-03 08:42:15 +0200 | [diff] [blame] | 113 | <bean id="resourceProvider" |
Michael Hanl | 482f30d | 2015-09-25 12:39:46 +0200 | [diff] [blame] | 114 | class="de.ids_mannheim.korap.handlers.ResourceDao"> |
Michael Hanl | 72c7b83 | 2015-09-03 08:42:15 +0200 | [diff] [blame] | 115 | <constructor-arg ref="kustvakt_db"/> |
| 116 | </bean> |
| 117 | |
| 118 | <bean id="kustvakt_policies" |
Michael Hanl | f21773f | 2015-10-16 23:02:31 +0200 | [diff] [blame] | 119 | class="de.ids_mannheim.korap.security.ac.PolicyDao"> |
Michael Hanl | 72c7b83 | 2015-09-03 08:42:15 +0200 | [diff] [blame] | 120 | <constructor-arg ref="kustvakt_db"/> |
| 121 | </bean> |
| 122 | |
Michael Hanl | 1e18cb4 | 2015-08-06 20:57:35 +0200 | [diff] [blame] | 123 | <bean name="kustvakt_encryption" |
Michael Hanl | f21773f | 2015-10-16 23:02:31 +0200 | [diff] [blame] | 124 | class="de.ids_mannheim.korap.interfaces.defaults.KustvaktEncryption"> |
Michael Hanl | 72c7b83 | 2015-09-03 08:42:15 +0200 | [diff] [blame] | 125 | <constructor-arg ref="kustvakt_config"/> |
| 126 | </bean> |
| 127 | |
Michael Hanl | 72c7b83 | 2015-09-03 08:42:15 +0200 | [diff] [blame] | 128 | <!-- authentication providers to use --> |
Michael Hanl | 72c7b83 | 2015-09-03 08:42:15 +0200 | [diff] [blame] | 129 | <bean id="api_auth" |
Michael Hanl | f21773f | 2015-10-16 23:02:31 +0200 | [diff] [blame] | 130 | class="de.ids_mannheim.korap.security.auth.APIAuthentication"> |
Michael Hanl | 72c7b83 | 2015-09-03 08:42:15 +0200 | [diff] [blame] | 131 | <constructor-arg |
| 132 | type="de.ids_mannheim.korap.config.KustvaktConfiguration" |
| 133 | ref="kustvakt_config"/> |
| 134 | </bean> |
| 135 | |
| 136 | <bean id="openid_auth" |
Michael Hanl | f21773f | 2015-10-16 23:02:31 +0200 | [diff] [blame] | 137 | class="de.ids_mannheim.korap.security.auth.OpenIDconnectAuthentication"> |
Michael Hanl | 72c7b83 | 2015-09-03 08:42:15 +0200 | [diff] [blame] | 138 | <constructor-arg |
| 139 | type="de.ids_mannheim.korap.config.KustvaktConfiguration" |
| 140 | ref="kustvakt_config"/> |
| 141 | <constructor-arg |
Michael Hanl | f21773f | 2015-10-16 23:02:31 +0200 | [diff] [blame] | 142 | type="de.ids_mannheim.korap.interfaces.db.PersistenceClient" |
Michael Hanl | 72c7b83 | 2015-09-03 08:42:15 +0200 | [diff] [blame] | 143 | ref="kustvakt_db"/> |
| 144 | </bean> |
| 145 | |
| 146 | <bean id="basic_auth" |
Michael Hanl | f21773f | 2015-10-16 23:02:31 +0200 | [diff] [blame] | 147 | class="de.ids_mannheim.korap.security.auth.BasicHttpAuth"/> |
Michael Hanl | 72c7b83 | 2015-09-03 08:42:15 +0200 | [diff] [blame] | 148 | |
| 149 | |
| 150 | <bean id="session_auth" |
Michael Hanl | f21773f | 2015-10-16 23:02:31 +0200 | [diff] [blame] | 151 | class="de.ids_mannheim.korap.security.auth.SessionAuthentication"> |
Michael Hanl | 72c7b83 | 2015-09-03 08:42:15 +0200 | [diff] [blame] | 152 | <constructor-arg |
| 153 | type="de.ids_mannheim.korap.config.KustvaktConfiguration" |
| 154 | ref="kustvakt_config"/> |
| 155 | <constructor-arg |
| 156 | type="de.ids_mannheim.korap.interfaces.EncryptionIface" |
| 157 | ref="kustvakt_encryption"/> |
| 158 | </bean> |
| 159 | |
| 160 | <util:list id="auth_providers" |
| 161 | value-type="de.ids_mannheim.korap.interfaces.AuthenticationIface"> |
| 162 | <ref bean="basic_auth"/> |
| 163 | <ref bean="session_auth"/> |
| 164 | <ref bean="api_auth"/> |
| 165 | <ref bean="openid_auth"/> |
| 166 | </util:list> |
| 167 | |
| 168 | <!-- specify type for constructor argument --> |
| 169 | <bean id="kustvakt_authenticationmanager" |
Michael Hanl | f21773f | 2015-10-16 23:02:31 +0200 | [diff] [blame] | 170 | class="de.ids_mannheim.korap.security.auth.KustvaktAuthenticationManager"> |
Michael Hanl | 72c7b83 | 2015-09-03 08:42:15 +0200 | [diff] [blame] | 171 | <constructor-arg |
Michael Hanl | f21773f | 2015-10-16 23:02:31 +0200 | [diff] [blame] | 172 | type="de.ids_mannheim.korap.interfaces.db.EntityHandlerIface" |
Michael Hanl | 72c7b83 | 2015-09-03 08:42:15 +0200 | [diff] [blame] | 173 | ref="kustvakt_userdb"/> |
| 174 | <constructor-arg type="de.ids_mannheim.korap.interfaces.EncryptionIface" |
| 175 | ref="kustvakt_encryption"/> |
| 176 | <constructor-arg ref="kustvakt_config"/> |
Michael Hanl | f21773f | 2015-10-16 23:02:31 +0200 | [diff] [blame] | 177 | <constructor-arg |
| 178 | type="de.ids_mannheim.korap.interfaces.db.AuditingIface" |
| 179 | ref="kustvakt_auditing"/> |
Michael Hanl | 72c7b83 | 2015-09-03 08:42:15 +0200 | [diff] [blame] | 180 | <!-- inject authentication providers to use --> |
| 181 | <property name="providers" ref="auth_providers"/> |
| 182 | </bean> |
| 183 | |
Michael Hanl | 72c7b83 | 2015-09-03 08:42:15 +0200 | [diff] [blame] | 184 | <!-- todo: if db interfaces not loaded via spring, does transaction even work then? --> |
| 185 | <!-- the transactional advice (i.e. what 'happens'; see the <aop:advisor/> bean below) --> |
| 186 | <tx:advice id="txAdvice" transaction-manager="txManager"> |
| 187 | <!-- the transactional semantics... --> |
| 188 | <tx:attributes> |
| 189 | <!-- all methods starting with 'get' are read-only --> |
| 190 | <tx:method name="get*" read-only="true" |
| 191 | rollback-for="KorAPException"/> |
| 192 | <!-- other methods use the default transaction settings (see below) --> |
| 193 | <tx:method name="*" rollback-for="KorAPException"/> |
| 194 | </tx:attributes> |
| 195 | </tx:advice> |
| 196 | |
| 197 | <!-- ensure that the above transactional advice runs for any execution |
| 198 | of an operation defined by the service interface --> |
| 199 | <aop:config> |
| 200 | <aop:pointcut id="service" |
Michael Hanl | f21773f | 2015-10-16 23:02:31 +0200 | [diff] [blame] | 201 | expression="execution(* de.ids_mannheim.korap.interfaces.db.*.*(..))"/> |
Michael Hanl | 72c7b83 | 2015-09-03 08:42:15 +0200 | [diff] [blame] | 202 | <aop:advisor advice-ref="txAdvice" pointcut-ref="service"/> |
| 203 | </aop:config> |
| 204 | |
| 205 | <!-- similarly, don't forget the PlatformTransactionManager --> |
| 206 | <bean id="txManager" |
| 207 | class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> |
| 208 | <property name="dataSource" ref="dataSource"/> |
Michael Hanl | ca740d7 | 2015-06-16 10:04:58 +0200 | [diff] [blame] | 209 | </bean> |
| 210 | </beans> |