use of org.talend.core.runtime.repository.build.AbstractBuildProvider in project tdi-studio-se by Talend.
the class BuildJobFactory method createBuildJobHandler.
public static IBuildJobHandler createBuildJobHandler(ProcessItem processItem, String contextName, String version, Map<ExportChoice, Object> exportChoiceMap, String buildType) {
// if null, will try to find the type from item for build type.
if (StringUtils.isEmpty(buildType)) {
final Object type = processItem.getProperty().getAdditionalProperties().get(TalendProcessArgumentConstant.ARG_BUILD_TYPE);
if (type != null) {
buildType = type.toString();
}
// else{ // if didn't set, should use default provider to create it.
}
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put(IBuildParametes.ITEM, processItem);
parameters.put(IBuildParametes.VERSION, version);
parameters.put(IBuildJobParameters.CONTEXT_GROUP, contextName);
parameters.put(IBuildJobParameters.CHOICE_OPTION, exportChoiceMap);
final AbstractBuildProvider buildProvider = BuildExportManager.getInstance().getBuildProvider(buildType, parameters);
if (buildProvider != null) {
IBuildExportHandler buildExportHandler = buildProvider.createBuildExportHandler(parameters);
if (buildExportHandler instanceof IBuildJobHandler) {
// if buildType is null, will get first one. so use exact provider one.
buildExportHandler.getArguments().put(TalendProcessArgumentConstant.ARG_BUILD_TYPE, buildProvider.getBuildType().getName());
return (IBuildJobHandler) buildExportHandler;
}
}
return null;
}
use of org.talend.core.runtime.repository.build.AbstractBuildProvider in project tdi-studio-se by Talend.
the class MavenJavaProcessor method createMavenPomCreator.
protected IMavenPomCreator createMavenPomCreator() {
final Property itemProperty = this.getProperty();
String buildTypeName = null;
// FIXME, better use the arguments directly for run/export/build/..., and remove this flag later.
if (ProcessorUtilities.isExportConfig()) {
// final Object exportType = itemProperty.getAdditionalProperties().get(MavenConstants.NAME_EXPORT_TYPE);
final Object exportType = getArguments().get(TalendProcessArgumentConstant.ARG_BUILD_TYPE);
buildTypeName = exportType != null ? exportType.toString() : null;
}
// else { //if run job, will be null (use Standalone by default)
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put(IBuildParametes.ITEM, itemProperty.getItem());
parameters.put(IBuildPomCreatorParameters.PROCESSOR, this);
parameters.put(IBuildPomCreatorParameters.FILE_POM, getPomFile());
parameters.put(IBuildPomCreatorParameters.FILE_ASSEMBLY, getAssemblyFile());
parameters.put(IBuildPomCreatorParameters.CP_LINUX, this.unixClasspath);
parameters.put(IBuildPomCreatorParameters.CP_WIN, this.windowsClasspath);
parameters.put(IBuildPomCreatorParameters.ARGUMENTS_MAP, getArguments());
parameters.put(IBuildPomCreatorParameters.OVERWRITE_POM, Boolean.TRUE);
AbstractBuildProvider foundBuildProvider = BuildExportManager.getInstance().getBuildProvider(buildTypeName, parameters);
if (foundBuildProvider != null) {
final IMavenPomCreator creator = foundBuildProvider.createPomCreator(parameters);
if (creator != null) {
return creator;
}
}
// normally, won't be here, should return creator in font.
CreateMavenJobPom createTemplatePom = new CreateMavenJobPom(this, getPomFile());
createTemplatePom.setUnixClasspath(this.unixClasspath);
createTemplatePom.setWindowsClasspath(this.windowsClasspath);
createTemplatePom.setAssemblyFile(getAssemblyFile());
IPath itemLocationPath = ItemResourceUtil.getItemLocationPath(this.getProperty());
IFolder objectTypeFolder = ItemResourceUtil.getObjectTypeFolder(this.getProperty());
if (itemLocationPath != null && objectTypeFolder != null) {
IPath itemRelativePath = itemLocationPath.removeLastSegments(1).makeRelativeTo(objectTypeFolder.getLocation());
createTemplatePom.setObjectTypeFolder(objectTypeFolder);
createTemplatePom.setItemRelativePath(itemRelativePath);
}
return createTemplatePom;
}
Aggregations