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

ppfuse-ibatis.2.1.0.source-code.applicationContext-dao.xml Maven / Gradle / Ivy

The 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:context="http://www.springframework.org/schema/context"
       xmlns:aop="http://www.springframework.org/schema/aop"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
            http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
            http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd"
       default-lazy-init="true">

    <!-- SqlMap setup for iBATIS Database Layer -->
    <bean id="sqlMapClient" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean">
        <property name="configLocation" value="classpath:/sql-map-config.xml"/>
        <property name="dataSource" ref="dataSource"/>
    </bean>

    <!-- Transaction manager for a single JDBC DataSource -->
    <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
        <property name="dataSource" ref="dataSource"/>
    </bean>

    <!-- Activates scanning of @Autowired -->
    <context:annotation-config/>

    <!-- Activates scanning of @Repository -->
    <context:component-scan base-package="org.appfuse.dao"/>

    <!-- Compass Search Section -->

    <!-- Compass Bean, automatically scanning for searchable classes within the model -->
    <!-- Hooks into Spring transaction management and stores the index on the file system -->
    <bean id="compass" class="org.compass.spring.LocalCompassBean">
        <property name="mappingScan" value="org.appfuse.model"/>
        <property name="transactionManager" ref="transactionManager"/>
        <property name="settings">
            <map>
                <entry key="compass.engine.connection" value="target/test-index"/>
            </map>
        </property>
    </bean>

    <!-- Compass Template allowing to automatically join/start exising transactions when performing operations -->
    <bean id="compassTemplate" class="org.compass.core.CompassTemplate">
        <property name="compass" ref="compass"/>
    </bean>

    <!-- Compass Search Helper allowing to perform search operations in a simpler manner -->
    <bean id="compassSearchHelper" class="org.compass.core.support.search.CompassSearchHelper">
        <constructor-arg ref="compass"/>
        <property name="pageSize" value="10"/>
    </bean>

    <!-- CompassGps allows to perform index operation based on the select statements defined in iBatis -->
    <bean id="compassGps" class="org.compass.gps.impl.SingleCompassGps" init-method="start" destroy-method="stop">
        <property name="compass" ref="compass"/>
        <property name="gpsDevices">
            <list>
                <bean class="org.compass.gps.device.ibatis.SqlMapClientGpsDevice">
                    <property name="name" value="ibatis"/>
                    <property name="sqlMapClient" ref="sqlMapClient"/>
                    <property name="selectStatementsIds">
                        <list>
                            <value>getUsers</value>
                        </list>
                    </property>
                </bean>
            </list>
        </property>
    </bean>

    <!-- Search AOP section allows to intercept operations and apply them to the index -->
    <bean id="compassSearchSaveAdvice" class="org.appfuse.dao.ibatis.search.CompassSaveAdvice">
        <property name="compass" ref="compass" />
    </bean>
    <bean id="compassSearchDeleteAdvice" class="org.appfuse.dao.ibatis.search.CompassDeleteAdvice">
        <property name="compass" ref="compass" />
    </bean>

    <aop:config>
        <aop:pointcut id="searchSave" expression="execution(* org.appfuse.dao.ibatis.*.save*(..))"/>
        <aop:pointcut id="searchDelete" expression="execution(* org.appfuse.dao.ibatis.*.remove*(..))"/>

        <aop:advisor pointcut-ref="searchSave" advice-ref="compassSearchSaveAdvice"/>
        <aop:advisor pointcut-ref="searchDelete" advice-ref="compassSearchDeleteAdvice"/>
    </aop:config>

</beans>




© 2015 - 2025 Weber Informatics LLC | Privacy Policy