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