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

The following examples show how to use org.apache.flink.table.descriptors.DescriptorProperties#getClass() . 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: ElasticsearchUpsertTableSinkFactoryBase.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
private ActionRequestFailureHandler getFailureHandler(DescriptorProperties descriptorProperties) {
	final String failureHandler = descriptorProperties
		.getOptionalString(CONNECTOR_FAILURE_HANDLER)
		.orElse(DEFAULT_FAILURE_HANDLER);
	switch (failureHandler) {
		case CONNECTOR_FAILURE_HANDLER_VALUE_FAIL:
			return new NoOpFailureHandler();
		case CONNECTOR_FAILURE_HANDLER_VALUE_IGNORE:
			return new IgnoringFailureHandler();
		case CONNECTOR_FAILURE_HANDLER_VALUE_RETRY:
			return new RetryRejectedExecutionFailureHandler();
		case CONNECTOR_FAILURE_HANDLER_VALUE_CUSTOM:
			final Class<? extends ActionRequestFailureHandler> clazz = descriptorProperties
				.getClass(CONNECTOR_FAILURE_HANDLER_CLASS, ActionRequestFailureHandler.class);
			return InstantiationUtil.instantiate(clazz);
		default:
			throw new IllegalArgumentException("Unknown failure handler.");
	}
}
 
Example 2
Source File: ElasticsearchUpsertTableSinkFactoryBase.java    From flink with Apache License 2.0 6 votes vote down vote up
private ActionRequestFailureHandler getFailureHandler(DescriptorProperties descriptorProperties) {
	final String failureHandler = descriptorProperties
		.getOptionalString(CONNECTOR_FAILURE_HANDLER)
		.orElse(DEFAULT_FAILURE_HANDLER);
	switch (failureHandler) {
		case CONNECTOR_FAILURE_HANDLER_VALUE_FAIL:
			return new NoOpFailureHandler();
		case CONNECTOR_FAILURE_HANDLER_VALUE_IGNORE:
			return new IgnoringFailureHandler();
		case CONNECTOR_FAILURE_HANDLER_VALUE_RETRY:
			return new RetryRejectedExecutionFailureHandler();
		case CONNECTOR_FAILURE_HANDLER_VALUE_CUSTOM:
			final Class<? extends ActionRequestFailureHandler> clazz = descriptorProperties
				.getClass(CONNECTOR_FAILURE_HANDLER_CLASS, ActionRequestFailureHandler.class);
			return InstantiationUtil.instantiate(clazz);
		default:
			throw new IllegalArgumentException("Unknown failure handler.");
	}
}
 
Example 3
Source File: ElasticsearchUpsertTableSinkFactoryBase.java    From flink with Apache License 2.0 6 votes vote down vote up
private ActionRequestFailureHandler getFailureHandler(DescriptorProperties descriptorProperties) {
	final String failureHandler = descriptorProperties
		.getOptionalString(CONNECTOR_FAILURE_HANDLER)
		.orElse(DEFAULT_FAILURE_HANDLER);
	switch (failureHandler) {
		case CONNECTOR_FAILURE_HANDLER_VALUE_FAIL:
			return new NoOpFailureHandler();
		case CONNECTOR_FAILURE_HANDLER_VALUE_IGNORE:
			return new IgnoringFailureHandler();
		case CONNECTOR_FAILURE_HANDLER_VALUE_RETRY:
			return new RetryRejectedExecutionFailureHandler();
		case CONNECTOR_FAILURE_HANDLER_VALUE_CUSTOM:
			final Class<? extends ActionRequestFailureHandler> clazz = descriptorProperties
				.getClass(CONNECTOR_FAILURE_HANDLER_CLASS, ActionRequestFailureHandler.class);
			return InstantiationUtil.instantiate(clazz);
		default:
			throw new IllegalArgumentException("Unknown failure handler.");
	}
}
 
