You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zeppelin.apache.org by mi...@apache.org on 2016/09/28 03:32:11 UTC

zeppelin git commit: [MINOR] Change Markdown class name from MarkdownInterpreter to Markdown

Repository: zeppelin
Updated Branches:
  refs/heads/master aff653bca -> 46ecf77b7


[MINOR] Change Markdown class name from MarkdownInterpreter to Markdown

### What is this PR for?
Markdown interpreter's class name have changed from `Markdown` to `MarkdownInterpreter` in #1384 and this will bring some compatibility issue in case user have `Markdown` class specified in `conf/interpreter.json` file. This PR rollbacks markdown class name from `MarkdownInterpreter` to `Markdown` to avoid side effect

### What type of PR is it?
Hotfix

### Questions:
* Does the licenses files need update? no
* Is there breaking changes for older versions? no
* Does this needs documentation? no

Author: Mina Lee <mi...@apache.org>

Closes #1449 from minahlee/update/markdownClassName and squashes the following commits:

7bdad44 [Mina Lee] Change classname of MarkdownInterpreter -> Markdown


Project: http://git-wip-us.apache.org/repos/asf/zeppelin/repo
Commit: http://git-wip-us.apache.org/repos/asf/zeppelin/commit/46ecf77b
Tree: http://git-wip-us.apache.org/repos/asf/zeppelin/tree/46ecf77b
Diff: http://git-wip-us.apache.org/repos/asf/zeppelin/diff/46ecf77b

Branch: refs/heads/master
Commit: 46ecf77b7bf9cf81375136172e9dab127e17a545
Parents: aff653b
Author: Mina Lee <mi...@apache.org>
Authored: Fri Sep 23 17:11:34 2016 +0900
Committer: Mina Lee <mi...@apache.org>
Committed: Wed Sep 28 12:32:01 2016 +0900

----------------------------------------------------------------------
 .../org/apache/zeppelin/markdown/Markdown.java  | 124 +++++++++++++++++++
 .../zeppelin/markdown/MarkdownInterpreter.java  | 124 -------------------
 .../src/main/resources/interpreter-setting.json |   2 +-
 .../zeppelin/markdown/Markdown4jParserTest.java |   6 +-
 .../zeppelin/markdown/PegdownParserTest.java    |   6 +-
 5 files changed, 131 insertions(+), 131 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zeppelin/blob/46ecf77b/markdown/src/main/java/org/apache/zeppelin/markdown/Markdown.java
----------------------------------------------------------------------
diff --git a/markdown/src/main/java/org/apache/zeppelin/markdown/Markdown.java b/markdown/src/main/java/org/apache/zeppelin/markdown/Markdown.java
new file mode 100644
index 0000000..a811eab
--- /dev/null
+++ b/markdown/src/main/java/org/apache/zeppelin/markdown/Markdown.java
@@ -0,0 +1,124 @@
+/*
+ * 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
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.markdown;
+
+import java.io.IOException;
+import java.util.List;
+import java.util.Properties;
+
+import org.apache.zeppelin.interpreter.Interpreter;
+import org.apache.zeppelin.interpreter.InterpreterContext;
+import org.apache.zeppelin.interpreter.InterpreterPropertyBuilder;
+import org.apache.zeppelin.interpreter.InterpreterResult;
+import org.apache.zeppelin.interpreter.InterpreterResult.Code;
+import org.apache.zeppelin.interpreter.InterpreterUtils;
+import org.apache.zeppelin.interpreter.thrift.InterpreterCompletion;
+import org.apache.zeppelin.scheduler.Scheduler;
+import org.apache.zeppelin.scheduler.SchedulerFactory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/** MarkdownInterpreter interpreter for Zeppelin. */
+public class Markdown extends Interpreter {
+  private static final Logger LOGGER = LoggerFactory.getLogger(Markdown.class);
+
+  private MarkdownParser parser;
+
+  /** Markdown Parser Type. */
+  public enum MarkdownParserType {
+    PEGDOWN {
+      @Override
+      public String toString() {
+        return PARSER_TYPE_PEGDOWN;
+      }
+    },
+
+    MARKDOWN4j {
+      @Override
+      public String toString() {
+        return PARSER_TYPE_MARKDOWN4J;
+      }
+    }
+  }
+
+  public static final String MARKDOWN_PARSER_TYPE = "markdown.parser.type";
+  public static final String PARSER_TYPE_PEGDOWN = "pegdown";
+  public static final String PARSER_TYPE_MARKDOWN4J = "markdown4j";
+
+  public Markdown(Properties property) {
+    super(property);
+  }
+
+  public static MarkdownParser createMarkdownParser(String parserType) {
+    LOGGER.debug("Creating " + parserType + " markdown interpreter");
+
+    if (MarkdownParserType.PEGDOWN.toString().equals(parserType)) {
+      return new PegdownParser();
+    } else {
+      /** default parser. */
+      return new Markdown4jParser();
+    }
+  }
+
+  @Override
+  public void open() {
+    String parserType = getProperty(MARKDOWN_PARSER_TYPE);
+    parser = createMarkdownParser(parserType);
+  }
+
+  @Override
+  public void close() {}
+
+  @Override
+  public InterpreterResult interpret(String markdownText, InterpreterContext interpreterContext) {
+    String html;
+
+    try {
+      html = parser.render(markdownText);
+    } catch (RuntimeException e) {
+      LOGGER.error("Exception in MarkdownInterpreter while interpret ", e);
+      return new InterpreterResult(Code.ERROR, InterpreterUtils.getMostRelevantMessage(e));
+    }
+
+    return new InterpreterResult(Code.SUCCESS, "%html " + html);
+  }
+
+  @Override
+  public void cancel(InterpreterContext context) {}
+
+  @Override
+  public FormType getFormType() {
+    return FormType.SIMPLE;
+  }
+
+  @Override
+  public int getProgress(InterpreterContext context) {
+    return 0;
+  }
+
+  @Override
+  public Scheduler getScheduler() {
+    return SchedulerFactory.singleton()
+        .createOrGetParallelScheduler(Markdown.class.getName() + this.hashCode(), 5);
+  }
+
+  @Override
+  public List<InterpreterCompletion> completion(String buf, int cursor) {
+    return null;
+  }
+}

