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); }
@Override public void validate(DescriptorProperties properties) { super.validate(properties); properties.validateBoolean(FORMAT_DERIVE_SCHEMA, true); final boolean deriveSchema = properties.getOptionalBoolean(FORMAT_DERIVE_SCHEMA).orElse(false); final boolean hasSchema = properties.containsKey(FORMAT_SCHEMA); final boolean hasSchemaString = properties.containsKey(FORMAT_JSON_SCHEMA); if (deriveSchema && (hasSchema || hasSchemaString)) { throw new ValidationException( "Format cannot define a schema and derive from the table's schema at the same time."); } else if (!deriveSchema && hasSchema && hasSchemaString) { throw new ValidationException("A definition of both a schema and JSON schema is not allowed."); } else if (!deriveSchema && !hasSchema && !hasSchemaString) { throw new ValidationException("A definition of a schema or JSON schema is required."); } else if (hasSchema) { properties.validateType(FORMAT_SCHEMA, false, true); } else if (hasSchemaString) { properties.validateString(FORMAT_JSON_SCHEMA, false, 1); } properties.validateBoolean(FORMAT_FAIL_ON_MISSING_FIELD, true); } }
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); }
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); }
@Override public void validate(DescriptorProperties properties) { super.validate(properties); properties.validateBoolean(FORMAT_DERIVE_SCHEMA, true); final boolean deriveSchema = properties.getOptionalBoolean(FORMAT_DERIVE_SCHEMA).orElse(false); final boolean hasSchema = properties.containsKey(FORMAT_SCHEMA); final boolean hasSchemaString = properties.containsKey(FORMAT_JSON_SCHEMA); if (deriveSchema && (hasSchema || hasSchemaString)) { throw new ValidationException( "Format cannot define a schema and derive from the table's schema at the same time."); } else if (!deriveSchema && hasSchema && hasSchemaString) { throw new ValidationException("A definition of both a schema and JSON schema is not allowed."); } else if (!deriveSchema && !hasSchema && !hasSchemaString) { throw new ValidationException("A definition of a schema or JSON schema is required."); } else if (hasSchema) { properties.validateType(FORMAT_SCHEMA, false, true); } else if (hasSchemaString) { properties.validateString(FORMAT_JSON_SCHEMA, false, 1); } properties.validateBoolean(FORMAT_FAIL_ON_MISSING_FIELD, true); } }
@Override public void validate(DescriptorProperties properties) { super.validate(properties); properties.validateBoolean(FORMAT_DERIVE_SCHEMA, true); final boolean deriveSchema = properties.getOptionalBoolean(FORMAT_DERIVE_SCHEMA).orElse(false); final boolean hasSchema = properties.containsKey(FORMAT_SCHEMA); final boolean hasSchemaString = properties.containsKey(FORMAT_JSON_SCHEMA); if (deriveSchema && (hasSchema || hasSchemaString)) { throw new ValidationException( "Format cannot define a schema and derive from the table's schema at the same time."); } else if (!deriveSchema && hasSchema && hasSchemaString) { throw new ValidationException("A definition of both a schema and JSON schema is not allowed."); } else if (!deriveSchema && !hasSchema && !hasSchemaString) { throw new ValidationException("A definition of a schema or JSON schema is required."); } else if (hasSchema) { properties.validateType(FORMAT_SCHEMA, false, true); } else if (hasSchemaString) { properties.validateString(FORMAT_JSON_SCHEMA, false, 1); } properties.validateBoolean(FORMAT_FAIL_ON_MISSING_FIELD, true); } }