protected void resolveAddress(MessageExchangeImpl exchange) throws JBIException {
ServiceEndpoint theEndpoint = exchange.getEndpoint();
if (theEndpoint != null) {
if (theEndpoint instanceof ExternalEndpoint) {
throw new JBIException("External endpoints can not be used for routing: should be an internal or dynamic endpoint.");
}
if (!(theEndpoint instanceof AbstractServiceEndpoint)) {
throw new JBIException(
"Component-specific endpoints can not be used for routing: should be an internal or dynamic endpoint.");
}
}
// Resolve linked endpoints
if (theEndpoint instanceof LinkedEndpoint) {
QName svcName = ((LinkedEndpoint) theEndpoint).getToService();
String epName = ((LinkedEndpoint) theEndpoint).getToEndpoint();
ServiceEndpoint ep = registry.getInternalEndpoint(svcName, epName);
if (ep == null) {
throw new JBIException("Could not resolve linked endpoint: " + theEndpoint);
}
theEndpoint = ep;
}
// get the context which created the exchange