http://git-wip-us.apache.org/repos/asf/zeppelin/blob/0d746fa2/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/Interpreter.java ---------------------------------------------------------------------- diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/Interpreter.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/Interpreter.java index e1ee73f..cb2f9f1 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/Interpreter.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/Interpreter.java @@ -17,15 +17,7 @@ package org.apache.zeppelin.interpreter; -import java.lang.reflect.Field; -import java.net.URL; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Properties; -import java.util.regex.Matcher; -import java.util.regex.Pattern; + import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.reflect.FieldUtils; import org.apache.zeppelin.annotation.Experimental; @@ -38,32 +30,46 @@ import org.apache.zeppelin.scheduler.SchedulerFactory; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import java.lang.reflect.Field; +import java.net.URL; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Properties; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + /** - * Interface for interpreters. If you want to implement new Zeppelin interpreter, extend this class + * Interface for interpreters. + * If you want to implement new Zeppelin interpreter, extend this class * - * <p>Please see, + * Please see, * https://zeppelin.apache.org/docs/latest/development/writingzeppelininterpreter.html * - * <p>open(), close(), interpret() is three the most important method you need to implement. - * cancel(), getProgress(), completion() is good to have getFormType(), getScheduler() determine - * Zeppelin's behavior + * open(), close(), interpret() is three the most important method you need to implement. + * cancel(), getProgress(), completion() is good to have + * getFormType(), getScheduler() determine Zeppelin's behavior */ public abstract class Interpreter { /** - * Opens interpreter. You may want to place your initialize routine here. open() is called only - * once + * Opens interpreter. You may want to place your initialize routine here. + * open() is called only once */ @ZeppelinApi public abstract void open() throws InterpreterException; /** - * Closes interpreter. You may want to free your resources up here. close() is called only once + * Closes interpreter. You may want to free your resources up here. + * close() is called only once */ @ZeppelinApi public abstract void close() throws InterpreterException; - /** Run precode if exists. */ + /** + * Run precode if exists. + */ @ZeppelinApi public InterpreterResult executePrecode(InterpreterContext interpreterContext) throws InterpreterException { @@ -87,8 +93,10 @@ public abstract class Interpreter { // substitute {variable} only if 'variable' has a value ... Resource resource = resourcePool.get(varPat.substring(1, varPat.length() - 1)); Object variableValue = resource == null ? null : resource.get(); - if (variableValue != null) sb.append(variableValue); - else return cmd; + if (variableValue != null) + sb.append(variableValue); + else + return cmd; } else if (varPat.matches("[{]{2}[^{}]+[}]{2}")) { // escape {{text}} ... sb.append("{").append(varPat.substring(2, varPat.length() - 2)).append("}"); @@ -108,18 +116,22 @@ public abstract class Interpreter { * @param st statements to run */ @ZeppelinApi - public abstract InterpreterResult interpret(String st, InterpreterContext context) + public abstract InterpreterResult interpret(String st, + InterpreterContext context) throws InterpreterException; - /** Optionally implement the canceling routine to abort interpret() method */ + /** + * Optionally implement the canceling routine to abort interpret() method + */ @ZeppelinApi public abstract void cancel(InterpreterContext context) throws InterpreterException; /** - * Dynamic form handling see http://zeppelin.apache.org/docs/dynamicform.html + * Dynamic form handling + * see http://zeppelin.apache.org/docs/dynamicform.html * * @return FormType.SIMPLE enables simple pattern replacement (eg. Hello ${name=world}), - * FormType.NATIVE handles form in API + * FormType.NATIVE handles form in API */ @ZeppelinApi public abstract FormType getFormType() throws InterpreterException; @@ -133,8 +145,8 @@ public abstract class Interpreter { public abstract int getProgress(InterpreterContext context) throws InterpreterException; /** - * Get completion list based on cursor position. By implementing this method, it enables - * auto-completion. + * Get completion list based on cursor position. + * By implementing this method, it enables auto-completion. * * @param buf statements * @param cursor cursor position in statements @@ -142,22 +154,22 @@ public abstract class Interpreter { * @return list of possible completion. Return empty list if there're nothing to return. */ @ZeppelinApi - public List<InterpreterCompletion> completion( - String buf, int cursor, InterpreterContext interpreterContext) throws InterpreterException { + public List<InterpreterCompletion> completion(String buf, int cursor, + InterpreterContext interpreterContext) throws InterpreterException { return null; } /** - * Interpreter can implements it's own scheduler by overriding this method. There're two default - * scheduler provided, FIFO, Parallel. If your interpret() can handle concurrent request, use - * Parallel or use FIFO. + * Interpreter can implements it's own scheduler by overriding this method. + * There're two default scheduler provided, FIFO, Parallel. + * If your interpret() can handle concurrent request, use Parallel or use FIFO. * - * <p>You can get default scheduler by using + * You can get default scheduler by using * SchedulerFactory.singleton().createOrGetFIFOScheduler() * SchedulerFactory.singleton().createOrGetParallelScheduler() * * @return return scheduler instance. This method can be called multiple times and have to return - * the same instance. Can not return null. + * the same instance. Can not return null. */ @ZeppelinApi public Scheduler getScheduler() { @@ -354,62 +366,51 @@ public abstract class Interpreter { } /** - * Replace markers #{contextFieldName} by values from {@link InterpreterContext} fields with same - * name and marker #{user}. If value == null then replace by empty string. + * Replace markers #{contextFieldName} by values from {@link InterpreterContext} fields + * with same name and marker #{user}. If value == null then replace by empty string. */ private void replaceContextParameters(Properties properties) { InterpreterContext interpreterContext = InterpreterContext.get(); if (interpreterContext != null) { String markerTemplate = "#\\{%s\\}"; List<String> skipFields = Arrays.asList("paragraphTitle", "paragraphId", "paragraphText"); - List typesToProcess = - Arrays.asList( - String.class, - Double.class, - Float.class, - Short.class, - Byte.class, - Character.class, - Boolean.class, - Integer.class, - Long.class); + List typesToProcess = Arrays.asList(String.class, Double.class, Float.class, Short.class, + Byte.class, Character.class, Boolean.class, Integer.class, Long.class); for (String key : properties.stringPropertyNames()) { String p = properties.getProperty(key); if (StringUtils.isNotEmpty(p)) { for (Field field : InterpreterContext.class.getDeclaredFields()) { Class clazz = field.getType(); - if (!skipFields.contains(field.getName()) - && (typesToProcess.contains(clazz) || clazz.isPrimitive())) { + if (!skipFields.contains(field.getName()) && (typesToProcess.contains(clazz) + || clazz.isPrimitive())) { Object value = null; try { value = FieldUtils.readField(field, interpreterContext, true); } catch (Exception e) { logger.error("Cannot read value of field {0}", field.getName()); } - p = - p.replaceAll( - String.format(markerTemplate, field.getName()), - value != null ? value.toString() : StringUtils.EMPTY); + p = p.replaceAll(String.format(markerTemplate, field.getName()), + value != null ? value.toString() : StringUtils.EMPTY); } } - p = - p.replaceAll( - String.format(markerTemplate, "user"), - StringUtils.defaultString(userName, StringUtils.EMPTY)); + p = p.replaceAll(String.format(markerTemplate, "user"), + StringUtils.defaultString(userName, StringUtils.EMPTY)); properties.setProperty(key, p); } } } } - /** Type of interpreter. */ + /** + * Type of interpreter. + */ public enum FormType { - NATIVE, - SIMPLE, - NONE + NATIVE, SIMPLE, NONE } - /** Represent registered interpreter class */ + /** + * Represent registered interpreter class + */ public static class RegisteredInterpreter { private String group; @@ -422,20 +423,13 @@ public abstract class Interpreter { private InterpreterOption option; private InterpreterRunner runner; - public RegisteredInterpreter( - String name, - String group, - String className, + public RegisteredInterpreter(String name, String group, String className, Map<String, DefaultInterpreterProperty> properties) { this(name, group, className, false, properties); } - public RegisteredInterpreter( - String name, - String group, - String className, - boolean defaultInterpreter, - Map<String, DefaultInterpreterProperty> properties) { + public RegisteredInterpreter(String name, String group, String className, + boolean defaultInterpreter, Map<String, DefaultInterpreterProperty> properties) { super(); this.name = name; this.group = group; @@ -494,9 +488,11 @@ public abstract class Interpreter { } } - /** Type of Scheduling. */ + /** + * Type of Scheduling. + */ public enum SchedulingMode { - FIFO, - PARALLEL + FIFO, PARALLEL } + }
http://git-wip-us.apache.org/repos/asf/zeppelin/blob/0d746fa2/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterContext.java ---------------------------------------------------------------------- diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterContext.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterContext.java index 07d9e40..23ac789 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterContext.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterContext.java @@ -17,15 +17,18 @@ package org.apache.zeppelin.interpreter; -import java.util.HashMap; -import java.util.Map; import org.apache.zeppelin.display.AngularObjectRegistry; import org.apache.zeppelin.display.GUI; import org.apache.zeppelin.interpreter.remote.RemoteInterpreterEventClient; import org.apache.zeppelin.resource.ResourcePool; import org.apache.zeppelin.user.AuthenticationInfo; -/** Interpreter context */ +import java.util.HashMap; +import java.util.Map; + +/** + * Interpreter context + */ public class InterpreterContext { private static final ThreadLocal<InterpreterContext> threadIC = new ThreadLocal<>(); @@ -60,7 +63,9 @@ public class InterpreterContext { private Map<String, String> localProperties = new HashMap<>(); private RemoteInterpreterEventClient intpEventClient; - /** Builder class for InterpreterContext */ + /** + * Builder class for InterpreterContext + */ public static class Builder { private InterpreterContext context; @@ -163,7 +168,10 @@ public class InterpreterContext { return new Builder(); } - private InterpreterContext() {} + private InterpreterContext() { + + } + public String getNoteId() { return noteId; @@ -220,7 +228,7 @@ public class InterpreterContext { public String getInterpreterClassName() { return interpreterClassName; } - + public void setInterpreterClassName(String className) { this.interpreterClassName = className; } @@ -239,7 +247,6 @@ public class InterpreterContext { /** * Set progress of paragraph manually - * * @param n integer from 0 to 100 */ public void setProgress(int n) { http://git-wip-us.apache.org/repos/asf/zeppelin/blob/0d746fa2/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterException.java ---------------------------------------------------------------------- diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterException.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterException.java index 6c1aa24..1ce63f3 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterException.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterException.java @@ -17,10 +17,15 @@ package org.apache.zeppelin.interpreter; -/** General Exception for interpreters. */ + +/** + * General Exception for interpreters. + * + */ public class InterpreterException extends Exception { - public InterpreterException() {} + public InterpreterException() { + } public InterpreterException(Throwable e) { super(e); @@ -34,8 +39,8 @@ public class InterpreterException extends Exception { super(msg, t); } - public InterpreterException( - String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { + public InterpreterException(String message, Throwable cause, boolean enableSuppression, + boolean writableStackTrace) { super(message, cause, enableSuppression, writableStackTrace); } } http://git-wip-us.apache.org/repos/asf/zeppelin/blob/0d746fa2/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterGroup.java ---------------------------------------------------------------------- diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterGroup.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterGroup.java index 638a391..4cf4b31 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterGroup.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterGroup.java @@ -17,28 +17,30 @@ package org.apache.zeppelin.interpreter; -import java.security.SecureRandom; +import org.apache.zeppelin.display.AngularObjectRegistry; +import org.apache.zeppelin.resource.ResourcePool; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.Map; +import java.security.SecureRandom; import java.util.concurrent.ConcurrentHashMap; -import org.apache.zeppelin.display.AngularObjectRegistry; -import org.apache.zeppelin.resource.ResourcePool; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; /** - * InterpreterGroup is collections of interpreter sessions. One session could include multiple - * interpreters. For example spark, pyspark, sql interpreters are in the same 'spark' interpreter - * session. + * InterpreterGroup is collections of interpreter sessions. + * One session could include multiple interpreters. + * For example spark, pyspark, sql interpreters are in the same 'spark' interpreter session. * - * <p>Remember, list of interpreters are dedicated to a session. Session could be shared across user - * or notes, so the sessionId could be user or noteId or their combination. So InterpreterGroup - * internally manages map of [sessionId(noteId, user, or their combination), list of interpreters] + * Remember, list of interpreters are dedicated to a session. Session could be shared across user + * or notes, so the sessionId could be user or noteId or their combination. + * So InterpreterGroup internally manages map of [sessionId(noteId, user, or + * their combination), list of interpreters] * - * <p>A InterpreterGroup runs interpreter process while its subclass ManagedInterpreterGroup runs in - * zeppelin server process. + * A InterpreterGroup runs interpreter process while its subclass ManagedInterpreterGroup runs + * in zeppelin server process. */ public class InterpreterGroup { @@ -54,14 +56,15 @@ public class InterpreterGroup { /** * Create InterpreterGroup with given id, used in InterpreterProcess - * * @param id */ public InterpreterGroup(String id) { this.id = id; } - /** Create InterpreterGroup with autogenerated id */ + /** + * Create InterpreterGroup with autogenerated id + */ public InterpreterGroup() { this.id = generateId(); } @@ -74,12 +77,12 @@ public class InterpreterGroup { return this.id; } - // TODO(zjffdu) change it to getSession. For now just keep this method to reduce code change + //TODO(zjffdu) change it to getSession. For now just keep this method to reduce code change public synchronized List<Interpreter> get(String sessionId) { return sessions.get(sessionId); } - // TODO(zjffdu) change it to addSession. For now just keep this method to reduce code change + //TODO(zjffdu) change it to addSession. For now just keep this method to reduce code change public synchronized void put(String sessionId, List<Interpreter> interpreters) { this.sessions.put(sessionId, interpreters); } @@ -94,8 +97,8 @@ public class InterpreterGroup { put(sessionId, interpreters); } - // TODO(zjffdu) rename it to a more proper name. - // For now just keep this method to reduce code change + //TODO(zjffdu) rename it to a more proper name. + //For now just keep this method to reduce code change public Collection<List<Interpreter>> values() { return sessions.values(); } @@ -103,15 +106,15 @@ public class InterpreterGroup { public AngularObjectRegistry getAngularObjectRegistry() { return angularObjectRegistry; } - + public void setAngularObjectRegistry(AngularObjectRegistry angularObjectRegistry) { this.angularObjectRegistry = angularObjectRegistry; } - + public InterpreterHookRegistry getInterpreterHookRegistry() { return hookRegistry; } - + public void setInterpreterHookRegistry(InterpreterHookRegistry hookRegistry) { this.hookRegistry = hookRegistry; } http://git-wip-us.apache.org/repos/asf/zeppelin/blob/0d746fa2/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterHookListener.java ---------------------------------------------------------------------- diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterHookListener.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterHookListener.java index e47c511..d0dbad1 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterHookListener.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterHookListener.java @@ -17,11 +17,17 @@ package org.apache.zeppelin.interpreter; -/** An interface for processing custom callback code into the interpreter. */ +/** + * An interface for processing custom callback code into the interpreter. + */ public interface InterpreterHookListener { - /** Prepends pre-execute hook code to the script that will be interpreted */ + /** + * Prepends pre-execute hook code to the script that will be interpreted + */ void onPreExecute(String script); - - /** Appends post-execute hook code to the script that will be interpreted */ + + /** + * Appends post-execute hook code to the script that will be interpreted + */ void onPostExecute(String script); } http://git-wip-us.apache.org/repos/asf/zeppelin/blob/0d746fa2/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterHookRegistry.java ---------------------------------------------------------------------- diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterHookRegistry.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterHookRegistry.java index 6b8a449..83917ec 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterHookRegistry.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterHookRegistry.java @@ -23,10 +23,10 @@ import java.util.Map; import java.util.Set; /** - * The InterpreterHookRegistry specifies code to be conditionally executed by an interpreter. The - * constants defined in this class denote currently supported events. Each instance is bound to a - * single InterpreterGroup. Scope is determined on a per-note basis (except when null for global - * scope). + * The InterpreterHookRegistry specifies code to be conditionally executed by an + * interpreter. The constants defined in this class denote currently + * supported events. Each instance is bound to a single InterpreterGroup. + * Scope is determined on a per-note basis (except when null for global scope). */ public class InterpreterHookRegistry { static final String GLOBAL_KEY = "_GLOBAL_"; @@ -34,6 +34,7 @@ public class InterpreterHookRegistry { // Scope (noteId/global scope) -> (ClassName -> (EventType -> Hook Code)) private Map<String, Map<String, Map<String, String>>> registry = new HashMap<>(); + /** * Adds a note to the registry * @@ -46,7 +47,7 @@ public class InterpreterHookRegistry { } } } - + /** * Adds a className to the registry * @@ -61,7 +62,7 @@ public class InterpreterHookRegistry { } } } - + /** * Register a hook for a specific event. * @@ -70,8 +71,8 @@ public class InterpreterHookRegistry { * @param event hook event (see constants defined in this class) * @param cmd Code to be executed by the interpreter */ - public void register(String noteId, String className, String event, String cmd) - throws InvalidHookException { + public void register(String noteId, String className, + String event, String cmd) throws InvalidHookException { synchronized (registry) { if (!HookType.ValidEvents.contains(event)) { throw new InvalidHookException("event " + event + " is not valid hook event"); @@ -83,7 +84,7 @@ public class InterpreterHookRegistry { registry.get(noteId).get(className).put(event, cmd); } } - + /** * Unregister a hook for a specific event. * @@ -100,7 +101,7 @@ public class InterpreterHookRegistry { registry.get(noteId).get(className).remove(event); } } - + /** * Get a hook for a specific event. * @@ -117,16 +118,18 @@ public class InterpreterHookRegistry { return registry.get(noteId).get(className).get(event); } } - - /** Container for hook event type constants */ + + /** + * Container for hook event type constants + */ public enum HookType { // Execute the hook code PRIOR to main paragraph code execution PRE_EXEC("pre_exec"), - + // Execute the hook code AFTER main paragraph code execution POST_EXEC("post_exec"), - + // Same as above but reserved for interpreter developers, in order to allow // notebook users to use the above without overwriting registry settings // that are initialized directly in subclasses of Interpreter. @@ -144,11 +147,11 @@ public class InterpreterHookRegistry { } public static Set<String> ValidEvents = new HashSet(); - static { for (HookType type : values()) { ValidEvents.add(type.getName()); } } } + } http://git-wip-us.apache.org/repos/asf/zeppelin/blob/0d746fa2/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterOption.java ---------------------------------------------------------------------- diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterOption.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterOption.java index 632d1a0..0c01d97 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterOption.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterOption.java @@ -21,12 +21,14 @@ import java.util.ArrayList; import java.util.List; import org.apache.zeppelin.conf.ZeppelinConfiguration; -/** */ +/** + * + */ public class InterpreterOption { public static final transient String SHARED = "shared"; public static final transient String SCOPED = "scoped"; public static final transient String ISOLATED = "isolated"; - private static ZeppelinConfiguration conf = ZeppelinConfiguration.create(); + private static ZeppelinConfiguration conf = ZeppelinConfiguration.create(); // always set it as true, keep this field just for backward compatibility boolean remote = true; @@ -84,7 +86,8 @@ public class InterpreterOption { isUserImpersonate = userImpersonate; } - public InterpreterOption() {} + public InterpreterOption() { + } public InterpreterOption(String perUser, String perNote) { if (perUser == null) { @@ -107,8 +110,8 @@ public class InterpreterOption { option.perUser = other.perUser; option.isExistingProcess = other.isExistingProcess; option.setPermission = other.setPermission; - option.owners = - (null == other.owners) ? new ArrayList<String>() : new ArrayList<>(other.owners); + option.owners = (null == other.owners) ? + new ArrayList<String>() : new ArrayList<>(other.owners); return option; } @@ -121,6 +124,7 @@ public class InterpreterOption { return port; } + public boolean perUserShared() { return SHARED.equals(perUser); } http://git-wip-us.apache.org/repos/asf/zeppelin/blob/0d746fa2/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterOutput.java ---------------------------------------------------------------------- diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterOutput.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterOutput.java index faae180..8853227 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterOutput.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterOutput.java @@ -16,6 +16,10 @@ */ package org.apache.zeppelin.interpreter; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import java.io.ByteArrayOutputStream; import java.io.File; import java.io.IOException; @@ -24,12 +28,10 @@ import java.net.URL; import java.util.Collections; import java.util.LinkedList; import java.util.List; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; /** - * InterpreterOutput is OutputStream that supposed to print content on notebook in addition to - * InterpreterResult which used to return from Interpreter.interpret(). + * InterpreterOutput is OutputStream that supposed to print content on notebook + * in addition to InterpreterResult which used to return from Interpreter.interpret(). */ public class InterpreterOutput extends OutputStream { Logger logger = LoggerFactory.getLogger(InterpreterOutput.class); @@ -59,8 +61,8 @@ public class InterpreterOutput extends OutputStream { clear(); } - public InterpreterOutput( - InterpreterOutputListener flushListener, InterpreterOutputChangeListener listener) + public InterpreterOutput(InterpreterOutputListener flushListener, + InterpreterOutputChangeListener listener) throws IOException { this.flushListener = flushListener; this.changeListener = listener; @@ -166,6 +168,7 @@ public class InterpreterOutput extends OutputStream { } } + int previousChar = 0; boolean startOfTheNewLine = true; boolean firstCharIsPercentSign = false; @@ -187,12 +190,8 @@ public class InterpreterOutput extends OutputStream { InterpreterResult.Type type = currentOut.getType(); if (type == InterpreterResult.Type.TEXT || type == InterpreterResult.Type.TABLE) { setType(InterpreterResult.Type.HTML); - getCurrentOutput() - .write( - ResultMessages.getExceedsLimitSizeMessage( - limit, "ZEPPELIN_INTERPRETER_OUTPUT_LIMIT") - .getData() - .getBytes()); + getCurrentOutput().write(ResultMessages.getExceedsLimitSizeMessage(limit, + "ZEPPELIN_INTERPRETER_OUTPUT_LIMIT").getData().getBytes()); truncated = true; return; } @@ -276,12 +275,12 @@ public class InterpreterOutput extends OutputStream { } @Override - public void write(byte[] b) throws IOException { + public void write(byte [] b) throws IOException { write(b, 0, b.length); } @Override - public void write(byte[] b, int off, int len) throws IOException { + public void write(byte [] b, int off, int len) throws IOException { for (int i = off; i < len; i++) { write(b[i]); } @@ -289,7 +288,6 @@ public class InterpreterOutput extends OutputStream { /** * In dev mode, it monitors file and update ZeppelinServer - * * @param file * @throws IOException */ @@ -309,7 +307,6 @@ public class InterpreterOutput extends OutputStream { /** * write contents in the resource file in the classpath - * * @param url * @throws IOException */ http://git-wip-us.apache.org/repos/asf/zeppelin/blob/0d746fa2/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterOutputChangeListener.java ---------------------------------------------------------------------- diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterOutputChangeListener.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterOutputChangeListener.java index 19e179d..44bcd7c 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterOutputChangeListener.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterOutputChangeListener.java @@ -18,7 +18,10 @@ package org.apache.zeppelin.interpreter; import java.io.File; -/** InterpreterOutputChangeListener */ +/** + * InterpreterOutputChangeListener + */ public interface InterpreterOutputChangeListener { void fileChanged(File file); + } http://git-wip-us.apache.org/repos/asf/zeppelin/blob/0d746fa2/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterOutputChangeWatcher.java ---------------------------------------------------------------------- diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterOutputChangeWatcher.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterOutputChangeWatcher.java index 965cc0c..1cb9c23 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterOutputChangeWatcher.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterOutputChangeWatcher.java @@ -20,7 +20,6 @@ import static java.nio.file.StandardWatchEventKinds.ENTRY_CREATE; import static java.nio.file.StandardWatchEventKinds.ENTRY_DELETE; import static java.nio.file.StandardWatchEventKinds.ENTRY_MODIFY; import static java.nio.file.StandardWatchEventKinds.OVERFLOW; - import java.io.File; import java.io.IOException; import java.nio.file.ClosedWatchServiceException; @@ -34,10 +33,13 @@ import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.concurrent.TimeUnit; + import org.slf4j.Logger; import org.slf4j.LoggerFactory; -/** Watch the change for the development mode support */ +/** + * Watch the change for the development mode support + */ public class InterpreterOutputChangeWatcher extends Thread { Logger logger = LoggerFactory.getLogger(InterpreterOutputChangeWatcher.class); @@ -78,6 +80,7 @@ public class InterpreterOutputChangeWatcher extends Thread { synchronized (watchKeys) { for (WatchKey key : watchKeys.keySet()) { key.cancel(); + } watchKeys.clear(); watchFiles.clear(); http://git-wip-us.apache.org/repos/asf/zeppelin/blob/0d746fa2/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterOutputListener.java ---------------------------------------------------------------------- diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterOutputListener.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterOutputListener.java index 79cbbab..a176ef2 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterOutputListener.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterOutputListener.java @@ -16,14 +16,17 @@ */ package org.apache.zeppelin.interpreter; -/** Listen InterpreterOutput buffer flush */ +/** + * Listen InterpreterOutput buffer flush + */ public interface InterpreterOutputListener { - /** update all message outputs */ + /** + * update all message outputs + */ void onUpdateAll(InterpreterOutput out); /** * called when newline is detected - * * @param index * @param out * @param line @@ -32,7 +35,6 @@ public interface InterpreterOutputListener { /** * when entire output is updated. eg) after detecting new display system - * * @param index * @param out */ http://git-wip-us.apache.org/repos/asf/zeppelin/blob/0d746fa2/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterProperty.java ---------------------------------------------------------------------- diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterProperty.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterProperty.java index 053acfa..92cf3a8 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterProperty.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterProperty.java @@ -17,7 +17,9 @@ package org.apache.zeppelin.interpreter; -/** Property for instance of interpreter */ +/** + * Property for instance of interpreter + */ public class InterpreterProperty { private String name; private Object value; http://git-wip-us.apache.org/repos/asf/zeppelin/blob/0d746fa2/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterPropertyBuilder.java ---------------------------------------------------------------------- diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterPropertyBuilder.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterPropertyBuilder.java index 7ec0d27..aa1a0b2 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterPropertyBuilder.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterPropertyBuilder.java @@ -20,23 +20,26 @@ package org.apache.zeppelin.interpreter; import java.util.HashMap; import java.util.Map; -/** InterpreterPropertyBuilder */ +/** + * InterpreterPropertyBuilder + */ public class InterpreterPropertyBuilder { Map<String, DefaultInterpreterProperty> properties = new HashMap<>(); - public InterpreterPropertyBuilder add(String name, String defaultValue, String description) { - properties.put(name, new DefaultInterpreterProperty(defaultValue, description)); + public InterpreterPropertyBuilder add(String name, String defaultValue, String description){ + properties.put(name, + new DefaultInterpreterProperty(defaultValue, description)); return this; } - public InterpreterPropertyBuilder add( - String name, String envName, String propertyName, String defaultValue, String description) { - properties.put( - name, new DefaultInterpreterProperty(envName, propertyName, defaultValue, description)); + public InterpreterPropertyBuilder add(String name, String envName, String propertyName, + String defaultValue, String description){ + properties.put(name, + new DefaultInterpreterProperty(envName, propertyName, defaultValue, description)); return this; } - public Map<String, DefaultInterpreterProperty> build() { + public Map<String, DefaultInterpreterProperty> build(){ return properties; } } http://git-wip-us.apache.org/repos/asf/zeppelin/blob/0d746fa2/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterPropertyType.java ---------------------------------------------------------------------- diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterPropertyType.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterPropertyType.java index bb45a1e..6bbc39d 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterPropertyType.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterPropertyType.java @@ -20,8 +20,11 @@ package org.apache.zeppelin.interpreter; import java.util.ArrayList; import java.util.List; -/** Types of interpreter properties */ +/** + * Types of interpreter properties + */ public enum InterpreterPropertyType { + TEXTAREA("textarea"), STRING("string"), NUMBER("number"), http://git-wip-us.apache.org/repos/asf/zeppelin/blob/0d746fa2/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterResult.java ---------------------------------------------------------------------- diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterResult.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterResult.java index 804046a..255b21e 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterResult.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterResult.java @@ -18,20 +18,25 @@ package org.apache.zeppelin.interpreter; import com.google.gson.Gson; +import org.apache.zeppelin.common.JsonSerializable; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import java.io.IOException; import java.io.Serializable; import java.util.LinkedList; import java.util.List; -import org.apache.zeppelin.common.JsonSerializable; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -/** Interpreter result template. */ +/** + * Interpreter result template. + */ public class InterpreterResult implements Serializable, JsonSerializable { transient Logger logger = LoggerFactory.getLogger(InterpreterResult.class); private static final Gson gson = new Gson(); - /** Type of result after code execution. */ + /** + * Type of result after code execution. + */ public enum Code { SUCCESS, INCOMPLETE, @@ -39,7 +44,9 @@ public class InterpreterResult implements Serializable, JsonSerializable { KEEP_PREVIOUS_RESULT } - /** Type of Data. */ + /** + * Type of Data. + */ public enum Type { TEXT, HTML, @@ -75,7 +82,6 @@ public class InterpreterResult implements Serializable, JsonSerializable { /** * Automatically detect %[display_system] directives - * * @param msg */ public void add(String msg) { @@ -88,6 +94,7 @@ public class InterpreterResult implements Serializable, JsonSerializable { } catch (IOException e) { logger.error(e.getMessage(), e); } + } public void add(Type type, String data) { http://git-wip-us.apache.org/repos/asf/zeppelin/blob/0d746fa2/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterResultMessage.java ---------------------------------------------------------------------- diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterResultMessage.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterResultMessage.java index 370253c..f137ca5 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterResultMessage.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterResultMessage.java @@ -18,7 +18,9 @@ package org.apache.zeppelin.interpreter; import java.io.Serializable; -/** Interpreter result message */ +/** + * Interpreter result message + */ public class InterpreterResultMessage implements Serializable { InterpreterResult.Type type; String data; http://git-wip-us.apache.org/repos/asf/zeppelin/blob/0d746fa2/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterResultMessageOutput.java ---------------------------------------------------------------------- diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterResultMessageOutput.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterResultMessageOutput.java index 436ca4a..8758c98 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterResultMessageOutput.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterResultMessageOutput.java @@ -16,6 +16,9 @@ */ package org.apache.zeppelin.interpreter; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileInputStream; @@ -25,10 +28,10 @@ import java.io.OutputStream; import java.net.URL; import java.util.LinkedList; import java.util.List; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -/** InterpreterMessageOutputStream */ +/** + * InterpreterMessageOutputStream + */ public class InterpreterResultMessageOutput extends OutputStream { Logger logger = LoggerFactory.getLogger(InterpreterResultMessageOutput.class); private final int NEW_LINE_CHAR = '\n'; @@ -43,7 +46,8 @@ public class InterpreterResultMessageOutput extends OutputStream { private boolean firstWrite = true; public InterpreterResultMessageOutput( - InterpreterResult.Type type, InterpreterResultMessageOutputListener listener) { + InterpreterResult.Type type, + InterpreterResultMessageOutputListener listener) { this.type = type; this.flushListener = listener; } @@ -51,8 +55,7 @@ public class InterpreterResultMessageOutput extends OutputStream { public InterpreterResultMessageOutput( InterpreterResult.Type type, InterpreterResultMessageOutputListener flushListener, - InterpreterOutputChangeListener listener) - throws IOException { + InterpreterOutputChangeListener listener) throws IOException { this.type = type; this.flushListener = flushListener; watcher = new InterpreterOutputChangeWatcher(listener); @@ -106,12 +109,12 @@ public class InterpreterResultMessageOutput extends OutputStream { } @Override - public void write(byte[] b) throws IOException { + public void write(byte [] b) throws IOException { write(b, 0, b.length); } @Override - public void write(byte[] b, int off, int len) throws IOException { + public void write(byte [] b, int off, int len) throws IOException { synchronized (outList) { for (int i = off; i < len; i++) { write(b[i]); @@ -121,7 +124,6 @@ public class InterpreterResultMessageOutput extends OutputStream { /** * In dev mode, it monitors file and update ZeppelinServer - * * @param file * @throws IOException */ @@ -138,7 +140,6 @@ public class InterpreterResultMessageOutput extends OutputStream { /** * write contents in the resource file in the classpath - * * @param url * @throws IOException */ http://git-wip-us.apache.org/repos/asf/zeppelin/blob/0d746fa2/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterResultMessageOutputListener.java ---------------------------------------------------------------------- diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterResultMessageOutputListener.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterResultMessageOutputListener.java index 5b56e61..7f14a3e 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterResultMessageOutputListener.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterResultMessageOutputListener.java @@ -16,15 +16,18 @@ */ package org.apache.zeppelin.interpreter; -/** InterpreterResultMessage update events */ +/** + * InterpreterResultMessage update events + */ public interface InterpreterResultMessageOutputListener { /** * called when newline is detected - * * @param line */ void onAppend(InterpreterResultMessageOutput out, byte[] line); - /** when entire output is updated. eg) after detecting new display system */ + /** + * when entire output is updated. eg) after detecting new display system + */ void onUpdate(InterpreterResultMessageOutput out); } http://git-wip-us.apache.org/repos/asf/zeppelin/blob/0d746fa2/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterRunner.java ---------------------------------------------------------------------- diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterRunner.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterRunner.java index 982823a..e60ada7 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterRunner.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterRunner.java @@ -2,16 +2,19 @@ package org.apache.zeppelin.interpreter; import com.google.gson.annotations.SerializedName; -/** Interpreter runner path */ +/** + * Interpreter runner path + */ public class InterpreterRunner { @SerializedName("linux") private String linuxPath; - @SerializedName("win") private String winPath; - public InterpreterRunner() {} + public InterpreterRunner() { + + } public InterpreterRunner(String linuxPath, String winPath) { this.linuxPath = linuxPath; http://git-wip-us.apache.org/repos/asf/zeppelin/blob/0d746fa2/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterUtils.java ---------------------------------------------------------------------- diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterUtils.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterUtils.java index 49ea68d..c3d3b9e 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterUtils.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterUtils.java @@ -1,22 +1,27 @@ /** - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license - * agreements. See the NOTICE file distributed with this work for additional information regarding - * copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance with the License. You may obtain a - * copy of the License at + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * <p>http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * <p>Unless required by applicable law or agreed to in writing, software distributed under the - * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either - * express or implied. See the License for the specific language governing permissions and + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.zeppelin.interpreter; import java.lang.reflect.InvocationTargetException; -/** Interpreter utility functions */ +/** + * Interpreter utility functions + */ public class InterpreterUtils { public static String getMostRelevantMessage(Exception ex) { http://git-wip-us.apache.org/repos/asf/zeppelin/blob/0d746fa2/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InvalidHookException.java ---------------------------------------------------------------------- diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InvalidHookException.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InvalidHookException.java index 3d7b308..9b44726 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InvalidHookException.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InvalidHookException.java @@ -15,9 +15,12 @@ * limitations under the License. */ + package org.apache.zeppelin.interpreter; -/** Exception for invalid hook */ +/** + * Exception for invalid hook + */ public class InvalidHookException extends Exception { public InvalidHookException(String message) { http://git-wip-us.apache.org/repos/asf/zeppelin/blob/0d746fa2/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/KerberosInterpreter.java ---------------------------------------------------------------------- diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/KerberosInterpreter.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/KerberosInterpreter.java index 57a4e69..4da5ef5 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/KerberosInterpreter.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/KerberosInterpreter.java @@ -31,14 +31,18 @@ import org.slf4j.LoggerFactory; /** * Interpreter wrapper for Kerberos initialization * - * <p>runKerberosLogin() method you need to implement that determine how should this interpeter do a - * kinit for this interpreter. isKerboseEnabled() method needs to implement which determines if the - * kerberos is enabled for that interpreter. startKerberosLoginThread() needs to be called inside - * the open() and shutdownExecutorService() inside close(). + * runKerberosLogin() method you need to implement that determine how should this interpeter do a + * kinit for this interpreter. + * isKerboseEnabled() method needs to implement which determines if the kerberos is enabled for that + * interpreter. + * startKerberosLoginThread() needs to be called inside the open() and + * shutdownExecutorService() inside close(). * - * <p>Environment variables defined in zeppelin-env.sh KERBEROS_REFRESH_INTERVAL controls the - * refresh interval for Kerberos ticket. The default value is 1d. KINIT_FAIL_THRESHOLD controls how - * many times should kinit retry. The default value is 5. + * + * Environment variables defined in zeppelin-env.sh + * KERBEROS_REFRESH_INTERVAL controls the refresh interval for Kerberos ticket. The default value + * is 1d. + * KINIT_FAIL_THRESHOLD controls how many times should kinit retry. The default value is 5. */ public abstract class KerberosInterpreter extends Interpreter { @@ -71,18 +75,15 @@ public abstract class KerberosInterpreter extends Interpreter { private Long getKerberosRefreshInterval() { Long refreshInterval; String refreshIntervalString = "1d"; - // defined in zeppelin-env.sh, if not initialized then the default value is one day. + //defined in zeppelin-env.sh, if not initialized then the default value is one day. if (System.getenv("KERBEROS_REFRESH_INTERVAL") != null) { refreshIntervalString = System.getenv("KERBEROS_REFRESH_INTERVAL"); } try { refreshInterval = getTimeAsMs(refreshIntervalString); } catch (IllegalArgumentException e) { - logger.error( - "Cannot get time in MS for the given string, " - + refreshIntervalString - + " defaulting to 1d ", - e); + logger.error("Cannot get time in MS for the given string, " + refreshIntervalString + + " defaulting to 1d ", e); refreshInterval = getTimeAsMs("1d"); } @@ -91,17 +92,13 @@ public abstract class KerberosInterpreter extends Interpreter { private Integer kinitFailThreshold() { Integer kinitFailThreshold = 5; - // defined in zeppelin-env.sh, if not initialized then the default value is 5. + //defined in zeppelin-env.sh, if not initialized then the default value is 5. if (System.getenv("KINIT_FAIL_THRESHOLD") != null) { try { kinitFailThreshold = new Integer(System.getenv("KINIT_FAIL_THRESHOLD")); } catch (Exception e) { - logger.error( - "Cannot get integer value from the given string, " - + System.getenv("KINIT_FAIL_THRESHOLD") - + " defaulting to " - + kinitFailThreshold, - e); + logger.error("Cannot get integer value from the given string, " + System + .getenv("KINIT_FAIL_THRESHOLD") + " defaulting to " + kinitFailThreshold, e); } } return kinitFailThreshold; @@ -125,39 +122,36 @@ public abstract class KerberosInterpreter extends Interpreter { throw new IllegalArgumentException("Invalid suffix: \"" + suffix + "\""); } - return TimeUnit.MILLISECONDS.convert( - val, suffix != null ? Constants.TIME_SUFFIXES.get(suffix) : TimeUnit.MILLISECONDS); + return TimeUnit.MILLISECONDS.convert(val, + suffix != null ? Constants.TIME_SUFFIXES.get(suffix) : TimeUnit.MILLISECONDS); } private ScheduledExecutorService startKerberosLoginThread() { scheduledExecutorService = Executors.newScheduledThreadPool(1); - scheduledExecutorService.submit( - new Callable() { - public Object call() throws Exception { - - if (runKerberosLogin()) { - logger.info("Ran runKerberosLogin command successfully."); - kinitFailCount = 0; - // schedule another kinit run with a fixed delay. - scheduledExecutorService.schedule( - this, getKerberosRefreshInterval(), TimeUnit.MILLISECONDS); - } else { - kinitFailCount++; - logger.info("runKerberosLogin failed for " + kinitFailCount + " time(s)."); - // schedule another retry at once or close the interpreter if too many times kinit - // fails - if (kinitFailCount >= kinitFailThreshold()) { - logger.error( - "runKerberosLogin failed for max attempts, calling close interpreter."); - close(); - } else { - scheduledExecutorService.submit(this); - } - } - return null; + scheduledExecutorService.submit(new Callable() { + public Object call() throws Exception { + + if (runKerberosLogin()) { + logger.info("Ran runKerberosLogin command successfully."); + kinitFailCount = 0; + // schedule another kinit run with a fixed delay. + scheduledExecutorService + .schedule(this, getKerberosRefreshInterval(), TimeUnit.MILLISECONDS); + } else { + kinitFailCount++; + logger.info("runKerberosLogin failed for " + kinitFailCount + " time(s)."); + // schedule another retry at once or close the interpreter if too many times kinit fails + if (kinitFailCount >= kinitFailThreshold()) { + logger.error("runKerberosLogin failed for max attempts, calling close interpreter."); + close(); + } else { + scheduledExecutorService.submit(this); } - }); + } + return null; + } + }); return scheduledExecutorService; } @@ -167,4 +161,5 @@ public abstract class KerberosInterpreter extends Interpreter { scheduledExecutorService.shutdown(); } } + } http://git-wip-us.apache.org/repos/asf/zeppelin/blob/0d746fa2/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/LazyOpenInterpreter.java ---------------------------------------------------------------------- diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/LazyOpenInterpreter.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/LazyOpenInterpreter.java index 3303751..7581e67 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/LazyOpenInterpreter.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/LazyOpenInterpreter.java @@ -20,11 +20,16 @@ package org.apache.zeppelin.interpreter; import java.net.URL; import java.util.List; import java.util.Properties; + import org.apache.zeppelin.interpreter.thrift.InterpreterCompletion; import org.apache.zeppelin.scheduler.Scheduler; -/** Interpreter wrapper for lazy initialization */ -public class LazyOpenInterpreter extends Interpreter implements WrappedInterpreter { +/** + * Interpreter wrapper for lazy initialization + */ +public class LazyOpenInterpreter + extends Interpreter + implements WrappedInterpreter { private Interpreter intp; volatile boolean opened = false; @@ -127,8 +132,8 @@ public class LazyOpenInterpreter extends Interpreter implements WrappedInterpret } @Override - public List<InterpreterCompletion> completion( - String buf, int cursor, InterpreterContext interpreterContext) throws InterpreterException { + public List<InterpreterCompletion> completion(String buf, int cursor, + InterpreterContext interpreterContext) throws InterpreterException { open(); List completion = intp.completion(buf, cursor, interpreterContext); return completion; @@ -150,12 +155,12 @@ public class LazyOpenInterpreter extends Interpreter implements WrappedInterpret } @Override - public URL[] getClassloaderUrls() { + public URL [] getClassloaderUrls() { return intp.getClassloaderUrls(); } @Override - public void setClassloaderUrls(URL[] urls) { + public void setClassloaderUrls(URL [] urls) { intp.setClassloaderUrls(urls); } http://git-wip-us.apache.org/repos/asf/zeppelin/blob/0d746fa2/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/RemoteZeppelinServerResource.java ---------------------------------------------------------------------- diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/RemoteZeppelinServerResource.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/RemoteZeppelinServerResource.java index 1511138..bf96a09 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/RemoteZeppelinServerResource.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/RemoteZeppelinServerResource.java @@ -20,12 +20,16 @@ package org.apache.zeppelin.interpreter; import com.google.gson.Gson; import org.apache.zeppelin.common.JsonSerializable; -/** Remote Zeppelin Server Resource */ +/** + * Remote Zeppelin Server Resource + */ public class RemoteZeppelinServerResource implements JsonSerializable { private static final Gson gson = new Gson(); - /** Resource Type for Zeppelin Server */ - public enum Type { + /** + * Resource Type for Zeppelin Server + */ + public enum Type{ PARAGRAPH_RUNNERS } http://git-wip-us.apache.org/repos/asf/zeppelin/blob/0d746fa2/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/ResultMessages.java ---------------------------------------------------------------------- diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/ResultMessages.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/ResultMessages.java index 2fa3de8..d32299e 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/ResultMessages.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/ResultMessages.java @@ -17,32 +17,30 @@ package org.apache.zeppelin.interpreter; -/** */ +/** + * + */ public class ResultMessages { public static final String EXCEEDS_LIMIT_ROWS = "<strong>Output is truncated</strong> to %s rows. Learn more about <strong>%s</strong>"; public static final String EXCEEDS_LIMIT_SIZE = "<strong>Output is truncated</strong> to %s bytes. Learn more about <strong>%s</strong>"; public static final String EXCEEDS_LIMIT = - "<div class=\"result-alert alert-warning\" role=\"alert\">" - + "<button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-label=\"Close\">" - + "<span aria-hidden=\"true\">×</span></button>" - + "%s" - + "</div>"; + "<div class=\"result-alert alert-warning\" role=\"alert\">" + + "<button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-label=\"Close\">" + + "<span aria-hidden=\"true\">×</span></button>" + + "%s" + + "</div>"; public static InterpreterResultMessage getExceedsLimitRowsMessage(int amount, String variable) { - InterpreterResultMessage message = - new InterpreterResultMessage( - InterpreterResult.Type.HTML, - String.format(EXCEEDS_LIMIT, String.format(EXCEEDS_LIMIT_ROWS, amount, variable))); + InterpreterResultMessage message = new InterpreterResultMessage(InterpreterResult.Type.HTML, + String.format(EXCEEDS_LIMIT, String.format(EXCEEDS_LIMIT_ROWS, amount, variable))); return message; } public static InterpreterResultMessage getExceedsLimitSizeMessage(int amount, String variable) { - InterpreterResultMessage message = - new InterpreterResultMessage( - InterpreterResult.Type.HTML, - String.format(EXCEEDS_LIMIT, String.format(EXCEEDS_LIMIT_SIZE, amount, variable))); + InterpreterResultMessage message = new InterpreterResultMessage(InterpreterResult.Type.HTML, + String.format(EXCEEDS_LIMIT, String.format(EXCEEDS_LIMIT_SIZE, amount, variable))); return message; } } http://git-wip-us.apache.org/repos/asf/zeppelin/blob/0d746fa2/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/WrappedInterpreter.java ---------------------------------------------------------------------- diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/WrappedInterpreter.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/WrappedInterpreter.java index 39785cb..040b546 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/WrappedInterpreter.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/WrappedInterpreter.java @@ -17,7 +17,9 @@ package org.apache.zeppelin.interpreter; -/** WrappedInterpreter */ +/** + * WrappedInterpreter + */ public interface WrappedInterpreter { Interpreter getInnerInterpreter(); } http://git-wip-us.apache.org/repos/asf/zeppelin/blob/0d746fa2/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/graph/GraphResult.java ---------------------------------------------------------------------- diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/graph/GraphResult.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/graph/GraphResult.java index e12d8bf..df1b9a3 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/graph/GraphResult.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/graph/GraphResult.java @@ -17,40 +17,52 @@ package org.apache.zeppelin.interpreter.graph; -import com.google.gson.Gson; import java.util.Collection; import java.util.Map; import java.util.Set; + import org.apache.zeppelin.interpreter.InterpreterResult; import org.apache.zeppelin.tabledata.Node; import org.apache.zeppelin.tabledata.Relationship; -/** The intepreter result template for Networks */ +import com.google.gson.Gson; + +/** + * The intepreter result template for Networks + * + */ public class GraphResult extends InterpreterResult { - /** The Graph structure parsed from the front-end */ + /** + * The Graph structure parsed from the front-end + * + */ public static class Graph { private Collection<Node> nodes; - + private Collection<Relationship> edges; - - /** The node types in the whole graph, and the related colors */ + + /** + * The node types in the whole graph, and the related colors + * + */ private Map<String, String> labels; - - /** The relationship types in the whole graph */ + + /** + * The relationship types in the whole graph + * + */ private Set<String> types; - /** Is a directed graph */ + /** + * Is a directed graph + */ private boolean directed; - + public Graph() {} - public Graph( - Collection<Node> nodes, - Collection<Relationship> edges, - Map<String, String> labels, - Set<String> types, - boolean directed) { + public Graph(Collection<Node> nodes, Collection<Relationship> edges, + Map<String, String> labels, Set<String> types, boolean directed) { super(); this.setNodes(nodes); this.setEdges(edges); @@ -86,7 +98,7 @@ public class GraphResult extends InterpreterResult { public Set<String> getTypes() { return types; } - + public void setTypes(Set<String> types) { this.types = types; } @@ -98,11 +110,13 @@ public class GraphResult extends InterpreterResult { public void setDirected(boolean directed) { this.directed = directed; } - } + } + private static final Gson gson = new Gson(); public GraphResult(Code code, Graph graphObject) { super(code, Type.NETWORK, gson.toJson(graphObject)); } + } http://git-wip-us.apache.org/repos/asf/zeppelin/blob/0d746fa2/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/launcher/InterpreterLaunchContext.java ---------------------------------------------------------------------- diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/launcher/InterpreterLaunchContext.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/launcher/InterpreterLaunchContext.java index 6b61f53..136d866 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/launcher/InterpreterLaunchContext.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/launcher/InterpreterLaunchContext.java @@ -17,11 +17,14 @@ package org.apache.zeppelin.interpreter.launcher; -import java.util.Properties; import org.apache.zeppelin.interpreter.InterpreterOption; import org.apache.zeppelin.interpreter.InterpreterRunner; -/** Context class for Interpreter Launch */ +import java.util.Properties; + +/** + * Context class for Interpreter Launch + */ public class InterpreterLaunchContext { private Properties properties; @@ -35,17 +38,16 @@ public class InterpreterLaunchContext { private int zeppelinServerRPCPort; private String zeppelinServerHost; - public InterpreterLaunchContext( - Properties properties, - InterpreterOption option, - InterpreterRunner runner, - String userName, - String interpreterGroupId, - String interpreterSettingId, - String interpreterSettingGroup, - String interpreterSettingName, - int zeppelinServerRPCPort, - String zeppelinServerHost) { + public InterpreterLaunchContext(Properties properties, + InterpreterOption option, + InterpreterRunner runner, + String userName, + String interpreterGroupId, + String interpreterSettingId, + String interpreterSettingGroup, + String interpreterSettingName, + int zeppelinServerRPCPort, + String zeppelinServerHost) { this.properties = properties; this.option = option; this.runner = runner; http://git-wip-us.apache.org/repos/asf/zeppelin/blob/0d746fa2/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/launcher/InterpreterLauncher.java ---------------------------------------------------------------------- diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/launcher/InterpreterLauncher.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/launcher/InterpreterLauncher.java index dfec532..30cf995 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/launcher/InterpreterLauncher.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/launcher/InterpreterLauncher.java @@ -17,12 +17,15 @@ package org.apache.zeppelin.interpreter.launcher; -import java.io.IOException; -import java.util.Properties; import org.apache.zeppelin.conf.ZeppelinConfiguration; import org.apache.zeppelin.interpreter.recovery.RecoveryStorage; -/** Component to Launch interpreter process. */ +import java.io.IOException; +import java.util.Properties; + +/** + * Component to Launch interpreter process. + */ public abstract class InterpreterLauncher { protected ZeppelinConfiguration zConf; @@ -39,11 +42,8 @@ public abstract class InterpreterLauncher { zConf.getInt(ZeppelinConfiguration.ConfVars.ZEPPELIN_INTERPRETER_CONNECT_TIMEOUT); if (properties.containsKey( ZeppelinConfiguration.ConfVars.ZEPPELIN_INTERPRETER_CONNECT_TIMEOUT.getVarName())) { - connectTimeout = - Integer.parseInt( - properties.getProperty( - ZeppelinConfiguration.ConfVars.ZEPPELIN_INTERPRETER_CONNECT_TIMEOUT - .getVarName())); + connectTimeout = Integer.parseInt(properties.getProperty( + ZeppelinConfiguration.ConfVars.ZEPPELIN_INTERPRETER_CONNECT_TIMEOUT.getVarName())); } return connectTimeout; } http://git-wip-us.apache.org/repos/asf/zeppelin/blob/0d746fa2/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/recovery/RecoveryStorage.java ---------------------------------------------------------------------- diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/recovery/RecoveryStorage.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/recovery/RecoveryStorage.java index 3f64700..8bbe830 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/recovery/RecoveryStorage.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/recovery/RecoveryStorage.java @@ -17,12 +17,17 @@ package org.apache.zeppelin.interpreter.recovery; -import java.io.IOException; -import java.util.Map; import org.apache.zeppelin.conf.ZeppelinConfiguration; import org.apache.zeppelin.interpreter.launcher.InterpreterClient; -/** Interface for storing interpreter process recovery metadata. */ +import java.io.IOException; +import java.util.Map; + + +/** + * Interface for storing interpreter process recovery metadata. + * + */ public abstract class RecoveryStorage { protected ZeppelinConfiguration zConf; @@ -34,7 +39,6 @@ public abstract class RecoveryStorage { /** * Update RecoveryStorage when new InterpreterClient is started - * * @param client * @throws IOException */ @@ -42,13 +46,13 @@ public abstract class RecoveryStorage { /** * Update RecoveryStorage when InterpreterClient is stopped - * * @param client * @throws IOException */ public abstract void onInterpreterClientStop(InterpreterClient client) throws IOException; /** + * * It is only called when Zeppelin Server is started. * * @return @@ -56,6 +60,7 @@ public abstract class RecoveryStorage { */ public abstract Map<String, InterpreterClient> restore() throws IOException; + /** * It is called after constructor * http://git-wip-us.apache.org/repos/asf/zeppelin/blob/0d746fa2/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/InvokeResourceMethodEventMessage.java ---------------------------------------------------------------------- diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/InvokeResourceMethodEventMessage.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/InvokeResourceMethodEventMessage.java index 623ce87..aaf3d7b 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/InvokeResourceMethodEventMessage.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/InvokeResourceMethodEventMessage.java @@ -20,7 +20,9 @@ import com.google.gson.Gson; import org.apache.zeppelin.common.JsonSerializable; import org.apache.zeppelin.resource.ResourceId; -/** message payload to invoke method of resource in the resourcepool */ +/** + * message payload to invoke method of resource in the resourcepool + */ public class InvokeResourceMethodEventMessage implements JsonSerializable { private static final Gson gson = new Gson(); @@ -35,7 +37,8 @@ public class InvokeResourceMethodEventMessage implements JsonSerializable { String methodName, Class[] paramtypes, Object[] params, - String returnResourceName) { + String returnResourceName + ) { this.resourceId = resourceId; this.methodName = methodName; if (paramtypes != null) { @@ -51,12 +54,12 @@ public class InvokeResourceMethodEventMessage implements JsonSerializable { this.returnResourceName = returnResourceName; } - public Class[] getParamTypes() throws ClassNotFoundException { + public Class [] getParamTypes() throws ClassNotFoundException { if (paramClassnames == null) { return null; } - Class[] types = new Class[paramClassnames.length]; + Class [] types = new Class[paramClassnames.length]; for (int i = 0; i < paramClassnames.length; i++) { types[i] = this.getClass().getClassLoader().loadClass(paramClassnames[i]); } http://git-wip-us.apache.org/repos/asf/zeppelin/blob/0d746fa2/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterEventClient.java ---------------------------------------------------------------------- diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterEventClient.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterEventClient.java index 37a0c6a..287095d 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterEventClient.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterEventClient.java @@ -17,11 +17,6 @@ package org.apache.zeppelin.interpreter.remote; import com.google.gson.Gson; -import java.io.IOException; -import java.nio.ByteBuffer; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; import org.apache.thrift.TException; import org.apache.zeppelin.display.AngularObject; import org.apache.zeppelin.display.AngularObjectRegistryListener; @@ -43,12 +38,18 @@ import org.apache.zeppelin.resource.ResourceSet; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import java.io.IOException; +import java.nio.ByteBuffer; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + /** - * This class is used to communicate with ZeppelinServer via thrift. All the methods are - * synchronized because thrift client is not thread safe. + * This class is used to communicate with ZeppelinServer via thrift. + * All the methods are synchronized because thrift client is not thread safe. */ -public class RemoteInterpreterEventClient - implements ResourcePoolConnector, AngularObjectRegistryListener { +public class RemoteInterpreterEventClient implements ResourcePoolConnector, + AngularObjectRegistryListener { private final Logger LOGGER = LoggerFactory.getLogger(RemoteInterpreterEventClient.class); private final Gson gson = new Gson(); @@ -108,7 +109,10 @@ public class RemoteInterpreterEventClient */ @Override public synchronized Object invokeMethod( - ResourceId resourceId, String methodName, Class[] paramTypes, Object[] params) { + ResourceId resourceId, + String methodName, + Class[] paramTypes, + Object[] params) { LOGGER.debug("Request Invoke method {} of Resource {}", methodName, resourceId.getName()); return null; @@ -211,11 +215,8 @@ public class RemoteInterpreterEventClient } public synchronized void onInterpreterOutputUpdate( - String noteId, - String paragraphId, - int outputIndex, - InterpreterResult.Type type, - String output) { + String noteId, String paragraphId, int outputIndex, + InterpreterResult.Type type, String output) { try { intpEventServiceClient.updateOutput( new OutputUpdateEvent(noteId, paragraphId, outputIndex, type.name(), output, null)); @@ -235,7 +236,7 @@ public class RemoteInterpreterEventClient } private List<org.apache.zeppelin.interpreter.thrift.RemoteInterpreterResultMessage> - convertToThrift(List<InterpreterResultMessage> messages) { + convertToThrift(List<InterpreterResultMessage> messages) { List<org.apache.zeppelin.interpreter.thrift.RemoteInterpreterResultMessage> thriftMessages = new ArrayList<>(); for (InterpreterResultMessage message : messages) { @@ -246,11 +247,10 @@ public class RemoteInterpreterEventClient return thriftMessages; } - public synchronized void runParagraphs( - String noteId, - List<String> paragraphIds, - List<Integer> paragraphIndices, - String curParagraphId) { + public synchronized void runParagraphs(String noteId, + List<String> paragraphIds, + List<Integer> paragraphIndices, + String curParagraphId) { RunParagraphsEvent event = new RunParagraphsEvent(noteId, paragraphIds, paragraphIndices, curParagraphId); try { @@ -271,13 +271,10 @@ public class RemoteInterpreterEventClient } } + public synchronized void onAppOutputUpdate( - String noteId, - String paragraphId, - int index, - String appId, - InterpreterResult.Type type, - String output) { + String noteId, String paragraphId, int index, String appId, + InterpreterResult.Type type, String output) { AppOutputUpdateEvent event = new AppOutputUpdateEvent(noteId, paragraphId, appId, index, type.name(), output); try { @@ -287,8 +284,8 @@ public class RemoteInterpreterEventClient } } - public synchronized void onAppStatusUpdate( - String noteId, String paragraphId, String appId, String status) { + public synchronized void onAppStatusUpdate(String noteId, String paragraphId, String appId, + String status) { AppStatusUpdateEvent event = new AppStatusUpdateEvent(noteId, paragraphId, appId, status); try { intpEventServiceClient.updateAppStatus(event); @@ -324,8 +321,8 @@ public class RemoteInterpreterEventClient } @Override - public synchronized void onRemove( - String interpreterGroupId, String name, String noteId, String paragraphId) { + public synchronized void onRemove(String interpreterGroupId, String name, String noteId, + String paragraphId) { try { intpEventServiceClient.removeAngularObject(intpGroupId, noteId, paragraphId, name); } catch (TException e) {