http://git-wip-us.apache.org/repos/asf/zeppelin/blob/46ecf77b/markdown/src/main/java/org/apache/zeppelin/markdown/MarkdownInterpreter.java
----------------------------------------------------------------------
diff --git a/markdown/src/main/java/org/apache/zeppelin/markdown/MarkdownInterpreter.java b/markdown/src/main/java/org/apache/zeppelin/markdown/MarkdownInterpreter.java
deleted file mode 100644
index ca2eb73..0000000
--- a/markdown/src/main/java/org/apache/zeppelin/markdown/MarkdownInterpreter.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * 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
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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.markdown;
-
-import java.io.IOException;
-import java.util.List;
-import java.util.Properties;
-
-import org.apache.zeppelin.interpreter.Interpreter;
-import org.apache.zeppelin.interpreter.InterpreterContext;
-import org.apache.zeppelin.interpreter.InterpreterPropertyBuilder;
-import org.apache.zeppelin.interpreter.InterpreterResult;
-import org.apache.zeppelin.interpreter.InterpreterResult.Code;
-import org.apache.zeppelin.interpreter.InterpreterUtils;
-import org.apache.zeppelin.interpreter.thrift.InterpreterCompletion;
-import org.apache.zeppelin.scheduler.Scheduler;
-import org.apache.zeppelin.scheduler.SchedulerFactory;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/** MarkdownInterpreter interpreter for Zeppelin. */
-public class MarkdownInterpreter extends Interpreter {
-  private static final Logger LOGGER = LoggerFactory.getLogger(MarkdownInterpreter.class);
-
-  private MarkdownParser parser;
-
-  /** Markdown Parser Type. */
-  public enum MarkdownParserType {
-    PEGDOWN {
-      @Override
-      public String toString() {
-        return PARSER_TYPE_PEGDOWN;
-      }
-    },
-
-    MARKDOWN4j {
-      @Override
-      public String toString() {
-        return PARSER_TYPE_MARKDOWN4J;
-      }
-    }
-  }
-
-  public static final String MARKDOWN_PARSER_TYPE = "markdown.parser.type";
-  public static final String PARSER_TYPE_PEGDOWN = "pegdown";
-  public static final String PARSER_TYPE_MARKDOWN4J = "markdown4j";
-
-  public MarkdownInterpreter(Properties property) {
-    super(property);
-  }
-
-  public static MarkdownParser createMarkdownParser(String parserType) {
-    LOGGER.debug("Creating " + parserType + " markdown interpreter");
-
-    if (MarkdownParserType.PEGDOWN.toString().equals(parserType)) {
-      return new PegdownParser();
-    } else {
-      /** default parser. */
-      return new Markdown4jParser();
-    }
-  }
-
-  @Override
-  public void open() {
-    String parserType = getProperty(MARKDOWN_PARSER_TYPE);
-    parser = createMarkdownParser(parserType);
-  }
-
-  @Override
-  public void close() {}
-
-  @Override
-  public InterpreterResult interpret(String markdownText, InterpreterContext interpreterContext) {
-    String html;
-
-    try {
-      html = parser.render(markdownText);
-    } catch (RuntimeException e) {
-      LOGGER.error("Exception in MarkdownInterpreter while interpret ", e);
-      return new InterpreterResult(Code.ERROR, InterpreterUtils.getMostRelevantMessage(e));
-    }
-
-    return new InterpreterResult(Code.SUCCESS, "%html " + html);
-  }
-
-  @Override
-  public void cancel(InterpreterContext context) {}
-
-  @Override
-  public FormType getFormType() {
-    return FormType.SIMPLE;
-  }
-
-  @Override
-  public int getProgress(InterpreterContext context) {
-    return 0;
-  }
-
-  @Override
-  public Scheduler getScheduler() {
-    return SchedulerFactory.singleton()
-        .createOrGetParallelScheduler(MarkdownInterpreter.class.getName() + this.hashCode(), 5);
-  }
-
-  @Override
-  public List<InterpreterCompletion> completion(String buf, int cursor) {
-    return null;
-  }
-}

