blob: 0923d60075c61079669fc3008da4e07d194b98d6 [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<beans default-lazy-init="true" xmlns="http://www.springframework.org/schema/beans"
xmlns:aop="http://www.springframework.org/schema/aop" xmlns:jee="http://www.springframework.org/schema/jee"
xmlns:tx="http://www.springframework.org/schema/tx" xmlns:context="http://www.springframework.org/schema/context"
xmlns:task="http://www.springframework.org/schema/task" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-4.3.xsd
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-4.3.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-4.3.xsd
http://www.springframework.org/schema/jee
http://www.springframework.org/schema/jee/spring-jee-4.3.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-4.3.xsd
http://www.springframework.org/schema/task
http://www.springframework.org/schema/task/spring-task-4.3.xsd
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util.xsd">
<context:component-scan base-package="org.apache.ranger" >
<!-- context:exclude-filter type="regex" expression="org.apache.ranger\.common\.db\.DaoManager" / -->
</context:component-scan>
<context:component-scan base-package="org.apache.ranger" />
<tx:annotation-driven />
<bean id="defaultEntityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="persistenceUnitName" value="defaultPU" />
<property name="dataSource" ref="defaultDataSource" />
<property name="jpaVendorAdapter">
<bean class="org.springframework.orm.jpa.vendor.EclipseLinkJpaVendorAdapter">
<property name="databasePlatform" value="${ranger.jpa.jdbc.dialect}" />
<property name="showSql" value="${ranger.jpa.showsql}" />
<property name="generateDdl" value="false" />
</bean>
</property>
<property name="jpaPropertyMap">
<props>
<prop key="eclipselink.weaving">false</prop>
</props>
</property>
<property name="loadTimeWeaver">
<bean class="org.springframework.instrument.classloading.InstrumentationLoadTimeWeaver"/>
</property>
</bean>
<bean id="loggingEntityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="persistenceUnitName" value="loggingPU" />
<property name="dataSource" ref="loggingDataSource" />
<property name="jpaVendorAdapter">
<bean class="org.springframework.orm.jpa.vendor.EclipseLinkJpaVendorAdapter">
<property name="databasePlatform" value="${ranger.jpa.jdbc.dialect}" />
<property name="showSql" value="${ranger.jpa.showsql}" />
<property name="generateDdl" value="false" />
</bean>
</property>
<property name="jpaPropertyMap">
<props>
<prop key="eclipselink.weaving">false</prop>
</props>
</property>
<property name="loadTimeWeaver">
<bean class="org.springframework.instrument.classloading.InstrumentationLoadTimeWeaver"/>
</property>
</bean>
<bean id="xmlPropertyConfigurer" class="org.apache.ranger.common.XMLPropertiesUtil" />
<bean id="propertyConfigurer" class="org.apache.ranger.common.PropertiesUtil">
<property name="locations">
<list>
<!-- <value>classpath:xa_default.properties</value> -->
<!-- <value>classpath:xa_system.properties</value> -->
<!-- <value>classpath:xa_custom.properties</value> -->
<!-- <value>classpath:xa_ldap.properties</value> -->
<value>classpath:core-site.xml</value>
<value>classpath:ranger-admin-default-site.xml</value>
<value>classpath:ranger-admin-site.xml</value>
</list>
</property>
<property name="propertiesPersister" ref="xmlPropertyConfigurer" />
</bean>
<bean class="org.springframework.beans.factory.config.CustomScopeConfigurer">
<property name="scopes">
<map>
<entry key="session">
<bean class="org.springframework.web.context.request.SessionScope" />
</entry>
<entry key="request">
<bean class="org.springframework.web.context.request.RequestScope" />
</entry>
</map>
</property>
</bean>
<bean id="messageMappingConfigurer" class="org.apache.ranger.common.ErrorMessageUtil">
<property name="locations">
<list>
<value>classpath:db_message_bundle.properties</value>
</list>
</property>
</bean>
<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
<property name="entityManagerFactory" ref="defaultEntityManagerFactory" />
</bean>
<bean id="transactionManager2" class="org.springframework.orm.jpa.JpaTransactionManager">
<property name="entityManagerFactory" ref="loggingEntityManagerFactory" />
</bean>
<!-- Datasource and Connection Pool Configuration http://www.mchange.com/projects/c3p0/index.jsp#configuration_properties -->
<bean id="defaultDataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
<property name="driverClass">
<value>${ranger.jpa.jdbc.driver}</value>
</property>
<property name="jdbcUrl">
<value>${ranger.jpa.jdbc.url}</value>
</property>
<property name="user">
<value>${ranger.jpa.jdbc.user}</value>
</property>
<property name="password">
<value>${ranger.jpa.jdbc.password}</value>
</property>
<property name="maxPoolSize">
<!-- <value>20</value> -->
<value>${ranger.jpa.jdbc.maxpoolsize}</value>
</property>
<property name="minPoolSize">
<value>${ranger.jpa.jdbc.minpoolsize}</value>
</property>
<property name="initialPoolSize">
<value>${ranger.jpa.jdbc.initialpoolsize}</value>
</property>
<!-- Seconds a Connection can remain pooled but unused before being discarded.
Zero means idle connections never expire. -->
<property name="maxIdleTime">
<value>${ranger.jpa.jdbc.maxidletime}</value>
</property>
<property name="maxStatements">
<value>${ranger.jpa.jdbc.maxstatements}</value>
</property>
<property name="preferredTestQuery">
<value>${ranger.jpa.jdbc.preferredtestquery}</value>
</property>
<property name="idleConnectionTestPeriod">
<value>${ranger.jpa.jdbc.idleconnectiontestperiod}</value>
</property>
<property name="statementCacheNumDeferredCloseThreads">
<value>1</value>
</property>
</bean>
<bean id="loggingDataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
<property name="driverClass">
<value>${ranger.jpa.jdbc.driver}</value>
</property>
<property name="jdbcUrl">
<value>${ranger.jpa.audit.jdbc.url}</value>
</property>
<property name="user">
<value>${ranger.jpa.jdbc.user}</value>
</property>
<property name="password">
<value>${ranger.jpa.jdbc.password}</value>
</property>
<property name="maxPoolSize">
<!-- <value>20</value> -->
<value>${ranger.jpa.jdbc.maxpoolsize}</value>
</property>
<property name="minPoolSize">
<value>${ranger.jpa.jdbc.minpoolsize}</value>
</property>
<property name="initialPoolSize">
<value>${ranger.jpa.jdbc.initialpoolsize}</value>
</property>
<!-- Seconds a Connection can remain pooled but unused before being discarded.
Zero means idle connections never expire. -->
<property name="maxIdleTime">
<value>${ranger.jpa.jdbc.maxidletime}</value>
</property>
<property name="maxStatements">
<value>${ranger.jpa.jdbc.maxstatements}</value>
</property>
<property name="preferredTestQuery">
<value>${ranger.jpa.jdbc.preferredtestquery}</value>
</property>
<property name="idleConnectionTestPeriod">
<value>${ranger.jpa.jdbc.idleconnectiontestperiod}</value>
</property>
</bean>
<bean id="messageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
<property name="basenames">
<list>
<value>WEB-INF/classes/internationalization/messages</value>
</list>
</property>
</bean>
<bean id="restTemplate" class="org.springframework.web.client.RestTemplate"></bean>
</beans>