Hi All,
I am trying to test the this Code inside my web application - using Java and Spring Framework
private void tsestGraph() {
String plugins = null;
String propertiesFile = null;
if (plugins == null || propertiesFile == null) {
Properties arguments = new Properties();
if ((new File(PARAMETER_FILE)).exists()) {
try {
arguments.load(new FileInputStream(PARAMETER_FILE));
} catch (FileNotFoundException e) {
//do nothing: we checked it
} catch (IOException e) {
throw new RuntimeException(e);
}
}
plugins = arguments.getProperty(PLUGINS_PROPERTY);
}
FileInputStream in=null;
PrintStream out=null;
DataRecord record;
//initialization; must be present
EngineInitializer.initEngine(plugins, propertiesFile, null);
DataRecordMetadata metadataIn;
DataRecordMetadataXMLReaderWriter reader=new DataRecordMetadataXMLReaderWriter();
try{
metadataIn=reader.read(new FileInputStream(“ETL/testmetadata.xml”));
}catch(IOException ex){
System.err.println(“Error when reading metadata!!”);
throw new RuntimeException(ex);
}
if (metadataIn==null){
throw new RuntimeException(“No INPUT metadata”);
}
// create Graph + Node + 2 connections (edges)
TransformationGraph graph = new TransformationGraph();
Edge inEdge=new Edge(“InEdge”,metadataIn);
Edge outEdge=new Edge(“OutEdge”,metadataIn);
Node nodeRead=new DataReader(“DataParser”,“ETL/tset.csv”);
String sortKeys=new String{“SupName”};
Node nodeSort=new ExtSort(“Sorter”,sortKeys, true);
DataWriter nodeWrite=new DataWriter(“DataWriter”,“ETL/test.out.csv”,“UTF-8”,false);
// assign ports (input & output)
nodeRead.addOutputPort(0,inEdge);
nodeSort.addInputPort(0,inEdge);
nodeSort.addOutputPort(0,outEdge);
nodeWrite.addInputPort(0,outEdge);
// add Edges & Nodes & Phases to graph
try {
graph.addPhase(_PHASE_1);
_PHASE_1.addNode(nodeRead);
_PHASE_1.addNode(nodeSort);
graph.addPhase(_PHASE_2);
_PHASE_2.addNode(nodeWrite);
graph.addEdge(inEdge);
graph.addEdge(outEdge);
}catch (GraphConfigurationException ex){
ex.printStackTrace();
}
//prepare runtime parameters - JMX is turned off
GraphRuntimeContext runtimeContext = new GraphRuntimeContext();
runtimeContext.setUseJMX(false);
Future result;
try{
result = runGraph.executeGraph(graph, runtimeContext);
while (result.isDone()) {;}
if (!result.get().equals(Result.FINISHED_OK)){
System.out.println(“Failed graph execution!\n”);
return;
}
}catch (Exception e) {
System.out.println(“Failed graph execution!\n” + e.getMessage());
return;
}
}
But I have this exception , anyone can help me plz
ERROR [org.jetel.graph.runtime.WatchDog] -
Element [OutEdge:]-java.io.IOException: No such file or directory
at org.jetel.graph.Edge.init(Edge.java:275)
at org.jetel.graph.Phase.init(Phase.java:141)
at org.jetel.graph.runtime.WatchDog.executePhase(WatchDog.java:423)
at org.jetel.graph.runtime.WatchDog.call(WatchDog.java:177)
at org.jetel.graph.runtime.WatchDog.call(WatchDog.java:1)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.io.IOException: No such file or directory
at java.io.UnixFileSystem.createFileExclusively(Native Method)
at java.io.File.checkAndCreate(File.java:1704)
at java.io.File.createTempFile(File.java:1792)
at org.jetel.data.tape.DataRecordTape.open(DataRecordTape.java:142)
at org.jetel.graph.PhaseConnectionEdge.init(PhaseConnectionEdge.java:127)
at org.jetel.graph.Edge.init(Edge.java:273)
… 7 more
ERROR [org.jetel.graph.runtime.WatchDog] - <!!! Phase finished with error - stopping graph run !!!>