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" |
| 67 | class="de.ids_mannheim.korap.ext.database.JDBCClient"> |
| 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" |
| 74 | class="de.ids_mannheim.korap.ext.database.JDBCAuditing"> |
| 75 | <constructor-arg ref="kustvakt_db"/> |
| 76 | </bean> |
| 77 | |
| 78 | <bean id="kustvakt_userdb" |
| 79 | class="de.ids_mannheim.korap.ext.database.EntityDao"> |
| 80 | <constructor-arg ref="kustvakt_db"/> |
| 81 | </bean> |
| 82 | |
| 83 | <bean id="collectionProvider" |
| 84 | class="de.ids_mannheim.korap.ext.database.CollectionDao"> |
| 85 | <constructor-arg ref="kustvakt_db"/> |
| 86 | </bean> |
| 87 | |
| 88 | <bean id="resourceProvider" |
| 89 | class="de.ids_mannheim.korap.ext.database.ResourceDao"> |
| 90 | <constructor-arg ref="kustvakt_db"/> |
| 91 | </bean> |
| 92 | |
| 93 | <bean id="kustvakt_policies" |
| 94 | class="de.ids_mannheim.korap.ext.security.dataAccess.PolicyDao"> |
| 95 | <constructor-arg ref="kustvakt_db"/> |
| 96 | </bean> |
| 97 | |
Michael Hanl | 1e18cb4 | 2015-08-06 20:57:35 +0200 | [diff] [blame] | 98 | <bean name="kustvakt_encryption" |
Michael Hanl | 72c7b83 | 2015-09-03 08:42:15 +0200 | [diff] [blame^] | 99 | class="de.ids_mannheim.korap.ext.security.encryption.KorAPEncryption"> |
| 100 | <constructor-arg ref="kustvakt_config"/> |
| 101 | </bean> |
| 102 | |
| 103 | <bean id="resourceHandler" |
| 104 | class="de.ids_mannheim.korap.ext.security.accessControl.ResourceHandler"/> |
| 105 | |
| 106 | |
| 107 | <!-- authentication providers to use --> |
| 108 | |
| 109 | <bean id="api_auth" |
| 110 | class="de.ids_mannheim.korap.ext.security.authentication.APIAuthentication"> |
| 111 | <constructor-arg |
| 112 | type="de.ids_mannheim.korap.config.KustvaktConfiguration" |
| 113 | ref="kustvakt_config"/> |
| 114 | </bean> |
| 115 | |
| 116 | <bean id="openid_auth" |
| 117 | class="de.ids_mannheim.korap.ext.security.authentication.OpenIDconnectAuthentication"> |
| 118 | <constructor-arg |
| 119 | type="de.ids_mannheim.korap.config.KustvaktConfiguration" |
| 120 | ref="kustvakt_config"/> |
| 121 | <constructor-arg |
| 122 | type="de.ids_mannheim.korap.interfaces.PersistenceClient" |
| 123 | ref="kustvakt_db"/> |
| 124 | </bean> |
| 125 | |
| 126 | <bean id="basic_auth" |
| 127 | class="de.ids_mannheim.korap.ext.security.authentication.BasicHttpAuth"/> |
| 128 | |
| 129 | |
| 130 | <bean id="session_auth" |
| 131 | class="de.ids_mannheim.korap.ext.security.authentication.SessionAuthentication"> |
| 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" |
| 150 | class="de.ids_mannheim.korap.ext.security.authentication.KustvaktAuthenticationManager"> |
| 151 | <constructor-arg |
| 152 | type="de.ids_mannheim.korap.interfaces.EntityHandlerIface" |
| 153 | ref="kustvakt_userdb"/> |
| 154 | <constructor-arg type="de.ids_mannheim.korap.interfaces.EncryptionIface" |
| 155 | ref="kustvakt_encryption"/> |
| 156 | <constructor-arg ref="kustvakt_config"/> |
| 157 | <constructor-arg type="de.ids_mannheim.korap.interfaces.AuditingIface" |
| 158 | ref="kustvakt_auditing"/> |
| 159 | <!-- inject authentication providers to use --> |
| 160 | <property name="providers" ref="auth_providers"/> |
| 161 | </bean> |
| 162 | |
| 163 | <!-- |
| 164 | <util:list id="providers" |
| 165 | value-type="de.ids_mannheim.korap.ext.interfaces.ResourceOperationIface"> |
| 166 | <ref bean="resourceProvider"/> |
| 167 | <ref bean="collectionProvider"/> |
| 168 | </util:list> |
| 169 | --> |
| 170 | |
| 171 | <!-- todo: if db interfaces not loaded via spring, does transaction even work then? --> |
| 172 | <!-- the transactional advice (i.e. what 'happens'; see the <aop:advisor/> bean below) --> |
| 173 | <tx:advice id="txAdvice" transaction-manager="txManager"> |
| 174 | <!-- the transactional semantics... --> |
| 175 | <tx:attributes> |
| 176 | <!-- all methods starting with 'get' are read-only --> |
| 177 | <tx:method name="get*" read-only="true" |
| 178 | rollback-for="KorAPException"/> |
| 179 | <!-- other methods use the default transaction settings (see below) --> |
| 180 | <tx:method name="*" rollback-for="KorAPException"/> |
| 181 | </tx:attributes> |
| 182 | </tx:advice> |
| 183 | |
| 184 | <!-- ensure that the above transactional advice runs for any execution |
| 185 | of an operation defined by the service interface --> |
| 186 | <aop:config> |
| 187 | <aop:pointcut id="service" |
| 188 | expression="execution(* de.ids_mannheim.korap.interfaces.*.*(..))"/> |
| 189 | <aop:advisor advice-ref="txAdvice" pointcut-ref="service"/> |
| 190 | </aop:config> |
| 191 | |
| 192 | <!-- similarly, don't forget the PlatformTransactionManager --> |
| 193 | <bean id="txManager" |
| 194 | class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> |
| 195 | <property name="dataSource" ref="dataSource"/> |
Michael Hanl | ca740d7 | 2015-06-16 10:04:58 +0200 | [diff] [blame] | 196 | </bean> |
| 197 | </beans> |