<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING/DTD BEAN//EN"
	"http://www.springframework.org/dtd/spring-beans.dtd">

<beans>

    <bean id="avmNodeDAO" class="org.alfresco.repo.avm.ibatis.AVMNodeDAOIbatis">
        <property name="sessionFactory">
            <ref bean="sessionFactory"/>
        </property>
    </bean>
    
    <bean id="avmStoreDAO" class="org.alfresco.repo.avm.ibatis.AVMStoreDAOIbatis">
        
        <property name="sessionFactory">
            <ref bean="sessionFactory"/>
        </property>
     
    </bean>
    
    <bean id="versionRootDAO" class="org.alfresco.repo.avm.ibatis.VersionRootDAOIbatis"/>
    
    <bean id="childEntryDAO" class="org.alfresco.repo.avm.ibatis.ChildEntryDAOIbatis"/>
    
    <bean id="historyLinkDAO" class="org.alfresco.repo.avm.ibatis.HistoryLinkDAOIbatis"/>
    
    <bean id="mergeLinkDAO" class="org.alfresco.repo.avm.ibatis.MergeLinkDAOIbatis"/>
    
    <bean id="avmStorePropertyDAO" class="org.alfresco.repo.avm.ibatis.AVMStorePropertyDAOIbatis">
        <property name="sessionFactory">
            <ref bean="sessionFactory"/>
        </property>
    </bean>
    
    <bean id="versionLayeredNodeEntryDAO" class="org.alfresco.repo.avm.ibatis.VersionLayeredNodeEntryDAOIbatis"/>
    
	<bean id="avmDAOs" class="org.alfresco.repo.avm.AVMDAOs" factory-method="Instance">
		<property name="nodeDAO">
			<ref bean="avmNodeDAO"/>
		</property>
		<property name="newAvmNodeDAO">
            <ref bean="newAvmNodeDAO"/>
        </property>
		<property name="newAvmNodeLinksDAO">
            <ref bean="newAvmNodeLinksDAO"/>
        </property>
        <property name="contentDataDAO">
            <ref bean="contentDataDAO"/>
        </property>
		<property name="avmStoreDAO">
			<ref bean="avmStoreDAO"/>
		</property>
		<property name="newAvmStoreDAO">
            <ref bean="newAvmStoreDAO"/>
        </property>
		<property name="versionRootDAO">
			<ref bean="versionRootDAO"/>
		</property>
		<property name="newAvmVersionRootDAO">
            <ref bean="newAvmVersionRootDAO"/>
        </property>
		<property name="childEntryDAO">
			<ref bean="childEntryDAO"/>
		</property>
		<property name="historyLinkDAO">
			<ref bean="historyLinkDAO"/>
		</property>
		<property name="mergeLinkDAO">
			<ref bean="mergeLinkDAO"/>
		</property>
		<property name="avmStorePropertyDAO">
			<ref bean="avmStorePropertyDAO"/>
		</property>
		<property name="attributeDAO">
		    <ref bean="attributeDAO"/>
		</property>
		<property name="mapEntryDAO">
		    <ref bean="mapEntryDAO"/>
		</property>
		<property name="listEntryDAO">
		    <ref bean="listEntryDAO"/>
		</property>
		<property name="versionLayeredNodeEntryDAO">
		    <ref bean="versionLayeredNodeEntryDAO"/>
		</property>
	</bean>

	<bean id="lookupCache" class="org.alfresco.repo.avm.NOOPLookupCache"/>

	<bean id="rawServices" class="org.alfresco.repo.avm.util.RawServices"/>

	<bean id="orphanReaper" class="org.alfresco.repo.avm.OrphanReaper"
		depends-on="AVMService" destroy-method="shutDown">
		<property name="activeBaseSleep">
			<value>1000</value>
		</property>
		<property name="batchSize">
		    <value>50</value>
		</property>
		<property name="maxQueueLength">
			<value>1000</value>
		</property>
		<property name="transactionService">
			<ref bean="transactionService"/>
		</property>
		<property name="sessionFactory">
			<ref bean="sessionFactory"/>
		</property>
	</bean>

	<bean id="createStoreTxnListener" class="org.alfresco.repo.avm.CreateStoreTxnListener"/>

	<bean id="purgeStoreTxnListener" class="org.alfresco.repo.avm.PurgeStoreTxnListener"/>

	<bean id="createVersionTxnListener" class="org.alfresco.repo.avm.CreateVersionTxnListener"/>

	<bean id="purgeVersionTxnListener" class="org.alfresco.repo.avm.PurgeVersionTxnListener"/>

	<bean id="avmRepository" class="org.alfresco.repo.avm.AVMRepository">
		<property name="lookupCache">
		    <ref bean="lookupCache"/>
		</property>
		<property name="contentStore">
		    <ref bean="fileContentStore"/>
		</property>
	    <property name="createStoreTxnListener">
		    <ref bean="createStoreTxnListener"/>
		</property>
	    <property name="purgeStoreTxnListener">
		    <ref bean="purgeStoreTxnListener"/>
		</property>
	    <property name="createVersionTxnListener">
		    <ref bean="createVersionTxnListener"/>
		</property>
	    <property name="purgeVersionTxnListener">
		    <ref bean="purgeVersionTxnListener"/>
		</property>
		<property name="qnameDAO">
		    <ref bean="qnameDAO"/>
		</property>
		<property name="avmStoreDAO">
		    <ref bean="avmStoreDAO"/>
		</property>
		<property name="avmNodeDAO">
		    <ref bean="avmNodeDAO"/>
		</property>
		<property name="versionRootDAO">
		    <ref bean="versionRootDAO"/>
		</property>
		<property name="versionLayeredNodeEntryDAO">
		    <ref bean="versionLayeredNodeEntryDAO"/>
		</property>
		<property name="avmStorePropertyDAO">
		    <ref bean="avmStorePropertyDAO"/>
		</property>
		<property name="childEntryDAO">
		    <ref bean="childEntryDAO"/>
		</property>
		<property name="dictionaryService">
		    <ref bean="dictionaryService"/>
		</property>
	</bean>

	<!-- A Local implementation of the Remote AVM interface. -->
	<bean id="avmRemote" class="org.alfresco.repo.avm.AVMRemoteLocal">
	    <property name="avmService">
	        <ref bean="AVMService"/>
	    </property>
	</bean>


    <!-- Used to notify virtualization server occur after commit/rollback -->
    <bean id="AVMSubmitTransactionListener"
          class="org.alfresco.repo.avm.wf.AVMSubmitTransactionListener"/>


    <!-- NameMatcher beans for filtering what shows up as different in compares. -->
    <bean id="excludeRegexMatcher" class="org.alfresco.util.RegexNameMatcher">
        <property name="patterns">
            <!--
            NOTE:  Regexes are implicitly anchored with ^ and $ in this context.
            -->
            <list>
            	<value>.*/#[^/]*</value>    <!-- A leaf starting with '#' -->
            </list>
        </property>
    </bean>

    <bean id="excludeExtensionMatcher" class="org.alfresco.repo.avm.util.FileExtensionNameMatcher">
    	<property name="extensions">
    	    <list>
    	        <value>.o</value>
    	        <value>.bak</value>
    	        <value>.tmp</value>
    	        <value>~</value>
    	    </list>
    	</property>
    </bean>

    <bean id="globalPathExcluder" class="org.alfresco.util.OrCompositeNameMatcher">
        <property name="matchers">
            <list>
                <ref bean="excludeExtensionMatcher"/>
                <ref bean="excludeRegexMatcher"/>
            </list>
        </property>
    </bean>

    <!-- Bean used to process content that has expired in AVM staging areas -->
    <bean id="avmExpiredContentProcessor" class="org.alfresco.repo.avm.AVMExpiredContentProcessor">
        <property name="adminUserName">
            <value>admin</value>
        </property>
        <property name="workflowName">
            <value>jbpm$wcmwf:changerequest</value>
        </property>
        <property name="avmService">
            <ref bean="AVMService" />
        </property>
        <property name="avmSyncService">
            <ref bean="AVMSyncService" />
        </property>
        <property name="avmLockingAwareService">
            <ref bean="AVMLockingAwareService" />
        </property>
        <property name="avmLockingService">
            <ref bean="AVMLockingService" />
        </property>
        <property name="nodeService">
            <ref bean="NodeService" />
        </property>
        <property name="workflowService">
            <ref bean="WorkflowService" />
        </property>
        <property name="personService">
            <ref bean="PersonService" />
        </property>
        <property name="permissionService">
            <ref bean="PermissionService" />
        </property>
        <property name="transactionService">
            <ref bean="TransactionService" />
        </property>
        <property name="virtServerRegistry">
            <ref bean="VirtServerRegistry" />
        </property>
        <property name="searchService">
            <ref bean="SearchService" />
        </property>
        <property name="sandboxFactory">
            <ref bean="sandboxFactory" />
        </property>
    </bean>

	<!-- AVM Locking. -->

	<bean id="avmLockingService" class="org.alfresco.repo.avm.locking.AVMLockingServiceImpl">
	    <property name="attributeService">
	        <ref bean="attributeService"/>
	    </property>
	    <property name="authorityService">
	        <ref bean="authorityService"/>
	    </property>
	    <property name="personService">
	        <ref bean="personService"/>
	    </property>
	    <property name="retryingTransactionHelper">
	        <ref bean="retryingTransactionHelper"/>
	    </property>
	    <property name="nodeService">
	        <ref bean="nodeService"/>
	    </property>
	    <property name="searchService">
	        <ref bean="searchService"/>
	    </property>
	    <property name="webProjectStore">
	        <value>workspace://SpacesStore</value>
	    </property>
	</bean>

   <bean id="avmSessionSizeResourceInterceptor" class="org.alfresco.repo.transaction.SingleEntryTransactionResourceInterceptor" >
      <property name="methodResourceManagers">
         <list>
            <ref bean="avmSessionSizeResourceManager"></ref>
         </list>
      </property>
      <property name="elapsedTimeBeforeActivationMillis">
         <value>500</value>
      </property>
      <property name="resourceManagerCallFrequencyMillis">
         <value>250</value>
      </property>
   </bean>

   <bean id="avmSessionSizeResourceManager" class="org.alfresco.repo.domain.hibernate.SessionSizeResourceManager">
      <property name="sessionFactory">
         <ref bean="sessionFactory" />
      </property>
      <property name="writeThreshold">
         <value>100</value>
      </property>
      <property name="readThreshold">
         <value>100</value>
      </property>
      <property name="retentionFactor">
         <value>0</value>
      </property>
   </bean>
</beans>
