Necessary changes from CloverETL ver. 2.x to 2.6

Transform interface change

In Clover Engine 2.6 transform interface has been improved. Return value is int with meaning:

< -1 -- fatal error / user defined
SKIP = -1 -- error / skip record
>= 0 -- send to a specified output port
ALL = Integer.MAX_VALUE -- send to all output ports

Mappings written in CTL don't require any modification. However, mapping written in java must be modified to a new form. There are two ways to migrate to Clover 2.6 – use import wizard or make changes by hand.

Import wizard

This wizard converts graphs with inline java code. Java sources in standalone files are not converted and you must make changes by hand.

Import by steps:

  1. in Eclipse menu choose File→Import
  2. select CloverETL->Import graphs - version conversion

  3. select source directory, graphs to convert and output directory and select "From 2.x.x to 2.6.x" in Conversion listbox

  4. press Finish

Changes by hand

You must change all java classes implementing interface RecordTransform, RecordNormalize or RecordDenormalize or extends from abstract classes DataRecordTransform, DataRecordNormalize or DataRecordDenormalize. Change return type of transform method to int. For RecordDenormalize you must also rename method addInputRecord to append and method getOutputRecord to transform.

RecordTransform

old code:

class MyTransform implements RecordTransform {
    ...
    public boolean transform(DataRecord[] sources, DataRecord[] target) throws TransformException {
        ...
        if(...) {
            // success
            return true;
        } else {
            // some problem occured, skip record
            return false;
        }
    }
}

new code:

class MyTransform implements RecordTransform {
    ...
    public int transform(DataRecord source, DataRecord target, int idx) {
        ...
        if(...) {
            // success
            return ALL;
        } else {
            // some problem occured, skip record
            return SKIP;
        }
    }
}

RecordNormalize

old code:

public class MyNormalize implements RecordNormalize {
    ...
    public boolean transform(DataRecord source, DataRecord target, int idx) {
        ...
        if(...) {
            // success
            return true;
        } else {
            // some problem occured, skip record
            return false;
        }
    }
}

new code:

public class MyNormalize implements RecordNormalize {
    ...
    public int transform(DataRecord source, DataRecord target, int idx) throws TransformException
        ...
        if(...) {
            // success
            return OK;
        } else {
            // some problem occured, skip record
            return SKIP;
        }
    }
}

RecordDenormalize

old code:

public class MyDenormalize implements RecordDenormalize {
    ...
    public boolean addInputRecord(DataRecord inRecord) {
	return true;
    }

    public boolean getOutputRecord(DataRecord outRecord) {
        ...
        if(...) {
            // success
            return true;
        } else {
            // some problem occured, skip record
            return false;
        }
}

new code:

public class MyDenormalize implements RecordDenormalize {
    ...
    public int append(DataRecord inRecord) {
	return 0;
    }

    public int transform(DataRecord outRecord) {
        ...
        if(...) {
            // success
            return OK;
        } else {
            // some problem occured, skip record
            return SKIP;
        }
}

migration/migrationtoclover26.txt · Last modified: 2009/09/16 12:27 (external edit)
Back to top
chimeric.de = chi`s home Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0