Edge Data Streaming
- Edge Data Streaming 2.5.0
- All Products
package ...; import java.io.IOException; import java.nio.ByteBuffer; import com.informatica.vds.api.VDSConfiguration; import com.informatica.vds.api.VDSEvent; import com.informatica.vds.api.VDSEventList; import com.informatica.vds.api.VDSTransform; public class CustomTransform implements VDSTransform { @Override public void close() throws IOException { /* Clean up. */ ... } /* Apply a transformation to the data. */ @Override public void apply(VDSEvent vdsevent, VDSEventList vdsevents) throws Exception { /* Get data from the VDSEvent object. */ ByteBuffer bytebuff = vdsevent.getBuffer(); byte[] totdata = new byte[vdsevent.getBufferLen()]; bytebuff.get(totdata); /* Transform the data. */ ... /* Assume that the transformation returns a byte[] that is stored in a * variable named transformedData. Add transformedData to the event * list. */ vdsevents.addEvent(transformedData, transformedData.length); } /* Initialize the VDSTarget object. */ @Override public void open(VDSConfiguration vdsconfiguration) throws Exception { /* The internal name of the key. */ String exprVal = "ExpressionFromUI"; /* The default value of the key. */ String exprDefault = "DefaultValue" /* Retrieve the value of the key ExpressionFromUI. */ String Expr = vdsconfiguration.optString(exprVal, exprDefault); /* Similarly, retrieve other keys. */ ... /* Create or initialize the transformation by using * the configuration. */ ... } }
package ...; import java.io.IOException; import java.nio.ByteBuffer; import com.informatica.vds.api.VDSConfiguration; import com.informatica.vds.api.VDSEvent; import com.informatica.vds.api.VDSEventList; import com.informatica.vds.api.VDSTransform; public class CustomTransform implements VDSTransform { @Override public void close() throws IOException { /* Clean up. */ ... } /* Apply a transformation to the data. */ @Override public void apply(VDSEvent vdsevent, VDSEventList vdsevents) throws Exception { System.out.println("Applying transform..."); ByteBuffer byteBuffer = vdsevent.getBuffer(); byte[] event = new byte[vdsevent.getBufferLen()]; byteBuffer.get(event); ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); outputStream.write(event); outputStream.write(txtField.getBytes()); System.out.println("Transformed data " + outputStream.toString()); Map<String, String> map = new HashMap(); String str = new String(event); if (str.contains("secure")) { map.put("transportTopic", "SecureTopic"); } else { map.put("transportTopic", "NonsecureTopic"); } vdsevents.addEvent(outputStream.toByteArray(), outputStream.toByteArray().length, map); } @Override public void open(VDSConfiguration vdsconfiguration) throws Exception { /* The internal name of the key. */ String exprVal = "ExpressionFromUI"; /* The default value of the key. */ String exprDefault = "DefaultValue" /* Retrieve the value of the key ExpressionFromUI. */ String Expr = vdsconfiguration.optString(exprVal, exprDefault); /* Similarly, retrieve other keys. */ ... /* Create or initialize the transformation by using * the configuration. */ ... } }