public Object mediateInput(Object input, Operation sourceOperation, Operation targetOperation, Map<String, Object> metadata) { // Get the data type to represent the input passed in by the source operation DataType sourceType = sourceOperation.getInputType(); // Get the data type to represent the input expected by the target operation DataType targetType = targetOperation.getInputType(); if (sourceType == targetType || (sourceType != null && sourceType.equals(targetType))) { return input; } Map<String, Object> context = new HashMap<String, Object>(); if (metadata != null) { context.putAll(metadata); } if (sourceOperation != null) { context.put(SOURCE_OPERATION, sourceOperation); } if (targetOperation != null) { context.put(TARGET_OPERATION, targetOperation); } if (context.get(BODY_TYPE) == null) { context.put(BODY_TYPE, BODY_TYPE_INPUT); } return mediate(input, sourceType, targetType, context); }
public Object mediateInput(Object input, Operation sourceOperation, Operation targetOperation, Map<String, Object> metadata) { // Get the data type to represent the input passed in by the source operation DataType sourceType = sourceOperation.getInputType(); // Get the data type to represent the input expected by the target operation DataType targetType = targetOperation.getInputType(); if (sourceType == targetType || (sourceType != null && sourceType.equals(targetType))) { return input; } Map<String, Object> context = new HashMap<String, Object>(); if (metadata != null) { context.putAll(metadata); } if (sourceOperation != null) { context.put(SOURCE_OPERATION, sourceOperation); } if (targetOperation != null) { context.put(TARGET_OPERATION, targetOperation); } if (context.get(BODY_TYPE) == null) { context.put(BODY_TYPE, BODY_TYPE_INPUT); } return mediate(input, sourceType, targetType, context); }
return mediate(output, targetType, sourceType, context);
return mediate(output, targetType, sourceType, context);
/** * @param source The source exception * @param sourceExType The data type for the source exception * @param targetExType The data type for the target exception * @param sourceType The fault type for the source * @param targetType The fault type for the target * @return */ private Object transformException(Object source, DataType sourceExType, DataType targetExType, DataType sourceType, DataType targetType, Map<String, Object> metadata) { if (sourceType == targetType || (sourceType != null && sourceType.equals(targetType))) { return source; } DataType<DataType> eSourceDataType = new DataTypeImpl<DataType>(IDL_FAULT, sourceExType.getPhysical(), sourceType); DataType<DataType> eTargetDataType = new DataTypeImpl<DataType>(IDL_FAULT, targetExType.getPhysical(), targetType); return mediate(source, eSourceDataType, eTargetDataType, metadata); }
/** * @param source The source exception * @param sourceExType The data type for the source exception * @param targetExType The data type for the target exception * @param sourceType The fault type for the source * @param targetType The fault type for the target * @return */ private Object transformException(Object source, DataType sourceExType, DataType targetExType, DataType sourceType, DataType targetType, Map<String, Object> metadata) { if (sourceType == targetType || (sourceType != null && sourceType.equals(targetType))) { return source; } DataType<DataType> eSourceDataType = new DataTypeImpl<DataType>(IDL_FAULT, sourceExType.getPhysical(), sourceType); DataType<DataType> eTargetDataType = new DataTypeImpl<DataType>(IDL_FAULT, targetExType.getPhysical(), targetType); return mediate(source, eSourceDataType, eTargetDataType, metadata); }