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);
}
}
Aggregations