use of org.talend.designer.publish.core.models.FeaturesModel in project tdi-studio-se by Talend.
the class AbstractPublishJobAction method getFeatureModel.
private FeaturesModel getFeatureModel(File tmpJob) {
ProcessItem processItem = (ProcessItem) node.getObject().getProperty().getItem();
FeaturesModel featuresModel = new FeaturesModel(groupId, artifactName, artifactVersion);
featuresModel.setConfigName(node.getObject().getLabel());
featuresModel.setContexts(JobContextUtils.getContextsMap(processItem));
BundleModel bundleModel = new BundleModel(groupId, artifactName, artifactVersion, tmpJob);
featuresModel.addBundle(bundleModel);
return featuresModel;
}
use of org.talend.designer.publish.core.models.FeaturesModel in project tdi-studio-se by Talend.
the class AbstractPublishJobAction method exportJobForOSGI.
private void exportJobForOSGI(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
File tmpJob = null;
final ProcessItem processItem = (ProcessItem) node.getObject().getProperty().getItem();
try {
tmpJob = File.createTempFile("job", ".jar", null);
jobScriptsManager = JobScriptsManagerFactory.createManagerInstance(JobScriptsManagerFactory.getDefaultExportChoiceMap(), processItem.getProcess().getDefaultContext(), JobScriptsManager.LAUNCHER_ALL, IProcessor.NO_STATISTICS, IProcessor.NO_TRACES, JobExportType.OSGI);
// generate
jobScriptsManager.setDestinationPath(tmpJob.getAbsolutePath());
JobExportAction action = new JobExportAction(Collections.singletonList(node), jobVersion, bundleVersion, jobScriptsManager, System.getProperty("java.io.tmpdir"));
action.run(monitor);
if (!action.isBuildSuccessful()) {
return;
}
monitor.beginTask("Deploy to Artifact Repository....", IProgressMonitor.UNKNOWN);
FeaturesModel featuresModel = getFeatureModel(tmpJob);
// [TESB-12036] add talend-data-mapper feature
NodeType tHMapNode = EmfModelUtils.getComponentByName(processItem, THMAP_COMPONENT_NAME);
if (tHMapNode != null) {
featuresModel.addFeature(new FeatureModel(FeaturesModel.TALEND_DATA_MAPPER_FEATURE_NAME));
}
processModules(featuresModel, ((JobJavaScriptOSGIForESBManager) jobScriptsManager).getExcludedModuleNeededs());
process(processItem, featuresModel, monitor);
} catch (IOException e) {
throw new InvocationTargetException(e);
} finally {
if (tmpJob != null && tmpJob.exists()) {
tmpJob.delete();
}
}
}
use of org.talend.designer.publish.core.models.FeaturesModel in project tdi-studio-se by Talend.
the class AbstractPublishJobAction method exportJobForPOJO.
private void exportJobForPOJO(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
File tmpJob = null;
try {
tmpJob = File.createTempFile("item", ".zip", null);
// jobScriptsManager.setDestinationPath(tmpJob.getAbsolutePath());
// JobExportAction action = new JobExportAction(Collections.singletonList(node), jobVersion,
// jobScriptsManager, null,
// "job");
// action.run(monitor);
// if (!action.isBuildSuccessful()) {
// return;
// }
// TDI-32861, because for publish job, so means, must be binaries
exportChoiceMap.put(ExportChoice.binaries, true);
exportChoiceMap.put(ExportChoice.includeLibs, true);
exportChoiceMap.put(ExportChoice.addStatistics, true);
ProcessItem processItem = (ProcessItem) node.getObject().getProperty().getItem();
String contextName = (String) exportChoiceMap.get(ExportChoice.contextName);
if (contextName == null) {
contextName = processItem.getProcess().getDefaultContext();
}
BuildJobManager.getInstance().buildJob(tmpJob.getAbsolutePath(), processItem, jobVersion, contextName, exportChoiceMap, exportType, monitor);
if (GlobalServiceRegister.getDefault().isServiceRegistered(IRunProcessService.class)) {
IRunProcessService service = (IRunProcessService) GlobalServiceRegister.getDefault().getService(IRunProcessService.class);
boolean hasError = service.checkExportProcess(new StructuredSelection(node), true);
if (hasError) {
return;
}
}
monitor.beginTask("Deploy to Artifact Repository....", IProgressMonitor.UNKNOWN);
FeaturesModel featuresModel = getFeatureModel(tmpJob);
process(processItem, featuresModel, monitor);
} catch (InterruptedException e) {
throw e;
} catch (Exception e) {
throw new InvocationTargetException(e);
} finally {
if (tmpJob != null && tmpJob.exists()) {
tmpJob.delete();
}
}
}
use of org.talend.designer.publish.core.models.FeaturesModel in project tesb-studio-se by Talend.
the class JavaCamelJobScriptsExportWSAction method run.
@Override
public final void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
this.monitor = monitor;
String groupId = getGroupId();
String routeName = getArtifactId();
String routeVersion = getArtifactVersion();
featuresModel = new FeaturesModel(groupId, routeName, routeVersion);
try {
// generated bundle jar first
File routeFile;
try {
routeFile = File.createTempFile("route", FileConstants.JAR_FILE_SUFFIX, //$NON-NLS-1$
new File(getTempDir()));
} catch (IOException e) {
throw new InvocationTargetException(e);
}
BundleModel routeModel = new BundleModel(groupId, routeName, routeVersion, routeFile);
if (featuresModel.addBundle(routeModel)) {
final ProcessItem routeProcess = (ProcessItem) routeNode.getObject().getProperty().getItem();
CamelFeatureUtil.addFeatureAndBundles(routeProcess, featuresModel);
featuresModel.setConfigName(routeNode.getObject().getLabel());
featuresModel.setContexts(JobContextUtils.getContextsMap(routeProcess));
exportAllReferenceJobs(routeName, routeProcess);
final Set<String> routelets = new HashSet<>();
exportAllReferenceRoutelets(routeName, routeProcess, routelets);
exportRouteBundle(routeNode, routeFile, version, null, null, bundleVersion, null, routelets, null);
}
processResults(featuresModel, monitor);
} finally {
// remove generated files
removeTempFiles();
}
}
use of org.talend.designer.publish.core.models.FeaturesModel in project tesb-studio-se by Talend.
the class ExportServiceAction method run.
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
String destinationPath = serviceManager.getDestinationPath();
if (!destinationPath.endsWith(FileConstants.KAR_FILE_SUFFIX)) {
//$NON-NLS-1$
destinationPath = destinationPath.replace("\\", PATH_SEPERATOR);
if (destinationPath.indexOf(PATH_SEPERATOR) != -1) {
String filePath = destinationPath.substring(0, destinationPath.lastIndexOf(PATH_SEPERATOR) + 1);
String fileName = destinationPath.substring(destinationPath.lastIndexOf(PATH_SEPERATOR) + 1);
if (fileName.indexOf('.') != -1) {
fileName = fileName.substring(0, fileName.lastIndexOf('.'));
}
destinationPath = filePath + fileName + FileConstants.KAR_FILE_SUFFIX;
}
}
FeaturesModel feature = new FeaturesModel(getGroupId(), getServiceName(), getServiceVersion());
feature.setConfigName(getServiceName());
feature.setContexts(contextValues);
try {
addRequiredFeatures(feature);
exportJobsBundle(monitor, feature);
// control bundle
addControlBundle(feature);
processFeature(feature);
processFinalResult(destinationPath);
} catch (InvocationTargetException e) {
throw e;
} catch (InterruptedException e) {
throw e;
} catch (Exception e) {
throw new InvocationTargetException(e);
} finally {
clean();
}
}
Aggregations