Dear visitor, welcome to Palo Community Forum.
If this is your first visit here, please read the Help. It explains in detail how this page works.
To use all features of this page, you should consider registering.
Please use the registration form, to register here or read more information about the registration process.
If you are already registered, please login here.
JAVA transformation
I do make some mistake in implementing a JAVA transformer.
Can you please have a look at what I have done so far?
I have made a package and class according to the manual:
package userlib;
import org.proclos.etlcore.transformer.Transformer;
public class JavaTrans extends Transformer {
@Override
protected Object transform(Object[] arg0) {
// TODO Auto-generated method stub
Object[] arg1 = arg0;
return arg1;
}
}
This is in the client config file
<?xml version="1.0" encoding="UTF-8"?>
<components xmlns="http://www.example.org/component"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.example.org/component component.xsd">
<connections>
<component name="teradata" driver="com.ncr.teradata.TeraDriver"
class="org.proclos.etlcore.connection.RelationalConnection"/>
</connections>
<transformers>
<component name="TestJavaTrans" class="JavaTrans"/>
</transformers>
</components>
This is in the xml definition:
Transformer:
<transformer name="TestJavaTrans" type="Java">
<parameter name="class">TestJava</parameter>
<parameter name="method">transform</parameter>
<parameter name="paramtest">Y</parameter>
</transformer>
Target:
<coordinate name="Months">
<input nameref="TestJavaTrans"/>
</coordinate>
This is the result:
2008-09-23 13:14:22,203 INFO [main] (CLIClient.java:173) - Parameters: -p
.\examples\ImportFile2PaloTransform.xml
2008-09-23 13:14:23,656 ERROR [main] (TransformerFactory.java:94) - Failed to create transformation TestJavaTrans: TestJava
2008-09-23 13:14:23,656 WARN [main] (TransformerManager.java:69) - Failed to add null- Transformation
2008-09-23 13:14:23,656 ERROR [main] (ConfigManager.java:403) - Component
importFile2Palo.pipelines.PipeTest1.transformers.TestJavaTrans not found.
2008-09-23 13:14:23,656 WARN [main] (TransformerManager.java:69) - Failed to add null- Transformation
RE: JAVA transformation
Hello Henk,
I see 2 mistakes in your transformer:
1. The publishing of the transformer in component.xml has to include the package of the class (package user:
...
<transformers>
<component name="TestJavaTrans" class="userlib.JavaTrans"/>
</transformers>
2. A new type of transformer is defined with approach, so in the ETL project definition it is used like this
...
<transformer name="Test1" type="TestJavaTrans">
...
where Test1 is an arbitrary alias, which can be used in the pipeline-target as input like the aliases of the source.
For comparison, the transformer of type "Java" is standard with purpose to include existing Java methods. In principle, it's possible to develop customer enhancements with the Java-transformer. No entry has to be created in component.xml in this case. But it's more convenient to create own transformer types.
Example:
<transformer name="CountryName_UP" type="Java">
<parameter name="class">java.lang.String</parameter>
<parameter name="method">toUpperCase</parameter>