IBM WebSphere Adapters Network Card User Manual


 
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();
JDEBFOperationASI[] ops = dataDesc.getOperationASI();
ArrayList operations = new ArrayList();
for(int i=0; i<ops.length; i++) {
if(ops[i].getBsfnNames().length>0){
operations.add(ops[i].getName());
}
}
Iterator opIterator = operations.iterator();
while (opIterator.hasNext())
{
String operation = (String)opIterator.next();
WBIOutboundFunctionDescriptionImpl funcDesc = new WBIOutboundFunctionDescriptionImpl();
//Added for Faults
addFaultsToBFDataDescriptionBasedOnOperationName(funcDesc,operation);
//Added for Faults funcDesc.setName(operation.toLowerCase() + dataDesc.getBOName());
funcDesc.setInputDataDescription(dataDesc);
funcDesc.setOutputDataDescription(dataDesc);
JDEInteractionSpec iSpec = new JDEInteractionSpec();
iSpec.setFunctionName(operation);
funcDesc.setInteractionSpec(iSpec);
functionDescriptions.add(funcDesc);
}
}
}
private void addFaultsToBFDataDescriptionBasedOnOperationName(WBIOutboundFunctionDescriptionImpl funcDesc, String operationName)
throws MetadataException {
// Define XSDs for faults supported by this adapter.
try {
//During implementation - add faults based on the operationName parameter. For ex an operation may have more than one fault.
//And so the below logic will have to be using conditions if(operationName.equals("CREATE")) {} then do this etc.
JDEBFFaultDataDescription fdesc1 = new JDEBFFaultDataDescription();
JDEBFFaultDataDescription fdesc2 = new JDEBFFaultDataDescription();
BusinessObjectDefinition bo = FaultBOUtil.createDuplicateRecordBO();
URI uri = new URI("./" + FaultBOUtil.DUPLICATE_RECORD_NAME //$NON-NLS-1$
+ EMDConstants.XSD);
fdesc1.put(FaultBOUtil.FAULT_TARGET_NS, uri, bo.serialize());
fdesc1.setGenericDataBindingClassName("com.ibm.j2ca.extension.emd.runtime.WBIFaultDataBindingImpl");
fdesc1.setFaultName(FaultBOUtil.DUPLICATE_RECORD_NAME);
bo = FaultBOUtil.createMatchesExceededLimitBO();
uri = new URI("./" + FaultBOUtil.MATCHES_EXCEEDED_LIMIT_NAME //$NON-NLS-1$
+ EMDConstants.XSD);
fdesc2.put(FaultBOUtil.FAULT_TARGET_NS, uri, bo.serialize());
WebSphere Adapter development overview 171