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);
}
}
Aggregations