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

<beans>

   <!--                                 -->
   <!-- Workflow Service Implementation -->
   <!--                                 -->

   <bean id="workflowServiceImpl" class="org.alfresco.repo.workflow.WorkflowServiceImpl">
      <property name="BPMEngineRegistry" ref="bpm_engineRegistry"/>
   </bean>

   <!--                       -->
   <!-- Alfresco BPM Registry -->
   <!--                       -->

   <bean id="bpm_engineRegistry" class="org.alfresco.repo.workflow.BPMEngineRegistry">
   </bean>

   <bean id="bpm_engine" class="org.alfresco.repo.workflow.BPMEngine" abstract="true">
      <property name="BPMEngineRegistry" ref="bpm_engineRegistry"/>
   </bean>

   <!--                     -->
   <!-- jBPM Implementation -->
   <!--                     -->

   <bean id="jbpm_configuration" class="org.springmodules.workflow.jbpm31.LocalJbpmConfigurationFactoryBean">
      <property name="sessionFactory" ref="sessionFactory"/>
      <property name="configuration" value="classpath:org/jbpm/default.jbpm.cfg.xml"/>
      <property name="processDefinitions">
      <list>
         <ref local="jbpm_testWorkflow"/>
      </list>
      </property>
   </bean>

   <bean id="jbpm_template" class="org.springmodules.workflow.jbpm31.JbpmTemplate">
      <constructor-arg index="0" ref="jbpm_configuration"/>
   </bean>

   <bean id="jbpm_engine" class="org.alfresco.repo.workflow.jbpm.JBPMEngine" parent="bpm_engine">
      <property name="engineId" value="jbpm"/>
      <property name="JBPMTemplate" ref="jbpm_template"/>
      <property name="dictionaryService" ref="DictionaryService"/>
      <property name="namespaceService" ref="NamespaceService"/>
   </bean>

   <!-- TODO: Remove this - for short-term testing only -->
   <bean id="jbpm_testWorkflow" class="org.springmodules.workflow.jbpm31.definition.ProcessDefinitionFactoryBean">
    <property name="definitionLocation" value="classpath:org/alfresco/repo/workflow/jbpm/test_processdefinition.xml"/>
  </bean>   

</beans>
