Search in sources :

Example 1 with StormJavaProcessor

use of org.talend.designer.runprocess.storm.StormJavaProcessor in project tdi-studio-se by Talend.

the class DefaultRunProcessService method createJavaProcessor.

/**
     * DOC xue Comment method "createJavaProcessor".
     *
     * @param process
     * @param filenameFromLabel
     * @return
     */
protected IProcessor createJavaProcessor(IProcess process, Property property, boolean filenameFromLabel) {
    boolean isTestContainer = false;
    if (GlobalServiceRegister.getDefault().isServiceRegistered(ITestContainerProviderService.class)) {
        ITestContainerProviderService testContainerService = (ITestContainerProviderService) GlobalServiceRegister.getDefault().getService(ITestContainerProviderService.class);
        if (testContainerService != null && property != null && property.getItem() != null) {
            isTestContainer = testContainerService.isTestContainerItem(property.getItem());
        }
    }
    if (isTestContainer) {
        return new MavenJavaProcessor(process, property, filenameFromLabel);
    }
    // check for ESB Runtime
    if (GlobalServiceRegister.getDefault().isServiceRegistered(IESBRunContainerService.class)) {
        IESBRunContainerService runContainerService = (IESBRunContainerService) GlobalServiceRegister.getDefault().getService(IESBRunContainerService.class);
        if (runContainerService != null) {
            IProcessor processor = runContainerService.createJavaProcessor(process, property, filenameFromLabel);
            if (processor != null) {
                return processor;
            }
        }
    }
    if (ComponentCategory.CATEGORY_4_MAPREDUCE.getName().equals(process.getComponentsType())) {
        return new MapReduceJavaProcessor(process, property, filenameFromLabel);
    } else if (ComponentCategory.CATEGORY_4_SPARK.getName().equals(process.getComponentsType())) {
        return new SparkJavaProcessor(process, property, filenameFromLabel);
    } else if (ComponentCategory.CATEGORY_4_STORM.getName().equals(process.getComponentsType())) {
        return new StormJavaProcessor(process, property, filenameFromLabel);
    } else if (ComponentCategory.CATEGORY_4_SPARKSTREAMING.getName().equals(process.getComponentsType())) {
        return new SparkJavaProcessor(process, property, filenameFromLabel);
    } else if (ComponentCategory.CATEGORY_4_CAMEL.getName().equals(process.getComponentsType())) {
        Bundle bundle = Platform.getBundle(PluginChecker.EXPORT_ROUTE_PLUGIN_ID);
        if (bundle != null) {
            try {
                Class camelJavaProcessor = bundle.loadClass("org.talend.resources.export.maven.runprocess.CamelJavaProcessor");
                Constructor constructor = camelJavaProcessor.getConstructor(IProcess.class, Property.class, boolean.class);
                return (MavenJavaProcessor) constructor.newInstance(process, property, filenameFromLabel);
            } catch (Exception e) {
                ExceptionHandler.process(e);
            }
        }
        return new MavenJavaProcessor(process, property, filenameFromLabel);
    } else {
        return new MavenJavaProcessor(process, property, filenameFromLabel);
    }
}
Also used : StormJavaProcessor(org.talend.designer.runprocess.storm.StormJavaProcessor) MavenJavaProcessor(org.talend.designer.runprocess.maven.MavenJavaProcessor) MapReduceJavaProcessor(org.talend.designer.runprocess.mapreduce.MapReduceJavaProcessor) Bundle(org.osgi.framework.Bundle) Constructor(java.lang.reflect.Constructor) SparkJavaProcessor(org.talend.designer.runprocess.spark.SparkJavaProcessor) ITestContainerProviderService(org.talend.core.ui.ITestContainerProviderService) CoreException(org.eclipse.core.runtime.CoreException) FileNotFoundException(java.io.FileNotFoundException) IOException(java.io.IOException)

Aggregations

FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1 Constructor (java.lang.reflect.Constructor)1 CoreException (org.eclipse.core.runtime.CoreException)1 Bundle (org.osgi.framework.Bundle)1 ITestContainerProviderService (org.talend.core.ui.ITestContainerProviderService)1 MapReduceJavaProcessor (org.talend.designer.runprocess.mapreduce.MapReduceJavaProcessor)1 MavenJavaProcessor (org.talend.designer.runprocess.maven.MavenJavaProcessor)1 SparkJavaProcessor (org.talend.designer.runprocess.spark.SparkJavaProcessor)1 StormJavaProcessor (org.talend.designer.runprocess.storm.StormJavaProcessor)1