Github user mcgilman commented on a diff in the pull request:
https://github.com/apache/nifi/pull/2750#discussion_r195449260
--- Diff:
nifi-nar-bundles/nifi-couchbase-bundle/nifi-couchbase-processors/src/main/java/org/apache/nifi/processors/couchbase/AbstractCouchbaseProcessor.java
---
@@ -39,54 +38,32 @@
import com.couchbase.client.core.CouchbaseException;
import com.couchbase.client.java.Bucket;
+import static
org.apache.nifi.couchbase.CouchbaseConfigurationProperties.BUCKET_NAME;
+import static
org.apache.nifi.couchbase.CouchbaseConfigurationProperties.COUCHBASE_CLUSTER_SERVICE;
+
/**
- * Provides common functionalities for Couchbase processors.
+ * Provides common functionality for Couchbase processors.
*/
public abstract class AbstractCouchbaseProcessor extends AbstractProcessor
{
- public static final PropertyDescriptor DOCUMENT_TYPE = new
PropertyDescriptor.Builder().name("Document Type")
- .description("The type of contents.")
- .required(true)
- .allowableValues(DocumentType.values())
- .defaultValue(DocumentType.Json.toString())
- .build();
-
- public static final PropertyDescriptor DOC_ID = new
PropertyDescriptor.Builder().name("Document Id")
+ public static final PropertyDescriptor DOC_ID = new
PropertyDescriptor.Builder()
+ .name("document-id")
+ .displayName("Document Id")
.description("A static, fixed Couchbase document id, or an
expression to construct the Couchbase document id.")
.expressionLanguageSupported(ExpressionLanguageScope.FLOWFILE_ATTRIBUTES)
.addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
.build();
- public static final Relationship REL_SUCCESS = new
Relationship.Builder()
- .name("success")
- .description("All FlowFiles that are written to Couchbase Server
are routed to this relationship.")
- .build();
- public static final Relationship REL_ORIGINAL = new
Relationship.Builder()
- .name("original")
- .description("The original input file will be routed to this
destination when it has been successfully processed.")
- .build();
- public static final Relationship REL_RETRY = new Relationship.Builder()
- .name("retry")
- .description("All FlowFiles that cannot written to Couchbase
Server but can be retried are routed to this relationship.")
- .build();
- public static final Relationship REL_FAILURE = new
Relationship.Builder()
- .name("failure")
- .description("All FlowFiles that cannot written to Couchbase
Server and can't be retried are routed to this relationship.")
- .build();
-
- public static final PropertyDescriptor COUCHBASE_CLUSTER_SERVICE = new
PropertyDescriptor.Builder().name("Couchbase Cluster Controller Service")
- .description("A Couchbase Cluster Controller Service which manages
connections to a Couchbase cluster.")
- .required(true)
-
.identifiesControllerService(CouchbaseClusterControllerService.class)
- .build();
+ public static final Relationship.Builder RELB_SUCCESS = new
Relationship.Builder().name("success");
+ public static final Relationship.Builder RELB_ORIGINAL = new
Relationship.Builder().name("original");
+ public static final Relationship.Builder RELB_RETRY = new
Relationship.Builder().name("retry");
+ public static final Relationship.Builder RELB_FAILURE = new
Relationship.Builder().name("failure");
- public static final PropertyDescriptor BUCKET_NAME = new
PropertyDescriptor.Builder().name("Bucket Name")
- .description("The name of bucket to access.")
- .required(true)
- .addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
- .defaultValue("default")
- .build();
+ public static final Relationship REL_ORIGINAL = RELB_ORIGINAL.build();
+ public static final Relationship REL_SUCCESS = RELB_SUCCESS.build();
+ public static final Relationship REL_RETRY = RELB_RETRY.build();
+ public static final Relationship REL_FAILURE = RELB_FAILURE.build();
--- End diff --
While the issue does not surface due to the way `getRelationships` is
invoked, as `static` fields I believe these `Relationship` and
`Relationship.Builder` variables are shared across any implementations of an
`AbstractCouchbaseProcessor`. Because they are shared, when one implementation
set's a description it would be reflected in any other implementation. With an
approach like this, it probably makes sense to have these be not `static`.
---