All Downloads are FREE. Search and download functionalities are using the official Maven repository.

usergrid-core.0.0.13.source-code.usergrid-core-context.xml Maven / Gradle / Ivy

There is a newer version: 0.0.27.1
Show newest version
<?xml version="1.0" encoding="UTF-8"?>
<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.usergrid.persistence" />
	<context:annotation-config />

	
	<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.usergrid.persistence.cassandra.util.TraceTagManager"/>
    <bean id="traceTagReporter" class="org.usergrid.persistence.cassandra.util.Slf4jTraceTagReporter"/>

    <bean id="taggedOpTimer" class="org.usergrid.persistence.cassandra.util.TaggedOpTimer">
        <constructor-arg ref="traceTagManager"/>
    </bean>

	<bean id="cassandraHostConfigurator"
		class="me.prettyprint.cassandra.service.CassandraHostConfigurator">
		<constructor-arg value="${cassandra.url}" />
		<property name="clockResolution" ref="microsecondsTimeResolution" />
        <property name="opTimer" ref="taggedOpTimer"/>
	</bean>

	<bean id="cassandraCluster" class="me.prettyprint.cassandra.service.ThriftCluster">
		<constructor-arg value="${cassandra.cluster}" />
		<constructor-arg ref="cassandraHostConfigurator" />
	</bean>

	<!--  locking for a single node -->	
	<bean name="lockManager" class="org.usergrid.locking.singlenode.SingleNodeLockManagerImpl" />
	
	<!--  hector based locks -->
	<!-- Note that if this is deployed in a production cluster, the RF on the keyspace MUST be updated to use an odd number for it's replication Factor.
		  Even numbers can potentially case the locks to fail, via "split brain" when read at QUORUM on lock verification-->
	
	<!--  <bean name="lockManager" class="org.usergrid.locking.cassandra.HectorLockManagerImpl" >
		<property name="cluster" ref="cassandraCluster"/>
		<property name="keyspaceName" value="${cassandra.lock.keyspace}"/>
	</bean>-->
	
	<!--  zookeeper locks -->
	<!--
	<bean name="lockManager" class="org.usergrid.locking.zookeeper.ZooKeeperLockManagerImpl" >
		<property name="hostPort" value="${zookeeper.url}"/>
		<property name="sessionTimeout" value="2000"/>
		<property name="maxAttempts" value="10"/>
	</bean>  -->
	
		
	
	<bean id="cassandraService"
		class="org.usergrid.persistence.cassandra.CassandraService" init-method="init">
		<constructor-arg ref="properties" />
		<constructor-arg ref="cassandraCluster" />
		<constructor-arg ref="cassandraHostConfigurator" />
		<constructor-arg ref="lockManager" />
		<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.usergrid.persistence.cassandra.EntityManagerFactoryImpl">
		<constructor-arg ref="cassandraService" />
        <constructor-arg ref="counterUtils"/>
        <constructor-arg value="${usergrid.counter.skipAggregate}"/>
    </bean>

    <bean id="queueManagerFactory"
          class="org.usergrid.mq.cassandra.QueueManagerFactoryImpl">
        <constructor-arg ref="cassandraService" />
        <constructor-arg ref="counterUtils"/>
    </bean>

    <bean id="simpleBatcher" class="com.usergrid.count.SimpleBatcher">
        <constructor-arg value="1"/>
        <property name="batchSubmitter" ref="batchSubmitter"/>
        <property name="batchSize" value="${usergrid.counter.batch.size}"/>
    </bean>

    <bean id="batchSubmitter" class="com.usergrid.count.CassandraSubmitter">
        <constructor-arg ref="cassandraCounterStore"/>
    </bean>

    <bean id="cassandraCounterStore" class="com.usergrid.count.CassandraCounterStore">
        <constructor-arg>
            <bean id="keyspace"
                  factory-bean="cassandraService"
                  factory-method="getUsergridApplicationKeyspace"/>
        </constructor-arg>
    </bean>

    <bean id="counterUtils" class="org.usergrid.persistence.cassandra.CounterUtils">
        <property name="batcher" ref="simpleBatcher"/>
        <property name="counterType" value="n"/>
    </bean>

    <bean id="usergridSystemMonitor" class="org.usergrid.system.UsergridSystemMonitor">
        <constructor-arg value="${usergrid.version.build}"/>
        <constructor-arg ref="cassandraCluster"/>
    </bean>
    
        
   <bean id="indexBucketLocator" class="org.usergrid.persistence.cassandra.SimpleIndexBucketLocatorImpl">
    	<constructor-arg value="${usergrid.index.defaultbucketsize}"/>
    </bean>
    
    <bean id="mailUtils" class="org.usergrid.utils.MailUtils" />

    <bean id="entityManager" class="org.usergrid.persistence.cassandra.EntityManagerImpl" scope="prototype"/>

    <bean id="relationManager" class="org.usergrid.persistence.cassandra.RelationManagerImpl" scope="prototype"/>

    <bean id="traceTagAspect" class="org.usergrid.persistence.cassandra.util.TraceTagAspect"/>

    <aop:config>
      <aop:aspect id="traceParticipant" ref="traceTagAspect">
        <!-- pointcut on the prescense of the TraceParticipant annotation only -->
        <aop:pointcut id="emTraceParticipant"
            expression="execution(* org.usergrid.persistence.cassandra.EntityManagerImpl.*(..)) and
            @annotation(org.usergrid.persistence.cassandra.util.TraceParticipant)"/>
        <aop:around
           pointcut-ref="emTraceParticipant"
           method="applyTrace"/>
      </aop:aspect>
    </aop:config>

</beans>




© 2015 - 2024 Weber Informatics LLC | Privacy Policy