http://git-wip-us.apache.org/repos/asf/zeppelin/blob/46ecf77b/markdown/src/main/resources/interpreter-setting.json
----------------------------------------------------------------------
diff --git a/markdown/src/main/resources/interpreter-setting.json b/markdown/src/main/resources/interpreter-setting.json
index 38a6a76..8673ef9 100644
--- a/markdown/src/main/resources/interpreter-setting.json
+++ b/markdown/src/main/resources/interpreter-setting.json
@@ -2,7 +2,7 @@
   {
     "group": "md",
     "name": "md",
-    "className": "org.apache.zeppelin.markdown.MarkdownInterpreter",
+    "className": "org.apache.zeppelin.markdown.Markdown",
     "properties": {
       "markdown.parser.type": {
         "envName": "MARKDOWN_PARSER_TYPE",

http://git-wip-us.apache.org/repos/asf/zeppelin/blob/46ecf77b/markdown/src/test/java/org/apache/zeppelin/markdown/Markdown4jParserTest.java
----------------------------------------------------------------------
diff --git a/markdown/src/test/java/org/apache/zeppelin/markdown/Markdown4jParserTest.java b/markdown/src/test/java/org/apache/zeppelin/markdown/Markdown4jParserTest.java
index 6da2757..54448a2 100644
--- a/markdown/src/test/java/org/apache/zeppelin/markdown/Markdown4jParserTest.java
+++ b/markdown/src/test/java/org/apache/zeppelin/markdown/Markdown4jParserTest.java
@@ -28,13 +28,13 @@ import static org.junit.Assert.assertEquals;
 
 public class Markdown4jParserTest {
 
-  MarkdownInterpreter md;
+  Markdown md;
 
   @Before
   public void setUp() throws Exception {
     Properties props = new Properties();
-    props.put(MarkdownInterpreter.MARKDOWN_PARSER_TYPE, MarkdownInterpreter.PARSER_TYPE_MARKDOWN4J);
-    md = new MarkdownInterpreter(props);
+    props.put(Markdown.MARKDOWN_PARSER_TYPE, Markdown.PARSER_TYPE_MARKDOWN4J);
+    md = new Markdown(props);
     md.open();
   }
 

http://git-wip-us.apache.org/repos/asf/zeppelin/blob/46ecf77b/markdown/src/test/java/org/apache/zeppelin/markdown/PegdownParserTest.java
----------------------------------------------------------------------
diff --git a/markdown/src/test/java/org/apache/zeppelin/markdown/PegdownParserTest.java b/markdown/src/test/java/org/apache/zeppelin/markdown/PegdownParserTest.java
index 66d6d76..3b60155 100644
--- a/markdown/src/test/java/org/apache/zeppelin/markdown/PegdownParserTest.java
+++ b/markdown/src/test/java/org/apache/zeppelin/markdown/PegdownParserTest.java
@@ -29,13 +29,13 @@ import org.junit.Test;
 
 public class PegdownParserTest {
 
-  MarkdownInterpreter md;
+  Markdown md;
 
   @Before
   public void setUp() throws Exception {
     Properties props = new Properties();
-    props.put(MarkdownInterpreter.MARKDOWN_PARSER_TYPE, MarkdownInterpreter.PARSER_TYPE_PEGDOWN);
-    md = new MarkdownInterpreter(props);
+    props.put(Markdown.MARKDOWN_PARSER_TYPE, Markdown.PARSER_TYPE_PEGDOWN);
+    md = new Markdown(props);
     md.open();
   }