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 | 72c7b83 | 2015-09-03 08:42:15 +0200 | [diff] [blame] | 41 | class="de.ids_mannheim.korap.ext.config.ExtConfiguration"> |
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" |
| 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 Hanl | 482f30d | 2015-09-25 12:39:46 +0200 | [diff] [blame] | 67 | class="de.ids_mannheim.korap.handlers.JDBCClient"> |
Michael Hanl | 72c7b83 | 2015-09-03 08:42:15 +0200 | [diff] [blame] | 68 | <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 Hanl | 482f30d | 2015-09-25 12:39:46 +0200 | [diff] [blame] | 74 | class="de.ids_mannheim.korap.handlers.JDBCAuditing"> |
Michael Hanl | 72c7b83 | 2015-09-03 08:42:15 +0200 | [diff] [blame] | 75 | <constructor-arg ref="kustvakt_db"/> |
| 76 | </bean> |
| 77 | |
| 78 | <bean id="kustvakt_userdb" |
Michael Hanl | 482f30d | 2015-09-25 12:39:46 +0200 | [diff] [blame] | 79 | class="de.ids_mannheim.korap.handlers.EntityDao"> |
Michael Hanl | 72c7b83 | 2015-09-03 08:42:15 +0200 | [diff] [blame] | 80 | <constructor-arg ref="kustvakt_db"/> |
| 81 | </bean> |
| 82 | |
Michael Hanl | 482f30d | 2015-09-25 12:39:46 +0200 | [diff] [blame] | 83 | <!--fixme: change name according to convention --> |
Michael Hanl | 72c7b83 | 2015-09-03 08:42:15 +0200 | [diff] [blame] | 84 | <bean id="collectionProvider" |
Michael Hanl | 482f30d | 2015-09-25 12:39:46 +0200 | [diff] [blame] | 85 | class="de.ids_mannheim.korap.handlers.CollectionDao"> |
Michael Hanl | 72c7b83 | 2015-09-03 08:42:15 +0200 | [diff] [blame] | 86 | <constructor-arg ref="kustvakt_db"/> |
| 87 | </bean> |
| 88 | |
Michael Hanl | 482f30d | 2015-09-25 12:39:46 +0200 | [diff] [blame] | 89 | <!--fixme: change name according to convention --> |
Michael Hanl | 72c7b83 | 2015-09-03 08:42:15 +0200 | [diff] [blame] | 90 | <bean id="resourceProvider" |
Michael Hanl | 482f30d | 2015-09-25 12:39:46 +0200 | [diff] [blame] | 91 | class="de.ids_mannheim.korap.handlers.ResourceDao"> |
Michael Hanl | 72c7b83 | 2015-09-03 08:42:15 +0200 | [diff] [blame] | 92 | <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 Hanl | 1e18cb4 | 2015-08-06 20:57:35 +0200 | [diff] [blame] | 100 | <bean name="kustvakt_encryption" |
Michael Hanl | 72c7b83 | 2015-09-03 08:42:15 +0200 | [diff] [blame] | 101 | class="de.ids_mannheim.korap.ext.security.encryption.KorAPEncryption"> |
| 102 | <constructor-arg ref="kustvakt_config"/> |
| 103 | </bean> |
| 104 | |
Michael Hanl | 72c7b83 | 2015-09-03 08:42:15 +0200 | [diff] [blame] | 105 | <!-- authentication providers to use --> |
Michael Hanl | 72c7b83 | 2015-09-03 08:42:15 +0200 | [diff] [blame] | 106 | <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 Hanl | 72c7b83 | 2015-09-03 08:42:15 +0200 | [diff] [blame] | 160 | <!-- 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 Hanl | ca740d7 | 2015-06-16 10:04:58 +0200 | [diff] [blame] | 185 | </bean> |
| 186 | </beans> |