Hi,
I am creating a reusable transformation that will implement checkpoint for a transformation or job by creation of touch files.
This reusable transformation would be called by any job.
The plan is use UDJC(user defined java class) to invoke a job or transformation based on the argument that is given to this reusuable component.
The problem!!!
1) i am new to udjc
and ...
The transformation or job invoked by UDJC is unable to access the value of the variables(the scope is at "root" level) which are set by the master/parent job.I am able to run in spoon (4.4) but it fails in Linux (pentaho version is 4.3)
But if I change the scope to JVM level it works in Linux os.
How do I pass all the variables to the "invoked" transformation/job without using setvariables in udjc. i dont want to use setvariables(we have to explicitly mention the variables) because i don't know how many variables will the invoked trans/job needs .do we have any method in udjc? like variablespace etc...
please provide code snippets as well if possible...
this is the code for the udjc
----------------------------------------------------------------------------------------------------------------
public boolean processRow(StepMetaInterface smi, StepDataInterface sdi) throws KettleException
{
Object[] r=getRow();
if (r==null)
{
setOutputDone();
return false;
}
KettleEnvironment.init();
EnvUtil.environmentInit();
r = createOutputRow(r, data.outputRowMeta.size());
String input_param = get(Fields.In, "input_param").getString(r);
TransMeta transMeta = new TransMeta(input_param);
Trans trans = new Trans(transMeta, getTrans());
trans.execute(null);
trans.waitUntilFinished();
Result result = trans.getResult();
get(Fields.Out, "result").setValue(r, Boolean.valueOf(result.getResult()));
get(Fields.Out, "errors").setValue(r, Long.valueOf(result.getNrErrors()));
get(Fields.Out, "err_desc").setValue(r, String.valueOf(result.getLogText()));
// Send the row on to the next step.
putRow(data.outputRowMeta, r);
return true;
}
-------------------------------------------------------------------------------------------------------------------------------
regards,
pramod.
I am creating a reusable transformation that will implement checkpoint for a transformation or job by creation of touch files.
This reusable transformation would be called by any job.
The plan is use UDJC(user defined java class) to invoke a job or transformation based on the argument that is given to this reusuable component.
The problem!!!
1) i am new to udjc
and ...
The transformation or job invoked by UDJC is unable to access the value of the variables(the scope is at "root" level) which are set by the master/parent job.I am able to run in spoon (4.4) but it fails in Linux (pentaho version is 4.3)
But if I change the scope to JVM level it works in Linux os.
How do I pass all the variables to the "invoked" transformation/job without using setvariables in udjc. i dont want to use setvariables(we have to explicitly mention the variables) because i don't know how many variables will the invoked trans/job needs .do we have any method in udjc? like variablespace etc...
please provide code snippets as well if possible...
this is the code for the udjc
----------------------------------------------------------------------------------------------------------------
public boolean processRow(StepMetaInterface smi, StepDataInterface sdi) throws KettleException
{
Object[] r=getRow();
if (r==null)
{
setOutputDone();
return false;
}
KettleEnvironment.init();
EnvUtil.environmentInit();
r = createOutputRow(r, data.outputRowMeta.size());
String input_param = get(Fields.In, "input_param").getString(r);
TransMeta transMeta = new TransMeta(input_param);
Trans trans = new Trans(transMeta, getTrans());
trans.execute(null);
trans.waitUntilFinished();
Result result = trans.getResult();
get(Fields.Out, "result").setValue(r, Boolean.valueOf(result.getResult()));
get(Fields.Out, "errors").setValue(r, Long.valueOf(result.getNrErrors()));
get(Fields.Out, "err_desc").setValue(r, String.valueOf(result.getLogText()));
// Send the row on to the next step.
putRow(data.outputRowMeta, r);
return true;
}
-------------------------------------------------------------------------------------------------------------------------------
regards,
pramod.