<?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="resourceFinder" class="org.alfresco.util.ResourceFinder"/>
    
    <bean id="schedulerResources" factory-bean="resourceFinder" factory-method="getResources">
        <constructor-arg>
            <list>
                <value>classpath:alfresco/domain/quartz.properties</value>
                <value>classpath*:alfresco/enterprise/*-quartz.properties</value>
                <value>classpath*:alfresco/extension/*-quartz.properties</value>
            </list>
        </constructor-arg>
    </bean>

    <bean id="schedulerProperties" class="org.springframework.beans.factory.config.PropertiesFactoryBean">
        <property name="locations">
            <ref bean="schedulerResources" />
        </property>
    </bean>

    <!-- 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="schedulerFactoryClass">
            <value>org.alfresco.repo.scheduler.AlfrescoSchedulerFactory</value>
        </property>
        <property name="quartzProperties">
            <ref bean="schedulerProperties" />
        </property>
        <property name="schedulerName">
            <value>DefaultScheduler</value>
        </property>
        <!-- Do not auto start the scheduler - this is done at the end of the bootstrap process -->
        <property name="autoStartup">
            <value>false</value>
        </property>
    </bean>
</beans>
