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