@Bean(name = "file-language") @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) @ConditionalOnMissingBean(FileLanguage.class) public FileLanguage configureFileLanguage() throws Exception { FileLanguage language = new FileLanguage(); IntrospectionSupport.getProperties(configuration, parameters, null, false); CamelPropertiesHelper.setCamelProperties(camelContext, language, parameters, false); if (ObjectHelper.isNotEmpty(customizers)) { for (LanguageCustomizer<FileLanguage> customizer : customizers) { boolean useCustomizer = (customizer instanceof HasId) ? HierarchicalPropertiesEvaluator.evaluate( applicationContext.getEnvironment(), "camel.language.customizer", "camel.language.file.customizer", ((HasId) customizer).getId()) : HierarchicalPropertiesEvaluator.evaluate( applicationContext.getEnvironment(), "camel.language.customizer", "camel.language.file.customizer");
@Override @SuppressWarnings("unchecked") protected String convertPathToActualDestination(String path, Map<String, Object> parameters) { // support ActiveMQ destination options using the destination. prefix // http://activemq.apache.org/destination-options.html Map options = IntrospectionSupport.extractProperties(parameters, "destination."); String query; try { query = URISupport.createQueryString(options); } catch (URISyntaxException e) { throw ObjectHelper.wrapRuntimeCamelException(e); } // if we have destination options then append them to the destination name if (ObjectHelper.isNotEmpty(query)) { return path + "?" + query; } else { return path; } }
@Bean(name = HystrixConstants.DEFAULT_HYSTRIX_CONFIGURATION_ID) @ConditionalOnClass(CamelContext.class) @ConditionalOnMissingBean(name = HystrixConstants.DEFAULT_HYSTRIX_CONFIGURATION_ID) public HystrixConfigurationDefinition defaultHystrixConfigurationDefinition() throws Exception { Map<String, Object> properties = new HashMap<>(); IntrospectionSupport.getProperties(config, properties, null, false); HystrixConfigurationDefinition definition = new HystrixConfigurationDefinition(); IntrospectionSupport.setProperties(camelContext, camelContext.getTypeConverter(), definition, properties); return definition; }
/** * Extract additional ftp client key store options from the parameters map (parameters starting with * 'ftpClient.keyStore.'). To remember these parameters, we set them in the endpoint and we can use * them when creating a client. */ protected void extractAndSetFtpClientKeyStoreParameters(Map<String, Object> parameters, FtpsEndpoint endpoint) { if (IntrospectionSupport.hasProperties(parameters, "ftpClient.keyStore.")) { Map<String, Object> param = IntrospectionSupport.extractProperties(parameters, "ftpClient.keyStore."); endpoint.setFtpClientKeyStoreParameters(param); } }
private WordpressComponentConfiguration copyComponentProperties() throws Exception { Map<String, Object> componentProperties = new HashMap<>(); IntrospectionSupport.getProperties(configuration, componentProperties, null, false); // create endpoint configuration with component properties WordpressComponentConfiguration config = new WordpressComponentConfiguration(); IntrospectionSupport.setProperties(config, componentProperties); return config; } }
@Bean(name = "zookeeper-service-registry") @Scope(ConfigurableBeanFactory.SCOPE_SINGLETON) public ZooKeeperServiceRegistry zookeeperServiceRegistry(ZooKeeperServiceRegistryConfiguration configuration) throws Exception { ZooKeeperServiceRegistry service = new ZooKeeperServiceRegistry(); IntrospectionSupport.setProperties( service, IntrospectionSupport.getNonNullProperties(configuration) ); return service; } }
@Bean(name = "lra-service") @ConditionalOnMissingBean(CamelSagaService.class) @ConditionalOnProperty(value = "camel.service.lra.enabled", havingValue = "true") public LRASagaService configureLraSagaService() throws Exception { LRASagaService service = new LRASagaService(); Map<String, Object> parameters = new HashMap<>(); IntrospectionSupport.getProperties(configuration, parameters, null, false); CamelPropertiesHelper.setCamelProperties(camelContext, service, parameters, false); camelContext.addService(service); return service; } }
@SuppressWarnings("PMD") @Override public Optional<ProcessorDefinition> handle(Step step, ProcessorDefinition route, IntegrationRouteBuilder builder) { ObjectHelper.notNull(route, "route"); String options = null; if (ObjectHelper.isEmpty(function)) { return Optional.empty(); if (ObjectHelper.isNotEmpty(properties)) { options = properties.entrySet().stream() .filter(entry -> ObjectHelper.isNotEmpty(entry.getKey())) IntrospectionSupport.setProperties(context, converter, stepExtension, props); } catch (Exception e) { throw new IllegalStateException(e);
Map<String, Object> httpClientOptions = IntrospectionSupport.extractProperties(parameters, "httpClient."); IntrospectionSupport.setProperties(clientParams, httpClientOptions); Map<String, Object> httpConnectionManagerOptions = IntrospectionSupport.extractProperties(parameters, "httpConnectionManager."); IntrospectionSupport.setProperties(connectionManagerParams, httpConnectionManagerOptions); IntrospectionSupport.getProperties(getHttpConfiguration(), properties, null); setProperties(endpoint, properties);
final List<String> customizers = step.getCustomizers(); if (ObjectHelper.isNotEmpty(customizers)) { for (Map.Entry<String, Object> entry : options.entrySet()) { Object val = entry.getValue(); ObjectHelper.trySetCamelContext(customizer, context); IntrospectionSupport.setProperties(converter, customizer, options);
/** * Return all configuration properties on a map. * * @return */ public Map<String, Object> asMap() { final Map<String, Object> map = new HashMap<>(); IntrospectionSupport.getProperties(this, map, null); return map; }
@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); } }
ObjectHelper.notNull(context, "context"); ObjectHelper.notNull(target, "target"); ObjectHelper.notNull(properties, "properties"); boolean rc = false; if (stringValue != null && isReferenceParameter(stringValue)) { hit = IntrospectionSupport.setProperty(context, context.getTypeConverter(), target, name, null, stringValue, true); } else if (value != null) { hit = IntrospectionSupport.setProperty(context, context.getTypeConverter(), target, name, value); } catch (IllegalArgumentException e) { hit = IntrospectionSupport.setProperty(context, context.getTypeConverter(), target, name, null, stringValue, true);
@Override public void configureProperties(Map<String, Object> options) { super.configureProperties(options); Map<String, Object> emProperties = IntrospectionSupport.extractProperties(options, "emf."); if (emProperties != null) { setEntityManagerProperties(emProperties); } }
/** * Initializes the property placeholders by registering the {@link PropertiesComponent} with * the configuration from the given init parameters. */ private void initPropertyPlaceholder(ServletCamelContext camelContext, Map<String, Object> parameters) throws Exception { // setup property placeholder first Map<String, Object> properties = IntrospectionSupport.extractProperties(parameters, "propertyPlaceholder."); if (properties != null && !properties.isEmpty()) { PropertiesComponent pc = new PropertiesComponent(); IntrospectionSupport.setProperties(pc, properties); // validate we could set all parameters if (!properties.isEmpty()) { throw new IllegalArgumentException("Error setting propertyPlaceholder parameters on CamelContext." + " There are " + properties.size() + " unknown parameters. [" + properties + "]"); } // register the properties component camelContext.addComponent("properties", pc); } }
if (sslcf == null && !"https".equals(endpoint.getProtocol())) { result = (AbstractConnector)ObjectHelper .loadClass("org.eclipse.jetty.server.nio.SelectChannelConnector", Server.class.getClassLoader()).newInstance(); } else if (sslcf == null) { result = (AbstractConnector)ObjectHelper .loadClass("org.eclipse.jetty.server.ssl.SslSelectChannelConnector", Server.class.getClassLoader()).newInstance(); } else { result = (AbstractConnector)ObjectHelper .loadClass("org.eclipse.jetty.server.ssl.SslSelectChannelConnector", Server.class.getClassLoader()).getConstructor(SslContextFactory.class) .newInstance(sslcf); IntrospectionSupport.setProperties(result, properties); if (properties.size() > 0) { throw new IllegalArgumentException("There are " + properties.size() IntrospectionSupport.setProperties(result, properties); if (properties.size() > 0) { throw new IllegalArgumentException("There are " + properties.size()
IntrospectionSupport.setProperties(sslcf, properties); if (properties.size() > 0) { throw new IllegalArgumentException("There are " + properties.size() throw ObjectHelper.wrapRuntimeCamelException(e);
protected void setProcessDefinitionProperty(T entity, ProcessDefinition processDefinition) throws Exception { IntrospectionSupport.setProperty(entity, "processDefinition", processDefinition); }
@Override public Optional<ProcessorDefinition> handle(Extension step, ProcessorDefinition route, SyndesisRouteBuilder routeBuilder) { final CamelContext context = routeBuilder.getContext(); final TypeConverter converter = context.getTypeConverter(); final String target = step.getName(); if (!Strings.isEmpty(target)) { try { final Class<SyndesisStepExtension> clazz = context.getClassResolver().resolveMandatoryClass(target, SyndesisStepExtension.class); final SyndesisStepExtension stepExtension = context.getInjector().newInstance(clazz); final Map<String, Object> props = new HashMap<>(step.getProperties()); try { IntrospectionSupport.setProperties(context, converter, stepExtension, props); } catch (Exception e) { throw new IllegalStateException(e); } return stepExtension.configure(context, route, props); } catch (ClassNotFoundException e) { throw new IllegalStateException(e); } } return Optional.of(route); } }
ObjectHelper.trySetCamelContext(customizer, context); if (IntrospectionSupport.setProperty(context, customizer, key, val)) {