Runtime tools : Core components : CHA : Tasks : Creating your own CHA implementation
  
Creating your own CHA implementation
To create your own CHA implementation, perform the following two steps:
1 Create a new class implementing the Context interface:
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
import java.io.Serializable;

import com.ibm.btt.base.Context;
import com.ibm.btt.base.DSEException;
import com.ibm.btt.base.DSEInvalidArgumentException;
import com.ibm.btt.base.DSEInvalidRequestException;
import com.ibm.btt.base.DSEObjectNotFoundException;
import com.ibm.btt.base.DataElement;
import com.ibm.btt.base.Externalizer;
import com.ibm.btt.base.KeyedCollection;
import com.ibm.btt.base.SortedTable;
import com.ibm.btt.base.Tag;
import com.ibm.btt.base.TagInputStream;
import com.ibm.btt.base.Vector;

public class CustomerContextImpl implements Context (
private static final long serialVersionUID = 1L;
public void addChild(Context aNewChild) throws DSEInvalidRequestException {
// Add implemeantation code here
}

pulbic void addElement(DataElement aDataElement) throws DSEInvalidRequestException
// Add implemeantation code here
}

public void chainTo(Context aContext) throws DSEInvalidRequestException {
// Add implemeantation code here
}

public void clearKeyedCollection() throws DSEInvalidRequestExcption {
// Add implemeantation code here
}
//... ...
2 Modify the context setting in btt.xml:
<kColl id="classTable">
<!-- indicates the implementation class of context-->
<field id="context" value="com.ibm.btt.base.CustomerContextImpl"/>
</kColl>
What to do next
When CHA starts, it automatically locates the context implementation class. The newly implemented context can be accessed by ContextFactory.
For information about the programming examples, see Programming Examples.
Go up to
Tasks