| margaretha | 46e2c95 | 2024-05-23 09:09:54 +0200 | [diff] [blame] | 1 | <?xml version="1.0" encoding="UTF-8"?> | 
|  | 2 | <beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | 
|  | 3 | xmlns:p="http://www.springframework.org/schema/p" | 
|  | 4 | xmlns:util="http://www.springframework.org/schema/util" | 
|  | 5 | xmlns:aop="http://www.springframework.org/schema/aop" | 
|  | 6 | xmlns:tx="http://www.springframework.org/schema/tx" | 
|  | 7 | xmlns="http://www.springframework.org/schema/beans" | 
|  | 8 | xmlns:context="http://www.springframework.org/schema/context" | 
|  | 9 | xmlns:cache="http://www.springframework.org/schema/cache" | 
|  | 10 | xsi:schemaLocation="http://www.springframework.org/schema/beans | 
|  | 11 | http://www.springframework.org/schema/beans/spring-beans.xsd | 
|  | 12 | http://www.springframework.org/schema/tx | 
|  | 13 | http://www.springframework.org/schema/tx/spring-tx.xsd | 
|  | 14 | http://www.springframework.org/schema/aop | 
|  | 15 | http://www.springframework.org/schema/aop/spring-aop.xsd | 
|  | 16 | http://www.springframework.org/schema/context | 
|  | 17 | http://www.springframework.org/schema/context/spring-context.xsd | 
|  | 18 | http://www.springframework.org/schema/util | 
|  | 19 | http://www.springframework.org/schema/util/spring-util.xsd"> | 
|  | 20 |  | 
|  | 21 | <context:component-scan | 
|  | 22 | base-package="de.ids_mannheim.korap" /> | 
|  | 23 | <context:annotation-config /> | 
|  | 24 |  | 
|  | 25 | <bean id="props" | 
|  | 26 | class="org.springframework.beans.factory.config.PropertiesFactoryBean"> | 
|  | 27 | <property name="ignoreResourceNotFound" value="true" /> | 
|  | 28 | <property name="locations"> | 
|  | 29 | <array> | 
|  | 30 | <value>classpath:kustvakt-dnb.conf</value> | 
|  | 31 | <value>file:./kustvakt-dnb.conf</value> | 
|  | 32 | </array> | 
|  | 33 | </property> | 
|  | 34 | </bean> | 
|  | 35 |  | 
|  | 36 | <bean id="placeholders" | 
|  | 37 | class="org.springframework.context.support.PropertySourcesPlaceholderConfigurer"> | 
|  | 38 | <property name="ignoreResourceNotFound" value="true" /> | 
|  | 39 | <property name="locations"> | 
|  | 40 | <array> | 
|  | 41 | <value>classpath:test-jdbc.properties</value> | 
| margaretha | 2906084 | 2025-04-07 09:09:42 +0200 | [diff] [blame] | 42 | <value>file:./data/test-jdbc.properties</value> | 
| margaretha | 46e2c95 | 2024-05-23 09:09:54 +0200 | [diff] [blame] | 43 | <value>classpath:test-hibernate.properties</value> | 
| margaretha | 46e2c95 | 2024-05-23 09:09:54 +0200 | [diff] [blame] | 44 | <value>classpath:kustvakt-dnb.conf</value> | 
| margaretha | 2906084 | 2025-04-07 09:09:42 +0200 | [diff] [blame] | 45 | <value>file:./data/kustvakt-dnb.conf</value> | 
| margaretha | 46e2c95 | 2024-05-23 09:09:54 +0200 | [diff] [blame] | 46 | </array> | 
|  | 47 | </property> | 
|  | 48 | </bean> | 
|  | 49 |  | 
| margaretha | 2906084 | 2025-04-07 09:09:42 +0200 | [diff] [blame] | 50 | <!-- props are injected from default-config.xml --> | 
|  | 51 | <bean id="kustvakt_config" | 
|  | 52 | class="de.ids_mannheim.korap.config.FullConfiguration"> | 
|  | 53 | <constructor-arg name="properties" ref="props" /> | 
|  | 54 | </bean> | 
|  | 55 |  | 
| margaretha | 46e2c95 | 2024-05-23 09:09:54 +0200 | [diff] [blame] | 56 |  | 
|  | 57 | <bean id="dataSource" | 
|  | 58 | class="org.apache.commons.dbcp2.BasicDataSource" lazy-init="true"> | 
|  | 59 | <!-- <property name="driverClassName" value="${jdbc.driverClassName}" /> --> | 
|  | 60 | <property name="url" value="${jdbc.url}" /> | 
|  | 61 | <property name="username" value="${jdbc.username}" /> | 
|  | 62 | <property name="password" value="${jdbc.password}" /> | 
|  | 63 | <property name="maxTotal" value="4" /> | 
|  | 64 | <property name="maxIdle" value="1" /> | 
|  | 65 | <property name="minIdle" value="1" /> | 
|  | 66 | <property name="maxWaitMillis" value="15000" /> | 
|  | 67 | <!--<property name="poolPreparedStatements" value="true"/> --> | 
|  | 68 | </bean> | 
|  | 69 |  | 
| margaretha | 46e2c95 | 2024-05-23 09:09:54 +0200 | [diff] [blame] | 70 | <bean id="c3p0DataSource" | 
|  | 71 | class="com.mchange.v2.c3p0.ComboPooledDataSource" | 
|  | 72 | destroy-method="close"> | 
|  | 73 | <property name="driverClass" value="${jdbc.driverClassName}" /> | 
|  | 74 | <property name="jdbcUrl" value="${jdbc.url}" /> | 
|  | 75 | <property name="user" value="${jdbc.username}" /> | 
|  | 76 | <property name="password" value="${jdbc.password}" /> | 
|  | 77 | <property name="maxPoolSize" value="4" /> | 
|  | 78 | <property name="minPoolSize" value="1" /> | 
|  | 79 | <property name="maxStatements" value="1" /> | 
|  | 80 | <property name="testConnectionOnCheckout" value="true" /> | 
|  | 81 | </bean> | 
|  | 82 |  | 
|  | 83 | <!-- to configure database for sqlite, mysql, etc. migrations --> | 
|  | 84 | <bean id="flywayConfig" | 
|  | 85 | class="org.flywaydb.core.api.configuration.ClassicConfiguration"> | 
|  | 86 | <!-- drop existing tables and create new tables --> | 
|  | 87 | <property name="validateOnMigrate" value="true" /> | 
|  | 88 | <property name="cleanOnValidationError" value="true" /> | 
|  | 89 | <property name="baselineOnMigrate" value="false" /> | 
|  | 90 | <property name="locations" | 
|  | 91 | value="#{'${jdbc.schemaPath}'.split(',')}" /> | 
| margaretha | 46e2c95 | 2024-05-23 09:09:54 +0200 | [diff] [blame] | 92 | <property name="dataSource" ref="dataSource" /> | 
|  | 93 | <property name="outOfOrder" value="true" /> | 
|  | 94 | </bean> | 
|  | 95 |  | 
|  | 96 | <bean id="flyway" class="org.flywaydb.core.Flyway" | 
|  | 97 | init-method="migrate"> | 
|  | 98 | <constructor-arg ref="flywayConfig" /> | 
|  | 99 | </bean> | 
|  | 100 |  | 
|  | 101 |  | 
|  | 102 | <bean id="entityManagerFactory" | 
|  | 103 | class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"> | 
|  | 104 | <property name="dataSource" ref="dataSource" /> | 
| margaretha | 46e2c95 | 2024-05-23 09:09:54 +0200 | [diff] [blame] | 105 | <property name="packagesToScan"> | 
|  | 106 | <array> | 
|  | 107 | <value>de.ids_mannheim.korap.core.entity</value> | 
|  | 108 | <value>de.ids_mannheim.korap.entity</value> | 
|  | 109 | <value>de.ids_mannheim.korap.oauth2.entity</value> | 
|  | 110 | </array> | 
|  | 111 | </property> | 
|  | 112 | <property name="jpaVendorAdapter"> | 
|  | 113 | <bean id="jpaVendorAdapter" | 
|  | 114 | class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"> | 
|  | 115 | <property name="databasePlatform" | 
|  | 116 | value="${hibernate.dialect}" /> | 
|  | 117 | </bean> | 
|  | 118 | </property> | 
|  | 119 | <property name="jpaProperties"> | 
|  | 120 | <props> | 
|  | 121 | <prop key="hibernate.dialect">${hibernate.dialect}</prop> | 
|  | 122 | <prop key="hibernate.hbm2ddl.auto">${hibernate.hbm2ddl.auto}</prop> | 
|  | 123 | <prop key="hibernate.show_sql">${hibernate.show_sql}</prop> | 
|  | 124 | <prop key="hibernate.cache.use_query_cache">${hibernate.cache.use_query_cache}</prop> | 
|  | 125 | <prop key="hibernate.cache.use_second_level_cache">${hibernate.cache.use_second_level_cache} | 
|  | 126 | </prop> | 
|  | 127 | <prop key="hibernate.cache.provider_class">${hibernate.cache.provider}</prop> | 
|  | 128 | <prop key="hibernate.cache.region.factory_class">${hibernate.cache.region.factory}</prop> | 
|  | 129 | <prop key="hibernate.jdbc.time_zone">${hibernate.jdbc.time_zone}</prop> | 
|  | 130 | <!-- <prop key="net.sf.ehcache.configurationResourceName">classpath:ehcache.xml</prop> --> | 
|  | 131 | </props> | 
|  | 132 | </property> | 
|  | 133 | </bean> | 
|  | 134 |  | 
|  | 135 | <tx:annotation-driven proxy-target-class="true" | 
|  | 136 | transaction-manager="transactionManager" /> | 
|  | 137 | <bean id="transactionManager" | 
|  | 138 | class="org.springframework.orm.jpa.JpaTransactionManager"> | 
|  | 139 | <property name="entityManagerFactory" | 
|  | 140 | ref="entityManagerFactory" /> | 
|  | 141 | </bean> | 
|  | 142 |  | 
|  | 143 | <bean id="transactionTemplate" | 
|  | 144 | class="org.springframework.transaction.support.TransactionTemplate"> | 
|  | 145 | <constructor-arg ref="transactionManager" /> | 
|  | 146 | </bean> | 
|  | 147 |  | 
|  | 148 | <!-- Data access objects --> | 
|  | 149 | <bean id="adminDao" class="de.ids_mannheim.korap.dao.AdminDaoImpl" /> | 
|  | 150 | <bean id="resourceDao" | 
|  | 151 | class="de.ids_mannheim.korap.dao.ResourceDao" /> | 
|  | 152 | <bean id="accessScopeDao" | 
|  | 153 | class="de.ids_mannheim.korap.oauth2.dao.AccessScopeDao" /> | 
|  | 154 | <bean id="authorizationDao" | 
|  | 155 | class="de.ids_mannheim.korap.oauth2.dao.CachedAuthorizationDaoImpl" /> | 
|  | 156 |  | 
|  | 157 | <!-- Services --> | 
|  | 158 | <bean id="scopeService" | 
|  | 159 | class="de.ids_mannheim.korap.oauth2.service.OAuth2ScopeServiceImpl" /> | 
|  | 160 |  | 
| margaretha | 335abd9 | 2025-05-02 10:11:29 +0200 | [diff] [blame] | 161 | <!-- <bean id="initializator" | 
| margaretha | 46e2c95 | 2024-05-23 09:09:54 +0200 | [diff] [blame] | 162 | class="de.ids_mannheim.korap.init.Initializator" | 
| margaretha | 335abd9 | 2025-05-02 10:11:29 +0200 | [diff] [blame] | 163 | init-method="initTestWithoutAvailability"> | 
| margaretha | 46e2c95 | 2024-05-23 09:09:54 +0200 | [diff] [blame] | 164 | </bean> | 
| margaretha | 335abd9 | 2025-05-02 10:11:29 +0200 | [diff] [blame] | 165 | --> | 
|  | 166 |  | 
| margaretha | 46e2c95 | 2024-05-23 09:09:54 +0200 | [diff] [blame] | 167 | <!-- Krill --> | 
|  | 168 | <bean id="search_krill" | 
|  | 169 | class="de.ids_mannheim.korap.web.SearchKrill"> | 
|  | 170 | <constructor-arg value="${krill.indexDir}" /> | 
|  | 171 | </bean> | 
|  | 172 |  | 
|  | 173 | <!-- Validator --> | 
|  | 174 | <bean id="validator" | 
|  | 175 | class="de.ids_mannheim.korap.validator.ApacheValidator" /> | 
|  | 176 |  | 
|  | 177 | <!-- URLValidator --> | 
|  | 178 | <bean id="redirectURIValidator" | 
|  | 179 | class="org.apache.commons.validator.routines.UrlValidator"> | 
|  | 180 | <constructor-arg value="http,https" index="0" /> | 
|  | 181 | <constructor-arg index="1" type="long" | 
|  | 182 | value="#{T(org.apache.commons.validator.routines.UrlValidator).ALLOW_LOCAL_URLS + | 
|  | 183 | T(org.apache.commons.validator.routines.UrlValidator).NO_FRAGMENTS}" /> | 
|  | 184 | </bean> | 
|  | 185 | <bean id="urlValidator" | 
|  | 186 | class="org.apache.commons.validator.routines.UrlValidator"> | 
|  | 187 | <constructor-arg value="http,https" /> | 
|  | 188 | </bean> | 
|  | 189 |  | 
|  | 190 | <!-- Rewrite --> | 
|  | 191 | <bean id="foundryRewrite" | 
|  | 192 | class="de.ids_mannheim.korap.rewrite.FoundryRewrite" /> | 
| margaretha | 46e2c95 | 2024-05-23 09:09:54 +0200 | [diff] [blame] | 193 | <bean id="virtualCorpusRewrite" | 
|  | 194 | class="de.ids_mannheim.korap.rewrite.VirtualCorpusRewrite" /> | 
| margaretha | 46e2c95 | 2024-05-23 09:09:54 +0200 | [diff] [blame] | 195 | <bean id="queryReferenceRewrite" | 
|  | 196 | class="de.ids_mannheim.korap.rewrite.QueryReferenceRewrite" /> | 
| margaretha | 2906084 | 2025-04-07 09:09:42 +0200 | [diff] [blame] | 197 | <bean id="queryContextRewrite" | 
|  | 198 | class="de.ids_mannheim.korap.rewrite.QueryContextRewrite" /> | 
|  | 199 |  | 
| margaretha | 46e2c95 | 2024-05-23 09:09:54 +0200 | [diff] [blame] | 200 |  | 
|  | 201 | <util:list id="rewriteTasks" | 
|  | 202 | value-type="de.ids_mannheim.korap.rewrite.RewriteTask"> | 
| margaretha | 46e2c95 | 2024-05-23 09:09:54 +0200 | [diff] [blame] | 203 | <ref bean="foundryRewrite" /> | 
| margaretha | 46e2c95 | 2024-05-23 09:09:54 +0200 | [diff] [blame] | 204 | <ref bean="virtualCorpusRewrite" /> | 
|  | 205 | <ref bean="queryReferenceRewrite" /> | 
| margaretha | 2906084 | 2025-04-07 09:09:42 +0200 | [diff] [blame] | 206 | <ref bean="queryContextRewrite" /> | 
| margaretha | 46e2c95 | 2024-05-23 09:09:54 +0200 | [diff] [blame] | 207 | </util:list> | 
|  | 208 |  | 
|  | 209 | <bean id="rewriteHandler" | 
|  | 210 | class="de.ids_mannheim.korap.rewrite.RewriteHandler"> | 
|  | 211 | <constructor-arg ref="rewriteTasks" /> | 
|  | 212 | </bean> | 
| margaretha | 2906084 | 2025-04-07 09:09:42 +0200 | [diff] [blame] | 213 |  | 
|  | 214 | <util:list id="statisticsRewriteTasks" | 
|  | 215 | value-type="de.ids_mannheim.korap.rewrite.RewriteTask"> | 
|  | 216 | <ref bean="foundryRewrite" /> | 
|  | 217 | <ref bean="virtualCorpusRewrite" /> | 
|  | 218 | <ref bean="queryReferenceRewrite" /> | 
|  | 219 | </util:list> | 
|  | 220 |  | 
|  | 221 | <bean id="statisticsRewriteHandler" | 
|  | 222 | class="de.ids_mannheim.korap.rewrite.RewriteHandler"> | 
|  | 223 | <constructor-arg ref="statisticsRewriteTasks" /> | 
|  | 224 | </bean> | 
| margaretha | 46e2c95 | 2024-05-23 09:09:54 +0200 | [diff] [blame] | 225 |  | 
|  | 226 | <bean id="kustvaktResponseHandler" | 
|  | 227 | class="de.ids_mannheim.korap.web.KustvaktResponseHandler"> | 
|  | 228 | </bean> | 
|  | 229 |  | 
|  | 230 | <!-- OAuth --> | 
|  | 231 | <bean id="oauth2ResponseHandler" | 
|  | 232 | class="de.ids_mannheim.korap.web.OAuth2ResponseHandler"> | 
|  | 233 | </bean> | 
|  | 234 |  | 
|  | 235 | <bean name="kustvakt_encryption" | 
|  | 236 | class="de.ids_mannheim.korap.encryption.KustvaktEncryption"> | 
|  | 237 | <constructor-arg ref="kustvakt_config" /> | 
|  | 238 | </bean> | 
|  | 239 |  | 
|  | 240 | <!-- authentication providers to use --> | 
|  | 241 | <bean id="basic_auth" | 
|  | 242 | class="de.ids_mannheim.korap.authentication.BasicAuthentication" /> | 
|  | 243 |  | 
| margaretha | 46e2c95 | 2024-05-23 09:09:54 +0200 | [diff] [blame] | 244 | <bean id="oauth2_auth" | 
|  | 245 | class="de.ids_mannheim.korap.authentication.OAuth2Authentication" /> | 
|  | 246 |  | 
|  | 247 |  | 
|  | 248 | <util:list id="kustvakt_authproviders" | 
|  | 249 | value-type="de.ids_mannheim.korap.interfaces.AuthenticationIface"> | 
|  | 250 | <ref bean="basic_auth" /> | 
| margaretha | 46e2c95 | 2024-05-23 09:09:54 +0200 | [diff] [blame] | 251 | <ref bean="oauth2_auth" /> | 
|  | 252 | </util:list> | 
|  | 253 |  | 
|  | 254 | <!-- specify type for constructor argument --> | 
|  | 255 | <bean id="authenticationManager" | 
|  | 256 | class="de.ids_mannheim.korap.authentication.KustvaktAuthenticationManager"> | 
|  | 257 | <constructor-arg | 
|  | 258 | type="de.ids_mannheim.korap.interfaces.EncryptionIface" | 
|  | 259 | ref="kustvakt_encryption" /> | 
|  | 260 | <constructor-arg ref="kustvakt_config" /> | 
|  | 261 | <!-- inject authentication providers to use --> | 
|  | 262 | <property name="providers" ref="kustvakt_authproviders" /> | 
|  | 263 | </bean> | 
|  | 264 |  | 
|  | 265 | <!-- todo: if db interfaces not loaded via spring, does transaction even | 
|  | 266 | work then? --> | 
|  | 267 | <!-- the transactional advice (i.e. what 'happens'; see the <aop:advisor/> | 
|  | 268 | bean below) --> | 
|  | 269 | <tx:advice id="txAdvice" transaction-manager="txManager"> | 
|  | 270 | <!-- the transactional semantics... --> | 
|  | 271 | <tx:attributes> | 
|  | 272 | <!-- all methods starting with 'get' are read-only --> | 
|  | 273 | <tx:method name="get*" read-only="true" | 
|  | 274 | rollback-for="KorAPException" /> | 
|  | 275 | <!-- other methods use the default transaction settings (see below) --> | 
|  | 276 | <tx:method name="*" rollback-for="KorAPException" /> | 
|  | 277 | </tx:attributes> | 
|  | 278 | </tx:advice> | 
|  | 279 |  | 
|  | 280 | <!-- ensure that the above transactional advice runs for any execution of | 
|  | 281 | an operation defined by the service interface --> | 
|  | 282 | <aop:config> | 
|  | 283 | <aop:pointcut id="service" | 
|  | 284 | expression="execution(* de.ids_mannheim.korap.interfaces.db.*.*(..))" /> | 
|  | 285 | <aop:advisor advice-ref="txAdvice" pointcut-ref="service" /> | 
|  | 286 | </aop:config> | 
|  | 287 |  | 
|  | 288 | <!-- similarly, don't forget the PlatformTransactionManager --> | 
|  | 289 | <bean id="txManager" | 
|  | 290 | class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> | 
|  | 291 | <property name="dataSource" ref="dataSource" /> | 
|  | 292 | </bean> | 
|  | 293 |  | 
| margaretha | 46e2c95 | 2024-05-23 09:09:54 +0200 | [diff] [blame] | 294 | </beans> |