Search in sources :

Example 31 with IRunProcessService

use of org.talend.designer.runprocess.IRunProcessService in project tdi-studio-se by Talend.

the class ConfigExternalLibPage method finish.

/**
     * Subclasses should implement this for its own business.
     * 
     * @return
     */
public boolean finish() {
    // maybe need process the pig udf and bean also. not only for routine.
    if (GlobalServiceRegister.getDefault().isServiceRegistered(IRunProcessService.class)) {
        IRunProcessService service = (IRunProcessService) GlobalServiceRegister.getDefault().getService(IRunProcessService.class);
        ITalendProcessJavaProject talendProcessJavaProject = service.getTalendProcessJavaProject();
        if (talendProcessJavaProject != null) {
            talendProcessJavaProject.updateRoutinesPom(true, true);
        }
    }
    return true;
}
Also used : IRunProcessService(org.talend.designer.runprocess.IRunProcessService) ITalendProcessJavaProject(org.talend.core.runtime.process.ITalendProcessJavaProject)

Example 32 with IRunProcessService

use of org.talend.designer.runprocess.IRunProcessService in project tdi-studio-se by Talend.

the class GenerateGrammarController method addReferenceJavaFile.

/**
     * Store file to file system. Actually, it locates src/routines/xx DOC ytao Comment method "addReferenceJavaFile".
     * 
     * @param routineItem
     * @param copyToTemp
     * @return
     * @throws SystemException
     */
private IFile addReferenceJavaFile(RoutineItem routineItem, boolean copyToTemp) throws SystemException {
    FileOutputStream fos = null;
    try {
        IRunProcessService service = DesignerPlugin.getDefault().getRunProcessService();
        ITalendProcessJavaProject talendProcessJavaProject = service.getTalendProcessJavaProject();
        if (talendProcessJavaProject == null) {
            return null;
        }
        String label = routineItem.getProperty().getLabel();
        IFile file = talendProcessJavaProject.getSrcFolder().getFile(JavaUtils.JAVA_ROUTINES_DIRECTORY + '/' + label + JavaUtils.JAVA_EXTENSION);
        if (copyToTemp) {
            String routineContent = new String(routineItem.getContent().getInnerContent());
            if (!label.equals(ITalendSynchronizer.TEMPLATE)) {
                routineContent = routineContent.replaceAll(ITalendSynchronizer.TEMPLATE, label);
                File f = file.getLocation().toFile();
                fos = new FileOutputStream(f);
                fos.write(routineContent.getBytes());
                fos.close();
            }
        }
        if (!file.exists()) {
            file.refreshLocal(1, null);
        }
        return file;
    } catch (Exception e) {
        throw new SystemException(e);
    } finally {
        try {
            fos.close();
        } catch (Exception e) {
            // ignore me even if i'm null
            ExceptionHandler.process(e);
        }
    }
}
Also used : IFile(org.eclipse.core.resources.IFile) SystemException(org.talend.commons.exception.SystemException) FileOutputStream(java.io.FileOutputStream) IRunProcessService(org.talend.designer.runprocess.IRunProcessService) IFile(org.eclipse.core.resources.IFile) File(java.io.File) ITalendProcessJavaProject(org.talend.core.runtime.process.ITalendProcessJavaProject) SystemException(org.talend.commons.exception.SystemException) IOException(java.io.IOException)

Example 33 with IRunProcessService

use of org.talend.designer.runprocess.IRunProcessService in project tdi-studio-se by Talend.

the class GenerateGrammarController method refreshProject.

/**
     * refresh the project
     * 
     * DOC ytao Comment method "refreshProject".
     */
private void refreshProject() {
    if (GlobalServiceRegister.getDefault().isServiceRegistered(IRunProcessService.class)) {
        IRunProcessService processService = (IRunProcessService) GlobalServiceRegister.getDefault().getService(IRunProcessService.class);
        processService.buildJavaProject();
    }
}
Also used : IRunProcessService(org.talend.designer.runprocess.IRunProcessService)

Example 34 with IRunProcessService

use of org.talend.designer.runprocess.IRunProcessService 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();
        }
    }
}
Also used : ProcessItem(org.talend.core.model.properties.ProcessItem) FeaturesModel(org.talend.designer.publish.core.models.FeaturesModel) IRunProcessService(org.talend.designer.runprocess.IRunProcessService) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) File(java.io.File) IOException(java.io.IOException) InvocationTargetException(java.lang.reflect.InvocationTargetException) InvocationTargetException(java.lang.reflect.InvocationTargetException)

Example 35 with IRunProcessService

use of org.talend.designer.runprocess.IRunProcessService in project tdi-studio-se by Talend.

the class WSDL2JAVAController method refreshProject.

private void refreshProject() {
    if (GlobalServiceRegister.getDefault().isServiceRegistered(IRunProcessService.class)) {
        IRunProcessService processService = (IRunProcessService) GlobalServiceRegister.getDefault().getService(IRunProcessService.class);
        processService.buildJavaProject();
    }
}
Also used : IRunProcessService(org.talend.designer.runprocess.IRunProcessService)

Aggregations

IRunProcessService (org.talend.designer.runprocess.IRunProcessService)51 ITalendProcessJavaProject (org.talend.core.runtime.process.ITalendProcessJavaProject)30 IFolder (org.eclipse.core.resources.IFolder)17 IFile (org.eclipse.core.resources.IFile)15 File (java.io.File)14 IOException (java.io.IOException)13 ArrayList (java.util.ArrayList)12 CoreException (org.eclipse.core.runtime.CoreException)11 URL (java.net.URL)9 PersistenceException (org.talend.commons.exception.PersistenceException)9 MalformedURLException (java.net.MalformedURLException)7 IPath (org.eclipse.core.runtime.IPath)7 IProcess (org.talend.core.model.process.IProcess)7 ProcessorException (org.talend.designer.runprocess.ProcessorException)6 InvocationTargetException (java.lang.reflect.InvocationTargetException)5 DocumentException (org.dom4j.DocumentException)5 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)5 HashSet (java.util.HashSet)4 ProcessItem (org.talend.core.model.properties.ProcessItem)4 ByteArrayInputStream (java.io.ByteArrayInputStream)3