Hello,
I try to run a graph with a java class, so I take the example of the wiki and try to run graph.
Defaults.init();
Plugins.init("./cloverEtl/plugins/");
TransformationGraph graph = new TransformationGraph("./graph/graph.grf");
if(!graph.init()){
System.err.println("Graph initialization failed !");
}
if (graph.run() != Result.FINISHED_OK){
System.out.println("Failed starting all nodes!");
}
But when it arrive to the line of graph.init() exception is catch I don’t understand the problem.
FATAL [main] - No root Nodes detected! There must be at least one root node defined. (Root node is node with output ports defined only.)
ERROR [main] - No root node!
org.jetel.exception.GraphConfigurationException: No root node!
at org.jetel.graph.TransformationGraphAnalyzer.analyzeGraphTopology(TransformationGraphAnalyzer.java:89)
at org.jetel.graph.TransformationGraph.init(TransformationGraph.java:466)
at src.Lau.main(Lau.java:106)
Hello,
constructor TransformationGraph(String) creates new (empty) graph with given name. To read graph from xml file you have to use TransformationGraphXMLReaderWriter class (see javaExamples/testXMLGraph.java in example package).
You have to initialize engine and plugins before you run a graph, so if you run more graphs from one application it suffices one initialization for all graphs.
It is correct way, but it is not necessary to do it if you know your graph is configured properly. If graph configuration is not correct method init will throw ComponentNotReadyException. Method checkConfig was introduced for GUI support purposes.