/** * Extract additional ftp client options from the parameters map (parameters starting with * 'ftpClient.'). To remember these parameters, we set them in the endpoint and we can use them * when creating a client. */ protected void extractAndSetFtpClientParameters(Map<String, Object> parameters, FtpEndpoint<FTPFile> answer) { if (IntrospectionSupport.hasProperties(parameters, "ftpClient.")) { Map<String, Object> param = IntrospectionSupport.extractProperties(parameters, "ftpClient."); answer.setFtpClientParameters(param); } }
@Override public void configureProperties(Map<String, Object> options) { super.configureProperties(options); Map<String, Object> emProperties = IntrospectionSupport.extractProperties(options, "emf."); if (emProperties != null) { setEntityManagerProperties(emProperties); } }
/** * 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); } }
/** * Extract additional ftp client trust store options from the parameters map (parameters starting with * 'ftpClient.trustStore.'). To remember these parameters, we set them in the endpoint and we can use * them when creating a client. */ protected void extractAndSetFtpClientTrustStoreParameters(Map<String, Object> parameters, FtpsEndpoint endpoint) { if (IntrospectionSupport.hasProperties(parameters, "ftpClient.trustStore.")) { Map<String, Object> param = IntrospectionSupport.extractProperties(parameters, "ftpClient.trustStore."); endpoint.setFtpClientTrustStoreParameters(param); } }
/** * Extract additional ftp client configuration options from the parameters map (parameters starting with * 'ftpClientConfig.'). To remember these parameters, we set them in the endpoint and we can use them * when creating a client. */ protected void extractAndSetFtpClientConfigParameters(Map<String, Object> parameters, FtpEndpoint<FTPFile> answer) { if (IntrospectionSupport.hasProperties(parameters, "ftpClientConfig.")) { Map<String, Object> param = IntrospectionSupport.extractProperties(parameters, "ftpClientConfig."); answer.setFtpClientConfigParameters(param); } }
@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; } }
@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; } }
/** * 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); } }
protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception { final TalendEndpoint endpoint = new TalendEndpoint(uri, remaining, this); endpoint.setStickyJob(isTrue(parameters.remove("sticky"))); setProperties(endpoint, parameters); // extract the properties.xxx and set them as properties Map<String, Object> properties = IntrospectionSupport.extractProperties(parameters, "endpointProperties."); if (properties != null) { Map<String, String> endpointProperties = new HashMap<String, String>(properties.size()); for (Map.Entry<String, Object> entry : properties.entrySet()) { endpointProperties.put(entry.getKey(), entry.getValue().toString()); } endpoint.setEndpointProperties(endpointProperties); } return endpoint; }
protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception { final TalendEndpoint endpoint = new TalendEndpoint(uri, remaining, this); endpoint.setStickyJob(isTrue(parameters.remove("sticky"))); setProperties(endpoint, parameters); // extract the properties.xxx and set them as properties Map<String, Object> properties = IntrospectionSupport.extractProperties(parameters, "endpointProperties."); if (properties != null) { Map<String, String> endpointProperties = new HashMap<String, String>(properties.size()); for (Map.Entry<String, Object> entry : properties.entrySet()) { endpointProperties.put(entry.getKey(), entry.getValue().toString()); } endpoint.setEndpointProperties(endpointProperties); } return endpoint; }
@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); } }
protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception { HBaseEndpoint endpoint = new HBaseEndpoint(uri, this, connection, remaining); Map<String, Object> mapping = IntrospectionSupport.extractProperties(parameters, "row."); endpoint.setRowMapping(mapping); setProperties(endpoint, parameters); 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; }
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); } }
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); } }
final Map<String, Object> readingProperties = IntrospectionSupport.extractProperties( options, FacebookConstants.READING_PREFIX); if (!readingProperties.isEmpty()) {
@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 protected Endpoint createEndpoint(String s, String s1, Map<String, Object> parameters) throws Exception { FlowableEndpoint ae = new FlowableEndpoint(s, getCamelContext()); ae.setIdentityService(identityService); ae.setRuntimeService(runtimeService); ae.setRepositoryService(repositoryService); ae.setCopyVariablesToProperties(this.copyVariablesToProperties); ae.setCopyVariablesToBodyAsMap(this.copyVariablesToBodyAsMap); ae.setCopyCamelBodyToBody(this.copyCamelBodyToBody); Map<String, Object> returnVars = IntrospectionSupport.extractProperties(parameters, "var.return."); if (returnVars != null && returnVars.size() > 0) { ae.getReturnVarMap().putAll(returnVars); } return ae; }
@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; }