mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Added code to create a transient ActivitiEngine to initialise the DB schema during bootstrap. Code is currently commented out though as it's still not working.
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@29720 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -57,11 +57,6 @@
|
||||
<property name="localSessionFactory">
|
||||
<ref bean="&sessionFactory"></ref> <!-- inject the actual factory, not a session -->
|
||||
</property>
|
||||
<!--
|
||||
<property name="activitiProcessEngine">
|
||||
<ref bean="activitiProcessEngine" />
|
||||
</property>
|
||||
-->
|
||||
<property name="dialect">
|
||||
<ref bean="dialect" />
|
||||
</property>
|
||||
|
@@ -42,6 +42,7 @@ import java.util.Properties;
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.activiti.engine.ProcessEngine;
|
||||
import org.activiti.engine.ProcessEngineConfiguration;
|
||||
import org.alfresco.error.AlfrescoRuntimeException;
|
||||
import org.alfresco.ibatis.SerializableTypeHandler;
|
||||
import org.alfresco.repo.admin.patch.Patch;
|
||||
@@ -195,7 +196,6 @@ public class SchemaBootstrap extends AbstractLifecycleBean
|
||||
|
||||
private DataSource dataSource;
|
||||
private LocalSessionFactoryBean localSessionFactory;
|
||||
private ProcessEngine activitiProcessEngine;
|
||||
private String schemaOuputFilename;
|
||||
private boolean updateSchema;
|
||||
private boolean stopAfterSchemaBootstrap;
|
||||
@@ -238,11 +238,6 @@ public class SchemaBootstrap extends AbstractLifecycleBean
|
||||
return localSessionFactory;
|
||||
}
|
||||
|
||||
public void setActivitiProcessEngine(ProcessEngine processEngine)
|
||||
{
|
||||
this.activitiProcessEngine = processEngine;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set this to output the full database creation script
|
||||
*
|
||||
@@ -796,12 +791,44 @@ public class SchemaBootstrap extends AbstractLifecycleBean
|
||||
checkSchemaPatchScripts(cfg, connection, postUpdateScriptPatches, true);
|
||||
}
|
||||
|
||||
// Ask emebedded Activiti to create or update it's schema
|
||||
// activitiProcessEngine.getManagementService().databaseSchemaUpgrade(connection, null, null);
|
||||
// initialise Activiti
|
||||
// initialiseActivitiDBSchema(connection);
|
||||
|
||||
return create;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialises the Activiti DB schema, if not present it's created, if
|
||||
* present it is upgraded appropriately if necessary.
|
||||
*
|
||||
* @param connection Connection to use the initialise DB schema
|
||||
*/
|
||||
private void initialiseActivitiDBSchema(Connection connection)
|
||||
{
|
||||
// create instance of activiti engine to initialise schema
|
||||
ProcessEngine engine = null;
|
||||
ProcessEngineConfiguration engineConfig = ProcessEngineConfiguration.createStandaloneProcessEngineConfiguration();
|
||||
try
|
||||
{
|
||||
// build the engine
|
||||
engine = engineConfig.setDataSource(dataSource).
|
||||
setDatabaseSchemaUpdate("none").
|
||||
setJobExecutorActivate(false).
|
||||
buildProcessEngine();
|
||||
|
||||
// create or upgrade the DB schema
|
||||
engine.getManagementService().databaseSchemaUpgrade(connection, null, null);
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (engine != null)
|
||||
{
|
||||
// close the process engine
|
||||
engine.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check that the necessary scripts have been executed against the database
|
||||
*/
|
||||
|
Reference in New Issue
Block a user