# Inheritance and runGraph()

**URL:** <https://forum.cloverdx.com/t/inheritance-and-rungraph/96>\
**Category:** CloverDX Platform\
**Created:** [July 16, 2007, 12:00am UTC](https://forum.cloverdx.com/t/inheritance-and-rungraph/96 "2007-07-16T00:00:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![oldforum](https://avatars.discourse-cdn.com/v4/letter/o/13edae/32.png) [@oldforum](https://forum.cloverdx.com/u/oldforum)\
**Post date:** [July 16, 2007, 12:00am UTC](https://forum.cloverdx.com/t/inheritance-and-rungraph/96/1 "2007-07-16T00:00:00Z")

</div>

DISCLAIMER: I am a Java beginner so I am really ignorant about a LOT of stuff. You’ve been warned.  
--------------------------------------------------------------------  
I am using “Clover.ETL” to push/pull data contained in our different databases.

We bought a scheduler (“Quartz”) to fire many jobs based on a pre-defined schedule. I have written classes that launch my ETL jobs on schedule like this:

public class ETL\_job1 extends QuartzJob {  
public void run() {  
try {  
System.out.flush();  
Runtime rt = Runtime.getRuntime();  
Process proc = rt  
.exec(“/j2sdk1.4.2\_10/bin/java -cp /clover/work/cloverETL.zip org.jetel.main.runGraph -v /home/clover/work/ETL\_job1.grf”);  
…

It works great but it is poor design (the paths…). The JavaDoc for “Clover.ETL” reads this:

“org.jetel.main.runGraph” has only one method “static void main(java.lang.String args)” and a unique constructor “runGraph()”. What I’m wondering is how to do I call runGraph() to run “ETL\_job1.grf”. I got to this point:

import org.jetel.main.runGraph;

public class RunThisGraph extends runGraph {  
public RunThisGraph() {  
super();  
}

}

but I am stuck. How do I pass arguments i.e. the name of my graph layout?

Thanks in advance for any help (especially IQ points you can spare…) you can provide.

Al.

---

<div class="post-metadata">

**Author:** ![oldforum](https://avatars.discourse-cdn.com/v4/letter/o/13edae/32.png) [@oldforum](https://forum.cloverdx.com/u/oldforum)\
**Post date:** [July 16, 2007, 8:23am UTC](https://forum.cloverdx.com/t/inheritance-and-rungraph/96/2 "2007-07-16T08:23:44Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![oldforum](https://avatars.discourse-cdn.com/v4/letter/o/13edae/32.png) [@oldforum](https://forum.cloverdx.com/u/oldforum)\
**Post date:** [July 16, 2007, 8:23am UTC](https://forum.cloverdx.com/t/inheritance-and-rungraph/96/3 "2007-07-16T08:23:45Z")

</div>

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
