Incorporated SRV format in connection string#1
Incorporated SRV format in connection string#1Krish-cloudsufi wants to merge 14 commits intodevelopfrom
Conversation
pom.xml
Outdated
| <cdapArtifacts> | ||
| <parent>system:cdap-data-pipeline[6.8.0-SNAPSHOT,7.0.0-SNAPSHOT)</parent> | ||
| <parent>system:cdap-data-streams[6.8.0-SNAPSHOT,7.0.0-SNAPSHOT)</parent> | ||
| <parent>system:cdap-data-pipeline[6.11.0-SNAPSHOT,7.0.0-SNAPSHOT)</parent> |
pom.xml
Outdated
| <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
| <!-- version properties --> | ||
| <cdap.version>6.8.0-SNAPSHOT</cdap.version> | ||
| <cdap.version>6.11.0-SNAPSHOT</cdap.version> |
| @Name(MongoDBConstants.USE_SRV) | ||
| @Description("Enable SRV format for connection string") | ||
| @Nullable | ||
| private Boolean useSRV; |
There was a problem hiding this comment.
make it primitive at all places
| if (!containsMacro(MongoDBConstants.HOST) && Strings.isNullOrEmpty(host)) { | ||
| throw new InvalidConfigPropertyException("Host must be specified", MongoDBConstants.HOST); | ||
| } | ||
| if (!containsMacro(MongoDBConstants.PORT)) { |
There was a problem hiding this comment.
keep this condition as when useSRV is not macro and not true, this validation is required
| private String password; | ||
|
|
||
| @Name(MongoDBConstants.USE_SRV) | ||
| @Description("Enable SRV format for connection string") |
There was a problem hiding this comment.
use Connect Using SRV String as field and label name in widget and also add the same in md doc file
There was a problem hiding this comment.
Add same description that you have added in md file
| @Name(MongoDBConstants.USE_SRV) | ||
| @Description("Enable SRV format for connection string") | ||
| @Nullable | ||
| private boolean useSRV; |
There was a problem hiding this comment.
Shall I make it as connectUsingSRV ?
There was a problem hiding this comment.
this name should be same as given in widget.json
| return password; | ||
| } | ||
|
|
||
| public boolean isUseSRV() { |
There was a problem hiding this comment.
adding 'is' as a prefix doesnt make much sense, keep it just connectUsingSRVString
|
|
||
| return connectionStringBuilder.toString(); | ||
|
|
||
|
|
| public static final String PASSWORD = "password"; | ||
|
|
||
| /** | ||
| * |
| public MongoDBSinkConfig(String referenceName, String host, int port, String database, String collection, | ||
| String user, String password, String connectionArguments, String idField) { | ||
| super(referenceName, host, port, database, collection, user, password, connectionArguments); | ||
| String user, String password, Boolean useSRV, String connectionArguments, String idField) { |
There was a problem hiding this comment.
make boolean primitive at all places
|
|
||
| **Password:** Password to use to connect to the specified database. | ||
|
|
||
| **Connect Using SRV String:** Toggle to determine whether to use an SRV connection string for MongoDB. It can be |
| /** | ||
| * Configuration property name used to specify whether to use an SRV Connection string for MongoDB. | ||
| */ | ||
| public static final String USE_SRV = "connectUsingSRVString"; |
There was a problem hiding this comment.
rename this also to CONNECT_USING_SRV_STRING
| @Description("Toggle to determine whether to use an SRV connection string for MongoDB. It can be " + | ||
| "enabled if the MongoDB deployment supports SRV DNS records for connection resolution.") | ||
| @Nullable | ||
| private boolean connectUsingSRVString; |
There was a problem hiding this comment.
I see this condition below to check this plugin property whether it contains macro or not, but the plugin property is not annotated with @macro annotation.
| protected String collection; | ||
| protected String user; | ||
| protected String password; | ||
| protected Boolean connectUsingSRVString; |
There was a problem hiding this comment.
change to boolean ? as the main config file uses the primitive type for the same variable.
Boolean can cause NPE, if the variable is not set.
|
LGTM. |
Incorporated SRV format in connection string and introduced a toggle property in MongoDB plugin UI.