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

<beans>

    <!-- Task scheduler -->
    <!-- Triggers should not appear here - the scheduler should be injected into the trigger definition -->
    <!-- This bean should not need to apear else where in extension configuration -->
    <bean id="schedulerFactory" class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
        <property name="waitForJobsToCompleteOnShutdown">
            <value>true</value>
        </property>
        <property name="configLocation">
            <value>classpath:alfresco/domain/quartz.properties</value>
        </property>
        <property name="schedulerName">
            <value>DefaultScheduler</value>
        </property>
    </bean>

    <!--                 -->
    <!-- Scheduled tasks -->
    <!--                 -->

    <bean id="ftsIndexerTrigger" class="org.alfresco.util.TriggerBean">
        <property name="jobDetail">
            <bean id="ftsIndexerJobDetail" class="org.springframework.scheduling.quartz.JobDetailBean">
                <property name="jobClass">
                    <value>org.alfresco.repo.search.impl.lucene.fts.FTSIndexerJob</value>
                </property>
                <property name="jobDataAsMap">
                    <map>
                        <entry key="bean">
                            <ref bean="LuceneFullTextSearchIndexer" />
                        </entry>
                    </map>
                </property>
            </bean>
        </property>
        <property name="scheduler">
            <ref bean="schedulerFactory" />
        </property>
        <property name="startDelayMinutes">
            <value>1</value>
        </property>
        <property name="repeatIntervalMinutes">
            <value>1</value>
        </property>
    </bean>

    <bean id="indexRecoveryTrigger" class="org.alfresco.util.TriggerBean">
        <property name="jobDetail">
            <bean class="org.springframework.scheduling.quartz.JobDetailBean">
                <property name="jobClass">
                    <value>org.alfresco.repo.node.index.IndexRecoveryJob</value>
                </property>
                <property name="jobDataAsMap">
                    <map>
                        <entry key="indexRecoveryComponent">
                            <ref bean="indexRecoveryComponent" />
                        </entry>
                    </map>
                </property>
            </bean>
        </property>
        <property name="scheduler">
            <ref bean="schedulerFactory" />
        </property>
        <property name="startDelayMinutes">
            <value>1</value>
        </property>
        <property name="repeatCount">
            <value>0</value>
        </property>
    </bean>
    
    <bean id="tempFileCleanerTrigger" class="org.alfresco.util.TriggerBean">
        <property name="jobDetail">
            <bean id="tempFileCleanerJobDetail" class="org.springframework.scheduling.quartz.JobDetailBean">
                <property name="jobClass">
                    <value>org.alfresco.util.TempFileProvider$TempFileCleanerJob</value>
                </property>
                <property name="jobDataAsMap">
                    <map>
                        <entry key="protectHours">
                            <value>1</value>
                        </entry>
                    </map>
                </property>
            </bean>
        </property>
        <property name="scheduler">
            <ref bean="schedulerFactory" />
        </property>
        <!-- start after half an hour and repeat hourly -->
        <property name="startDelayMinutes">
            <value>30</value>
        </property>
        <property name="repeatIntervalMinutes">
            <value>60</value>
        </property>
    </bean>

    <bean id="fileContentStoreCleanerJobDetail" class="org.springframework.scheduling.quartz.JobDetailBean">
        <property name="jobClass">
            <value>org.alfresco.repo.content.cleanup.ContentStoreCleanupJob</value>
        </property>
        <property name="jobDataAsMap">
            <map>
                <entry key="contentStoreCleaner">
                    <ref bean="contentStoreCleaner" />
                </entry>
            </map>
        </property>
    </bean>
    <bean id="contentStoreCleanerTrigger" class="org.alfresco.util.CronTriggerBean">
        <property name="jobDetail">
            <ref bean="fileContentStoreCleanerJobDetail" />
        </property>
        <property name="scheduler">
            <ref bean="schedulerFactory" />
        </property>
        <!-- trigger at 4am each day -->
        <property name="cronExpression">
            <value>0 0 4 * * ?</value>
        </property>
    </bean>

    <bean id="indexBackupJobDetail" class="org.springframework.scheduling.quartz.JobDetailBean">
        <property name="jobClass">
            <value>org.alfresco.repo.search.impl.lucene.LuceneIndexerAndSearcherFactory2$LuceneIndexBackupJob</value>
        </property>
        <property name="jobDataAsMap">
            <map>
                <entry key="luceneIndexBackupComponent">
                    <ref bean="luceneIndexBackupComponent" />
                </entry>
            </map>
        </property>
    </bean>
    <bean id="indexBackupTrigger" class="org.alfresco.util.CronTriggerBean">
        <property name="jobDetail">
            <ref bean="indexBackupJobDetail" />
        </property>
        <property name="scheduler">
            <ref bean="schedulerFactory" />
        </property>
        <!-- trigger at 3am each day -->
        <property name="cronExpression">
            <value>0 0 3 * * ?</value>
        </property>
    </bean>

    <!-- enable DEBUG for 'org.alfresco.repo.cache.EhCacheTracerJob' and enable scheduler property to activate -->
    <bean id="ehCacheTracerJob" class="org.alfresco.util.TriggerBean">
        <property name="jobDetail">
            <bean id="ehCacheTracerJobDetail" class="org.springframework.scheduling.quartz.JobDetailBean">
                <property name="jobClass">
                    <value>org.alfresco.repo.cache.EhCacheTracerJob</value>
                </property>
            </bean>
        </property>
        <!-- enable this to activate bean
        <property name="scheduler">
            <ref bean="schedulerFactory" />
        </property>
        -->
        <!-- start after an hour and repeat hourly -->
        <property name="startDelayMinutes">
            <value>60</value>
        </property>
        <property name="repeatIntervalMinutes">
            <value>60</value>
        </property>
    </bean>
    
</beans>