org.apache.flink.table.descriptors.ConnectorDescriptorValidator Java Examples

The following examples show how to use org.apache.flink.table.descriptors.ConnectorDescriptorValidator. 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: FlinkCalciteCatalogReader.java    From flink with Apache License 2.0 6 votes vote down vote up
/**
 * Checks whether the {@link CatalogTable} uses legacy connector source options.
 */
private static boolean isLegacySourceOptions(
		CatalogTable catalogTable,
		CatalogSchemaTable schemaTable) {
	// normalize option keys
	DescriptorProperties properties = new DescriptorProperties(true);
	properties.putProperties(catalogTable.getOptions());
	if (properties.containsKey(ConnectorDescriptorValidator.CONNECTOR_TYPE)) {
		return true;
	} else {
		// try to create legacy table source using the options,
		// some legacy factories uses the new 'connector' key
		try {
			TableFactoryUtil.findAndCreateTableSource(
				schemaTable.getCatalog(),
				schemaTable.getTableIdentifier(),
				catalogTable,
				new Configuration());
			// success, then we will use the legacy factories
			return true;
		} catch (Throwable e) {
			// fail, then we will use new factories
			return false;
		}
	}
}
 
Example #2
Source File: MockTableSourceFactory.java    From AthenaX with Apache License 2.0 5 votes vote down vote up
@Override
public Map<String, String> requiredContext() {
  Map<String, String> context = new HashMap<>();
  context.put(ConnectorDescriptorValidator.CONNECTOR_TYPE(), CONNECTOR_TYPE);
  context.put(ConnectorDescriptorValidator.CONNECTOR_PROPERTY_VERSION(), String.valueOf(CONNECTOR_VERSION));
  return context;
}
 
Example #3
Source File: JsonTableSourceFactory.java    From AthenaX with Apache License 2.0 5 votes vote down vote up
@Override
public Map<String, String> requiredContext() {
  Map<String, String> context = new HashMap<>();
  context.put(ConnectorDescriptorValidator.CONNECTOR_TYPE(), KAFKA_JSON_TABLE_SOURCE_TYPE);
  context.put(ConnectorDescriptorValidator.CONNECTOR_PROPERTY_VERSION(),
      String.valueOf(KAFKA_JSON_TABLE_SOURCE_VERSION));
  return context;
}
 
Example #4
Source File: TableSourceFactoryMock.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public Map<String, String> requiredContext() {
	final Map<String, String> context = new HashMap<>();
	context.put(ConnectorDescriptorValidator.CONNECTOR_TYPE, CONNECTOR_TYPE_VALUE);
	return context;
}
 
Example #5
Source File: TableSinkProviderRegistry.java    From AthenaX with Apache License 2.0 4 votes vote down vote up
static AthenaXTableSinkProvider getProvider(ExternalCatalogTable table) {
  DescriptorProperties properties = new DescriptorProperties(true);
  table.addProperties(properties);
  String connectorType = properties.getString(ConnectorDescriptorValidator.CONNECTOR_TYPE());
  return PROVIDERS.get(connectorType);
}
 
Example #6
Source File: TableSourceFactoryMock.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public Map<String, String> requiredContext() {
	final Map<String, String> context = new HashMap<>();
	context.put(ConnectorDescriptorValidator.CONNECTOR_TYPE, CONNECTOR_TYPE_VALUE);
	return context;
}