ALF-9258: Bootstrapping of schema now done in seperate (disposable) engine, using a bare connection instead of one from the datasource + jobexecutor startup delayed untill SchemaAvailableEvent

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@29865 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Frederik Heremans
2011-08-18 11:41:19 +00:00
parent 27dfd5ab17
commit b5d8e12577
3 changed files with 394 additions and 4 deletions

View File

@@ -0,0 +1,51 @@
/*
* Copyright (C) 2005-2011 Alfresco Software Limited.
*
* This file is part of Alfresco
*
* Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
package org.alfresco.repo.workflow.activiti;
import org.activiti.engine.ProcessEngine;
import org.activiti.engine.impl.ProcessEngineImpl;
import org.alfresco.repo.domain.schema.SchemaAvailableEvent;
import org.springframework.context.ApplicationEvent;
import org.springframework.context.ApplicationListener;
/**
* Class that waits for an {@link SchemaAvailableEvent} to start the activiti
* job executor.
*
* @author Frederik Heremans
*/
public class ActivitiEngineInitializer implements ApplicationListener<ApplicationEvent>
{
private ProcessEngine processEngine;
@Override
public void onApplicationEvent(ApplicationEvent event)
{
if(event instanceof SchemaAvailableEvent && processEngine instanceof ProcessEngineImpl)
{
// Start the job-executor
((ProcessEngineImpl)processEngine).getProcessEngineConfiguration().getJobExecutor().start();
}
}
public void setProcessEngine(ProcessEngine processEngine)
{
this.processEngine = processEngine;
}
}