use of org.talend.repository.ui.wizards.exportjob.scriptsmanager.JobScriptsManager.ExportChoice in project tdi-studio-se by Talend.
the class JobScriptsExportWizardPage method buildJobWithMaven.
protected boolean buildJobWithMaven(JobExportType jobExportType, IProgressMonitor monitor) {
String context = (contextCombo == null || contextCombo.isDisposed()) ? processItem.getProcess().getDefaultContext() : contextCombo.getText();
try {
String destination = getDestinationValue();
int separatorIndex = destination.lastIndexOf(File.separator);
if (separatorIndex == -1) {
//$NON-NLS-1$
String userDir = System.getProperty("user.dir");
destination = userDir + File.separator + destination;
}
Map<ExportChoice, Object> exportChoiceMap = getExportChoiceMap();
exportChoiceMap.put(ExportChoice.addStatistics, Boolean.TRUE);
return BuildJobManager.getInstance().buildJobs(destination, Arrays.asList(getCheckNodes()), getDefaultFileName(), getSelectedJobVersion(), context, exportChoiceMap, jobExportType, monitor);
} catch (Exception e) {
MessageBoxExceptionHandler.process(e, getShell());
return false;
}
}
use of org.talend.repository.ui.wizards.exportjob.scriptsmanager.JobScriptsManager.ExportChoice in project tdi-studio-se by Talend.
the class JavaJobScriptsExportWSWizardPage method createJobScriptsManager.
/*
* (non-Javadoc)
*
* @see org.talend.repository.ui.wizards.exportjob.JavaJobScriptsExportWizardPage#createJobScriptsManager()
*/
@Override
public JobScriptsManager createJobScriptsManager() {
Map<ExportChoice, Object> exportChoiceMap = getExportChoiceMap();
String log4jLevel = "";
String launcher = (getCurrentExportType1() == JobExportType.POJO) ? launcherCombo.getText() : "all";
String context = (contextCombo == null || contextCombo.isDisposed()) ? IContext.DEFAULT : contextCombo.getText();
JobScriptsManager manager = JobScriptsManagerFactory.createManagerInstance(exportChoiceMap, context, launcher, IProcessor.NO_STATISTICS, IProcessor.NO_TRACES, getCurrentExportType1());
manager.setDestinationPath(getDestinationValue());
if (log4jLevelCombo != null && !log4jLevelCombo.isDisposed()) {
if (log4jLevelCombo.isEnabled()) {
log4jLevel = log4jLevelCombo.getText();
} else {
log4jLevel = null;
}
} else {
log4jLevel = null;
}
manager.setLog4jLevel(log4jLevel);
return manager;
}
use of org.talend.repository.ui.wizards.exportjob.scriptsmanager.JobScriptsManager.ExportChoice in project tdi-studio-se by Talend.
the class StandardJobStandaloneBuildProvider method createBuildExportHandler.
@Override
public IBuildExportHandler createBuildExportHandler(Map<String, Object> parameters) {
if (parameters == null || parameters.isEmpty()) {
return null;
}
final Object item = parameters.get(ITEM);
if (item == null || !(item instanceof ProcessItem)) {
return null;
}
final Object version = parameters.get(VERSION);
if (version == null) {
return null;
}
final Object contextGroup = parameters.get(CONTEXT_GROUP);
if (contextGroup == null) {
return null;
}
Object choiceOption = parameters.get(CHOICE_OPTION);
if (choiceOption == null) {
choiceOption = Collections.emptyMap();
}
if (!(choiceOption instanceof Map)) {
return null;
}
IBuildJobHandler buildHandler = new BuildJobHandler((ProcessItem) item, version.toString(), contextGroup.toString(), (Map<ExportChoice, Object>) choiceOption);
return buildHandler;
}
use of org.talend.repository.ui.wizards.exportjob.scriptsmanager.JobScriptsManager.ExportChoice in project tdi-studio-se by Talend.
the class ExportProcessorHelper method export.
/**
*
* DOC ggu Comment method "export".
*
* export for execute or deploy the job on job server.
*/
public void export(IProgressMonitor monitor, ProcessItem item, ERepositoryObjectType type, String context, String archiveFile, String log4jLevel, boolean applyContextToChildren, int statisticsPort, int tracePort, Properties properties) throws ProcessorException {
if (item == null) {
throw new ProcessorException("Can't find the job");
}
if (monitor == null) {
monitor = new NullProgressMonitor();
}
// old way
// export(destDir, archiveFileName, context, log4jLevel, applyContextToChildren, statisticsPort, tracePort,
// statisticsPort > IProcessor.NO_STATISTICS, name, version, null, false, false, false);
// mostly, should same as BuildJobExecuteCommand
Map<ExportChoice, Object> exportChoiceMap = JobScriptsManagerFactory.getDefaultExportChoiceMap();
exportChoiceMap.put(ExportChoice.doNotCompileCode, false);
exportChoiceMap.put(ExportChoice.needDependencies, true);
exportChoiceMap.put(ExportChoice.addStatistics, (statisticsPort > IProcessor.NO_STATISTICS));
exportChoiceMap.put(ExportChoice.addTracs, (tracePort > IProcessor.NO_TRACES));
exportChoiceMap.put(ExportChoice.needAntScript, false);
exportChoiceMap.put(ExportChoice.needMavenScript, false);
exportChoiceMap.put(ExportChoice.applyToChildren, applyContextToChildren);
exportChoiceMap.put(ExportChoice.needContext, true);
exportChoiceMap.put(ExportChoice.binaries, true);
exportChoiceMap.put(ExportChoice.needSourceCode, false);
exportChoiceMap.put(ExportChoice.executeTests, false);
exportChoiceMap.put(ExportChoice.includeTestSource, false);
exportChoiceMap.put(ExportChoice.includeLibs, true);
exportChoiceMap.put(ExportChoice.needLog4jLevel, log4jLevel != null);
exportChoiceMap.put(ExportChoice.log4jLevel, log4jLevel);
// set like the method export(...) for buildJob
exportChoiceMap.put(ExportChoice.jobType, type);
if (context == null) {
context = item.getProcess().getDefaultContext();
}
exportChoiceMap.put(ExportChoice.contextName, context);
// add some other addition arguments in "properties"
Properties prop = new Properties();
if (properties != null) {
// add init properties.
Enumeration<Object> keys = properties.keys();
while (keys.hasMoreElements()) {
String key = keys.nextElement().toString();
String value = properties.getProperty(key);
prop.put(key, value);
}
}
// prop.put(TalendProcessArgumentConstant.ARG_PORT_STATS, statisticsPort);
// prop.put(TalendProcessArgumentConstant.ARG_PORT_TRACS, tracePort);
exportChoiceMap.put(ExportChoice.properties, prop);
if (monitor.isCanceled()) {
throw new ProcessorException(new InterruptedException());
}
try {
BuildJobManager.getInstance().buildJob(archiveFile, item, item.getProperty().getVersion(), context, exportChoiceMap, JobExportType.POJO, monitor);
} catch (InvocationTargetException e) {
if (e.getTargetException() != null) {
throw new ProcessorException(e.getTargetException());
} else {
throw new ProcessorException(e);
}
} catch (Exception e) {
throw new ProcessorException(e);
}
}
use of org.talend.repository.ui.wizards.exportjob.scriptsmanager.JobScriptsManager.ExportChoice in project tmdm-studio-se by Talend.
the class DeployOnMDMExportWizardPage method prepareProcess.
private boolean prepareProcess(boolean needContextScript, String context, IProgressMonitor monitor) {
monitor.setTaskName(Messages.DeployOnMDMExportWizardPage_prepareDeployJob);
monitor.worked(W_PREPARE_PROCESS);
Map<ExportChoice, Object> exportChoiceMap = getExportChoiceMap(needContextScript);
boolean canExport = false;
for (ExportChoice choice : ExportChoice.values()) {
if (exportChoiceMap.get(choice) != null && exportChoiceMap.get(choice) instanceof Boolean && (Boolean) exportChoiceMap.get(choice)) {
canExport = true;
break;
}
}
if (!canExport) {
Display.getDefault().asyncExec(new Runnable() {
public void run() {
MessageDialog.openInformation(getContainer().getShell(), Messages.DeployOnMDMExportWizardPage_publishResourceError, Messages.DeployOnMDMExportWizardPage_chooseResource);
}
});
setDeploySucceed(false);
return false;
}
// reset the manager,now only support zip type
manager = new JobJavaScriptsManager(exportChoiceMap, context, JobScriptsManager.ALL_ENVIRONMENTS, IProcessor.NO_STATISTICS, IProcessor.NO_TRACES);
if (!saveflag) {
saveflag = true;
return false;
}
// about to invoke the operation so save our state
doSaveWidgetValues();
monitor.worked(W_PREPARE_PROCESS);
return true;
}
Aggregations