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

<!--
Configuration of a scheduled job that, by default, at 4am removes any deployment attempt nodes
that are older than 180 days.
-->

<beans>
   
    <bean id="avmDeploymentAttemptCleaner" class="org.alfresco.repo.avm.AVMDeploymentAttemptCleaner">
        <!-- number of days to keep deployment attempts -->
        <property name="maxAge">
            <value>180</value>
        </property>
        <property name="nodeService">
            <ref bean="NodeService" />
        </property>
        <property name="transactionService">
            <ref bean="TransactionService" />
        </property>
        <property name="searchService">
            <ref bean="SearchService" />
        </property>
        <property name="importerBootstrap">
            <ref bean="spacesBootstrap" />
        </property>
    </bean>
    
    <bean id="avmDeploymentAttemptCleanup" class="org.alfresco.util.CronTriggerBean">
        <property name="jobDetail">
            <bean id="avmDeploymentAttemptCleanerDetail" class="org.springframework.scheduling.quartz.JobDetailBean">
                <property name="jobClass">
                    <value>org.alfresco.repo.avm.AVMDeploymentAttemptCleanerJob</value>
                </property>
                <property name="jobDataAsMap">
                    <map>
                        <entry key="deploymentAttemptCleaner">
                            <ref bean="avmDeploymentAttemptCleaner" />
                        </entry>
                    </map>
                </property>
            </bean>
        </property>
        <property name="scheduler">
            <ref bean="schedulerFactory" />
        </property>
        <!-- trigger at 4:00am each day -->
        <property name="cronExpression">
            <value>0 0 4 * * ?</value>
        </property>
    </bean>
    
</beans>