@Override protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> properties) throws Exception { AS400ConnectionPool connectionPool; if (properties.containsKey(CONNECTION_POOL)) { LOG.trace("AS400ConnectionPool instance specified in the URI - will look it up."); // We have chosen to handle the connectionPool option ourselves, so // we must remove it from the given parameter list (see // http://camel.apache.org/writing-components.html) String poolId = properties.remove(CONNECTION_POOL).toString(); connectionPool = EndpointHelper.resolveReferenceParameter(getCamelContext(), poolId, AS400ConnectionPool.class, true); } else { LOG.trace("No AS400ConnectionPool instance specified in the URI - one will be provided."); connectionPool = getConnectionPool(); } String type = remaining.substring(remaining.lastIndexOf(".") + 1).toUpperCase(); Jt400Endpoint endpoint = new Jt400Endpoint(uri, this, connectionPool); setProperties(endpoint, properties); endpoint.setType(Jt400Type.valueOf(type)); return endpoint; }
protected C setConfigurationProperties(C configuration, Map<String, Object> parameters) throws Exception { // Resolve config for named maps Map<String, Object> configs = IntrospectionSupport.extractProperties(parameters, "resource.config."); for (Map.Entry<String, Object> entry : configs.entrySet()) { String ref = (String)entry.getValue(); if (!EndpointHelper.isReferenceParameter(ref)) { throw new IllegalArgumentException("The option resource.config." + ref + " should be a reference"); } configuration.addResourceConfig( entry.getKey(), EndpointHelper.resolveReferenceParameter(getCamelContext(), ref, Properties.class)); } // Resolve options for named maps Map<String, Object> options = IntrospectionSupport.extractProperties(parameters, "resource.options."); for (Map.Entry<String, Object> entry : options.entrySet()) { String ref = (String)entry.getValue(); if (!EndpointHelper.isReferenceParameter(ref)) { throw new IllegalArgumentException("The option resource.options." + ref + " should be a reference"); } configuration.addResourceOption( entry.getKey(), EndpointHelper.resolveReferenceParameter(getCamelContext(), ref, Properties.class)); } setProperties(configuration, parameters); return configuration; }
String[] names = providersRef.split(","); for (String name : names) { Object provider = EndpointHelper.resolveReferenceParameter(getCamelContext(), name, Object.class, true); setProvider(provider);
/** * Configures the messageFilter's factory. The factory is looked up in the endpoint's URI and then in the Spring's context. * The bean search mechanism looks for a bean with the name messageFilter. * The endpoint's URI search mechanism looks for the URI's key parameter name messageFilter, for instance like this: * spring-ws:http://yourdomain.com?messageFilter=<beanName> */ private void configureMessageFilter(SpringWebserviceConfiguration configuration) { if (configuration.getMessageFilter() == null) { // try to lookup a global filter to use final MessageFilter globalMessageFilter = EndpointHelper.resolveReferenceParameter(getCamelContext(), "messageFilter", MessageFilter.class, false); if (globalMessageFilter != null) { configuration.setMessageFilter(globalMessageFilter); } else { // use basic as fallback configuration.setMessageFilter(new BasicMessageFilter()); } } }
@Override protected void doStart() throws Exception { super.doStart(); Processor target; if (EndpointHelper.isReferenceParameter(contentHandlerClass)) { ContentHandler handler = EndpointHelper.resolveReferenceParameter(getCamelContext(), contentHandlerClass.substring(1), ContentHandler.class, true); target = new StAXProcessor(handler); } else { Class<ContentHandler> clazz = getCamelContext().getClassResolver().resolveMandatoryClass(contentHandlerClass, ContentHandler.class); target = new StAXProcessor(clazz); } setProcessor(target); }