[ 
https://issues.apache.org/jira/browse/NIFI-210?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15130527#comment-15130527
 ] 

ASF GitHub Bot commented on NIFI-210:
-------------------------------------

Github user markap14 commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/203#discussion_r51731945
  
    --- Diff: 
nifi-nar-bundles/nifi-scripting-bundle/nifi-scripting-processors/src/main/java/org/apache/nifi/processors/script/impl/GroovyScriptEngineConfigurator.java
 ---
    @@ -42,13 +49,56 @@ public String getScriptEngineName() {
         }
     
         @Override
    -    public Object init(ScriptEngine engine, String modulePath) throws 
ScriptException {
    +    public URL[] getModuleURLsForClasspath(String[] modulePaths, 
ComponentLog log) {
    +        List<URL> additionalClasspath = new LinkedList<>();
    +        if (modulePaths != null) {
    +            for (String modulePathString : modulePaths) {
    +                File modulePath = new File(modulePathString);
    +
    +                if (modulePath.exists()) {
    +                    // Add the URL of this path
    +                    try {
    +                        
additionalClasspath.add(modulePath.toURI().toURL());
    +                    } catch (MalformedURLException mue) {
    +                        log.error("{} is not a valid file/folder, 
ignoring", new Object[]{modulePath.getAbsolutePath()}, mue);
    +                    }
    +
    +                    // If the path is a directory, we need to scan for 
JARs and add them to the classpath
    +                    if (modulePath.isDirectory()) {
    +                        File[] jarFiles = modulePath.listFiles(new 
FilenameFilter() {
    +                            @Override
    +                            public boolean accept(File dir, String name) {
    +                                return (name != null && 
name.endsWith(".jar"));
    +                            }
    +                        });
    +
    +                        if (jarFiles != null) {
    +                            // Add each to the classpath
    +                            for (File jarFile : jarFiles) {
    +                                try {
    +                                    
additionalClasspath.add(jarFile.toURI().toURL());
    +
    +                                } catch (MalformedURLException mue) {
    +                                    log.error("{} is not a valid 
file/folder, ignoring", new Object[]{modulePath.getAbsolutePath()}, mue);
    +                                }
    +                            }
    +                        }
    +                    }
    +                }
    +                log.info("{} does not exist, ignoring", new 
Object[]{modulePath.getAbsolutePath()});
    --- End diff --
    
    I think this is supposed to go in an 'else' :)
    Also, can we change this to a WARN level instead of INFO please?


> Provide an ExecuteScript processor
> ----------------------------------
>
>                 Key: NIFI-210
>                 URL: https://issues.apache.org/jira/browse/NIFI-210
>             Project: Apache NiFi
>          Issue Type: Improvement
>          Components: Core Framework
>    Affects Versions: 0.0.1
>            Reporter: A. Steven Anderson
>            Assignee: Matt Burgess
>              Labels: processor
>             Fix For: 0.5.0
>
>         Attachments: 
> 0001-NIFI-210-few-tweaks-to-drop-static-reference-and-fix.patch, 
> Fun_with_Scripting_Languages.xml, flow.xml.gz
>
>
> Should also support Clojure as per discussion and request on mailing list 
> http://mail-archives.apache.org/mod_mbox/nifi-dev/201506.mbox/%3CCAMpSqch4GK1gnw6M1u8tH6AN8e_miXZN5SNkAeMjBujXYGqJiw%40mail.gmail.com%3E
> UPDATE: The ScriptEngine for Clojure is not being maintained and is not 
> currently available via Maven Central or a public repository. Recommend 
> adding Clojure as a separate Improvement Jira case.
> UPDATE: Scala support proved too buggy using plain script engine.   Needs 
> much further analysis/review/testing before inclusion.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to