Search in sources :

Example 1 with ProcessEnginePlugin

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);
    }
}
Also used : ProcessEnginePluginXml(org.camunda.bpm.container.impl.metadata.spi.ProcessEnginePluginXml) ProcessEngineException(org.camunda.bpm.engine.ProcessEngineException) ProcessEnginePlugin(org.camunda.bpm.engine.impl.cfg.ProcessEnginePlugin)

Example 2 with ProcessEnginePlugin

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);
}
Also used : ProcessEnginePlugin(org.camunda.bpm.engine.impl.cfg.ProcessEnginePlugin) Test(org.junit.Test) AbstractFoxPlatformIntegrationTest(org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest)

Example 3 with ProcessEnginePlugin

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);
    }
}
Also used : ProcessEnginePluginXml(org.camunda.bpm.container.impl.metadata.spi.ProcessEnginePluginXml) ProcessEnginePlugin(org.camunda.bpm.engine.impl.cfg.ProcessEnginePlugin)

Example 4 with ProcessEnginePlugin

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();
}
Also used : StandaloneProcessEngineConfiguration(org.camunda.bpm.engine.impl.cfg.StandaloneProcessEngineConfiguration) PerfTestException(org.camunda.bpm.qa.performance.engine.framework.PerfTestException) ProcessEngineConfigurationImpl(org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl) ProcessEnginePlugin(org.camunda.bpm.engine.impl.cfg.ProcessEnginePlugin)

Aggregations

ProcessEnginePlugin (org.camunda.bpm.engine.impl.cfg.ProcessEnginePlugin)4 ProcessEnginePluginXml (org.camunda.bpm.container.impl.metadata.spi.ProcessEnginePluginXml)2 ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)1 ProcessEngineConfigurationImpl (org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl)1 StandaloneProcessEngineConfiguration (org.camunda.bpm.engine.impl.cfg.StandaloneProcessEngineConfiguration)1 AbstractFoxPlatformIntegrationTest (org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest)1 PerfTestException (org.camunda.bpm.qa.performance.engine.framework.PerfTestException)1 Test (org.junit.Test)1