Example 4
Source File: AvroRowFormatFactory.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Override
public DeserializationSchema<Row> createDeserializationSchema(Map<String, String> properties) {
	final DescriptorProperties descriptorProperties = getValidatedProperties(properties);

	// create and configure
	if (descriptorProperties.containsKey(AvroValidator.FORMAT_RECORD_CLASS)) {
		return new AvroRowDeserializationSchema(
			descriptorProperties.getClass(AvroValidator.FORMAT_RECORD_CLASS, SpecificRecord.class));
	} else {
		return new AvroRowDeserializationSchema(descriptorProperties.getString(AvroValidator.FORMAT_AVRO_SCHEMA));
	}
}
 
Example 5
Source File: AvroRowFormatFactory.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Override
public SerializationSchema<Row> createSerializationSchema(Map<String, String> properties) {
	final DescriptorProperties descriptorProperties = getValidatedProperties(properties);

	// create and configure
	if (descriptorProperties.containsKey(AvroValidator.FORMAT_RECORD_CLASS)) {
		return new AvroRowSerializationSchema(
			descriptorProperties.getClass(AvroValidator.FORMAT_RECORD_CLASS, SpecificRecord.class));
	} else {
		return new AvroRowSerializationSchema(descriptorProperties.getString(AvroValidator.FORMAT_AVRO_SCHEMA));
	}
}
 
Example 6
Source File: AvroRowFormatFactory.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public DeserializationSchema<Row> createDeserializationSchema(Map<String, String> properties) {
	final DescriptorProperties descriptorProperties = getValidatedProperties(properties);

	// create and configure
	if (descriptorProperties.containsKey(AvroValidator.FORMAT_RECORD_CLASS)) {
		return new AvroRowDeserializationSchema(
			descriptorProperties.getClass(AvroValidator.FORMAT_RECORD_CLASS, SpecificRecord.class));
	} else {
		return new AvroRowDeserializationSchema(descriptorProperties.getString(AvroValidator.FORMAT_AVRO_SCHEMA));
	}
}
 
Example 7
Source File: AvroRowFormatFactory.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public SerializationSchema<Row> createSerializationSchema(Map<String, String> properties) {
	final DescriptorProperties descriptorProperties = getValidatedProperties(properties);

	// create and configure
	if (descriptorProperties.containsKey(AvroValidator.FORMAT_RECORD_CLASS)) {
		return new AvroRowSerializationSchema(
			descriptorProperties.getClass(AvroValidator.FORMAT_RECORD_CLASS, SpecificRecord.class));
	} else {
		return new AvroRowSerializationSchema(descriptorProperties.getString(AvroValidator.FORMAT_AVRO_SCHEMA));
	}
}
 
Example 8
Source File: AvroRowFormatFactory.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public DeserializationSchema<Row> createDeserializationSchema(Map<String, String> properties) {
	final DescriptorProperties descriptorProperties = getValidatedProperties(properties);

	// create and configure
	if (descriptorProperties.containsKey(AvroValidator.FORMAT_RECORD_CLASS)) {
		return new AvroRowDeserializationSchema(
			descriptorProperties.getClass(AvroValidator.FORMAT_RECORD_CLASS, SpecificRecord.class));
	} else {
		return new AvroRowDeserializationSchema(descriptorProperties.getString(AvroValidator.FORMAT_AVRO_SCHEMA));
	}
}
 
Example 9
Source File: AvroRowFormatFactory.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public SerializationSchema<Row> createSerializationSchema(Map<String, String> properties) {
	final DescriptorProperties descriptorProperties = getValidatedProperties(properties);

	// create and configure
	if (descriptorProperties.containsKey(AvroValidator.FORMAT_RECORD_CLASS)) {
		return new AvroRowSerializationSchema(
			descriptorProperties.getClass(AvroValidator.FORMAT_RECORD_CLASS, SpecificRecord.class));
	} else {
		return new AvroRowSerializationSchema(descriptorProperties.getString(AvroValidator.FORMAT_AVRO_SCHEMA));
	}
}