/** * Validates an integer property. */ public void validateInt(String key, boolean isOptional) { validateInt(key, isOptional, Integer.MIN_VALUE, Integer.MAX_VALUE); }
/** * Validates an integer property. The boundaries are inclusive. */ public void validateInt(String key, boolean isOptional, int min) { validateInt(key, isOptional, min, Integer.MAX_VALUE); }
private void validateConnectionProperties(DescriptorProperties properties) { properties.validateInt(CONNECTOR_CONNECTION_MAX_RETRY_TIMEOUT, true, 1); properties.validateString(CONNECTOR_CONNECTION_PATH_PREFIX, true); } }
@Override public void validate(DescriptorProperties properties) { properties.validateString(CONNECTOR_TYPE, false, 1); properties.validateInt(CONNECTOR_PROPERTY_VERSION, true, 0); } }
private void validateHosts(DescriptorProperties properties) { final Map<String, Consumer<String>> hostsValidators = new HashMap<>(); hostsValidators.put(CONNECTOR_HOSTS_HOSTNAME, (key) -> properties.validateString(key, false, 1)); hostsValidators.put(CONNECTOR_HOSTS_PORT, (key) -> properties.validateInt(key, false, 0, 65535)); hostsValidators.put(CONNECTOR_HOSTS_PROTOCOL, (key) -> properties.validateString(key, false, 1)); properties.validateFixedIndexedProperties(CONNECTOR_HOSTS, false, hostsValidators); }
@Override protected void validate(DescriptorProperties properties) { properties.validateLong(DEPLOYMENT_RESPONSE_TIMEOUT, true, 0); properties.validateString(DEPLOYMENT_GATEWAY_ADDRESS, true, 0); properties.validateInt(DEPLOYMENT_GATEWAY_PORT, true, 0, 65535); }
private void validateBulkFlush(DescriptorProperties properties) { properties.validateBoolean(CONNECTOR_FLUSH_ON_CHECKPOINT, true); properties.validateInt(CONNECTOR_BULK_FLUSH_MAX_ACTIONS, true, 1); properties.validateMemorySize(CONNECTOR_BULK_FLUSH_MAX_SIZE, true, 1024 * 1024); // only allow MB precision properties.validateLong(CONNECTOR_BULK_FLUSH_INTERVAL, true, 0); properties.validateEnumValues(CONNECTOR_BULK_FLUSH_BACKOFF_TYPE, true, Arrays.asList( CONNECTOR_BULK_FLUSH_BACKOFF_TYPE_VALUE_DISABLED, CONNECTOR_BULK_FLUSH_BACKOFF_TYPE_VALUE_CONSTANT, CONNECTOR_BULK_FLUSH_BACKOFF_TYPE_VALUE_EXPONENTIAL)); properties.validateInt(CONNECTOR_BULK_FLUSH_BACKOFF_MAX_RETRIES, true, 1); properties.validateLong(CONNECTOR_BULK_FLUSH_BACKOFF_DELAY, true, 0); }
properties.validateLong(EXECUTION_MIN_STATE_RETENTION, true, 0); properties.validateLong(EXECUTION_MAX_STATE_RETENTION, true, 0); properties.validateInt(EXECUTION_PARALLELISM, true, 1); properties.validateInt(EXECUTION_MAX_PARALLELISM, true, 1); properties.validateInt(EXECUTION_MAX_TABLE_RESULT_ROWS, true, 1); properties.validateEnumValues( EXECUTION_RESTART_STRATEGY_TYPE, EXECUTION_RESTART_STRATEGY_TYPE_VALUE_FIXED_DELAY, EXECUTION_RESTART_STRATEGY_TYPE_VALUE_FAILURE_RATE)); properties.validateInt(EXECUTION_RESTART_STRATEGY_ATTEMPTS, true, 1); properties.validateLong(EXECUTION_RESTART_STRATEGY_DELAY, true, 0); properties.validateLong(EXECUTION_RESTART_STRATEGY_FAILURE_RATE_INTERVAL, true, 1); properties.validateInt(EXECUTION_RESTART_STRATEGY_MAX_FAILURES_PER_INTERVAL, true, 1);
private void validateStartupMode(DescriptorProperties properties) { final Map<String, Consumer<String>> specificOffsetValidators = new HashMap<>(); specificOffsetValidators.put( CONNECTOR_SPECIFIC_OFFSETS_PARTITION, (key) -> properties.validateInt( key, false, 0, Integer.MAX_VALUE)); specificOffsetValidators.put( CONNECTOR_SPECIFIC_OFFSETS_OFFSET, (key) -> properties.validateLong( key, false, 0, Long.MAX_VALUE)); final Map<String, Consumer<String>> startupModeValidation = new HashMap<>(); startupModeValidation.put(CONNECTOR_STARTUP_MODE_VALUE_GROUP_OFFSETS, noValidation()); startupModeValidation.put(CONNECTOR_STARTUP_MODE_VALUE_EARLIEST, noValidation()); startupModeValidation.put(CONNECTOR_STARTUP_MODE_VALUE_LATEST, noValidation()); startupModeValidation.put( CONNECTOR_STARTUP_MODE_VALUE_SPECIFIC_OFFSETS, key -> properties.validateFixedIndexedProperties(CONNECTOR_SPECIFIC_OFFSETS, false, specificOffsetValidators)); properties.validateEnum(CONNECTOR_STARTUP_MODE, true, startupModeValidation); }
/** * Validates an integer property. The boundaries are inclusive. */ public void validateInt(String key, boolean isOptional, int min) { validateInt(key, isOptional, min, Integer.MAX_VALUE); }
/** * Validates an integer property. The boundaries are inclusive. */ public void validateInt(String key, boolean isOptional, int min) { validateInt(key, isOptional, min, Integer.MAX_VALUE); }
/** * Validates an integer property. */ public void validateInt(String key, boolean isOptional) { validateInt(key, isOptional, Integer.MIN_VALUE, Integer.MAX_VALUE); }
/** * Validates an integer property. */ public void validateInt(String key, boolean isOptional) { validateInt(key, isOptional, Integer.MIN_VALUE, Integer.MAX_VALUE); }
private void validateConnectionProperties(DescriptorProperties properties) { properties.validateInt(CONNECTOR_CONNECTION_MAX_RETRY_TIMEOUT, true, 1); properties.validateString(CONNECTOR_CONNECTION_PATH_PREFIX, true); } }
@Override public void validate(DescriptorProperties properties) { properties.validateString(CONNECTOR_TYPE, false, 1); properties.validateInt(CONNECTOR_PROPERTY_VERSION, true, 0); } }
@Override public void validate(DescriptorProperties properties) { properties.validateString(CONNECTOR_TYPE, false, 1); properties.validateInt(CONNECTOR_PROPERTY_VERSION, true, 0); } }
@Override public void validate(DescriptorProperties properties) { super.validate(properties); properties.validateValue(CONNECTOR_TYPE, CONNECTOR_TYPE_VALUE_TAXI_RIDES, false); properties.validateString(CONNECTOR_PATH, false); properties.validateInt(CONNECTOR_MAX_EVENT_DELAY_SECS, true, 0); properties.validateInt(CONNECTOR_SERVING_SPEED_FACTOR, true, 1); } }
@Override public void validate(DescriptorProperties properties) { super.validate(properties); properties.validateValue(CONNECTOR_TYPE, CONNECTOR_TYPE_VALUE_TAXI_FARES, false); properties.validateString(CONNECTOR_PATH, false); properties.validateInt(CONNECTOR_MAX_EVENT_DELAY_SECS, true, 0); properties.validateInt(CONNECTOR_SERVING_SPEED_FACTOR, true, 1); } }
private void validateHosts(DescriptorProperties properties) { final Map<String, Consumer<String>> hostsValidators = new HashMap<>(); hostsValidators.put(CONNECTOR_HOSTS_HOSTNAME, (key) -> properties.validateString(key, false, 1)); hostsValidators.put(CONNECTOR_HOSTS_PORT, (key) -> properties.validateInt(key, false, 0, 65535)); hostsValidators.put(CONNECTOR_HOSTS_PROTOCOL, (key) -> properties.validateString(key, false, 1)); properties.validateFixedIndexedProperties(CONNECTOR_HOSTS, false, hostsValidators); }
private void validateHosts(DescriptorProperties properties) { final Map<String, Consumer<String>> hostsValidators = new HashMap<>(); hostsValidators.put( CONNECTOR_HOSTS_HOSTNAME, (key) -> properties.validateString(key, false, 1)); hostsValidators.put( CONNECTOR_HOSTS_PORT, (key) -> properties.validateInt(key, false, 0, 65535)); hostsValidators.put(CONNECTOR_HOSTS_PROTOCOL, (key) -> properties.validateString(key, false, 1)); properties.validateFixedIndexedProperties(CONNECTOR_HOSTS, false, hostsValidators); }