Search in sources :

Example 46 with IContext

use of org.talend.core.model.process.IContext in project tdi-studio-se by Talend.

the class JSONShadowProcess method run.

public CsvArray run() throws ProcessorException {
    IProcess talendProcess = buildProcess();
    IProcessor processor = ProcessorUtilities.getProcessor(talendProcess, null);
    processor.setProxyParameters(getProxyParameters());
    // try {
    // Delete previous Perl generated file
    File previousFile = outPath.toFile();
    if (previousFile.exists()) {
        previousFile.delete();
    }
    // Process ps = processor.run(process.getContextManager().getDefaultContext(), Processor.NO_STATISTICS,
    // Processor.NO_TRACES,Processor.WATCH_ALLOWED);//Old
    IContext context = talendProcess.getContextManager().getDefaultContext();
    processor.setContext(context);
    process = processor.run(IProcessor.NO_STATISTICS, IProcessor.NO_TRACES, null);
    ProcessStreamTrashReader.readAndForget(process);
    if (!outPath.toFile().exists()) {
        //$NON-NLS-1$
        throw new ProcessorException(Messages.getString("ShadowProcess.notGeneratedOutputException"));
    }
    try {
        CsvArray array = new CsvArray();
        array = array.createFrom(outPath.toFile(), currentProcessEncoding);
        return array;
    } catch (IOException ioe) {
        throw new ProcessorException(ioe);
    }
}
Also used : IContext(org.talend.core.model.process.IContext) ProcessorException(org.talend.designer.runprocess.ProcessorException) CsvArray(org.talend.core.utils.CsvArray) IProcessor(org.talend.designer.runprocess.IProcessor) IOException(java.io.IOException) IProcess(org.talend.core.model.process.IProcess) File(java.io.File)

Aggregations

IContext (org.talend.core.model.process.IContext)46 IContextParameter (org.talend.core.model.process.IContextParameter)14 ArrayList (java.util.ArrayList)13 List (java.util.List)11 IProcess (org.talend.core.model.process.IProcess)10 ProcessorException (org.talend.designer.runprocess.ProcessorException)10 HashMap (java.util.HashMap)9 ProcessItem (org.talend.core.model.properties.ProcessItem)8 IOException (java.io.IOException)7 IElementParameter (org.talend.core.model.process.IElementParameter)7 IProcessor (org.talend.designer.runprocess.IProcessor)7 File (java.io.File)6 InvocationTargetException (java.lang.reflect.InvocationTargetException)6 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)6 IContextManager (org.talend.core.model.process.IContextManager)6 HashSet (java.util.HashSet)5 IRunnableWithProgress (org.eclipse.jface.operation.IRunnableWithProgress)5 IProcess2 (org.talend.core.model.process.IProcess2)5 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)5 Map (java.util.Map)4