/** * Lookup a fault data type from the source operation which matches the target fault data type * @param sourceOperation The source operation * @param targetExceptionType The target fault data type * @return The matching source target fault type */ private DataType findSourceFaultDataType(Operation sourceOperation, DataType targetExceptionType) { boolean remotable = sourceOperation.getInterface().isRemotable(); DataType targetFaultType = getFaultType(targetExceptionType); for (DataType dt : sourceOperation.getFaultTypes()) { DataType sourceFaultType = getFaultType(dt); if (interfaceContractMapper.isCompatible(targetFaultType, sourceFaultType, remotable)) { return dt; } } return null; }
/** * Lookup a fault data type from the source operation which matches the target fault data type * @param sourceOperation The source operation * @param targetExceptionType The target fault data type * @return The matching source target fault type */ private DataType findSourceFaultDataType(Operation sourceOperation, DataType targetExceptionType) { boolean remotable = sourceOperation.getInterface().isRemotable(); DataType targetFaultType = getFaultType(targetExceptionType); for (DataType dt : sourceOperation.getFaultTypes()) { DataType sourceFaultType = getFaultType(dt); if (interfaceContractMapper.isCompatible(targetFaultType, sourceFaultType, remotable)) { return dt; } } return null; }
public Object copyFault(Object fault, Operation sourceOperation, Operation targetOperation) { // Rename the parameters so we can more easily remember which direction we're going in. Operation fromOperation = targetOperation; Operation toOperation = sourceOperation; if (faultExceptionMapper == null) { return fault; } List<DataType> fts = fromOperation.getFaultTypes(); for (int i = 0; i < fts.size(); i++) { DataType et = fts.get(i); if (et.getPhysical().isInstance(fault)) { Throwable ex = (Throwable)fault; DataType<DataType> exType = findFaultDataType(fromOperation, fault); DataType faultType = getFaultType(exType); Object faultInfo = faultExceptionMapper.getFaultInfo(ex, faultType.getPhysical(), fromOperation); DataType targetExType = findSourceFaultDataType(toOperation, exType); DataType targetFaultType = getFaultType(targetExType); faultInfo = copy(faultInfo, faultType, targetFaultType, fromOperation, toOperation); fault = faultExceptionMapper.wrapFaultInfo(targetExType, ex.getMessage(), faultInfo, ex.getCause(), toOperation); return fault; } } return fault; }
public Object copyFault(Object fault, Operation sourceOperation, Operation targetOperation) { // Rename the parameters so we can more easily remember which direction we're going in. Operation fromOperation = targetOperation; Operation toOperation = sourceOperation; if (faultExceptionMapper == null) { return fault; } List<DataType> fts = fromOperation.getFaultTypes(); for (int i = 0; i < fts.size(); i++) { DataType et = fts.get(i); if (et.getPhysical().isInstance(fault)) { Throwable ex = (Throwable)fault; DataType<DataType> exType = findFaultDataType(fromOperation, fault); DataType faultType = getFaultType(exType); Object faultInfo = faultExceptionMapper.getFaultInfo(ex, faultType.getPhysical(), fromOperation); DataType targetExType = findSourceFaultDataType(toOperation, exType); DataType targetFaultType = getFaultType(targetExType); faultInfo = copy(faultInfo, faultType, targetFaultType, fromOperation, toOperation); fault = faultExceptionMapper.wrapFaultInfo(targetExType, ex.getMessage(), faultInfo, ex.getCause(), toOperation); return fault; } } return fault; }
DataType targetFaultType = getFaultType(targetDataType); DataType sourceFaultType = null; for (DataType exType : sourceOperation.getFaultTypes()) { DataType faultType = getFaultType(exType);
DataType targetFaultType = getFaultType(targetDataType); DataType sourceFaultType = null; for (DataType exType : sourceOperation.getFaultTypes()) { DataType faultType = getFaultType(exType);