Java Code Examples for org.apache.flink.table.descriptors.DescriptorProperties#getFixedIndexedProperties()

The following examples show how to use org.apache.flink.table.descriptors.DescriptorProperties#getFixedIndexedProperties() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: KafkaTableSourceSinkFactoryBase.java    From flink with Apache License 2.0 6 votes vote down vote up
private Properties getKafkaProperties(DescriptorProperties descriptorProperties) {
	final Properties kafkaProperties = new Properties();

	if (KafkaValidator.hasConciseKafkaProperties(descriptorProperties)) {
		descriptorProperties.asMap().keySet()
			.stream()
			.filter(key -> key.startsWith(CONNECTOR_PROPERTIES))
			.forEach(key -> {
				final String value = descriptorProperties.getString(key);
				final String subKey = key.substring((CONNECTOR_PROPERTIES + '.').length());
				kafkaProperties.put(subKey, value);
			});
	} else {
		final List<Map<String, String>> propsList = descriptorProperties.getFixedIndexedProperties(
			CONNECTOR_PROPERTIES,
			Arrays.asList(CONNECTOR_PROPERTIES_KEY, CONNECTOR_PROPERTIES_VALUE));
		propsList.forEach(kv -> kafkaProperties.put(
			descriptorProperties.getString(kv.get(CONNECTOR_PROPERTIES_KEY)),
			descriptorProperties.getString(kv.get(CONNECTOR_PROPERTIES_VALUE))
		));
	}
	return kafkaProperties;
}
 
Example 2
Source File: ElasticsearchUpsertTableSinkFactoryBase.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
private List<Host> getHosts(DescriptorProperties descriptorProperties) {
	final List<Map<String, String>> hosts = descriptorProperties.getFixedIndexedProperties(
		CONNECTOR_HOSTS,
		Arrays.asList(CONNECTOR_HOSTS_HOSTNAME, CONNECTOR_HOSTS_PORT, CONNECTOR_HOSTS_PROTOCOL));
	return hosts.stream()
		.map(host -> new Host(
			descriptorProperties.getString(host.get(CONNECTOR_HOSTS_HOSTNAME)),
			descriptorProperties.getInt(host.get(CONNECTOR_HOSTS_PORT)),
			descriptorProperties.getString(host.get(CONNECTOR_HOSTS_PROTOCOL))))
		.collect(Collectors.toList());
}
 
Example 3
Source File: KafkaTableSourceSinkFactoryBase.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
private Properties getKafkaProperties(DescriptorProperties descriptorProperties) {
	final Properties kafkaProperties = new Properties();
	final List<Map<String, String>> propsList = descriptorProperties.getFixedIndexedProperties(
		CONNECTOR_PROPERTIES,
		Arrays.asList(CONNECTOR_PROPERTIES_KEY, CONNECTOR_PROPERTIES_VALUE));
	propsList.forEach(kv -> kafkaProperties.put(
		descriptorProperties.getString(kv.get(CONNECTOR_PROPERTIES_KEY)),
		descriptorProperties.getString(kv.get(CONNECTOR_PROPERTIES_VALUE))
	));
	return kafkaProperties;
}
 
Example 4
Source File: PulsarTableSourceSinkFactory.java    From pulsar-flink with Apache License 2.0 5 votes vote down vote up
private Properties getPulsarProperties(DescriptorProperties descriptorProperties) {
    final Properties pulsarProperties = new Properties();
    final List<Map<String, String>> propsList = descriptorProperties.getFixedIndexedProperties(
            CONNECTOR_PROPERTIES,
            Arrays.asList(CONNECTOR_PROPERTIES_KEY, CONNECTOR_PROPERTIES_VALUE));
    propsList.forEach(kv -> pulsarProperties.put(
            descriptorProperties.getString(kv.get(CONNECTOR_PROPERTIES_KEY)),
            descriptorProperties.getString(kv.get(CONNECTOR_PROPERTIES_VALUE))
    ));
    return pulsarProperties;
}
 
Example 5
Source File: ElasticsearchUpsertTableSinkFactoryBase.java    From flink with Apache License 2.0 5 votes vote down vote up
private List<Host> getHosts(DescriptorProperties descriptorProperties) {
	final List<Map<String, String>> hosts = descriptorProperties.getFixedIndexedProperties(
		CONNECTOR_HOSTS,
		Arrays.asList(CONNECTOR_HOSTS_HOSTNAME, CONNECTOR_HOSTS_PORT, CONNECTOR_HOSTS_PROTOCOL));
	return hosts.stream()
		.map(host -> new Host(
			descriptorProperties.getString(host.get(CONNECTOR_HOSTS_HOSTNAME)),
			descriptorProperties.getInt(host.get(CONNECTOR_HOSTS_PORT)),
			descriptorProperties.getString(host.get(CONNECTOR_HOSTS_PROTOCOL))))
		.collect(Collectors.toList());
}
 
Example 6
Source File: KafkaTableSourceSinkFactoryBase.java    From flink with Apache License 2.0 5 votes vote down vote up
private Properties getKafkaProperties(DescriptorProperties descriptorProperties) {
	final Properties kafkaProperties = new Properties();
	final List<Map<String, String>> propsList = descriptorProperties.getFixedIndexedProperties(
		CONNECTOR_PROPERTIES,
		Arrays.asList(CONNECTOR_PROPERTIES_KEY, CONNECTOR_PROPERTIES_VALUE));
	propsList.forEach(kv -> kafkaProperties.put(
		descriptorProperties.getString(kv.get(CONNECTOR_PROPERTIES_KEY)),
		descriptorProperties.getString(kv.get(CONNECTOR_PROPERTIES_VALUE))
	));
	return kafkaProperties;
}
 
Example 7
Source File: ElasticsearchUpsertTableSinkFactoryBase.java    From flink with Apache License 2.0 5 votes vote down vote up
private List<Host> getHosts(DescriptorProperties descriptorProperties) {
	if (descriptorProperties.containsKey(CONNECTOR_HOSTS)) {
		return validateAndParseHostsString(descriptorProperties);
	} else {
		final List<Map<String, String>> hosts = descriptorProperties.getFixedIndexedProperties(
			CONNECTOR_HOSTS,
			Arrays.asList(CONNECTOR_HOSTS_HOSTNAME, CONNECTOR_HOSTS_PORT, CONNECTOR_HOSTS_PROTOCOL));
		return hosts.stream()
			.map(host -> new Host(
				descriptorProperties.getString(host.get(CONNECTOR_HOSTS_HOSTNAME)),
				descriptorProperties.getInt(host.get(CONNECTOR_HOSTS_PORT)),
				descriptorProperties.getString(host.get(CONNECTOR_HOSTS_PROTOCOL))))
			.collect(Collectors.toList());
	}
}