use of org.apache.camel.component.cxf.blueprint.BlueprintSupport in project camel by apache.
the class CxfRsComponent method createEndpoint.
@Override
protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception {
CxfRsEndpoint answer;
Object value = parameters.remove("setDefaultBus");
if (value != null) {
LOG.warn("The option setDefaultBus is @deprecated, use name defaultBus instead");
if (!parameters.containsKey("defaultBus")) {
parameters.put("defaultBus", value);
}
}
if (remaining.startsWith(CxfConstants.SPRING_CONTEXT_ENDPOINT)) {
// Get the bean from the Spring context
String beanId = remaining.substring(CxfConstants.SPRING_CONTEXT_ENDPOINT.length());
if (beanId.startsWith("//")) {
beanId = beanId.substring(2);
}
AbstractJAXRSFactoryBean bean = CamelContextHelper.mandatoryLookup(getCamelContext(), beanId, AbstractJAXRSFactoryBean.class);
if (bean instanceof BlueprintSupport) {
answer = new CxfRsBlueprintEndpoint(this, remaining, bean);
} else {
answer = new CxfRsSpringEndpoint(this, remaining, bean);
}
// with to apply properties defined by URI query.
if (bean.getProperties() != null) {
Map<String, Object> copy = new HashMap<String, Object>();
copy.putAll(bean.getProperties());
setProperties(answer, copy);
}
// setup the skipFaultLogging
answer.setBeanId(beanId);
} else {
// endpoint URI does not specify a bean
answer = new CxfRsEndpoint(remaining, this);
}
String resourceClass = getAndRemoveParameter(parameters, "resourceClass", String.class);
if (resourceClass != null) {
Class<?> clazz = getCamelContext().getClassResolver().resolveMandatoryClass(resourceClass);
answer.addResourceClass(clazz);
}
String resourceClasses = getAndRemoveParameter(parameters, "resourceClasses", String.class);
Iterator<?> it = ObjectHelper.createIterator(resourceClasses);
while (it.hasNext()) {
String name = (String) it.next();
Class<?> clazz = getCamelContext().getClassResolver().resolveMandatoryClass(name);
answer.addResourceClass(clazz);
}
setProperties(answer, parameters);
Map<String, String> params = CastUtils.cast(parameters);
answer.setParameters(params);
setEndpointHeaderFilterStrategy(answer);
return answer;
}
Aggregations