beautypg.com

Clone method, Close method, Extract method – IBM WebSphere Adapters User Manual

Page 171

background image

the retriveAll operation could return

″N″ records from the backend application,

for each call to the getNext() method the implementation should fill in data of one
record from the backend application into OutputCursors/Accessors. It should keep
track of which record it needs to do next so in subsequent call to getNext() it can
fill in next record.

This method would be using the eisRepresentation being held on to the Record
instance, this is the backend representation of data which is used in this method to
read fields and set those in Output Cursors and Accessors.

Sample code

For a sample of how to implement the getNext() method, refer to the TwineBall
sample.

Clone method

Use this method to copy property values from the record instance to a newly
created instance.public Object clone ()

Sample

Here is a coding sample on how to implement the Clone method:

public Object clone()

{

//Build a new record
TwineBallStructuredRecord record = new TwineBallStructuredRecord();
try{
//Copying property values

record.twineBallConnection = twineBallConnection;
record.objectNaming = objectNaming;
record.objectSerializer = objectSerializer;
record.setEISRepresentation(this.getEISRepresentation());
}catch(Exception e){

throw new RuntimeException(e);

}
return record;

}

Close method

This method provides cleanup for the getNext method.public void close().

Purpose of the close method

Implement this method if you need to release resources/objects after the getNext()
method has been run.

Sample code

Here is a coding sample showing how to implement the Close method:

Extract method

public void extract(String xpath) throws DESPIException

What is this method?

Need a short description.

Purpose

This method needs implementation only if an Xpath expression can be used to
retrieve individual field values from backend object representation. This method is
invoked after getNext() is called with boolean value as false.

WebSphere Adapter development overview

165