cancel
Showing results for 
Search instead for 
Did you mean: 

Java Mapping Issue PI 7.1

Former Member
0 Kudos

Hi there,

Im trying to make a Java Mapping on PI 7.1 and i have the following problem:

from what i've read, you mapping class should look something like this

public class Mapping extends DefaultHandler implements StreamTransformation{

But StreamTransformation is deprecated and they sugest that instead you extend from AbstractTransformation,

wich brings the problem that i cannot extend from more than 1 Class in Java,

anybody has a workaround for this??,

Am i doing something wrong??,

Thanks for the help,

Roberto.

Edited by: Roberto Gomez on Sep 7, 2009 5:55 PM

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

If you are not using any method from DefaultHandler, do not extended it, extend only from AbstractTransformation.

Can you give us the reference where You found the documentation?...It is strange.

Regards

Ivan

Former Member
0 Kudos

I was following this blog :

http://www.riyaz.net/blog/xipi-java-mapping-demystified/

there, they extend from DefaultHandler and they implement StreamTransformation aswell,

they assign the current object to the handler as shown in the following code:

public void execute (InputStream in, OutputStream out)

throws com.sap.aii.mapping.api.StreamTransformationException {

DefaultHandler handler = this;

SAXParserFactory factory = SAXParserFactory.newInstance();

try {

SAXParser saxParser = factory.newSAXParser();

this.out = out;

saxParser.parse(in, handler);

}

catch (Throwable t){

t.printStackTrace();

}

}

im not sure if this is needed or if i could just make a new empty handler and use it

Former Member
0 Kudos

Well,

You need to define your own handler(MyHandler) which is going to extends to "BaseHandler", here you need to implement:

startDocument

endDocument

startElement

endElement

Then in your code,

MyHandler mh = new MyHandler();

saxParser.parse(in, mh );

Regards

Ivan

Former Member
0 Kudos

Hi

Can you give the exactly problem?.

Former Member
0 Kudos

StreamTransformation is an Interface that you need to implement in order to do a Java Mapping,

DefaultHander is Class that you need to extend from in order to call a saxParser.parse method,

StreamTransformation is deprecated now and they provide you an Abstract Class named AbstractTransformation

In Java i can only Extend from 1 Class hence the problem when trying to make the Mapping class work.

Regards,

Roberto.