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