use of org.camunda.bpm.engine.impl.cfg.ProcessEnginePlugin in project camunda-bpm-platform by camunda.
the class MscManagedProcessEngineController method addProcessEnginePlugins.
protected void addProcessEnginePlugins(JtaProcessEngineConfiguration processEngineConfiguration) {
// add process engine plugins:
List<ProcessEnginePluginXml> pluginConfigurations = processEngineMetadata.getPluginConfigurations();
for (ProcessEnginePluginXml pluginXml : pluginConfigurations) {
// create plugin instance
ProcessEnginePlugin plugin = null;
String pluginClassName = pluginXml.getPluginClass();
try {
plugin = (ProcessEnginePlugin) createInstance(pluginClassName);
} catch (ClassCastException e) {
throw new ProcessEngineException("Process engine plugin '" + pluginClassName + "' does not implement interface " + ProcessEnginePlugin.class.getName() + "'.");
}
// apply configured properties
Map<String, String> properties = pluginXml.getProperties();
PropertyHelper.applyProperties(plugin, properties);
// add to configuration
processEngineConfiguration.getProcessEnginePlugins().add(plugin);
}
}
use of org.camunda.bpm.engine.impl.cfg.ProcessEnginePlugin in project camunda-bpm-platform by camunda.
the class PaSpinSupportTest method spinPluginShouldBeRegistered.
@Test
public void spinPluginShouldBeRegistered() {
List<ProcessEnginePlugin> processEnginePlugins = processEngineConfiguration.getProcessEnginePlugins();
boolean spinPluginFound = false;
for (ProcessEnginePlugin plugin : processEnginePlugins) {
if (plugin.getClass().getName().contains("Spin")) {
spinPluginFound = true;
break;
}
}
Assert.assertTrue(spinPluginFound);
}
use of org.camunda.bpm.engine.impl.cfg.ProcessEnginePlugin in project camunda-bpm-platform by camunda.
the class StartProcessEngineStep method configurePlugins.
/**
* <p>Instantiates and applies all {@link ProcessEnginePlugin}s defined in the processEngineXml
*/
protected void configurePlugins(ProcessEngineConfigurationImpl configuration, ProcessEngineXml processEngineXml, ClassLoader classLoader) {
for (ProcessEnginePluginXml pluginXml : processEngineXml.getPlugins()) {
// create plugin instance
Class<? extends ProcessEnginePlugin> pluginClass = loadClass(pluginXml.getPluginClass(), classLoader, ProcessEnginePlugin.class);
ProcessEnginePlugin plugin = createInstance(pluginClass);
// apply configured properties
Map<String, String> properties = pluginXml.getProperties();
PropertyHelper.applyProperties(plugin, properties);
// add to configuration
configuration.getProcessEnginePlugins().add(plugin);
}
}
use of org.camunda.bpm.engine.impl.cfg.ProcessEnginePlugin in project camunda-bpm-platform by camunda.
the class PerfTestProcessEngine method createProcessEngine.
protected static ProcessEngine createProcessEngine(javax.sql.DataSource datasource, Properties properties) {
ProcessEngineConfigurationImpl processEngineConfiguration = new StandaloneProcessEngineConfiguration();
processEngineConfiguration.setDataSource(datasource);
processEngineConfiguration.setDatabaseSchemaUpdate(ProcessEngineConfiguration.DB_SCHEMA_UPDATE_TRUE);
processEngineConfiguration.setHistory(properties.getProperty("historyLevel"));
processEngineConfiguration.setJdbcBatchProcessing(Boolean.valueOf(properties.getProperty("jdbcBatchProcessing")));
// load plugins
String processEnginePlugins = properties.getProperty("processEnginePlugins", "");
for (String pluginName : processEnginePlugins.split(",")) {
if (pluginName.length() > 1) {
Object pluginInstance = ReflectUtil.instantiate(pluginName);
if (!(pluginInstance instanceof ProcessEnginePlugin)) {
throw new PerfTestException("Plugin " + pluginName + " is not an instance of ProcessEnginePlugin");
} else {
List<ProcessEnginePlugin> plugins = processEngineConfiguration.getProcessEnginePlugins();
if (plugins == null) {
plugins = new ArrayList<ProcessEnginePlugin>();
processEngineConfiguration.setProcessEnginePlugins(plugins);
}
plugins.add((ProcessEnginePlugin) pluginInstance);
}
}
}
return processEngineConfiguration.buildProcessEngine();
}
Aggregations