NIFI-11222 Added deprecation log for MongoDB URI Processor property

This closes #7212

Signed-off-by: David Handermann <exceptionfactory@apache.org>
This commit is contained in:
Mike Thomsen 2023-04-30 08:38:22 -04:00 committed by exceptionfactory
parent 42a5daa136
commit e22b6a93c7
No known key found for this signature in database
GPG Key ID: 29B6A52D2AAE8DBA
2 changed files with 7 additions and 0 deletions

View File

@ -44,6 +44,7 @@ import org.apache.nifi.components.AllowableValue;
import org.apache.nifi.components.PropertyDescriptor;
import org.apache.nifi.components.ValidationContext;
import org.apache.nifi.components.ValidationResult;
import org.apache.nifi.deprecation.log.DeprecationLoggerFactory;
import org.apache.nifi.expression.ExpressionLanguageScope;
import org.apache.nifi.flowfile.FlowFile;
import org.apache.nifi.mongodb.MongoDBClientService;
@ -373,6 +374,11 @@ public abstract class AbstractMongoProcessor extends AbstractProcessor {
boolean clientIsSet = context.getProperty(CLIENT_SERVICE).isSet();
boolean uriIsSet = context.getProperty(URI).isSet();
if (uriIsSet) {
DeprecationLoggerFactory.getLogger(getClass()).warn("The MongoDB URI and other client " +
"connection properties should be replaced with an implementation of the MongoClientService");
}
if (clientIsSet && uriIsSet) {
String msg = "The client service and URI fields cannot be set at the same time.";
retVal.add(new ValidationResult.Builder().valid(false).explanation(msg).build());

View File

@ -159,6 +159,7 @@ public class PutMongo extends AbstractMongoProcessor {
@Override
protected Collection<ValidationResult> customValidate(final ValidationContext validationContext) {
List<ValidationResult> problems = new ArrayList<>();
problems.addAll(super.customValidate(validationContext));
if (validationContext.getProperty(MODE).getValue().equals(MODE_INSERT)) {
return problems;