blob: 4b216e337467818863cf24c07bdf61fde821419d [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 xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:util="http://www.springframework.org/schema/util"
xmlns:context="http://www.springframework.org/schema/context" xmlns:p="http://www.springframework.org/schema/p"
xmlns:hz="http://www.hazelcast.com/schema/config" xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.1.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.1.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd">
<context:component-scan base-package="org.apache.usergrid.persistence" />
<context:annotation-config />
<aop:config proxy-target-class="true"/>
<bean id="propertyPlaceholderConfigurer"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="properties" ref="properties" />
<property name="systemPropertiesModeName">
<value>SYSTEM_PROPERTIES_MODE_OVERRIDE</value>
</property>
</bean>
<!-- The Time Resolution used for the cluster -->
<bean id="microsecondsTimeResolution" class="me.prettyprint.cassandra.service.clock.MicrosecondsClockResolution" />
<bean id="traceTagManager" class="org.apache.usergrid.persistence.cassandra.util.TraceTagManager"/>
<bean id="traceTagReporter" class="org.apache.usergrid.persistence.cassandra.util.Slf4jTraceTagReporter"/>
<bean id="taggedOpTimer" class="org.apache.usergrid.persistence.cassandra.util.TaggedOpTimer">
<constructor-arg ref="traceTagManager"/>
</bean>
<bean id="cassandraHostConfigurator" class="me.prettyprint.cassandra.service.CassandraHostConfigurator">
<constructor-arg value="${cassandra.url}"/>
<!-- set the pool size if it's available. If not go with 50 -->
<property name="maxActive" value="${cassandra.connections:15}"/>
<property name="cassandraThriftSocketTimeout" value="${cassandra.thriftSocketTimeout:5000}" />
<property name="useSocketKeepalive" value="${cassandra.useSocketKeepalive:false}" />
<!-- Fails on Java 8: <property name="clockResolution" ref="microsecondsTimeResolution" />-->
<property name="opTimer" ref="taggedOpTimer"/>
<property name="loadBalancingPolicy" ref="loadBalancingPolicy"/>
</bean>
<bean id="cassandraCluster" class="me.prettyprint.cassandra.service.ThriftCluster">
<constructor-arg value="${cassandra.cluster}" />
<constructor-arg ref="cassandraHostConfigurator" />
</bean>
<bean id="loadBalancingPolicy" class="me.prettyprint.cassandra.connection.DynamicLoadBalancingPolicy"/>
<bean id="injector"
class="org.apache.usergrid.corepersistence.GuiceFactory">
</bean>
<bean id="cassandraService"
class="org.apache.usergrid.persistence.cassandra.CassandraService" init-method="init" destroy-method="destroy">
<constructor-arg ref="properties" />
<constructor-arg ref="cassandraCluster" />
<constructor-arg ref="cassandraHostConfigurator" />
<constructor-arg ref="injector"/>
<property name="consistencyLevelPolicy" ref="consistencyLevelPolicy"/>
</bean>
<bean name="consistencyLevelPolicy" class="me.prettyprint.cassandra.model.ConfigurableConsistencyLevel">
<property name="defaultReadConsistencyLevel" value="${cassandra.readcl}"/>
<property name="defaultWriteConsistencyLevel" value="${cassandra.writecl}"/>
</bean>
<bean id="entityManagerFactory"
class="org.apache.usergrid.corepersistence.CpEntityManagerFactory" scope="singleton">
<constructor-arg ref="cassandraService" />
<constructor-arg ref="counterUtils"/>
<constructor-arg ref="injector"/>
</bean>
<bean id="queueManagerFactory"
class="org.apache.usergrid.mq.cassandra.QueueManagerFactoryImpl">
<constructor-arg ref="cassandraService" />
<constructor-arg ref="counterUtils"/>
<constructor-arg ref="injector"/>
<constructor-arg value="${usergrid.queue.lock.timeout}"/>
</bean>
<bean id="simpleBatcher" class="org.apache.usergrid.count.SimpleBatcher">
<property name="batchSubmitter" ref="batchSubmitter"/>
<property name="batchInterval" value="${usergrid.counter.batch.interval}"/>
<property name="batchSize" value="${usergrid.counter.batch.size}"/>
</bean>
<bean id="batchSubmitter" class="org.apache.usergrid.count.CassandraSubmitter">
<constructor-arg ref="cassandraCounterStore"/>
</bean>
<bean id="cassandraCounterStore" class="org.apache.usergrid.count.CassandraCounterStore">
<constructor-arg>
<bean id="keyspace"
factory-bean="cassandraService"
factory-method="getUsergridApplicationKeyspace"/>
</constructor-arg>
</bean>
<bean id="counterUtils" class="org.apache.usergrid.persistence.cassandra.CounterUtils">
<property name="batcher" ref="simpleBatcher"/>
<property name="counterType" value="n"/>
</bean>
<bean id="usergridSystemMonitor" class="org.apache.usergrid.system.UsergridSystemMonitor">
<constructor-arg value="${usergrid.version.build}"/>
<constructor-arg ref="cassandraCluster"/>
<constructor-arg ref="properties"/>
</bean>
<bean id="mailUtils" class="org.apache.usergrid.utils.MailUtils" />
<!-- ============================================================== -->
<!-- Scheduler Settings from removed Scheduler Module's app context -->
<!-- ============================================================== -->
<bean id="jobSchedulerBackgroundService" class="org.apache.usergrid.batch.service.JobSchedulerService">
<property name="jobFactory" ref="jobFactory" />
<property name="jobAccessor" ref="schedulerService" />
<property name="workerSize" value="${usergrid.scheduler.job.workers}" />
<property name="interval" value="${usergrid.scheduler.job.interval}" />
<property name="maxFailCount" value="${usergrid.scheduler.job.maxfail}" />
<property name="injector" ref="injector" />
</bean>
<bean id="schedulerService" class="org.apache.usergrid.batch.service.SchedulerServiceImpl">
<property name="jobTimeout" value="${usergrid.scheduler.job.timeout}" />
<property name="jobQueueName" value="${usergrid.scheduler.job.queueName}" />
</bean>
<bean id="jobFactory" class="org.apache.usergrid.batch.UsergridJobFactory" />
<context:component-scan base-package="org.apache.usergrid.batch.job" />
<context:annotation-config />
</beans>