@Override
protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception {
String splitURI[] = StringHelper.splitOnCharacter(remaining, ":", 2);
if (splitURI[1] != null) {
String contextId = splitURI[0];
String localEndpoint = splitURI[1];
Component component = getCamelContext().getComponent(contextId);
if (component != null) {
LOG.debug("Attempting to create local endpoint: {} inside the component: {}", localEndpoint, component);
Endpoint endpoint = component.createEndpoint(localEndpoint);
if (endpoint == null) {
throw new ResolveEndpointFailedException("Cannot create a endpoint with uri" + localEndpoint + " for the CamelContext Component " + contextId);
} else {
ContextEndpoint answer = new ContextEndpoint(uri, this, endpoint);
answer.setContextId(contextId);
answer.setLocalEndpointUrl(localEndpoint);
return answer;
}
} else {
throw new ResolveEndpointFailedException("Cannot create the camel context component for context " + contextId);
}
} else {
throw new ResolveEndpointFailedException("The uri " + remaining + "from camel context component is wrong");
}
}