Search in sources :

Example 1 with CreateMavenBundlePom

use of org.talend.camel.designer.build.CreateMavenBundlePom in project tesb-studio-se by Talend.

the class BundleJavaProcessor method createMavenPomCreator.

/*
     * (non-Javadoc)
     *
     * @see org.talend.designer.runprocess.maven.MavenJavaProcessor#createMavenPomCreator()
     */
@Override
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.
    CreateMavenBundlePom createTemplatePom = new CreateMavenBundlePom(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;
}
Also used : AbstractBuildProvider(org.talend.core.runtime.repository.build.AbstractBuildProvider) IPath(org.eclipse.core.runtime.IPath) HashMap(java.util.HashMap) IMavenPomCreator(org.talend.core.runtime.repository.build.IMavenPomCreator) RepositoryObject(org.talend.core.model.repository.RepositoryObject) IRepositoryObject(org.talend.core.model.repository.IRepositoryObject) CreateMavenBundlePom(org.talend.camel.designer.build.CreateMavenBundlePom) Property(org.talend.core.model.properties.Property) IFolder(org.eclipse.core.resources.IFolder)

Aggregations

HashMap (java.util.HashMap)1 IFolder (org.eclipse.core.resources.IFolder)1 IPath (org.eclipse.core.runtime.IPath)1 CreateMavenBundlePom (org.talend.camel.designer.build.CreateMavenBundlePom)1 Property (org.talend.core.model.properties.Property)1 IRepositoryObject (org.talend.core.model.repository.IRepositoryObject)1 RepositoryObject (org.talend.core.model.repository.RepositoryObject)1 AbstractBuildProvider (org.talend.core.runtime.repository.build.AbstractBuildProvider)1 IMavenPomCreator (org.talend.core.runtime.repository.build.IMavenPomCreator)1