Re: read in values from nifi.properties in a Groovy ExecuteScript processor
ntly the only supported protection scheme is AES/GCM encryption) and >>> can load multiple instances of the NiFiProperties directly from any >>> nifi.properties file simultaneously. >>> >>> 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’d probably use a >>> GetFile -> ExtractText -> EncryptContent processor chain, or the >>> ExecuteScript processor (Groovy and other scripting languages have >>> extensive tooling provided to easily read from files, parse text, etc.). >>> >>> [1] >>> https://github.com/apache/nifi/blob/master/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-properties-loader/src/main/java/org/apache/nifi/properties/ProtectedNiFiProperties.java >>> >>> <https://github.com/apache/nifi/blob/master/nifi-nar-bundles/nifi-framework-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-framework-bundle/nifi-framework/nifi-properties-loader/src/main/java/org/apache/nifi/properties/NiFiPropertiesLoader.java >>> >>> <https://github.com/apache/nifi/blob/master/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-properties-loader/src/main/java/org/apache/nifi/properties/NiFiPropertiesLoader.java> >>> >>> >>> Andy LoPresto >>> alopre...@apache.org <mailto:alopre...@apache.org> >>> alopresto.apa...@gmail.com <mailto:alopresto.apa...@gmail.com> >>> PGP Fingerprint: 70EC B3E5 98A6 5A3F D3C4 BACE 3C6E F65B 2F7D EF69 >>> >>>> On Sep 23, 2016, at 3:28 PM, Tom Gullo <tomgu...@gmail.com >>>> <mailto:tomgu...@gmail.com>> wrote: >>>> >>>> I'm using v1.0. I want to access some values that are in the >>>> nifi.properties 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 encryption feature. >>>> >>>> Thanks >>>> >>>> On Fri, Sep 23, 2016 at 6:05 PM, Andrew Grande <apere...@gmail.com >>>> <mailto:apere...@gmail.com>> wrote: >>>> Which NiFi version? With 1.0 there are some bits for variable registry >>>> available, basically one can reference values from external config files >>>> via regular EL expressions. >>>> >>>> Andrew >>>> >>>> >>>> On Fri, Sep 23, 2016, 6:00 PM Tom Gullo <tomgu...@gmail.com >>>> <mailto:tomgu...@gmail.com>> wrote: >>>> I want to read in values from nifi.properties in a Groovy ExecuteScript >>>> processor. What's the best way to do that? >>>> >>>> Thanks >>>> -Tom >>>> >>> >> >> > signature.asc Description: Message signed with OpenPGP using GPGMail
Re: read in values from nifi.properties in a Groovy ExecuteScript processor
Andy, That worked thank you. For any one else following I called the get method and then used the standard and protected classes with the nifiproperries loader. On Sep 24, 2016 2:26 AM, "Andy LoPresto" <alopresto.apa...@gmail.com> wrote: > Tom, > > If you are only concerned with the values in the currently-running NiFi > instance, 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 instance from a specific (non-default) file location. > > Andy LoPresto > alopre...@apache.org > alopresto.apa...@gmail.com > PGP Fingerprint: 70EC B3E5 98A6 5A3F D3C4 BACE 3C6E F65B 2F7D EF69 > > On Sep 23, 2016, at 23:09, Tom Gullo <tomgu...@gmail.com> wrote: > > Andy, I wasn't sure if I would need to read the file in myself 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 <alopre...@apache.org> > wrote: > >> Meant to add that there are Groovy unit tests for those classes so you >> may be able to copy the code directly from [1] and [2]. >> >> [1] https://github.com/apache/nifi/blob/master/nifi-nar-bund >> les/nifi-framework-bundle/nifi-framework/nifi-properties- >> loader/src/test/groovy/org/apache/nifi/properties/Protect >> edNiFiPropertiesGroovyTest.groovy >> [2] https://github.com/apache/nifi/blob/master/nifi-nar-bund >> les/nifi-framework-bundle/nifi-framework/nifi-properties- >> loader/src/test/groovy/org/apache/nifi/properties/NiFiPro >> pertiesLoaderGroovyTest.groovy >> >> Andy LoPresto >> alopre...@apache.org >> *alopresto.apa...@gmail.com <alopresto.apa...@gmail.com>* >> PGP Fingerprint: 70EC B3E5 98A6 5A3F D3C4 BACE 3C6E F65B 2F7D EF69 >> >> On Sep 23, 2016, at 7:45 PM, Andy LoPresto <alopre...@apache.org> wrote: >> >> Tom, >> >> You’ll want to take a look at ProtectedNiFiProperties [1] and >> NiFiPropertiesLoader [2]. ProtectedNiFiProperties provides a decorator on a >> normal NiFiProperties class which allows access to various values via key >> access or through named getters. It “unprotects” the values and can return >> a regular NiFiProperties instance with direct access to the plain values. >> The NiFiPropertiesLoader can be instantiated with the decryption key >> (currently the only supported protection scheme is AES/GCM encryption) and >> can load multiple instances of the NiFiProperties directly from any >> nifi.properties file simultaneously. >> >> 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’d probably use a >> GetFile -> ExtractText -> EncryptContent processor chain, or the >> ExecuteScript processor (Groovy and other scripting languages have >> extensive tooling provided to easily read from files, parse text, etc.). >> >> [1] https://github.com/apache/nifi/blob/master/nifi-nar-bund >> les/nifi-framework-bundle/nifi-framework/nifi-properties- >> loader/src/main/java/org/apache/nifi/properties/Protect >> edNiFiProperties.java >> [2] https://github.com/apache/nifi/blob/master/nifi-nar-bund >> les/nifi-framework-bundle/nifi-framework/nifi-properties- >> loader/src/main/java/org/apache/nifi/properties/NiFiPropertiesLoader.java >> >> >> Andy LoPresto >> alopre...@apache.org >> *alopresto.apa...@gmail.com <alopresto.apa...@gmail.com>* >> PGP Fingerprint: 70EC B3E5 98A6 5A3F D3C4 BACE 3C6E F65B 2F7D EF69 >> >> On Sep 23, 2016, at 3:28 PM, Tom Gullo <tomgu...@gmail.com> wrote: >> >> I'm using v1.0. I want to access some values that are in the >> nifi.properties 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 encryption feature. >> >> Thanks >> >> On Fri, Sep 23, 2016 at 6:05 PM, Andrew Grande <apere...@gmail.com> >> wrote: >> >>> Which NiFi version? With 1.0 there are some bits for variable registry >>> available, basically one can reference values from external config files >>> via regular EL expressions. >>> >>> Andrew >>> >>> On Fri, Sep 23, 2016, 6:00 PM Tom Gullo <tomgu...@gmail.com> wrote: >>> >>>> I want to read in values from nifi.properties in a Groovy ExecuteScript >>>> processor. What's the best way to do that? >>>> >>>> Thanks >>>> -Tom >>>> >>> >> >> >> >
Re: read in values from nifi.properties in a Groovy ExecuteScript processor
Tom, If you are only concerned with the values in the currently-running NiFi instance, 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 instance from a specific (non-default) file location. Andy LoPresto alopre...@apache.org alopresto.apa...@gmail.com PGP Fingerprint: 70EC B3E5 98A6 5A3F D3C4 BACE 3C6E F65B 2F7D EF69 > On Sep 23, 2016, at 23:09, Tom Gullo <tomgu...@gmail.com> wrote: > > Andy, I wasn't sure if I would need to read the file in myself 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 <alopre...@apache.org> wrote: >> Meant to add that there are Groovy unit tests for those classes so you may >> be able to copy the code directly from [1] and [2]. >> >> [1] >> https://github.com/apache/nifi/blob/master/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-properties-loader/src/test/groovy/org/apache/nifi/properties/ProtectedNiFiPropertiesGroovyTest.groovy >> [2] >> https://github.com/apache/nifi/blob/master/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-properties-loader/src/test/groovy/org/apache/nifi/properties/NiFiPropertiesLoaderGroovyTest.groovy >> >> Andy LoPresto >> alopre...@apache.org >> alopresto.apa...@gmail.com >> PGP Fingerprint: 70EC B3E5 98A6 5A3F D3C4 BACE 3C6E F65B 2F7D EF69 >> >>> On Sep 23, 2016, at 7:45 PM, Andy LoPresto <alopre...@apache.org> wrote: >>> >>> Tom, >>> >>> You’ll want to take a look at ProtectedNiFiProperties [1] and >>> NiFiPropertiesLoader [2]. ProtectedNiFiProperties provides a decorator on a >>> normal NiFiProperties class which allows access to various values via key >>> access or through named getters. It “unprotects” the values and can return >>> a regular NiFiProperties instance with direct access to the plain values. >>> The NiFiPropertiesLoader can be instantiated with the decryption key >>> (currently the only supported protection scheme is AES/GCM encryption) and >>> can load multiple instances of the NiFiProperties directly from any >>> nifi.properties file simultaneously. >>> >>> 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’d probably use a >>> GetFile -> ExtractText -> EncryptContent processor chain, or the >>> ExecuteScript processor (Groovy and other scripting languages have >>> extensive tooling provided to easily read from files, parse text, etc.). >>> >>> [1] >>> https://github.com/apache/nifi/blob/master/nifi-nar-bundles/nifi-framework-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-framework-bundle/nifi-framework/nifi-properties-loader/src/main/java/org/apache/nifi/properties/NiFiPropertiesLoader.java >>> >>> >>> Andy LoPresto >>> alopre...@apache.org >>> alopresto.apa...@gmail.com >>> PGP Fingerprint: 70EC B3E5 98A6 5A3F D3C4 BACE 3C6E F65B 2F7D EF69 >>> >>>> On Sep 23, 2016, at 3:28 PM, Tom Gullo <tomgu...@gmail.com> wrote: >>>> >>>> I'm using v1.0. I want to access some values that are in the >>>> nifi.properties 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 encryption feature. >>>> >>>> Thanks >>>> >>>>> On Fri, Sep 23, 2016 at 6:05 PM, Andrew Grande <apere...@gmail.com> wrote: >>>>> Which NiFi version? With 1.0 there are some bits for variable registry >>>>> available, basically one can reference values from external config files >>>>> via regular EL expressions. >>>>> >>>>> Andrew >>>>> >>>>> >>>>>> On Fri, Sep 23, 2016, 6:00 PM Tom Gullo <tomgu...@gmail.com> wrote: >>>>>> I want to read in values from nifi.properties in a Groovy ExecuteScript >>>>>> processor. What's the best way to do that? >>>>>> >>>>>> Thanks >>>>>> -Tom >>>> >>> >> >
Re: read in values from nifi.properties in a Groovy ExecuteScript processor
Andy, I wasn't sure if I would need to read the file in myself 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 <alopre...@apache.org> wrote: > Meant to add that there are Groovy unit tests for those classes so you may > be able to copy the code directly from [1] and [2]. > > [1] https://github.com/apache/nifi/blob/master/nifi-nar- > bundles/nifi-framework-bundle/nifi-framework/nifi- > properties-loader/src/test/groovy/org/apache/nifi/properties/ > ProtectedNiFiPropertiesGroovyTest.groovy > [2] https://github.com/apache/nifi/blob/master/nifi-nar- > bundles/nifi-framework-bundle/nifi-framework/nifi- > properties-loader/src/test/groovy/org/apache/nifi/properties/ > NiFiPropertiesLoaderGroovyTest.groovy > > Andy LoPresto > alopre...@apache.org > *alopresto.apa...@gmail.com <alopresto.apa...@gmail.com>* > PGP Fingerprint: 70EC B3E5 98A6 5A3F D3C4 BACE 3C6E F65B 2F7D EF69 > > On Sep 23, 2016, at 7:45 PM, Andy LoPresto <alopre...@apache.org> wrote: > > Tom, > > You’ll want to take a look at ProtectedNiFiProperties [1] and > NiFiPropertiesLoader [2]. ProtectedNiFiProperties provides a decorator on a > normal NiFiProperties class which allows access to various values via key > access or through named getters. It “unprotects” the values and can return > a regular NiFiProperties instance with direct access to the plain values. > The NiFiPropertiesLoader can be instantiated with the decryption key > (currently the only supported protection scheme is AES/GCM encryption) and > can load multiple instances of the NiFiProperties directly from any > nifi.properties file simultaneously. > > 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’d probably use a > GetFile -> ExtractText -> EncryptContent processor chain, or the > ExecuteScript processor (Groovy and other scripting languages have > extensive tooling provided to easily read from files, parse text, etc.). > > [1] https://github.com/apache/nifi/blob/master/nifi-nar- > bundles/nifi-framework-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-framework-bundle/nifi-framework/nifi- > properties-loader/src/main/java/org/apache/nifi/properties/ > NiFiPropertiesLoader.java > > > Andy LoPresto > alopre...@apache.org > *alopresto.apa...@gmail.com <alopresto.apa...@gmail.com>* > PGP Fingerprint: 70EC B3E5 98A6 5A3F D3C4 BACE 3C6E F65B 2F7D EF69 > > On Sep 23, 2016, at 3:28 PM, Tom Gullo <tomgu...@gmail.com> wrote: > > I'm using v1.0. I want to access some values that are in the > nifi.properties 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 encryption feature. > > Thanks > > On Fri, Sep 23, 2016 at 6:05 PM, Andrew Grande <apere...@gmail.com> wrote: > >> Which NiFi version? With 1.0 there are some bits for variable registry >> available, basically one can reference values from external config files >> via regular EL expressions. >> >> Andrew >> >> On Fri, Sep 23, 2016, 6:00 PM Tom Gullo <tomgu...@gmail.com> wrote: >> >>> I want to read in values from nifi.properties in a Groovy ExecuteScript >>> processor. What's the best way to do that? >>> >>> Thanks >>> -Tom >>> >> > > >
Re: read in values from nifi.properties in a Groovy ExecuteScript processor
Meant to add that there are Groovy unit tests for those classes so you may be able to copy the code directly from [1] and [2]. [1] https://github.com/apache/nifi/blob/master/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-properties-loader/src/test/groovy/org/apache/nifi/properties/ProtectedNiFiPropertiesGroovyTest.groovy <https://github.com/apache/nifi/blob/master/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-properties-loader/src/test/groovy/org/apache/nifi/properties/ProtectedNiFiPropertiesGroovyTest.groovy> [2] https://github.com/apache/nifi/blob/master/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-properties-loader/src/test/groovy/org/apache/nifi/properties/NiFiPropertiesLoaderGroovyTest.groovy <https://github.com/apache/nifi/blob/master/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-properties-loader/src/test/groovy/org/apache/nifi/properties/NiFiPropertiesLoaderGroovyTest.groovy> Andy LoPresto alopre...@apache.org alopresto.apa...@gmail.com PGP Fingerprint: 70EC B3E5 98A6 5A3F D3C4 BACE 3C6E F65B 2F7D EF69 > On Sep 23, 2016, at 7:45 PM, Andy LoPresto <alopre...@apache.org> wrote: > > Tom, > > You’ll want to take a look at ProtectedNiFiProperties [1] and > NiFiPropertiesLoader [2]. ProtectedNiFiProperties provides a decorator on a > normal NiFiProperties class which allows access to various values via key > access or through named getters. It “unprotects” the values and can return a > regular NiFiProperties instance with direct access to the plain values. The > NiFiPropertiesLoader can be instantiated with the decryption key (currently > the only supported protection scheme is AES/GCM encryption) and can load > multiple instances of the NiFiProperties directly from any nifi.properties > file simultaneously. > > 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’d probably use a GetFile -> > ExtractText -> EncryptContent processor chain, or the ExecuteScript processor > (Groovy and other scripting languages have extensive tooling provided to > easily read from files, parse text, etc.). > > [1] > https://github.com/apache/nifi/blob/master/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-properties-loader/src/main/java/org/apache/nifi/properties/ProtectedNiFiProperties.java > > <https://github.com/apache/nifi/blob/master/nifi-nar-bundles/nifi-framework-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-framework-bundle/nifi-framework/nifi-properties-loader/src/main/java/org/apache/nifi/properties/NiFiPropertiesLoader.java > > <https://github.com/apache/nifi/blob/master/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-properties-loader/src/main/java/org/apache/nifi/properties/NiFiPropertiesLoader.java> > > > Andy LoPresto > alopre...@apache.org <mailto:alopre...@apache.org> > alopresto.apa...@gmail.com <mailto:alopresto.apa...@gmail.com> > PGP Fingerprint: 70EC B3E5 98A6 5A3F D3C4 BACE 3C6E F65B 2F7D EF69 > >> On Sep 23, 2016, at 3:28 PM, Tom Gullo <tomgu...@gmail.com >> <mailto:tomgu...@gmail.com>> wrote: >> >> I'm using v1.0. I want to access some values that are in the >> nifi.properties 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 encryption feature. >> >> Thanks >> >> On Fri, Sep 23, 2016 at 6:05 PM, Andrew Grande <apere...@gmail.com >> <mailto:apere...@gmail.com>> wrote: >> Which NiFi version? With 1.0 there are some bits for variable registry >> available, basically one can reference values from external config files via >> regular EL expressions. >> >> Andrew >> >> >> On Fri, Sep 23, 2016, 6:00 PM Tom Gullo <tomgu...@gmail.com >> <mailto:tomgu...@gmail.com>> wrote: >> I want to read in values from nifi.properties in a Groovy ExecuteScript >> processor. What's the best way to do that? >> >> Thanks >> -Tom >> > signature.asc Description: Message signed with OpenPGP using GPGMail
Re: read in values from nifi.properties in a Groovy ExecuteScript processor
Tom, You’ll want to take a look at ProtectedNiFiProperties [1] and NiFiPropertiesLoader [2]. ProtectedNiFiProperties provides a decorator on a normal NiFiProperties class which allows access to various values via key access or through named getters. It “unprotects” the values and can return a regular NiFiProperties instance with direct access to the plain values. The NiFiPropertiesLoader can be instantiated with the decryption key (currently the only supported protection scheme is AES/GCM encryption) and can load multiple instances of the NiFiProperties directly from any nifi.properties file simultaneously. 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’d probably use a GetFile -> ExtractText -> EncryptContent processor chain, or the ExecuteScript processor (Groovy and other scripting languages have extensive tooling provided to easily read from files, parse text, etc.). [1] https://github.com/apache/nifi/blob/master/nifi-nar-bundles/nifi-framework-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-framework-bundle/nifi-framework/nifi-properties-loader/src/main/java/org/apache/nifi/properties/NiFiPropertiesLoader.java <https://github.com/apache/nifi/blob/master/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-properties-loader/src/main/java/org/apache/nifi/properties/NiFiPropertiesLoader.java> Andy LoPresto alopre...@apache.org alopresto.apa...@gmail.com PGP Fingerprint: 70EC B3E5 98A6 5A3F D3C4 BACE 3C6E F65B 2F7D EF69 > On Sep 23, 2016, at 3:28 PM, Tom Gullo <tomgu...@gmail.com> wrote: > > I'm using v1.0. I want to access some values that are in the nifi.properties > 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 encryption > feature. > > Thanks > > On Fri, Sep 23, 2016 at 6:05 PM, Andrew Grande <apere...@gmail.com > <mailto:apere...@gmail.com>> wrote: > Which NiFi version? With 1.0 there are some bits for variable registry > available, basically one can reference values from external config files via > regular EL expressions. > > Andrew > > > On Fri, Sep 23, 2016, 6:00 PM Tom Gullo <tomgu...@gmail.com > <mailto:tomgu...@gmail.com>> wrote: > I want to read in values from nifi.properties in a Groovy ExecuteScript > processor. What's the best way to do that? > > Thanks > -Tom > signature.asc Description: Message signed with OpenPGP using GPGMail
Re: read in values from nifi.properties in a Groovy ExecuteScript processor
I'm using v1.0. I want to access some values that are in the nifi.properties 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 encryption feature. Thanks On Fri, Sep 23, 2016 at 6:05 PM, Andrew Grande <apere...@gmail.com> wrote: > Which NiFi version? With 1.0 there are some bits for variable registry > available, basically one can reference values from external config files > via regular EL expressions. > > Andrew > > On Fri, Sep 23, 2016, 6:00 PM Tom Gullo <tomgu...@gmail.com> wrote: > >> I want to read in values from nifi.properties in a Groovy ExecuteScript >> processor. What's the best way to do that? >> >> Thanks >> -Tom >> >
Re: read in values from nifi.properties in a Groovy ExecuteScript processor
Which NiFi version? With 1.0 there are some bits for variable registry available, basically one can reference values from external config files via regular EL expressions. Andrew On Fri, Sep 23, 2016, 6:00 PM Tom Gullo <tomgu...@gmail.com> wrote: > I want to read in values from nifi.properties in a Groovy ExecuteScript > processor. What's the best way to do that? > > Thanks > -Tom >
read in values from nifi.properties in a Groovy ExecuteScript processor
I want to read in values from nifi.properties in a Groovy ExecuteScript processor. What's the best way to do that? Thanks -Tom