return true;
}
if (source.getInterface().isRemotable() != target.getInterface().isRemotable()) {
if (!silent) {
throw new IncompatibleInterfaceContractException("Remotable settings do not match", source, target);
} else {
return false;
}
}
if (source.getInterface().isConversational() != target.getInterface().isConversational()) {
if (!silent) {
throw new IncompatibleInterfaceContractException("Interaction scopes do not match", source, target);
} else {
return false;
}
}
for (Operation operation : source.getInterface().getOperations()) {
Operation targetOperation = map(target.getInterface(), operation);
if (targetOperation == null) {
if (!silent) {
throw new IncompatibleInterfaceContractException("Operation not found on target", source, target);
} else {
return false;
}
}
if (!source.getInterface().isRemotable()) {
// FIXME: for remotable operation, only compare name for now
if (!isCompatible(operation, targetOperation, false)) {
if (!silent) {
throw new IncompatibleInterfaceContractException("Target operations are not compatible",
source, target);
} else {
return false;
}
}
}
}
if (ignoreCallback) {
return true;
}
if (source.getCallbackInterface() == null && target.getCallbackInterface() == null) {
return true;
}
if (source.getCallbackInterface() == null || target.getCallbackInterface() == null) {
if (!silent) {
throw new IncompatibleInterfaceContractException("Callback interface doesn't match", source, target);
} else {
return false;
}
}
for (Operation operation : source.getCallbackInterface().getOperations()) {
Operation targetOperation =
getOperation(target.getCallbackInterface().getOperations(), operation.getName());
if (targetOperation == null) {
if (!silent) {
throw new IncompatibleInterfaceContractException("Callback operation not found on target", source,
target, null, targetOperation);
} else {
return false;
}
}
if (!source.getCallbackInterface().isRemotable()) {
// FIXME: for remotable operation, only compare name for now
if (!operation.equals(targetOperation)) {
if (!silent) {
throw new IncompatibleInterfaceContractException("Target callback operation is not compatible",
source, target, operation, targetOperation);
} else {
return false;
}
}