Repository: nifi
Updated Branches:
  refs/heads/master 72de1cbde -> 361a58c53


NIFI-3851 Support EL in AWS Endpoint Override URL

Add expression language support to AWS Endpoint Override URL property

Signed-off-by: James Wing <[email protected]>

This closes #1769.


Project: http://git-wip-us.apache.org/repos/asf/nifi/repo
Commit: http://git-wip-us.apache.org/repos/asf/nifi/commit/361a58c5
Tree: http://git-wip-us.apache.org/repos/asf/nifi/tree/361a58c5
Diff: http://git-wip-us.apache.org/repos/asf/nifi/diff/361a58c5

Branch: refs/heads/master
Commit: 361a58c531c59bd638dcc8f55d2991cbaf4b087e
Parents: 72de1cb
Author: Tim Reardon <[email protected]>
Authored: Tue May 9 12:05:46 2017 -0400
Committer: James Wing <[email protected]>
Committed: Wed May 10 10:37:39 2017 -0700

----------------------------------------------------------------------
 .../apache/nifi/processors/aws/AbstractAWSProcessor.java  | 10 ++++++----
 .../nifi/processors/aws/s3/AbstractS3Processor.java       |  2 +-
 2 files changed, 7 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/nifi/blob/361a58c5/nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/AbstractAWSProcessor.java
----------------------------------------------------------------------
diff --git 
a/nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/AbstractAWSProcessor.java
 
b/nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/AbstractAWSProcessor.java
index d34447d..8a0d984 100644
--- 
a/nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/AbstractAWSProcessor.java
+++ 
b/nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/AbstractAWSProcessor.java
@@ -117,6 +117,7 @@ public abstract class AbstractAWSProcessor<ClientType 
extends AmazonWebServiceCl
             .description("Endpoint URL to use instead of the AWS default 
including scheme, host, port, and path. " +
                     "The AWS libraries select an endpoint URL based on the AWS 
region, but this property overrides " +
                     "the selected endpoint URL, allowing use with other 
S3-compatible endpoints.")
+            .expressionLanguageSupported(true)
             .required(false)
             .addValidator(StandardValidators.URL_VALIDATOR)
             .build();
@@ -220,11 +221,12 @@ public abstract class AbstractAWSProcessor<ClientType 
extends AmazonWebServiceCl
 
         // if the endpoint override has been configured, set the endpoint.
         // (per Amazon docs this should only be configured at client creation)
-        final String urlstr = 
StringUtils.trimToEmpty(context.getProperty(ENDPOINT_OVERRIDE).getValue());
-        if (!urlstr.isEmpty()) {
-            this.client.setEndpoint(urlstr);
+        if (getSupportedPropertyDescriptors().contains(ENDPOINT_OVERRIDE)) {
+            final String urlstr = 
StringUtils.trimToEmpty(context.getProperty(ENDPOINT_OVERRIDE).evaluateAttributeExpressions().getValue());
+            if (!urlstr.isEmpty()) {
+                this.client.setEndpoint(urlstr);
+            }
         }
-
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/nifi/blob/361a58c5/nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/s3/AbstractS3Processor.java
----------------------------------------------------------------------
diff --git 
a/nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/s3/AbstractS3Processor.java
 
b/nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/s3/AbstractS3Processor.java
index b96c05e..d372532 100644
--- 
a/nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/s3/AbstractS3Processor.java
+++ 
b/nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/s3/AbstractS3Processor.java
@@ -143,7 +143,7 @@ public abstract class AbstractS3Processor extends 
AbstractAWSCredentialsProvider
 
     private void initalizeEndpointOverride(final ProcessContext context, final 
AmazonS3Client s3) {
         // if ENDPOINT_OVERRIDE is set, use PathStyleAccess
-        
if(StringUtils.trimToEmpty(context.getProperty(ENDPOINT_OVERRIDE).getValue()).isEmpty()
 == false){
+        
if(StringUtils.trimToEmpty(context.getProperty(ENDPOINT_OVERRIDE).evaluateAttributeExpressions().getValue()).isEmpty()
 == false){
             final S3ClientOptions s3Options = new S3ClientOptions();
             s3Options.setPathStyleAccess(true);
             s3.setS3ClientOptions(s3Options);

Reply via email to