use of org.talend.designer.runprocess.maven.MavenJavaProcessor 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);
}
}
use of org.talend.designer.runprocess.maven.MavenJavaProcessor in project tesb-studio-se by Talend.
the class JobJavaScriptOSGIForESBRuntimeManager method generateJobFiles.
@Override
protected IProcess generateJobFiles(ProcessItem process, String contextName, String version, boolean statistics, boolean trace, boolean applyContextToChildren, IProgressMonitor monitor) throws ProcessorException {
LastGenerationInfo.getInstance().getUseDynamicMap().clear();
// TODO stat port tracer, to replace the port, need to improve efficiency
IDesignerCoreService service = CorePlugin.getDefault().getDesignerCoreService();
IProcess currentProcess = service.getProcessFromProcessItem(process);
IProcessor processor = ProcessorUtilities.getProcessor(currentProcess, null);
StatPortChecker checker = null;
if (processor instanceof MavenJavaProcessor) {
MavenJavaProcessor mvnProcessor = (MavenJavaProcessor) processor;
checker = new StatPortChecker(processor.getCodeProject().getFile(mvnProcessor.getSrcCodePath()).getLocation(), statisticPort, tracePort);
new Thread(checker, "Statistic Port Finder").start();
mvnProcessor = null;
}
IProcessor processor2 = ProcessorUtilities.generateCode(process, contextName, version, statistics, trace, applyContextToChildren, isOptionChoosed(ExportChoice.needContext), monitor);
if (checker != null) {
checker.stop();
}
return processor2.getProcess();
}
Aggregations