hello
i have created my SplitRecord class and modified component factory
then when i execute my testSplit graph i get exception that INPUT port has no out put port but there is in my graph.
i am providing full resources so
this is my graph
[testSplit.grf]
<?xml version="1.0" encoding="UTF-8"?>
0 and sv.current\_version and sv.sales\_representativ=em.id and em.person\_master\_id=pm.id and sd.sv\_id=sv.id"/>
here what i get on console
[console dump]
*** CloverETL framework/transformation graph runner ver1.7, (c) 2002-05 D.Pavlis, released under GNU Lesser General Public License ***
Graph definition file: E:/CloverETL/Examples/testSplit.txt
phase No. 0
phase No. 0
java.lang.NullPointerException
at org.jetel.graph.TransformationGraphXMLReaderWriter.instantiateNodes(TransformationGraphXMLReaderWriter.java:381)
at org.jetel.graph.TransformationGraphXMLReaderWriter.instantiatePhases(TransformationGraphXMLReaderWriter.java:348)
at org.jetel.graph.TransformationGraphXMLReaderWriter.read(TransformationGraphXMLReaderWriter.java:242)
at org.jetel.main.runGraph.main(runGraph.java:124)
Initializing DB connection: jdbc:postgresql://192.168.0.3/vtech0506 … OK
Initializing DB connection: jdbc:postgresql://192.168.0.3/olap … OK
[Clover] starting WatchDog thread …
[WatchDog] Thread started.
[WatchDog] Running on 1 CPU(s) max available memory for JVM 1639 KB
[Clover] Initializing phase: 0
initializing edges: all edges initialized successfully…
initializing nodes:
INPUT …FAILED !
Nov 12, 2005 5:12:02 PM org.jetel.graph.Phase init
SEVERE: At least one output port has to be defined for node INPUT
[WatchDog] !!! Phase finished with error - stopping graph run !!!
Failed starting graph !
[Clover] WatchDog thread finished - total execution time: 0 (sec)
[Clover] !!! Graph execution finished with errors !!!
here is my SplitRecord class
/*
* Created on Nov 10, 2005
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Style - Code Templates
*/
package org.jetel.component;
/**
* @author Deepak
*
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Style - Code Templates
*/
import java.io.IOException;
import org.jetel.data.DataRecord;
import org.jetel.exception.ComponentNotReadyException;
import org.jetel.graph.InputPort;
import org.jetel.graph.Node;
import org.jetel.graph.OutputPort;
/**
* @author Deepak
*
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Style - Code Templates
*/
public class SplitRecord extends Node{
public static final String COMPONENT_TYPE=“SPLIT_RECORD”;
public SplitRecord(String id)
{
super(id);
}
public String getType() {
return COMPONENT_TYPE;
}
public void init() throws ComponentNotReadyException {
// test that we have at least one input port and one output
if (inPorts.size()<1){
throw new ComponentNotReadyException("At least one input port has to be defined for node " + id);
}else if (outPorts.size()<1){
throw new ComponentNotReadyException("At least one output port has to be defined for node " + id);
}
}
public void run()
{
boolean isDriverDifferent;
// get all ports involved
InputPort inPort = getInputPort(0);
DataRecord driverRecordread = new DataRecord(inPort.getMetadata());
driverRecordread.init();
int index=0;
// get array of all ports defined/connected - use collection Collection - getInPorts();
OutputPort outPorts;
outPorts = (OutputPort) getOutPorts().toArray(new OutputPort[0]);
System.out.println("the no. of out put pin in split is " + outPorts.length);
int cou = new int[5];
Integer timeid=new Integer (1);
while (runIt)
{
try
{
driverRecordread = inPort.readRecord(driverRecordread);
if(driverRecordread != null)
{
DataRecord record0 = new DataRecord(outPorts[0].getMetadata());
record0.init();
record0.getField(0).setValue(driverRecordread.getField(1).getValue());
DataRecord record1=new DataRecord(outPorts[1].getMetadata());
record1.init();
record1.getField(0).setValue(new Integer(1));
record1.getField(1).setValue(driverRecordread.getField(0).getValue());
record1.getField(2).setValue(timeid );
record1.getField(3).setValue(driverRecordread.getField(2).getValue());
record1.getField(4).setValue(driverRecordread.getField(3).getValue());
record1.getField(5).setValue(driverRecordread.getField(4).getValue());
record1.getField(6).setValue(driverRecordread.getField(5).getValue());
record1.getField(7).setValue(“KG”);
record1.getField(8).setValue(driverRecordread.getField(6).getValue());
record1.getField(9).setValue(driverRecordread.getField(7).getValue());
record1.getField(10).setValue(driverRecordread.getField(8).getValue());
record1.getField(11).setValue(driverRecordread.getField(9).getValue());
outPorts[0].writeRecord(record0 );
outPorts[1].writeRecord(record1 );
}else
{
break;
}
} catch (IOException ex)
{
resultMsg = ex.getMessage();
resultCode = Node.RESULT_ERROR;
closeAllOutputPorts();
System.out.println(“IO error in split:” + ex.getMessage());
ex.printStackTrace();
return;
} catch (Exception ex)
{
resultMsg = ex.getMessage();
resultCode = Node.RESULT_FATAL_ERROR;
System.out.println(“error in split:” + ex.getMessage());
ex.printStackTrace();
return;
}
}
broadcastEOF();
if (runIt) {
resultMsg = “OK”;
} else
{
resultMsg = “STOPPED”;
}
resultCode = Node.RESULT_OK;
}
public boolean checkConfig() {
return true;
}
}
i made this entry in component factory class
registerComponent(SplitRecord.COMPONENT_TYPE,“org.jetel.component.SplitRecord”);
so
there is two thing wrong here
-
though there is output port in INPUT node
the input node can’t initialise due to it not get any output port
-
graphNode.setPhase(phaseNum);
instruction in org.jetel.graph.TransformationGraphXMLReaderWriter.instantiateNodes() function throws nullpontexception
if any body figure out problem then inform me
thanks in advance