Refine search
public void afterPropertiesSet() throws Exception { // lets bind the URI to a pojo notNull(uri, "uri"); // Always resolve the camel context by using the camelContextID if (ObjectHelper.isNotEmpty(camelContextId)) { camelContext = CamelContextResolverHelper.getCamelContextWithId(applicationContext, camelContextId); } notNull(camelContext, "camelContext"); if (serviceRef != null && getService() == null && applicationContext != null) { setService(applicationContext.getBean(serviceRef)); } Endpoint endpoint = CamelContextHelper.getMandatoryEndpoint(camelContext, uri); notNull(getService(), "service"); Object proxy = getProxyForService(); try { // need to start endpoint before we create consumer ServiceHelper.startService(endpoint); consumer = endpoint.createConsumer(new BeanProcessor(proxy, camelContext)); // add and start consumer camelContext.addService(consumer, true, true); } catch (Exception e) { throw new FailedToCreateConsumerException(endpoint, e); } }
@Override public void afterPropertiesSet() throws Exception { StopWatch watch = new StopWatch(); super.afterPropertiesSet(); Boolean shutdownEager = CamelContextHelper.parseBoolean(getContext(), getShutdownEager()); if (shutdownEager != null) { LOG.debug("Using shutdownEager: {}", shutdownEager); getContext().setShutdownEager(shutdownEager); } LOG.debug("afterPropertiesSet() took {} millis", watch.stop()); }
@Override public T create(CreationalContext<T> creationalContext) { try { CamelContext context = isNotEmpty(exporter.getCamelContextId()) ? getReferenceByName(manager, exporter.getCamelContextId(), CamelContext.class).get() : getReference(manager, CamelContext.class, this.context); Bean<?> bean = manager.resolve(manager.getBeans(exporter.getServiceRef())); if (bean == null) { throw new UnsatisfiedResolutionException("No bean with name [" + exporter.getServiceRef() + "] is deployed!"); } @SuppressWarnings("unchecked") T service = (T) manager.getReference(bean, type, manager.createCreationalContext(bean)); Endpoint endpoint = getMandatoryEndpoint(context, exporter.getUri()); try { // need to start endpoint before we create consumer startService(endpoint); Consumer consumer = endpoint.createConsumer(new BeanProcessor(service, context)); // add and start consumer context.addService(consumer, true, true); } catch (Exception cause) { throw new FailedToCreateConsumerException(endpoint, cause); } return service; } catch (Exception cause) { throw new CreationException("Error while creating instance for " + this, cause); } }
@Override @SuppressWarnings("unchecked") protected void doStart() throws Exception { ObjectHelper.notNull(camelContext, "CamelContext"); if (context == null) { // if context not injected, create one and resolve partial class up front so they are ready to be used context = createContext(); } introspector = context.createJAXBIntrospector(); if (partClass != null) { partialClass = camelContext.getClassResolver().resolveMandatoryClass(partClass, Object.class); } if (namespacePrefixRef != null) { namespacePrefix = CamelContextHelper.mandatoryLookup(camelContext, namespacePrefixRef, Map.class); } if (namespacePrefix != null) { namespacePrefixMapper = NamespacePrefixMapperFactory.newNamespacePrefixMapper(camelContext, namespacePrefix); } typeConverter = camelContext.getTypeConverter(); if (schema != null) { cachedSchema = createSchema(getSources()); } LOG.debug("JaxbDataFormat [prettyPrint={}, objectFactory={}]", prettyPrint, objectFactory); }
Object o = CamelContextHelper.mandatoryLookup(camelContext, name); bootstrap.option(option, o); } else { String networkInterface = configuration.getNetworkInterface() == null ? LOOPBACK_INTERFACE : configuration.getNetworkInterface(); multicastNetworkInterface = NetworkInterface.getByName(networkInterface); ObjectHelper.notNull(multicastNetworkInterface, "No network interface found for '" + networkInterface + "'."); LOG.info("ConnectionlessBootstrap joining {}:{} using network interface: {}", configuration.getHost(), configuration.getPort(), multicastNetworkInterface.getName()); datagramChannel.joinGroup(hostAddress, multicastNetworkInterface).syncUninterruptibly();
target = CamelContextHelper.mandatoryLookup(getCamelContext(), dataSourceRef, DataSource.class); Set<DataSource> dataSources = getCamelContext().getRegistry().findByType(DataSource.class); if (dataSources.size() > 1) { throw new IllegalArgumentException("Multiple DataSources found in the registry and no explicit configuration provided");
protected Endpoint resolveEndpoint(String targetId) { Endpoint result = getContext().getRegistry().lookup(targetId, Endpoint.class); if (result == null) { result = CamelContextHelper.getMandatoryEndpoint(getContext(), targetId); } return result; }
AbstractJAXRSFactoryBean bean = CamelContextHelper.mandatoryLookup(getCamelContext(), beanId, AbstractJAXRSFactoryBean.class); if (bean instanceof BlueprintSupport) { Class<?> clazz = getCamelContext().getClassResolver().resolveMandatoryClass(resourceClass); answer.addResourceClass(clazz); Iterator<?> it = ObjectHelper.createIterator(resourceClasses); while (it.hasNext()) { String name = (String) it.next(); Class<?> clazz = getCamelContext().getClassResolver().resolveMandatoryClass(name); answer.addResourceClass(clazz);
protected CxfEndpoint createCxfSpringEndpoint(String beanId) throws Exception { return CamelContextHelper.mandatoryLookup(getCamelContext(), beanId, CxfEndpoint.class); }
if (camelCtx.getStatus() == ServiceStatus.Started || camelCtx.getStatus() == ServiceStatus.Starting) throw new IgniteException("Failed to start Camel streamer (CamelContext already started or starting)."); endpoint = CamelContextHelper.getMandatoryEndpoint(camelCtx, endpointUri);
/** * Returns the to endpoint, lazily resolving it if need be */ protected Endpoint getToEndpoint(CamelContext camelContext) { if (toEndpoint == null) { if (to != null) { toEndpoint = CamelContextHelper.getMandatoryEndpoint(camelContext, to); } } return toEndpoint; }
String messageHistory = (String) parameters.remove("messageHistory"); if (messageHistory != null) { camelContext.setMessageHistory(CamelContextHelper.parseBoolean(camelContext, messageHistory)); camelContext.setStreamCaching(CamelContextHelper.parseBoolean(camelContext, streamCache)); camelContext.setTracing(CamelContextHelper.parseBoolean(camelContext, trace)); camelContext.setDelayer(CamelContextHelper.parseLong(camelContext, delayer)); camelContext.setHandleFault(CamelContextHelper.parseBoolean(camelContext, handleFault)); camelContext.setAutoStartup(CamelContextHelper.parseBoolean(camelContext, autoStartup)); camelContext.setUseMDCLogging(CamelContextHelper.parseBoolean(camelContext, useMDCLogging)); camelContext.setUseBreadcrumb(CamelContextHelper.parseBoolean(camelContext, useBreadcrumb));
/** * Populates a {@link MapMessage} from a {@link Map} instance. */ protected void populateMapMessage(MapMessage message, Map<?, ?> map, CamelContext context) throws JMSException { for (Entry<?, ?> entry : map.entrySet()) { String keyString = CamelContextHelper.convertTo(context, String.class, entry.getKey()); if (keyString != null) { message.setObject(keyString, entry.getValue()); } } }
@Override protected void doStart() throws Exception { influxDB = CamelContextHelper.mandatoryLookup(getCamelContext(), connectionBean, InfluxDB.class); LOG.debug("Resolved the connection with the name {} as {}", connectionBean, influxDB); super.doStart(); }
/** * Creates a {@link Validation} process object. * * @param validatorUri * URI of the endpoint that validates an exchange. * @return a validation process object. * @throws Exception * if a producer cannot be created for the endpoint represented * by <code>validatorUri</code>. */ public Validation validation(String validatorUri) throws Exception { Endpoint endpoint = CamelContextHelper.getMandatoryEndpoint(routeBuilder.getContext(), validatorUri); return new Validation(endpoint.createProducer()); }
/** * Gets the parameter. This method doesn't resolve reference parameters in the registry. * * @param parameters the parameters * @param key the key * @param type the requested type to convert the value from the parameter * @param defaultValue use this default value if the parameter does not contain the key * @return the converted value parameter */ public <T> T getParameter(Map<String, Object> parameters, String key, Class<T> type, T defaultValue) { Object value = parameters.get(key); if (value == null) { value = defaultValue; } if (value == null) { return null; } return CamelContextHelper.convertTo(getCamelContext(), type, value); }
private void addEndpointDispatcherToConfiguration(SpringWebserviceConfiguration configuration, String lookupKey) { // Obtain CamelEndpointDispatcher with the given name from registry CamelEndpointDispatcher endpoint = CamelContextHelper.mandatoryLookup(getCamelContext(), lookupKey, CamelEndpointDispatcher.class); configuration.setEndpointDispatcher(endpoint); }
/** * Creates a new {@link Enricher}. * * @param aggregationStrategy * aggregation strategy to combine input data and additional * data. * @param resourceUri * URI of resource endpoint for obtaining additional data. * @return an enricher. * @throws Exception * if a producer cannot be created for the endpoint represented * by <code>resourceUri</code>. */ public Enricher enricher(AggregationStrategy aggregationStrategy, String resourceUri) throws Exception { Endpoint endpoint = CamelContextHelper.getMandatoryEndpoint(routeBuilder.getContext(), resourceUri); return new Enricher(aggregationStrategy, endpoint.createProducer()); }
if (properties != null && !properties.isEmpty()) { String disabled = (String) properties.remove("disabled"); boolean disableJmx = CamelContextHelper.parseBoolean(camelContext, disabled != null ? disabled : "false"); if (disableJmx) { Boolean statisticsEnabled = CamelContextHelper.parseBoolean(camelContext, loadStatisticsEnabled != null ? loadStatisticsEnabled : "true"); if (statisticsEnabled != null) { camelContext.getManagementStrategy().setLoadStatisticsEnabled(statisticsEnabled);
@Override protected void doStart() throws Exception { if (writeConcern != null && writeConcernRef != null) { String msg = "Cannot set both writeConcern and writeConcernRef at the same time. Respective values: " + writeConcern + ", " + writeConcernRef + ". Aborting initialization."; throw new IllegalArgumentException(msg); } mongoConnection = CamelContextHelper.mandatoryLookup(getCamelContext(), connectionBean, MongoClient.class); LOG.debug("Resolved the connection with the name {} as {}", connectionBean, mongoConnection); setWriteReadOptionsOnConnection(); super.doStart(); }