Customer Portal

Inheritance and runGraph()

Comments 2

  • Avatar
    oldforum
    0
    Comment actions Permalink
    I have done more research. I re-wrote my class to this
    -------------------------------------
    import java.io.FileInputStream;

    import org.apache.log4j.Logger;
    import org.jetel.graph.TransformationGraph;
    import org.jetel.graph.TransformationGraphXMLReaderWriter;

    public class RunThisGraph {

    static Logger mylog = Logger.getLogger("RunThisGraph.class");
    static String GRF_NM = "/clover/Velocity.grf";

    public static void main(String[] args) {
    try {
    FileInputStream in=null;
    in = new FileInputStream(GRF_NM);
    TransformationGraphXMLReaderWriter graphReader = TransformationGraphXMLReaderWriter.getReference();
    TransformationGraph graph = TransformationGraph.getReference();
    graphReader.read(graph, in);
    mylog.info("We init. the graph here!");
    graph.init();
    graph.loadGraphProperties(GRF_NM);
    mylog.info("We run the graph here!");
    graph.run();
    } catch (Throwable t) {
    mylog.fatal(t.getMessage() + "Fatal Error. STOP");
    t.printStackTrace();

    }
    }
    }
    -------------------------------------
    It fails with several error messages:
    -------------------------------------
    ava.lang.RuntimeException: java.lang.RuntimeException: Unknown component: DB_INPUT_TABLE class: DB_INPUT_TABLE
    at org.jetel.graph.TransformationGraphXMLReaderWriter.read(Unknown Source)
    at RunThisGraph.main(RunThisGraph.java:20)
    Caused by: java.lang.RuntimeException: Unknown component: DB_INPUT_TABLE class: DB_INPUT_TABLE
    at org.jetel.component.ComponentFactory.createComponent(Unknown Source)
    at org.jetel.graph.TransformationGraphXMLReaderWriter.instantiateNodes(Unknown Source)
    at org.jetel.graph.TransformationGraphXMLReaderWriter.instantiatePhases(Unknown Source)
    ... 2 more
    -------------------------------------

    What I do not understand is that the same graph "/clover/Velocity.grf" runs successfully when launched from the command line.

    Where could be the problem in my code? Any idea?

    Al.
  • Avatar
    oldforum
    0
    Comment actions Permalink
    Hello Alan.
    Sorry for late reaction. I'm not sure if i understand what is your requierement. Your last implementation of class RunThisGraph look like our runGraph class (with some mistakes), only with hard-coded name of xml graph definition. If you want to run graph direct from your code, you can for example call direct main method of runGraph class and as parameters pass name of xml file (eventually other command line parameters of clover engine). Please better specify your goal and than we will help you sure.

    OtaSanek

Please sign in to leave a comment.