Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id E6C99200B8A for ; Sat, 24 Sep 2016 08:26:03 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id DAC10160AD1; Sat, 24 Sep 2016 06:26:03 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id C3D7C160ABE for ; Sat, 24 Sep 2016 08:26:02 +0200 (CEST) Received: (qmail 98800 invoked by uid 500); 24 Sep 2016 06:26:01 -0000 Mailing-List: contact users-help@nifi.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@nifi.apache.org Delivered-To: mailing list users@nifi.apache.org Received: (qmail 98790 invoked by uid 99); 24 Sep 2016 06:26:01 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 24 Sep 2016 06:26:01 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 60BB8C0F5E for ; Sat, 24 Sep 2016 06:26:01 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.899 X-Spam-Level: * X-Spam-Status: No, score=1.899 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=2, MIME_QP_LONG_LINE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd1-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id Z72ydMJmN6ji for ; Sat, 24 Sep 2016 06:25:58 +0000 (UTC) Received: from mail-pf0-f181.google.com (mail-pf0-f181.google.com [209.85.192.181]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTPS id 30C1E5F341 for ; Sat, 24 Sep 2016 06:25:57 +0000 (UTC) Received: by mail-pf0-f181.google.com with SMTP id 21so48687041pfy.0 for ; Fri, 23 Sep 2016 23:25:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:content-transfer-encoding:mime-version:date:subject:message-id :references:in-reply-to:to; bh=wcBagN8UIrO7WHePkgBOnhUc4GFHWmWy964hVL7aiEQ=; b=eVdN/NHS4uJbcf1aW/QLbn8j92jSK3hRa5GiGQeOBGhkGVDqUktfBBOwCeLqb12Doo kPeUY1zo9j4VDWUIt69I0nh6qR4ZlK5gj55pQsdG9CIwUblovVCd7eGIcvTGENkLyx6g wtevYqrFlsijfAvZ7/gmadYVGPXGtj7TSRHLaXPDg3i6UgY2Rwts0pJDph6Wj1MqvbcG fkCdPoPIrU0PioZHPWEqTbqc71MKT6CJTK5cjgH20ssDnX03d5yTAyzHac0FTFpw1b3v VOelBeqHfD+elr9a1wIuwqrEH0YEVLPvgGnY5tHLlD4Yjvonk8RHi9bsPTCMHcXg3M9g tIug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:content-transfer-encoding:mime-version:date :subject:message-id:references:in-reply-to:to; bh=wcBagN8UIrO7WHePkgBOnhUc4GFHWmWy964hVL7aiEQ=; b=hXyQ156wpWUCEGTU+CWIT1x61njHWxB38Ameu0Eqvk2gtkcqWIh/E93UHgR39Xe7sz ZVcOwYwxw2kwGv3oUVQIQ8jaNGXVw5eYnGME4je+aUMqUdR2AzMgb1myyTHJUEj9C5IC DkvaIcAg2BNnyk1865yF29wjnHpArs+z9McMuSNcUXxVfkbatSzZWBtB2RXzy9uBYrA8 JaZ9GOxjadYChwhba2f4rWnuFkDtzSVZBy40ULgfpZzDsOmMxdk1+CI1RJiTqDfzJlhc qMrX7CCzMhikHHnSaesBAqogaH0+TQ5UCVET0X/xCePbXPi6XsLCn3YtxdvRhU+9aZal 3QZQ== X-Gm-Message-State: AE9vXwNvhnuUBgfuKkaoM1cDvWK6hMLLho4vTd325jji8oCFLrlDEMwF3EEFrG1z0/s9YQ== X-Received: by 10.98.15.210 with SMTP id 79mr19150927pfp.183.1474698350088; Fri, 23 Sep 2016 23:25:50 -0700 (PDT) Received: from [10.137.227.238] (fa.c7.0bc6.ip4.static.sl-reverse.com. [198.11.199.250]) by smtp.gmail.com with ESMTPSA id a137sm15557535pfa.72.2016.09.23.23.25.48 for (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 23 Sep 2016 23:25:49 -0700 (PDT) From: Andy LoPresto Content-Type: multipart/alternative; boundary=Apple-Mail-8C8C5C0B-0F2D-49E4-AFD4-423A2B90AC07 Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (1.0) Date: Fri, 23 Sep 2016 23:25:48 -0700 Subject: Re: read in values from nifi.properties in a Groovy ExecuteScript processor Message-Id: <41F300A6-71FE-4693-A686-7421EFBE0980@gmail.com> References: <7AB58D8A-5A72-45D9-BA72-82C500286ECE@apache.org> In-Reply-To: To: users@nifi.apache.org X-Mailer: iPhone Mail (14A403) archived-at: Sat, 24 Sep 2016 06:26:04 -0000 --Apple-Mail-8C8C5C0B-0F2D-49E4-AFD4-423A2B90AC07 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Tom, If you are only concerned with the values in the currently-running NiFi inst= ance, you shouldn't need to directly interact with the file system. Just use= NiFIPropertiesLoader#get(). Use the static loaders if you want to get an in= stance from a specific (non-default) file location.=20 Andy LoPresto alopresto@apache.org alopresto.apache@gmail.com PGP Fingerprint: 70EC B3E5 98A6 5A3F D3C4 BACE 3C6E F65B 2F7D EF69 > On Sep 23, 2016, at 23:09, Tom Gullo wrote: >=20 > Andy, I wasn't sure if I would need to read the file in myself but it look= s like I do. Those unit tests help a lot. Thanks >=20 > -Tom >=20 >> On Fri, Sep 23, 2016 at 10:47 PM, Andy LoPresto wr= ote: >> Meant to add that there are Groovy unit tests for those classes so you ma= y be able to copy the code directly from [1] and [2].=20 >>=20 >> [1] https://github.com/apache/nifi/blob/master/nifi-nar-bundles/nifi-fram= ework-bundle/nifi-framework/nifi-properties-loader/src/test/groovy/org/apach= e/nifi/properties/ProtectedNiFiPropertiesGroovyTest.groovy >> [2] https://github.com/apache/nifi/blob/master/nifi-nar-bundles/nifi-fram= ework-bundle/nifi-framework/nifi-properties-loader/src/test/groovy/org/apach= e/nifi/properties/NiFiPropertiesLoaderGroovyTest.groovy >>=20 >> Andy LoPresto >> alopresto@apache.org >> alopresto.apache@gmail.com >> PGP Fingerprint: 70EC B3E5 98A6 5A3F D3C4 BACE 3C6E F65B 2F7D EF69 >>=20 >>> On Sep 23, 2016, at 7:45 PM, Andy LoPresto wrote:= >>>=20 >>> Tom, >>>=20 >>> You=E2=80=99ll want to take a look at ProtectedNiFiProperties [1] and Ni= FiPropertiesLoader [2]. ProtectedNiFiProperties provides a decorator on a no= rmal NiFiProperties class which allows access to various values via key acce= ss or through named getters. It =E2=80=9Cunprotects=E2=80=9D the values and c= an return a regular NiFiProperties instance with direct access to the plain v= alues. The NiFiPropertiesLoader can be instantiated with the decryption key (= currently the only supported protection scheme is AES/GCM encryption) and ca= n load multiple instances of the NiFiProperties directly from any nifi.prope= rties file simultaneously.=20 >>>=20 >>> If you wanted to do this with a non-native file (i.e. a source that NiFi= does not have an internal mechanism for reading), you=E2=80=99d probably us= e a GetFile -> ExtractText -> EncryptContent processor chain, or the Execute= Script processor (Groovy and other scripting languages have extensive toolin= g provided to easily read from files, parse text, etc.).=20 >>>=20 >>> [1] https://github.com/apache/nifi/blob/master/nifi-nar-bundles/nifi-fra= mework-bundle/nifi-framework/nifi-properties-loader/src/main/java/org/apache= /nifi/properties/ProtectedNiFiProperties.java >>> [2] https://github.com/apache/nifi/blob/master/nifi-nar-bundles/nifi-fra= mework-bundle/nifi-framework/nifi-properties-loader/src/main/java/org/apache= /nifi/properties/NiFiPropertiesLoader.java >>>=20 >>> =20 >>> Andy LoPresto >>> alopresto@apache.org >>> alopresto.apache@gmail.com >>> PGP Fingerprint: 70EC B3E5 98A6 5A3F D3C4 BACE 3C6E F65B 2F7D EF69 >>>=20 >>>> On Sep 23, 2016, at 3:28 PM, Tom Gullo wrote: >>>>=20 >>>> I'm using v1.0. I want to access some values that are in the nifi.prop= erties file. And I would like to just use the nifi.properties file because I= 'll be encrypting some of these values and I want to use the built in encryp= tion feature. >>>>=20 >>>> Thanks >>>>=20 >>>>> On Fri, Sep 23, 2016 at 6:05 PM, Andrew Grande wr= ote: >>>>> Which NiFi version? With 1.0 there are some bits for variable registry= available, basically one can reference values from external config files vi= a regular EL expressions. >>>>>=20 >>>>> Andrew >>>>>=20 >>>>>=20 >>>>>> On Fri, Sep 23, 2016, 6:00 PM Tom Gullo wrote: >>>>>> I want to read in values from nifi.properties in a Groovy ExecuteScri= pt processor. What's the best way to do that? >>>>>>=20 >>>>>> Thanks >>>>>> -Tom >>>>=20 >>>=20 >>=20 >=20 --Apple-Mail-8C8C5C0B-0F2D-49E4-AFD4-423A2B90AC07 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable
Tom= ,

If you are only concerned with the values in the currently-runnin= g NiFi instance, you shouldn't need to directly interact with the file syste= m. Just use NiFIPropertiesLoader#get(). Use the static loaders if you want t= o get an instance from a specific (non-default) file location. 
Andy LoPresto
alopresto@apache.org
alopresto.apache@gmai= l.com
PGP Fingerprint: 70EC B3E5 98A6 5A3F= D3C4  BACE 3C6E F65B 2F7D EF69


On Sep= 23, 2016, at 23:09, Tom Gullo <tom= gullo@gmail.com> wrote:

<= div dir=3D"ltr">Andy, I wasn't sure if I would need to read the file in myse= lf but it looks like I do.  Those unit tests help a lot. Thanks
-Tom

On Fri, Sep 23, 2016 at 10:47 PM, Andy LoPresto = <alopresto@apac= he.org> wrote:
Meant to add that there are Groovy unit tests for thos= e classes so you may be able to copy the code directly from [1] and [2].&nbs= p;


Andy LoPresto
PGP Fingerprint: 70EC B3E5 98A6 5A3F D3C4 &= nbsp;BACE 3C6E F65B 2F7D EF69

On Sep= 23, 2016, at 7:45 PM, Andy LoPresto <alopresto@apache.org> wrote:

Tom,

You=E2=80=99ll want= to take a look at ProtectedNiFiProperties [1] and NiFiPropertiesLoader [2].= ProtectedNiFiProperties provides a decorator on a normal NiFiProperties cla= ss which allows access to various values via key access or through named get= ters. It =E2=80=9Cunprotects=E2=80=9D the values and can return a regular Ni= FiProperties instance with direct access to the plain values. The NiFiProper= tiesLoader can be instantiated with the decryption key (currently the only s= upported protection scheme is AES/GCM encryption) and can load multiple inst= ances of the NiFiProperties directly from any nifi.properties file simultane= ously. 

If you wanted to do this with a non-na= tive file (i.e. a source that NiFi does not have an internal mechanism for r= eading), you=E2=80=99d probably use a GetFile -> ExtractText -> Encryp= tContent processor chain, or the ExecuteScript processor (Groovy and other s= cripting languages have extensive tooling provided to easily read from files= , parse text, etc.). 


 
Andy L= oPresto
PGP Fingerprint: 70EC B3E5 98A6 5A3F D3C4 &nb= sp;BACE 3C6E F65B 2F7D EF69

On Sep 23, 2016, at 3:28 PM, Tom Gul= lo <tomgullo@gmai= l.com> wrote:

I'm using v1.0.  I w= ant to access some values that are in the nifi.properties file.  And I w= ould like to just use the nifi.properties file because I'll be encrypting so= me of these values and I want to use the built in encryption feature.
Thanks

On Fri, Sep 23, 2016 at 6:05 PM, Andrew Grande <aperepel@gmail= .com> wrote:

W= hich NiFi version? With 1.0 there are some bits for variable registry availa= ble, basically one can reference values from external config files via regul= ar EL expressions.

Andrew


On Fri, Sep 23, 2016, 6:00 P= M Tom Gullo <tomg= ullo@gmail.com> wrote:
I want to read in values from nifi.properties in a Groovy ExecuteS= cript processor.  What's the best way to do that?

Th= anks
-Tom



=

= --Apple-Mail-8C8C5C0B-0F2D-49E4-AFD4-423A2B90AC07--