Just wondering as importClass fails if I do the following.

importClass("org.apache.nifi.processor.io.StreamCallback");
importClass("org.apache.commons.io.IOUtils");
importClass("java.nio.charset.StandardCharsets");


Apologies for all the questions - I've never tried to include Java classes
in a script before.



On 7 March 2016 at 17:03, Mike Harding <[email protected]> wrote:

> aaa ok cool. Given that org.apache.nifi.processor.io.StreamCallback is an
> interface do I need to include the underlying classes?
>
> On 7 March 2016 at 16:29, Matt Burgess <[email protected]> wrote:
>
>> Looks like on Rhino you need a different syntax to import stuff:
>> http://docs.oracle.com/javase/7/docs/technotes/guides/scripting/programmer_guide/#jsengine
>>
>> On Mon, Mar 7, 2016 at 11:26 AM, Matt Burgess <[email protected]>
>> wrote:
>>
>>> So that's weird since you're running NiFi on Java already and trying to
>>> use JavaScript. What version of Java are you using? I wonder if the
>>> Java.type() thing is new in Java 8's Nashorn.
>>>
>>> Sent from my iPhone
>>>
>>> On Mar 7, 2016, at 11:22 AM, Mike Harding <[email protected]>
>>> wrote:
>>>
>>> Hi Matt,
>>>
>>> Thanks for doing this - I've just tried to run the template and I get
>>> the reference error: "Java" is not defined. I have JAVA_HOME set on my
>>> ubuntu machine - just wondering if theres a new config setting I'm missing
>>> perhaps?
>>>
>>> Mike
>>>
>>> On 2 March 2016 at 21:40, Matt Burgess <[email protected]> wrote:
>>>
>>>> Ask and ye shall receive ;) I realize most of my examples are in Groovy
>>>> so it was a good idea to do some non-trivial stuff in another language,
>>>> thanks for the suggestion!
>>>>
>>>> I recreated the JSON-to-JSON template but with Javascript as the
>>>> language:
>>>> http://funnifi.blogspot.com/2016/03/executescript-json-to-json-revisited.html
>>>>
>>>> Regards,
>>>> Matt
>>>>
>>>> On Wed, Mar 2, 2016 at 10:52 AM, Mike Harding <[email protected]>
>>>> wrote:
>>>>
>>>>> Hi Matt,
>>>>>
>>>>> Do you know if there is documentation that describes the ExecuteScript
>>>>> JavaScript API at the moment ? Just as a practical example how would I
>>>>> translate the Groovy code sample you walk through in this post >
>>>>> http://funnifi.blogspot.co.uk/2016/02/executescript-json-to-json-conversion.html
>>>>>
>>>>> Thanks,
>>>>> M
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> On 1 March 2016 at 18:32, Mike Harding <[email protected]> wrote:
>>>>>
>>>>>> Hi Matt,
>>>>>>
>>>>>> That's exactly what I'm looking for - much appreciated !
>>>>>>
>>>>>> Thanks,
>>>>>> Mike
>>>>>>
>>>>>> On Tue, 1 Mar 2016 at 18:13, Matt Burgess <[email protected]>
>>>>>> wrote:
>>>>>>
>>>>>>> Mike,
>>>>>>>
>>>>>>> I have a blog containing a few posts on how to use ExecuteScript and
>>>>>>> InvokeScriptedProcessor: http://funnifi.blogspot.com
>>>>>>>
>>>>>>> One contains an example using Javascript to get data from Hazelcast
>>>>>>> and update flowfile attributes:
>>>>>>> http://funnifi.blogspot.com/2016/02/executescript-using-modules.html
>>>>>>>
>>>>>>> If you'd like to share what you'd like to do with ExecuteScript, I'd
>>>>>>> be happy to help you get going!
>>>>>>>
>>>>>>> Regards,
>>>>>>> Matt
>>>>>>>
>>>>>>> On Tue, Mar 1, 2016 at 11:53 AM, Mike Harding <
>>>>>>> [email protected]> wrote:
>>>>>>>
>>>>>>>> Hi,
>>>>>>>>
>>>>>>>> I'd like to utilise the ExecuteScript processor but I understand
>>>>>>>> that its experimental. Can anyone point me in the direction of an 
>>>>>>>> example
>>>>>>>> or tutorial preferably using Javascript on how to get started with it?
>>>>>>>>
>>>>>>>> Thanks,
>>>>>>>> Mike
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>
>>>>
>>>
>>
>

Reply via email to