Search in sources :

Example 41 with ProcessorException

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

the class RowGenProcessMain method runPreviewCode.

/**
     * qzhang Comment method "runPreviewCode".
     */
public Process runPreviewCode() {
    getProcess();
    if (jobContextManager == null) {
        // proc.getContextManager().setListContext(component.getProcess().getContextManager().getListContext());
        proc.getContextManager().setDefaultContext(component.getProcess().getContextManager().getDefaultContext());
    } else {
        // proc.getContextManager().setListContext(jobContextManager.getListContext());
        proc.getContextManager().setDefaultContext(jobContextManager.getDefaultContext());
    }
    // IContext context2 = new org.talend.core.model.context.JobContext(PREVIEW);
    // if (UIManager.isJavaProject()) {
    // List<IContextParameter> params = new ArrayList<IContextParameter>();
    // JobContextParameter contextParameter = new JobContextParameter();
    // contextParameter.setContext(context2);
    // contextParameter.setName(PREVIEW);
    // contextParameter.setValue(PREVIEW);
    // contextParameter.setType("String");
    // params.add(contextParameter);
    // context2.setContextParameterList(params);
    // }
    // generate context files.
    IProcessor contextProcessor = ProcessorUtilities.getProcessor(proc, null);
    contextProcessor.setContext(proc.getContextManager().getDefaultContext());
    try {
        contextProcessor.cleanBeforeGenerate(TalendProcessOptionConstants.CLEAN_CONTEXTS);
        contextProcessor.generateContextCode();
    } catch (ProcessorException pe) {
        ExceptionHandler.process(pe);
    }
    IProcessor processor = ProcessorUtilities.getProcessor(proc, null, proc.getContextManager().getDefaultContext());
    try {
        return processor.run(IProcessor.NO_STATISTICS, IProcessor.NO_TRACES, null);
    } catch (Exception e) {
        ExceptionHandler.process(e);
        return null;
    }
}
Also used : ProcessorException(org.talend.designer.runprocess.ProcessorException) IProcessor(org.talend.designer.runprocess.IProcessor) ProcessorException(org.talend.designer.runprocess.ProcessorException) IOException(java.io.IOException)

Example 42 with ProcessorException

use of org.talend.designer.runprocess.ProcessorException in project tmdm-studio-se by Talend.

the class DeployOnMDMExportWizardPage method generateProcess.

private boolean generateProcess(ExportFileResource p, IProgressMonitor monitor) {
    String label = getProcessName(p);
    monitor.setTaskName(Messages.bind(Messages.DeployOnMDMExportWizardPage_Generating, label));
    ProcessItem processItem = (ProcessItem) p.getItem();
    try {
        ProcessorUtilities.generateCode(processItem, processItem.getProcess().getDefaultContext(), false, false);
        monitor.worked(W_GENERATE_PROCESS);
    } catch (ProcessorException e) {
        MessageBoxExceptionHandler.process(e);
        setDeploySucceed(false);
        return false;
    }
    return true;
}
Also used : ProcessorException(org.talend.designer.runprocess.ProcessorException) ProcessItem(org.talend.core.model.properties.ProcessItem)

Example 43 with ProcessorException

use of org.talend.designer.runprocess.ProcessorException in project tmdm-studio-se by Talend.

the class DeployOnMDMExportWizardPage method exportJob.

private boolean exportJob(ExportFileResource p, boolean needContextScript, IProgressMonitor monitor) {
    String label = getProcessName(p);
    monitor.setTaskName(Messages.bind(Messages.DeployOnMDMExportWizardPage_exporting, label));
    if (!ensureTargetIsValid(p)) {
        setDeploySucceed(false);
        return false;
    }
    List<ExportFileResource> resourcesToExport = null;
    try {
        resourcesToExport = getExportResources(p);
    } catch (ProcessorException e) {
        MessageBoxExceptionHandler.process(e);
        setDeploySucceed(false);
        return false;
    }
    String topFolder = getRootFolderName(p);
    setTopFolder(resourcesToExport, topFolder);
    ArchiveFileExportOperationFullPath exporterOperation = getExporterOperation(p, resourcesToExport);
    boolean ok = executeExportOperation(exporterOperation);
    // TODO What if not ok ????
    // path can like name/name
    manager.deleteTempFiles();
    ProcessorUtilities.resetExportConfig();
    monitor.worked(W_EXPORT_PROCESS);
    return true;
}
Also used : ProcessorException(org.talend.designer.runprocess.ProcessorException) ExportFileResource(org.talend.repository.documentation.ExportFileResource) ArchiveFileExportOperationFullPath(org.talend.core.ui.export.ArchiveFileExportOperationFullPath)

Aggregations

ProcessorException (org.talend.designer.runprocess.ProcessorException)43 IOException (java.io.IOException)15 File (java.io.File)11 CoreException (org.eclipse.core.runtime.CoreException)11 ProcessItem (org.talend.core.model.properties.ProcessItem)11 IProcessor (org.talend.designer.runprocess.IProcessor)11 CsvArray (org.talend.core.utils.CsvArray)10 IContext (org.talend.core.model.process.IContext)9 Status (org.eclipse.core.runtime.Status)8 IProcess (org.talend.core.model.process.IProcess)8 ExportFileResource (org.talend.repository.documentation.ExportFileResource)8 IFile (org.eclipse.core.resources.IFile)6 InvocationTargetException (java.lang.reflect.InvocationTargetException)5 ILaunchConfiguration (org.eclipse.debug.core.ILaunchConfiguration)5 PersistenceException (org.talend.commons.exception.PersistenceException)5 ExportChoice (org.talend.repository.ui.wizards.exportjob.scriptsmanager.JobScriptsManager.ExportChoice)5 ByteArrayInputStream (java.io.ByteArrayInputStream)4 ArrayList (java.util.ArrayList)4 IStatus (org.eclipse.core.runtime.IStatus)4 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)4