@Override public Consumer createConsumer(Processor processor) throws Exception { Consumer ret = null; initDriver(I2CConsumer.class); device = bus.getDevice(deviceId); Constructor constructor = driverClass.getConstructor(I2CEndpoint.class, Processor.class, I2CDevice.class); ret = (Consumer) constructor.newInstance(this, processor, device); // Inject last parameter to i2c derived consumer EndpointHelper.setProperties(this.getCamelContext(), ret, parameters); if (!parameters.isEmpty()) { for (String param : parameters.keySet()) { LOG.warn( "There are parameters that couldn't be set on the endpoint Consumer. Check the uri if the parameters are spelt correctly and that they are properties of the endpoint." + " Unknown Consumer parameters=[" + param + "]"); } } return ret; }
@Override public Producer createProducer() throws Exception { Producer ret = null; initDriver(I2CProducer.class); device = bus.getDevice(deviceId); Constructor constructor = driverClass.getConstructor(I2CEndpoint.class, I2CDevice.class); ret = (Producer) constructor.newInstance(this, device); // Inject last parameter to i2c derived producer EndpointHelper.setProperties(this.getCamelContext(), ret, parameters); if (!parameters.isEmpty()) { for (String param : parameters.keySet()) { LOG.warn( "There are parameters that couldn't be set on the endpoint Producer. Check the uri if the parameters are spelt correctly and that they are properties of the endpoint." + " Unknown Producer parameters=[" + param + "]"); } } return ret; }
@Deprecated public IgniteQueueEndpoint(String endpointUri, URI remainingUri, Map<String, Object> parameters, IgniteComponent igniteComponent) throws Exception { super(endpointUri, igniteComponent); name = remainingUri.getHost(); ObjectHelper.notNull(name, "Queue name"); // Set the configuration values. if (!parameters.containsKey("configuration")) { Map<String, Object> configProps = IntrospectionSupport.extractProperties(parameters, "config."); EndpointHelper.setReferenceProperties(this.getCamelContext(), configProps, parameters); EndpointHelper.setProperties(this.getCamelContext(), configProps, parameters); } }
@Deprecated public IgniteSetEndpoint(String endpointUri, URI remainingUri, Map<String, Object> parameters, IgniteComponent igniteComponent) throws Exception { super(endpointUri, igniteComponent); name = remainingUri.getHost(); ObjectHelper.notNull(name, "Set name"); // Set the configuration values. if (!parameters.containsKey("configuration")) { Map<String, Object> configProps = IntrospectionSupport.extractProperties(parameters, "config."); EndpointHelper.setReferenceProperties(this.getCamelContext(), configProps, parameters); EndpointHelper.setProperties(this.getCamelContext(), configProps, parameters); } }
public void setCamelContext(CamelContext c) { super.setCamelContext(c); if (this.properties != null) { try { EndpointHelper.setReferenceProperties(getCamelContext(), this, this.properties); EndpointHelper.setProperties(getCamelContext(), this, this.properties); } catch (Throwable e) { // TODO: Why dont't we rethrown this exception LOG.warn("Error setting CamelContext. This exception will be ignored.", e); } } }
public IgniteSetEndpoint(String endpointUri, String remaining, Map<String, Object> parameters, IgniteSetComponent igniteComponent) throws Exception { super(endpointUri, igniteComponent); name = remaining; ObjectHelper.notNull(name, "Set name"); // Set the configuration values. if (!parameters.containsKey("configuration")) { Map<String, Object> configProps = IntrospectionSupport.extractProperties(parameters, "config."); EndpointHelper.setReferenceProperties(this.getCamelContext(), configProps, parameters); EndpointHelper.setProperties(this.getCamelContext(), configProps, parameters); } }
/** * To set additional CXF options using the key/value pairs from the Map. * For example to turn on stacktraces in SOAP faults, <tt>properties.faultStackTraceEnabled=true</tt> */ public void setProperties(Map<String, Object> properties) { if (this.properties == null) { this.properties = properties; } else { this.properties.putAll(properties); } if (getCamelContext() != null && this.properties != null) { try { EndpointHelper.setReferenceProperties(getCamelContext(), this, this.properties); EndpointHelper.setProperties(getCamelContext(), this, this.properties); } catch (Throwable e) { // TODO: Why dont't we rethrown this exception LOG.warn("Error setting properties. This exception will be ignored.", e); } } }
public IgniteQueueEndpoint(String endpointUri, String remaining, Map<String, Object> parameters, IgniteQueueComponent igniteComponent) throws Exception { super(endpointUri, igniteComponent); name = remaining; ObjectHelper.notNull(name, "Queue name"); // Set the configuration values. if (!parameters.containsKey("configuration")) { Map<String, Object> configProps = IntrospectionSupport.extractProperties(parameters, "config."); EndpointHelper.setReferenceProperties(this.getCamelContext(), configProps, parameters); EndpointHelper.setProperties(this.getCamelContext(), configProps, parameters); } }
@Override public void configureProperties(Map<String, Object> options) { super.configureProperties(options); // set configuration properties first try { if (config == null) { config = new WordpressComponentConfiguration(); } EndpointHelper.setReferenceProperties(getCamelContext(), config, options); EndpointHelper.setProperties(getCamelContext(), config, options); if (config.getSearchCriteria() == null) { final SearchCriteria searchCriteria = WordpressOperationType.valueOf(operation).getCriteriaType().newInstance(); Map<String, Object> criteriaOptions = IntrospectionSupport.extractProperties(options, "criteria."); // any property that has a "," should be a List criteriaOptions = criteriaOptions.entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey, e -> { if (e != null && e.toString().indexOf(",") > -1) { return Arrays.asList(e.toString().split(",")); } return e.getValue(); })); IntrospectionSupport.setProperties(searchCriteria, criteriaOptions); config.setSearchCriteria(searchCriteria); } } catch (Exception e) { throw new IllegalArgumentException(e.getMessage(), e); } // validate configuration config.validate(); this.initServiceProvider(); }
@Override public void configureProperties(Map<String, Object> options) { super.configureProperties(options); // set configuration properties first try { if (configuration == null) { configuration = new FacebookEndpointConfiguration(); } EndpointHelper.setReferenceProperties(getCamelContext(), configuration, options); EndpointHelper.setProperties(getCamelContext(), configuration, options); } catch (Exception e) { throw new IllegalArgumentException(e.getMessage(), e); } // extract reading properties FacebookPropertiesHelper.configureReadingProperties(configuration, options); // validate configuration configuration.validate(); // validate and initialize state initState(); }
@Override @SuppressWarnings("unchecked") protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception { JMXEndpoint endpoint = new JMXEndpoint(uri, this); // use the helper class to set all of the properties EndpointHelper.setReferenceProperties(getCamelContext(), endpoint, parameters); EndpointHelper.setProperties(getCamelContext(), endpoint, parameters); endpoint.setServerURL(remaining); Map objectProperties = IntrospectionSupport.extractProperties(parameters, "key."); if (objectProperties != null && !objectProperties.isEmpty()) { endpoint.setObjectProperties(objectProperties); } if (endpoint.getObjectDomain() == null) { throw new IllegalArgumentException("Must specify domain"); } if (endpoint.getObjectName() == null && endpoint.getObjectProperties() == null) { throw new IllegalArgumentException("Must specify object name or object properties"); } return endpoint; }
EndpointHelper.setProperties(component.getCamelContext(), this, parameters);
EndpointHelper.setProperties(component.getCamelContext(), this, parameters);