on 04-05-2017 7:11 AM
Dear Experts,
I am doing a simple file to file Scenario using Java mapping . In operation Mapping i am getting the error in Snap Shot. Please guide me if i am in wrong path.
Thanks in Advance.
Renjtihcapture.jpg
Also I can't catch the idea to implement static methods in transformation class. The better way is to put these methods in separate class and use it further in your mapping classes.
Regards, Evgeniy.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Renjtih,
Look at the error message please. Are you sure that your java mapping class implements StreamTransformation interface or extends AbstractTransformation class?
Regards,
Andrzej
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Renjith!
You should implement transform() method in your class.
Regards, Evgeniy.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I did not go through detailed. But I can see the issue with overriding.
Did you override the method transform()?
Please check
https://help.sap.com/doc/2fmapping.jpg39047ed6b141cb83658041d2d4e029/7.5.7/en-US/PI/index.html
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hai Andrzej,
Please refer the java mapping i am using and correct me if it is wrong as per the error snap shot.
Thanks in Advance,
Renjith
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
import java.io.*;
import java.security.MessageDigest;
import com.sap.aii.mapping.api.AbstractTransformation;
import java.io.FileReader;
import java.io.IOException;
public class MD5Checksum extends AbstractTransformation {
public static byte[] createChecksum(String filename) throws Exception {
InputStream fis = new FileInputStream(filename);
byte[] buffer = new byte[1024];
MessageDigest complete = MessageDigest.getInstance("MD5");
int numRead;
do {
numRead = fis.read(buffer);
if (numRead > 0) {
complete.update(buffer, 0, numRead);
}
} while (numRead != -1);
fis.close();
return complete.digest();
}
public static String getMD5Checksum(String filename) throws Exception {
byte[] b = createChecksum(filename);
String result = "";
for (int i=0; i < b.length; i++) {
result += Integer.toString( ( b[i] & 0xff ) + 0x100, 16).substring( 1 );
}
return result;
}
public static void main(String args[]) {
try {
/********my code*********/
String md5=getMD5Checksum("Path");
BufferedReader reader = new BufferedReader(new FileReader("path "));
/*int character;
while ((character = reader.read()) != -1) {
System.out.print((char) character);
}
reader.close();*/
String line;
while((line=reader.readLine()) != null){
if(line.contains("checksum")){
line=line.replace("\"\"", "\""+md5+"\"");
}
System.out.println(line);
}
}
catch (Exception e) {
e.printStackTrace();
}
}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
81 | |
25 | |
12 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.