Monitor.error(monitor,
this,
"endpoint-validation-messages",
"NoComponentReferenceTarget",
endpointReference.getReference().getName());
throw new ServiceRuntimeException("Unable to bind " +
monitor.getLastProblem().toString());
}
}
setSingleAutoWireTarget(endpointReference.getReference());
} else if ( endpointReference.getStatus() == EndpointReference.Status.WIRED_TARGET_FOUND_AND_MATCHED||
endpointReference.getStatus() == EndpointReference.Status.RESOLVED_BINDING ) {
// The endpoint reference is already resolved to either
// a service endpoint local to this composite or it has
// a remote binding
// still need to check that the callback endpoint is set correctly
if (hasCallback(endpointReference) &&
(endpointReference.getCallbackEndpoint() == null
|| endpointReference.getCallbackEndpoint().isUnresolved())) {
selectCallbackEndpoint(endpointReference,
endpointReference.getReference().getCallbackService(),
matchAudit,
builderContext,
runtime);
}
} else if (endpointReference.getStatus() == EndpointReference.Status.WIRED_TARGET_FOUND_READY_FOR_MATCHING ){
// The endpoint reference is already resolved to either
// a service endpoint but no binding was specified in the
// target URL and/or the policies have yet to be matched.
// Used when $self references are resolved
selectForwardEndpoint(endpointReference,
endpointReference.getTargetEndpoint().getService().getEndpoints(),
matchAudit,
builderContext);
if (hasCallback(endpointReference)){
selectCallbackEndpoint(endpointReference,
endpointReference.getReference().getCallbackService(),
matchAudit,
builderContext,
runtime);
}
} else if (endpointReference.getStatus() == EndpointReference.Status.WIRED_TARGET_IN_BINDING_URI ||
endpointReference.getStatus() == EndpointReference.Status.WIRED_TARGET_NOT_FOUND ||
endpointReference.getStatus() == EndpointReference.Status.NOT_CONFIGURED){
// The reference is not yet matched to a service
// find the service in the endpoint registry
List<Endpoint> endpoints = domainRegistry.findEndpoint(endpointReference);
if (endpoints.size() > 0){
selectForwardEndpoint(endpointReference,
endpoints,
matchAudit,
builderContext);
// If the reference was matched try to match the callback
if (endpointReference.getStatus().equals(EndpointReference.Status.WIRED_TARGET_FOUND_AND_MATCHED) &&
hasCallback(endpointReference)){
selectCallbackEndpoint(endpointReference,
endpointReference.getReference().getCallbackService(),
matchAudit,
builderContext,
runtime);
}
} else if (runtime) {
// tweak to test if this could be a resolved binding. This is the back end of the test
// in the builder that pulls the URI out of the binding if there are no targets
// on the reference. have to wait until here to see if the binding uri matches any
// available services. If not we assume here that it's a resolved binding
if (endpointReference.getStatus() == EndpointReference.Status.WIRED_TARGET_IN_BINDING_URI){
endpointReference.getTargetEndpoint().setBinding(endpointReference.getBinding());
endpointReference.setStatus(EndpointReference.Status.RESOLVED_BINDING);
} else {
processUnknownEndpoint(endpointReference, matchAudit);
if (!endpointReference.getStatus().equals(EndpointReference.Status.WIRED_TARGET_FOUND_AND_MATCHED)){
Monitor.error(monitor,
this,
"endpoint-validation-messages",
"NoEndpointsFound",
endpointReference.toString());
throw new ServiceRuntimeException("Unable to bind " +
monitor.getLastProblem().toString());
}
}
} else {
// it's build time so just give the UnknownEndpoint code a chance
// without regard for the result
processUnknownEndpoint(endpointReference, matchAudit);
}
}
logger.fine(matchAudit.toString());
if (endpointReference.getStatus() != EndpointReference.Status.WIRED_TARGET_FOUND_AND_MATCHED &&
endpointReference.getStatus() != EndpointReference.Status.RESOLVED_BINDING){
if (runtime){
Monitor.error(monitor,
this,
"endpoint-validation-messages",
"EndpointReferenceCantBeMatched",
endpointReference.toString(),
matchAudit);
throw new ServiceRuntimeException("Unable to bind " +
monitor.getLastProblem().toString());
} else {
Monitor.warning(monitor,
this,
"endpoint-validation-messages",