use of org.talend.repository.ui.wizards.exportjob.scriptsmanager.BDJobReArchieveCreator in project tdi-studio-se by Talend.
the class AbstractJavaProcessor method run.
@Override
public Process run(String[] optionsParam, int statisticsPort, int tracePort, IProgressMonitor monitor, IProcessMessageManager processMessageManager) throws ProcessorException {
if (isStandardJob()) {
Property property = this.getProperty();
if (property != null) {
// use the same function with ExportModelJavaProcessor, but will do for maven
ProcessItem processItem = (ProcessItem) property.getItem();
if (isRunAsExport()) {
// Step 1: Export job
archive = buildExportZip(processItem, monitor);
// Step 2: Deploy in local(Maybe just unpack)
unzipFolder = unzipAndDeploy(process, archive);
// Step 3: Run job from given folder.
return execFrom(unzipFolder + File.separatorChar + process.getName(), Level.INFO, statisticsPort, tracePort, optionsParam);
} else {
// If we are not in an export mode, we still have to check whether jobs need to be re-archived or
// not.
String version = processItem.getProperty().getVersion();
if (//$NON-NLS-1$
!RelationshipItemBuilder.LATEST_VERSION.equals(version) && version != null && !"".equals(version) && !version.equals(processItem.getProperty().getVersion())) {
processItem = ItemCacheManager.getProcessItem(processItem.getProperty().getId(), version);
}
Set<ProcessItem> processItems = new HashSet<>();
processItems.add(processItem);
// We get the father job childs.
Set<JobInfo> infos = ProcessorUtilities.getChildrenJobInfo(processItem);
Iterator<JobInfo> infoIterator = infos.iterator();
while (infoIterator.hasNext()) {
processItems.add(infoIterator.next().getProcessItem());
}
// We iterate over the job and its childs in order to re-archive them if needed.
for (ProcessItem pi : processItems) {
BDJobReArchieveCreator bdRecreator = new BDJobReArchieveCreator(pi, processItem);
bdRecreator.create(new File(this.getTalendJavaProject().getTargetFolder().getLocation().toPortableString()), false);
}
}
}
}
return super.run(optionsParam, statisticsPort, tracePort, monitor, processMessageManager);
}
Aggregations