mirror of https://github.com/apache/nifi.git
NIFI-12452 Improved support for DescribedValue in Descriptors
- Removed calls to Builder.defaultValue(null) in several Components This closes #8102 Signed-off-by: David Handermann <exceptionfactory@apache.org>
This commit is contained in:
parent
5b664147ee
commit
c272574dcc
|
@ -313,6 +313,24 @@ public final class PropertyDescriptor implements Comparable<PropertyDescriptor>
|
|||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies the initial value and the default value that will be used
|
||||
* if the user does not specify a value. When {@link #build()} is
|
||||
* called, if Allowable Values have been set (see
|
||||
* {@link #allowableValues(AllowableValue...)})
|
||||
* and the "Value" of the {@link DescribedValue} object is not
|
||||
* the "Value" of one of those Allowable Values, an Exception will be thrown.
|
||||
* If the Allowable Values have been set using the
|
||||
* {@link #allowableValues(AllowableValue...)} method, the default value
|
||||
* should be set providing the {@link AllowableValue} to this method.
|
||||
*
|
||||
* @param value default value holder
|
||||
* @return the builder
|
||||
*/
|
||||
public Builder defaultValue(final DescribedValue value) {
|
||||
return defaultValue(value != null ? value.getValue() : null);
|
||||
}
|
||||
|
||||
public Builder dynamic(final boolean dynamic) {
|
||||
this.dynamic = dynamic;
|
||||
return this;
|
||||
|
|
|
@ -134,6 +134,18 @@ public interface PropertyValue {
|
|||
*/
|
||||
ResourceReferences asResources();
|
||||
|
||||
/**
|
||||
* @param <E> the generic type of the enum used as allowable values
|
||||
* @param enumType the class of the enum used as allowable values
|
||||
* @return the DescribedValue enum entry whose value is the raw value of the
|
||||
* <code>this</code>, or <code>null</code> if the value is not set.
|
||||
* Throws an IllegalArgumentException if none of the enum entries correspond to the specified raw value.
|
||||
*
|
||||
* @throws IllegalArgumentException if the value of <code>this</code>
|
||||
* does not point to any of the entries of the specified enum type.
|
||||
*/
|
||||
<E extends Enum<E> & DescribedValue> E asDescribedValue(Class<E> enumType) throws IllegalArgumentException;
|
||||
|
||||
/**
|
||||
* @return <code>true</code> if the user has configured a value, or if the
|
||||
* {@link PropertyDescriptor} for the associated property has a default
|
||||
|
|
|
@ -69,6 +69,17 @@ public class TestPropertyDescriptor {
|
|||
assertNotNull(validDescriptorBuilder.build());
|
||||
}
|
||||
|
||||
@Test
|
||||
void testDefaultValueWithDescribedValue() {
|
||||
final PropertyDescriptor propertyDescriptor = new PropertyDescriptor.Builder()
|
||||
.name("defaultDescribedValueDescriptor")
|
||||
.defaultValue(EnumAllowableValue.GREEN)
|
||||
.build();
|
||||
|
||||
assertNotNull(propertyDescriptor);
|
||||
assertEquals(EnumAllowableValue.GREEN.getValue(), propertyDescriptor.getDefaultValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
void testAllowableValuesWithEnumClass() {
|
||||
final PropertyDescriptor propertyDescriptor = new PropertyDescriptor.Builder()
|
||||
|
|
|
@ -19,6 +19,8 @@ package org.apache.nifi.attribute.expression.language;
|
|||
import java.time.Duration;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.apache.nifi.components.DescribedValue;
|
||||
import org.apache.nifi.components.PropertyDescriptor;
|
||||
import org.apache.nifi.components.PropertyValue;
|
||||
import org.apache.nifi.components.resource.ResourceContext;
|
||||
|
@ -234,6 +236,21 @@ public class StandardPropertyValue implements PropertyValue {
|
|||
return resourceContext.getResourceReferenceFactory().createResourceReferences(rawValue, propertyDescriptor.getResourceDefinition());
|
||||
}
|
||||
|
||||
@Override
|
||||
public <E extends Enum<E> & DescribedValue> E asDescribedValue(Class<E> enumType) throws IllegalArgumentException {
|
||||
if (rawValue == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
for (E enumConstant : enumType.getEnumConstants()) {
|
||||
if (enumConstant.getValue().equals(rawValue)) {
|
||||
return enumConstant;
|
||||
}
|
||||
}
|
||||
|
||||
throw new IllegalArgumentException(String.format("%s does not have an entry with value %s", enumType.getSimpleName(), rawValue));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSet() {
|
||||
return rawValue != null;
|
||||
|
|
|
@ -25,6 +25,7 @@ import org.apache.nifi.annotation.behavior.InputRequirement;
|
|||
import org.apache.nifi.attribute.expression.language.Query;
|
||||
import org.apache.nifi.attribute.expression.language.Query.Range;
|
||||
import org.apache.nifi.attribute.expression.language.StandardPropertyValue;
|
||||
import org.apache.nifi.components.DescribedValue;
|
||||
import org.apache.nifi.components.PropertyDescriptor;
|
||||
import org.apache.nifi.components.PropertyValue;
|
||||
import org.apache.nifi.components.resource.ResourceContext;
|
||||
|
@ -322,6 +323,11 @@ public class MockPropertyValue implements PropertyValue {
|
|||
return new StandardResourceReferenceFactory().createResourceReferences(rawValue, propertyDescriptor.getResourceDefinition());
|
||||
}
|
||||
|
||||
@Override
|
||||
public <E extends Enum<E> & DescribedValue> E asDescribedValue(Class<E> enumType) throws IllegalArgumentException {
|
||||
ensureExpressionsEvaluated();
|
||||
return stdPropValue.asDescribedValue(enumType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSet() {
|
||||
|
|
|
@ -27,6 +27,7 @@ import org.apache.nifi.annotation.lifecycle.OnShutdown;
|
|||
import org.apache.nifi.annotation.lifecycle.OnStopped;
|
||||
import org.apache.nifi.annotation.lifecycle.OnUnscheduled;
|
||||
import org.apache.nifi.components.AllowableValue;
|
||||
import org.apache.nifi.components.DescribedValue;
|
||||
import org.apache.nifi.components.PropertyDescriptor;
|
||||
import org.apache.nifi.components.ValidationContext;
|
||||
import org.apache.nifi.components.ValidationResult;
|
||||
|
@ -579,7 +580,7 @@ public class StandardProcessorTestRunner implements TestRunner {
|
|||
}
|
||||
|
||||
@Override
|
||||
public ValidationResult setProperty(final PropertyDescriptor descriptor, final AllowableValue value) {
|
||||
public ValidationResult setProperty(final PropertyDescriptor descriptor, final DescribedValue value) {
|
||||
return context.setProperty(descriptor, value.getValue());
|
||||
}
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
package org.apache.nifi.util;
|
||||
|
||||
import org.apache.nifi.components.AllowableValue;
|
||||
import org.apache.nifi.components.DescribedValue;
|
||||
import org.apache.nifi.components.PropertyDescriptor;
|
||||
import org.apache.nifi.components.ValidationResult;
|
||||
import org.apache.nifi.controller.ControllerService;
|
||||
|
@ -247,7 +248,7 @@ public interface TestRunner {
|
|||
* @param value allowable valu
|
||||
* @return result
|
||||
*/
|
||||
ValidationResult setProperty(PropertyDescriptor descriptor, AllowableValue value);
|
||||
ValidationResult setProperty(PropertyDescriptor descriptor, DescribedValue value);
|
||||
|
||||
/**
|
||||
* Sets the annotation data.
|
||||
|
|
|
@ -99,7 +99,6 @@ public class PutAzureEventHub extends AbstractProcessor implements AzureEventHub
|
|||
.required(false)
|
||||
.expressionLanguageSupported(ExpressionLanguageScope.NONE)
|
||||
.addValidator(StandardValidators.ATTRIBUTE_KEY_VALIDATOR)
|
||||
.defaultValue(null)
|
||||
.build();
|
||||
static final PropertyDescriptor MAX_BATCH_SIZE = new PropertyDescriptor.Builder()
|
||||
.name("max-batch-size")
|
||||
|
|
|
@ -256,7 +256,6 @@ public class CaptureChangeMySQL extends AbstractSessionFactoryProcessor {
|
|||
.displayName("MySQL Driver Location(s)")
|
||||
.description("Comma-separated list of files/folders and/or URLs containing the MySQL driver JAR and its dependencies (if any). "
|
||||
+ "For example '/var/tmp/mysql-connector-java-5.1.38-bin.jar'")
|
||||
.defaultValue(null)
|
||||
.required(false)
|
||||
.identifiesExternalResource(ResourceCardinality.MULTIPLE, ResourceType.FILE, ResourceType.DIRECTORY, ResourceType.URL)
|
||||
.expressionLanguageSupported(ExpressionLanguageScope.ENVIRONMENT)
|
||||
|
|
|
@ -38,7 +38,6 @@ public final class DBCPProperties {
|
|||
.name("Database Connection URL")
|
||||
.description("A database connection URL used to connect to a database. May contain database system name, host, port, database name and some parameters."
|
||||
+ " The exact syntax of a database connection URL is specified by your DBMS.")
|
||||
.defaultValue(null)
|
||||
.addValidator(new ConnectionUrlValidator())
|
||||
.required(true)
|
||||
.expressionLanguageSupported(ExpressionLanguageScope.ENVIRONMENT)
|
||||
|
@ -47,7 +46,6 @@ public final class DBCPProperties {
|
|||
public static final PropertyDescriptor DB_USER = new PropertyDescriptor.Builder()
|
||||
.name("Database User")
|
||||
.description("Database user name")
|
||||
.defaultValue(null)
|
||||
.addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
|
||||
.expressionLanguageSupported(ExpressionLanguageScope.ENVIRONMENT)
|
||||
.build();
|
||||
|
@ -55,7 +53,6 @@ public final class DBCPProperties {
|
|||
public static final PropertyDescriptor DB_PASSWORD = new PropertyDescriptor.Builder()
|
||||
.name("Password")
|
||||
.description("The password for the database user")
|
||||
.defaultValue(null)
|
||||
.required(false)
|
||||
.sensitive(true)
|
||||
.addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
|
||||
|
@ -66,7 +63,6 @@ public final class DBCPProperties {
|
|||
public static final PropertyDescriptor DB_DRIVERNAME = new PropertyDescriptor.Builder()
|
||||
.name("Database Driver Class Name")
|
||||
.description("Database driver class name")
|
||||
.defaultValue(null)
|
||||
.required(true)
|
||||
.addValidator(new DriverClassValidator())
|
||||
.expressionLanguageSupported(ExpressionLanguageScope.ENVIRONMENT)
|
||||
|
@ -76,7 +72,6 @@ public final class DBCPProperties {
|
|||
.name("database-driver-locations")
|
||||
.displayName("Database Driver Location(s)")
|
||||
.description("Comma-separated list of files/folders and/or URLs containing the driver JAR and its dependencies (if any). For example '/var/tmp/mariadb-java-client-1.1.7.jar'")
|
||||
.defaultValue(null)
|
||||
.required(false)
|
||||
.identifiesExternalResource(ResourceCardinality.MULTIPLE, ResourceType.FILE, ResourceType.DIRECTORY, ResourceType.URL)
|
||||
.expressionLanguageSupported(ExpressionLanguageScope.ENVIRONMENT)
|
||||
|
|
|
@ -40,11 +40,11 @@ import java.util.List;
|
|||
@SystemResourceConsideration(resource = SystemResource.MEMORY, description = "")
|
||||
public class FullyDocumentedControllerService extends AbstractControllerService implements SampleService {
|
||||
|
||||
public static final PropertyDescriptor KEYSTORE = new PropertyDescriptor.Builder().name("Keystore Filename").description("The fully-qualified filename of the Keystore").defaultValue(null)
|
||||
public static final PropertyDescriptor KEYSTORE = new PropertyDescriptor.Builder().name("Keystore Filename").description("The fully-qualified filename of the Keystore")
|
||||
.addValidator(StandardValidators.FILE_EXISTS_VALIDATOR).sensitive(false).build();
|
||||
public static final PropertyDescriptor KEYSTORE_TYPE = new PropertyDescriptor.Builder().name("Keystore Type").description("The Type of the Keystore").allowableValues("JKS", "PKCS12")
|
||||
.addValidator(StandardValidators.NON_EMPTY_VALIDATOR).defaultValue("JKS").sensitive(false).build();
|
||||
public static final PropertyDescriptor KEYSTORE_PASSWORD = new PropertyDescriptor.Builder().name("Keystore Password").defaultValue(null).description("The password for the Keystore")
|
||||
public static final PropertyDescriptor KEYSTORE_PASSWORD = new PropertyDescriptor.Builder().name("Keystore Password").description("The password for the Keystore")
|
||||
.addValidator(StandardValidators.NON_EMPTY_VALIDATOR).sensitive(true).build();
|
||||
|
||||
private static final List<PropertyDescriptor> properties;
|
||||
|
|
|
@ -24,6 +24,8 @@ import java.util.HashSet;
|
|||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.apache.nifi.components.DescribedValue;
|
||||
import org.apache.nifi.components.PropertyDescriptor;
|
||||
import org.apache.nifi.components.PropertyValue;
|
||||
import org.apache.nifi.components.resource.ResourceReference;
|
||||
|
@ -151,6 +153,11 @@ public class ConnectableProcessContext implements ProcessContext {
|
|||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <E extends Enum<E> & DescribedValue> E asDescribedValue(Class<E> enumType) throws IllegalArgumentException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSet() {
|
||||
return false;
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
*/
|
||||
package org.apache.nifi.processor;
|
||||
|
||||
import org.apache.nifi.components.DescribedValue;
|
||||
import org.apache.nifi.parameter.ParameterLookup;
|
||||
import org.apache.nifi.attribute.expression.language.StandardPropertyValue;
|
||||
import org.apache.nifi.components.PropertyValue;
|
||||
|
@ -32,6 +33,7 @@ import java.util.Set;
|
|||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
|
||||
|
||||
|
@ -108,6 +110,23 @@ public class TestStandardPropertyValue {
|
|||
assertThrows(NumberFormatException.class, substituted::asInteger);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetValueAsDescribedValue() {
|
||||
for (ExamplePropertyEnum enumValue : ExamplePropertyEnum.values()) {
|
||||
final PropertyValue value = new StandardPropertyValue(enumValue.getValue(), lookup, ParameterLookup.EMPTY);
|
||||
assertEquals(enumValue, value.asDescribedValue(ExamplePropertyEnum.class));
|
||||
}
|
||||
|
||||
final PropertyValue nullValue = new StandardPropertyValue(null, lookup, ParameterLookup.EMPTY);
|
||||
assertNull(nullValue.asDescribedValue(ExamplePropertyEnum.class));
|
||||
|
||||
IllegalArgumentException exception = assertThrows(IllegalArgumentException.class, () -> {
|
||||
final PropertyValue invalidValue = new StandardPropertyValue("FOO", lookup, ParameterLookup.EMPTY);
|
||||
invalidValue.asDescribedValue(ExamplePropertyEnum.class);
|
||||
});
|
||||
assertEquals("ExamplePropertyEnum does not have an entry with value FOO", exception.getMessage());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFileSize() {
|
||||
final PropertyValue value = new StandardPropertyValue("${fileSize}", lookup, ParameterLookup.EMPTY);
|
||||
|
@ -177,4 +196,35 @@ public class TestStandardPropertyValue {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
private enum ExamplePropertyEnum implements DescribedValue {
|
||||
ONE("One Value", "One Display", "One Description"),
|
||||
OTHER("Other Value", "Other Display", "Other Description"),
|
||||
ANOTHER("Another Value", "Another Display", "Another Description");
|
||||
|
||||
private final String value;
|
||||
private final String displayName;
|
||||
private final String description;
|
||||
|
||||
ExamplePropertyEnum(final String value, final String displayName, final String description) {
|
||||
this.value = value;
|
||||
this.displayName = displayName;
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getValue() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDisplayName() {
|
||||
return this.displayName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return this.description;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -189,7 +189,6 @@ public class TinkerpopClientService extends AbstractControllerService implements
|
|||
"classes specified in the YAML file. Additionally, any custom classes required for the groovy script to " +
|
||||
"work in the bytecode submission setting should also be contained in these JAR files.")
|
||||
.dependsOn(CONNECTION_SETTINGS, YAML_SETTINGS)
|
||||
.defaultValue(null)
|
||||
.identifiesExternalResource(ResourceCardinality.MULTIPLE, ResourceType.FILE, ResourceType.DIRECTORY, ResourceType.URL)
|
||||
.expressionLanguageSupported(ExpressionLanguageScope.ENVIRONMENT)
|
||||
.dynamicallyModifiesClasspath(true)
|
||||
|
|
|
@ -106,7 +106,6 @@ public class Hive3ConnectionPool extends AbstractControllerService implements Hi
|
|||
.description("A database connection URL used to connect to a database. May contain database system name, host, port, database name and some parameters."
|
||||
+ " The exact syntax of a database connection URL is specified by the Hive documentation. For example, the server principal is often included "
|
||||
+ "as a connection parameter when connecting to a secure Hive server.")
|
||||
.defaultValue(null)
|
||||
.addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
|
||||
.required(true)
|
||||
.expressionLanguageSupported(ExpressionLanguageScope.ENVIRONMENT)
|
||||
|
@ -127,7 +126,6 @@ public class Hive3ConnectionPool extends AbstractControllerService implements Hi
|
|||
.name("hive-db-user")
|
||||
.displayName("Database User")
|
||||
.description("Database user name")
|
||||
.defaultValue(null)
|
||||
.addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
|
||||
.expressionLanguageSupported(ExpressionLanguageScope.ENVIRONMENT)
|
||||
.build();
|
||||
|
@ -136,7 +134,6 @@ public class Hive3ConnectionPool extends AbstractControllerService implements Hi
|
|||
.name("hive-db-password")
|
||||
.displayName("Password")
|
||||
.description("The password for the database user")
|
||||
.defaultValue(null)
|
||||
.required(false)
|
||||
.sensitive(true)
|
||||
.addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
|
||||
|
|
|
@ -375,7 +375,6 @@ public abstract class AbstractKuduProcessor extends AbstractProcessor {
|
|||
|
||||
alterTable.addColumn(new ColumnSchema.ColumnSchemaBuilder(columnName, toKuduType(nifiType))
|
||||
.nullable(true)
|
||||
.defaultValue(null)
|
||||
.typeAttributes(getKuduTypeAttributes(nifiType))
|
||||
.build());
|
||||
|
||||
|
|
|
@ -107,7 +107,6 @@ public class GetSNMP extends AbstractSNMPProcessor {
|
|||
"the outgoing flowfile.")
|
||||
.required(false)
|
||||
.addValidator(StandardValidators.NON_BLANK_VALIDATOR)
|
||||
.defaultValue(null)
|
||||
.build();
|
||||
|
||||
public static final Relationship REL_SUCCESS = new Relationship.Builder()
|
||||
|
|
|
@ -153,7 +153,6 @@ public class LivySessionController extends AbstractControllerService implements
|
|||
.required(false)
|
||||
.identifiesExternalResource(ResourceCardinality.MULTIPLE, ResourceType.FILE)
|
||||
.expressionLanguageSupported(ExpressionLanguageScope.ENVIRONMENT)
|
||||
.defaultValue(null)
|
||||
.build();
|
||||
|
||||
public static final PropertyDescriptor SSL_CONTEXT_SERVICE = new PropertyDescriptor.Builder()
|
||||
|
|
|
@ -197,7 +197,7 @@ public class ListenHTTP extends AbstractSessionFactoryProcessor {
|
|||
.description("HTTP Protocols supported for Application Layer Protocol Negotiation with TLS")
|
||||
.required(true)
|
||||
.allowableValues(HttpProtocolStrategy.class)
|
||||
.defaultValue(HttpProtocolStrategy.HTTP_1_1.getValue())
|
||||
.defaultValue(HttpProtocolStrategy.HTTP_1_1)
|
||||
.dependsOn(SSL_CONTEXT_SERVICE)
|
||||
.build();
|
||||
public static final PropertyDescriptor HEADERS_AS_ATTRIBUTES_REGEX = new PropertyDescriptor.Builder()
|
||||
|
@ -414,7 +414,7 @@ public class ListenHTTP extends AbstractSessionFactoryProcessor {
|
|||
|
||||
// get the configured port
|
||||
final int port = context.getProperty(PORT).evaluateAttributeExpressions().asInteger();
|
||||
final HttpProtocolStrategy httpProtocolStrategy = HttpProtocolStrategy.valueOf(context.getProperty(HTTP_PROTOCOL_STRATEGY).getValue());
|
||||
final HttpProtocolStrategy httpProtocolStrategy = context.getProperty(HTTP_PROTOCOL_STRATEGY).asDescribedValue(HttpProtocolStrategy.class);
|
||||
final ServerConnector connector = createServerConnector(server,
|
||||
port,
|
||||
sslContextService,
|
||||
|
|
|
@ -325,7 +325,6 @@ public class MergeContent extends BinFiles {
|
|||
.required(false)
|
||||
.expressionLanguageSupported(ExpressionLanguageScope.FLOWFILE_ATTRIBUTES)
|
||||
.addValidator(StandardValidators.ATTRIBUTE_KEY_VALIDATOR)
|
||||
.defaultValue(null)
|
||||
.dependsOn(MERGE_STRATEGY, MERGE_STRATEGY_BIN_PACK)
|
||||
.build();
|
||||
|
||||
|
|
|
@ -220,7 +220,6 @@ public class MergeRecord extends AbstractSessionFactoryProcessor {
|
|||
.required(false)
|
||||
.expressionLanguageSupported(ExpressionLanguageScope.NONE)
|
||||
.addValidator(StandardValidators.ATTRIBUTE_KEY_VALIDATOR)
|
||||
.defaultValue(null)
|
||||
.build();
|
||||
public static final PropertyDescriptor MIN_SIZE = new PropertyDescriptor.Builder()
|
||||
.name("min-bin-size")
|
||||
|
|
|
@ -96,7 +96,6 @@ public class ScanAttribute extends AbstractProcessor {
|
|||
+ "the dictionary will be used and each term will consist of the text of the entire line in the file")
|
||||
.required(false)
|
||||
.addValidator(StandardValidators.createRegexValidator(0, 1, false))
|
||||
.defaultValue(null)
|
||||
.build();
|
||||
|
||||
private List<PropertyDescriptor> properties;
|
||||
|
|
|
@ -201,7 +201,6 @@ public class ValidateRecord extends AbstractProcessor {
|
|||
.required(false)
|
||||
.expressionLanguageSupported(ExpressionLanguageScope.FLOWFILE_ATTRIBUTES)
|
||||
.addValidator(StandardValidators.ATTRIBUTE_KEY_VALIDATOR)
|
||||
.defaultValue(null)
|
||||
.build();
|
||||
static final PropertyDescriptor MAX_VALIDATION_DETAILS_LENGTH = new PropertyDescriptor.Builder()
|
||||
.name("maximum-validation-details-length")
|
||||
|
|
|
@ -236,7 +236,7 @@ public class TestListenHTTP {
|
|||
configureProcessorSslContextService(ListenHTTP.ClientAuthentication.AUTO, serverNoTruststoreConfiguration);
|
||||
|
||||
runner.setProperty(ListenHTTP.BASE_PATH, HTTP_BASE_PATH);
|
||||
runner.setProperty(ListenHTTP.HTTP_PROTOCOL_STRATEGY, HttpProtocolStrategy.H2_HTTP_1_1.getValue());
|
||||
runner.setProperty(ListenHTTP.HTTP_PROTOCOL_STRATEGY, HttpProtocolStrategy.H2_HTTP_1_1);
|
||||
runner.assertValid();
|
||||
|
||||
testPOSTRequestsReceived(HttpServletResponse.SC_OK, true, false);
|
||||
|
@ -248,7 +248,7 @@ public class TestListenHTTP {
|
|||
|
||||
runner.setProperty(ListenHTTP.BASE_PATH, HTTP_BASE_PATH);
|
||||
runner.setProperty(ListenHTTP.RETURN_CODE, Integer.toString(HttpServletResponse.SC_NO_CONTENT));
|
||||
runner.setProperty(ListenHTTP.HTTP_PROTOCOL_STRATEGY, HttpProtocolStrategy.H2.getValue());
|
||||
runner.setProperty(ListenHTTP.HTTP_PROTOCOL_STRATEGY, HttpProtocolStrategy.H2);
|
||||
runner.assertValid();
|
||||
|
||||
testPOSTRequestsReceived(HttpServletResponse.SC_NO_CONTENT, true, false);
|
||||
|
|
|
@ -134,7 +134,6 @@ public class MonitorMemory extends AbstractReportingTask {
|
|||
.description("Indicates how often this reporting task should report bulletins while the memory utilization exceeds the configured threshold")
|
||||
.required(false)
|
||||
.addValidator(StandardValidators.TIME_PERIOD_VALIDATOR)
|
||||
.defaultValue(null)
|
||||
.build();
|
||||
|
||||
public static final Pattern PERCENTAGE_PATTERN = Pattern.compile("\\d{1,2}%");
|
||||
|
|
|
@ -42,7 +42,6 @@ public class DisallowComponentType extends AbstractFlowAnalysisRule {
|
|||
" Either the simple or the fully qualified name of the type should be provided.")
|
||||
.required(true)
|
||||
.addValidator(StandardValidators.NON_BLANK_VALIDATOR)
|
||||
.defaultValue(null)
|
||||
.build();
|
||||
|
||||
private final static List<PropertyDescriptor> propertyDescriptors;
|
||||
|
|
|
@ -86,7 +86,6 @@ public class HikariCPConnectionPool extends AbstractControllerService implements
|
|||
.displayName("Database Connection URL")
|
||||
.description("A database connection URL used to connect to a database. May contain database system name, host, port, database name and some parameters."
|
||||
+ " The exact syntax of a database connection URL is specified by your DBMS.")
|
||||
.defaultValue(null)
|
||||
.addValidator(new ConnectionUrlValidator())
|
||||
.required(true)
|
||||
.expressionLanguageSupported(ExpressionLanguageScope.ENVIRONMENT)
|
||||
|
@ -96,7 +95,6 @@ public class HikariCPConnectionPool extends AbstractControllerService implements
|
|||
.name("hikaricp-driver-classname")
|
||||
.displayName("Database Driver Class Name")
|
||||
.description("The fully-qualified class name of the JDBC driver. Example: com.mysql.jdbc.Driver")
|
||||
.defaultValue(null)
|
||||
.required(true)
|
||||
.addValidator(new DriverClassValidator())
|
||||
.expressionLanguageSupported(ExpressionLanguageScope.ENVIRONMENT)
|
||||
|
@ -106,7 +104,6 @@ public class HikariCPConnectionPool extends AbstractControllerService implements
|
|||
.name("hikaricp-driver-locations")
|
||||
.displayName("Database Driver Location(s)")
|
||||
.description("Comma-separated list of files/folders and/or URLs containing the driver JAR and its dependencies (if any). For example '/var/tmp/mariadb-java-client-1.1.7.jar'")
|
||||
.defaultValue(null)
|
||||
.required(false)
|
||||
.identifiesExternalResource(ResourceCardinality.MULTIPLE, ResourceType.FILE, ResourceType.DIRECTORY, ResourceType.URL)
|
||||
.expressionLanguageSupported(ExpressionLanguageScope.ENVIRONMENT)
|
||||
|
@ -117,7 +114,6 @@ public class HikariCPConnectionPool extends AbstractControllerService implements
|
|||
.name("hikaricp-username")
|
||||
.displayName("Database User")
|
||||
.description("Database user name")
|
||||
.defaultValue(null)
|
||||
.addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
|
||||
.expressionLanguageSupported(ExpressionLanguageScope.ENVIRONMENT)
|
||||
.build();
|
||||
|
@ -126,7 +122,6 @@ public class HikariCPConnectionPool extends AbstractControllerService implements
|
|||
.name("hikaricp-password")
|
||||
.displayName("Password")
|
||||
.description("The password for the database user")
|
||||
.defaultValue(null)
|
||||
.required(false)
|
||||
.sensitive(true)
|
||||
.addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
|
||||
|
|
|
@ -104,7 +104,6 @@ public class HadoopDBCPConnectionPool extends AbstractControllerService implemen
|
|||
.name("Database Connection URL")
|
||||
.description("A database connection URL used to connect to a database. May contain database system name, host, port, database name and some parameters."
|
||||
+ " The exact syntax of a database connection URL is specified by your DBMS.")
|
||||
.defaultValue(null)
|
||||
.addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
|
||||
.required(true)
|
||||
.expressionLanguageSupported(ExpressionLanguageScope.ENVIRONMENT)
|
||||
|
@ -113,7 +112,6 @@ public class HadoopDBCPConnectionPool extends AbstractControllerService implemen
|
|||
public static final PropertyDescriptor DB_DRIVERNAME = new PropertyDescriptor.Builder()
|
||||
.name("Database Driver Class Name")
|
||||
.description("Database driver class name")
|
||||
.defaultValue(null)
|
||||
.required(true)
|
||||
.addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
|
||||
.expressionLanguageSupported(ExpressionLanguageScope.ENVIRONMENT)
|
||||
|
@ -125,7 +123,6 @@ public class HadoopDBCPConnectionPool extends AbstractControllerService implemen
|
|||
.description("Comma-separated list of files/folders and/or URLs containing the driver JAR and its dependencies (if any). " +
|
||||
"For example '/var/tmp/phoenix-client.jar'. NOTE: It is required that the resources specified by this property provide " +
|
||||
"the classes from hadoop-common, such as Configuration and UserGroupInformation.")
|
||||
.defaultValue(null)
|
||||
.required(true)
|
||||
.identifiesExternalResource(ResourceCardinality.MULTIPLE, ResourceType.FILE, ResourceType.DIRECTORY, ResourceType.URL)
|
||||
.expressionLanguageSupported(ExpressionLanguageScope.ENVIRONMENT)
|
||||
|
@ -147,7 +144,6 @@ public class HadoopDBCPConnectionPool extends AbstractControllerService implemen
|
|||
public static final PropertyDescriptor DB_USER = new PropertyDescriptor.Builder()
|
||||
.name("Database User")
|
||||
.description("The user for the database")
|
||||
.defaultValue(null)
|
||||
.addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
|
||||
.expressionLanguageSupported(ExpressionLanguageScope.ENVIRONMENT)
|
||||
.build();
|
||||
|
@ -155,7 +151,6 @@ public class HadoopDBCPConnectionPool extends AbstractControllerService implemen
|
|||
public static final PropertyDescriptor DB_PASSWORD = new PropertyDescriptor.Builder()
|
||||
.name("Password")
|
||||
.description("The password for the database user")
|
||||
.defaultValue(null)
|
||||
.required(false)
|
||||
.sensitive(true)
|
||||
.addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
|
||||
|
|
|
@ -94,7 +94,6 @@ public class JsonTreeReader extends SchemaRegistryService implements RecordReade
|
|||
.description("Skips forward to the given nested JSON field (array or object) to begin processing.")
|
||||
.required(false)
|
||||
.addValidator(StandardValidators.NON_BLANK_VALIDATOR)
|
||||
.defaultValue(null)
|
||||
.dependsOn(STARTING_FIELD_STRATEGY, StartingFieldStrategy.NESTED_FIELD.name())
|
||||
.build();
|
||||
|
||||
|
|
|
@ -71,7 +71,6 @@ public class StandardSSLContextService extends AbstractControllerService impleme
|
|||
.name("Truststore Filename")
|
||||
.description("The fully-qualified filename of the Truststore")
|
||||
.expressionLanguageSupported(ExpressionLanguageScope.ENVIRONMENT)
|
||||
.defaultValue(null)
|
||||
.identifiesExternalResource(ResourceCardinality.SINGLE, ResourceType.FILE)
|
||||
.sensitive(false)
|
||||
.build();
|
||||
|
@ -85,7 +84,6 @@ public class StandardSSLContextService extends AbstractControllerService impleme
|
|||
public static final PropertyDescriptor TRUSTSTORE_PASSWORD = new PropertyDescriptor.Builder()
|
||||
.name("Truststore Password")
|
||||
.description("The password for the Truststore")
|
||||
.defaultValue(null)
|
||||
.addValidator(Validator.VALID)
|
||||
.required(false)
|
||||
.sensitive(true)
|
||||
|
@ -94,7 +92,6 @@ public class StandardSSLContextService extends AbstractControllerService impleme
|
|||
.name("Keystore Filename")
|
||||
.description("The fully-qualified filename of the Keystore")
|
||||
.expressionLanguageSupported(ExpressionLanguageScope.ENVIRONMENT)
|
||||
.defaultValue(null)
|
||||
.identifiesExternalResource(ResourceCardinality.SINGLE, ResourceType.FILE)
|
||||
.sensitive(false)
|
||||
.build();
|
||||
|
@ -107,7 +104,6 @@ public class StandardSSLContextService extends AbstractControllerService impleme
|
|||
.build();
|
||||
public static final PropertyDescriptor KEYSTORE_PASSWORD = new PropertyDescriptor.Builder()
|
||||
.name("Keystore Password")
|
||||
.defaultValue(null)
|
||||
.description("The password for the Keystore")
|
||||
.addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
|
||||
.sensitive(true)
|
||||
|
|
Loading…
Reference in New Issue