IBM WebSphere Adapters User Manual
Page 177
public class JDEXMLListFaultDataDescription implements
FaultDataDescription {
public JDEXMLListFaultDataDescription() {
super();
// TODO Auto-generated constructor stub
}
private String faultName = null;
public String getFaultName() {
// TODO Auto-generated method stub
return faultName;
}
public void setFaultName(String faultName) {
this.faultName = faultName;
}
}
Modifying getBFFunctions method
Modifying getBFFunctions involves the following changes:
v
Adding a line to invoke a new method
v
Creating the new method or add some lines to an existing method to specify the
faults
v
Completing the stub to implement the FaultDataDescription class
The following example shows the first two changes:
private void getBFFunctions(ArrayList functionDescriptions, PropertyGroup pg,
String relativePath, ArrayList dataDescriptions) throws MetadataException {
Iterator iterator = dataDescriptions.iterator();
while(iterator.hasNext()){
JDEBFContainerDataDescription dataDesc = (JDEBFContainerDataDescription)iterator.next(); if(ops[i].getBsfnNames().length>0){ operations.add(ops[i].getName()); } } String operation = (String)opIterator.next(); //Added for Faults addFaultsToBFDataDescriptionBasedOnOperationName(funcDesc,operation); //Added for Faults funcDesc.setName(operation.toLowerCase() + dataDesc.getBOName()); funcDesc.setInputDataDescription(dataDesc); JDEInteractionSpec iSpec = new JDEInteractionSpec(); } } } throws MetadataException { // Define XSDs for faults supported by this adapter. //During implementation - add faults based on the operationName parameter. For ex an operation may have more than one fault. JDEBFFaultDataDescription fdesc1 = new JDEBFFaultDataDescription(); BusinessObjectDefinition bo = FaultBOUtil.createDuplicateRecordBO(); + EMDConstants.XSD); fdesc1.put(FaultBOUtil.FAULT_TARGET_NS, uri, bo.serialize()); bo = FaultBOUtil.createMatchesExceededLimitBO(); + EMDConstants.XSD); fdesc2.put(FaultBOUtil.FAULT_TARGET_NS, uri, bo.serialize()); WebSphere Adapter development overview 171
JDEBFOperationASI[] ops = dataDesc.getOperationASI();
ArrayList operations = new ArrayList();
for(int i=0; i
Iterator opIterator = operations.iterator();
while (opIterator.hasNext())
{
WBIOutboundFunctionDescriptionImpl funcDesc = new WBIOutboundFunctionDescriptionImpl();
funcDesc.setOutputDataDescription(dataDesc);
iSpec.setFunctionName(operation);
funcDesc.setInteractionSpec(iSpec);
functionDescriptions.add(funcDesc);
private void addFaultsToBFDataDescriptionBasedOnOperationName(WBIOutboundFunctionDescriptionImpl funcDesc, String operationName)
try {
//And so the below logic will have to be using conditions if(operationName.equals("CREATE")) {} then do this etc.
JDEBFFaultDataDescription fdesc2 = new JDEBFFaultDataDescription();
URI uri = new URI("./" + FaultBOUtil.DUPLICATE_RECORD_NAME //$NON-NLS-1$
fdesc1.setGenericDataBindingClassName("com.ibm.j2ca.extension.emd.runtime.WBIFaultDataBindingImpl");
fdesc1.setFaultName(FaultBOUtil.DUPLICATE_RECORD_NAME);
uri = new URI("./" + FaultBOUtil.MATCHES_EXCEEDED_LIMIT_NAME //$NON-NLS-1$