Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade NiFi to 1.4.0 #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@ repositories {


dependencies {
compile 'org.apache.nifi:nifi-api:0.6.1'
compile 'org.apache.nifi:nifi-mock:0.6.1'
compile 'org.apache.nifi:nifi-api:1.4.0'
compile 'org.apache.nifi:nifi-mock:1.4.0'
compile 'org.apache.nifi:nifi-logging-utils:1.4.0'
testCompile 'junit:junit:4.12'
runtime 'commons-io:commons-io:2.4'
runtime 'junit:junit:4.12'
Expand Down
6 changes: 4 additions & 2 deletions src/main/java/nifi/script/AbstractScriptProcessor.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@
import org.apache.nifi.components.AllowableValue;
import org.apache.nifi.components.PropertyDescriptor;
import org.apache.nifi.components.Validator;
import org.apache.nifi.logging.ProcessorLog;
import org.apache.nifi.logging.NiFiLog;
import org.apache.nifi.processor.AbstractSessionFactoryProcessor;
import org.apache.nifi.processor.Relationship;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.script.ScriptEngine;
import javax.script.ScriptEngineFactory;
Expand Down Expand Up @@ -176,7 +178,7 @@ private void setupEngines(int numberOfScriptEngines) {
engineQ = new LinkedBlockingQueue<>(numberOfScriptEngines);
ClassLoader originalContextClassLoader = Thread.currentThread().getContextClassLoader();
try {
ProcessorLog log = getLogger();
Logger log = new NiFiLog(LoggerFactory.getLogger(ExecuteScript.class));

ScriptEngineConfigurator configurator = scriptEngineConfiguratorMap.get(scriptEngineName.toLowerCase());

Expand Down
6 changes: 4 additions & 2 deletions src/main/java/nifi/script/ExecuteScript.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,14 @@
import org.apache.nifi.annotation.documentation.Tags;
import org.apache.nifi.annotation.lifecycle.OnScheduled;
import org.apache.nifi.components.PropertyDescriptor;
import org.apache.nifi.logging.ProcessorLog;
import org.apache.nifi.logging.NiFiLog;
import org.apache.nifi.processor.ProcessContext;
import org.apache.nifi.processor.ProcessSession;
import org.apache.nifi.processor.ProcessSessionFactory;
import org.apache.nifi.processor.Relationship;
import org.apache.nifi.processor.exception.ProcessException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.script.Bindings;
import javax.script.ScriptContext;
Expand Down Expand Up @@ -160,7 +162,7 @@ public void onTrigger(ProcessContext context, ProcessSessionFactory sessionFacto
// No engine available so nothing more to do here
return;
}
ProcessorLog log = getLogger();
Logger log = new NiFiLog(LoggerFactory.getLogger(ExecuteScript.class));
ProcessSession session = sessionFactory.createSession();
try {

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/nifi/script/ScriptEngineConfigurator.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
package nifi.script;


import org.apache.nifi.logging.ComponentLog;
import org.slf4j.Logger;

import javax.script.ScriptEngine;
import javax.script.ScriptException;
Expand All @@ -31,7 +31,7 @@ public interface ScriptEngineConfigurator {

String getScriptEngineName();

URL[] getModuleURLsForClasspath(String[] modulePaths, ComponentLog log);
URL[] getModuleURLsForClasspath(String[] modulePaths, Logger log);

Object init(ScriptEngine engine, String[] modulePaths) throws ScriptException;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
*/
package nifi.script.impl;

import org.apache.nifi.logging.ComponentLog;
import nifi.script.ScriptEngineConfigurator;
import org.slf4j.Logger;

import java.io.File;
import java.io.FilenameFilter;
Expand All @@ -43,7 +43,7 @@ abstract class AbstractModuleClassloaderConfigurator implements ScriptEngineConf
* @return An array of URLs corresponding to all modules determined from the input set of module paths.
*/
@Override
public URL[] getModuleURLsForClasspath(String[] modulePaths, ComponentLog log) {
public URL[] getModuleURLsForClasspath(String[] modulePaths, Logger log) {
List<URL> additionalClasspath = new LinkedList<>();
if (modulePaths != null) {
for (String modulePathString : modulePaths) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public class GroovyScriptEngineConfigurator extends AbstractModuleClassloaderCon
+ "import org.apache.nifi.processor.io.*\n"
+ "import org.apache.nifi.processor.util.*\n"
+ "import org.apache.nifi.processors.nifi.script.*\n"
+ "import org.apache.nifi.logging.ProcessorLog\n";
+ "import org.slf4j.Logger\n";


private ScriptEngine scriptEngine;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
*/
package nifi.script.impl;

import org.apache.nifi.logging.ComponentLog;
import nifi.script.ScriptEngineConfigurator;
import org.slf4j.Logger;

import javax.script.ScriptEngine;
import javax.script.ScriptException;
Expand All @@ -34,7 +34,7 @@ public String getScriptEngineName() {
}

@Override
public URL[] getModuleURLsForClasspath(String[] modulePaths, ComponentLog log) {
public URL[] getModuleURLsForClasspath(String[] modulePaths, Logger log) {
// We don't need to add the module paths to the classpath, they will be added via sys.path.append
return new URL[0];
}
Expand Down