http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/669d408d/zeppelin-interpreter/src/test/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterTest.java
----------------------------------------------------------------------
diff --git 
a/zeppelin-interpreter/src/test/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterTest.java
 
b/zeppelin-interpreter/src/test/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterTest.java
new file mode 100644
index 0000000..58299bb
--- /dev/null
+++ 
b/zeppelin-interpreter/src/test/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterTest.java
@@ -0,0 +1,446 @@
+/*
+ * 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.interpreter.remote;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
+import org.apache.thrift.transport.TTransportException;
+import org.apache.zeppelin.display.GUI;
+import org.apache.zeppelin.interpreter.InterpreterContext;
+import org.apache.zeppelin.interpreter.InterpreterGroup;
+import org.apache.zeppelin.interpreter.InterpreterResult;
+import org.apache.zeppelin.interpreter.remote.RemoteInterpreter;
+import org.apache.zeppelin.interpreter.remote.RemoteInterpreterProcess;
+import org.apache.zeppelin.interpreter.remote.mock.MockInterpreterA;
+import org.apache.zeppelin.interpreter.remote.mock.MockInterpreterB;
+import org.apache.zeppelin.scheduler.Job;
+import org.apache.zeppelin.scheduler.Job.Status;
+import org.apache.zeppelin.scheduler.Scheduler;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class RemoteInterpreterTest {
+
+
+  private InterpreterGroup intpGroup;
+  private HashMap<String, String> env;
+
+  @Before
+  public void setUp() throws Exception {
+    intpGroup = new InterpreterGroup();
+    env = new HashMap<String, String>();
+    env.put("ZEPPELIN_CLASSPATH", new 
File("./target/test-classes").getAbsolutePath());
+  }
+
+  @After
+  public void tearDown() throws Exception {
+    intpGroup.clone();
+    intpGroup.destroy();
+  }
+
+  @Test
+  public void testRemoteInterperterCall() throws TTransportException, 
IOException {
+    Properties p = new Properties();
+
+    RemoteInterpreter intpA = new RemoteInterpreter(
+        p,
+        MockInterpreterA.class.getName(),
+        new File("../bin/interpreter.sh").getAbsolutePath(),
+        "fake",
+        env
+        );
+
+    intpGroup.add(intpA);
+    intpA.setInterpreterGroup(intpGroup);
+
+    RemoteInterpreter intpB = new RemoteInterpreter(
+        p,
+        MockInterpreterB.class.getName(),
+        new File("../bin/interpreter.sh").getAbsolutePath(),
+        "fake",
+        env
+        );
+
+    intpGroup.add(intpB);
+    intpB.setInterpreterGroup(intpGroup);
+
+
+    RemoteInterpreterProcess process = intpA.getInterpreterProcess();
+    process.equals(intpB.getInterpreterProcess());
+
+    assertFalse(process.isRunning());
+    assertEquals(0, process.getNumIdleClient());
+    assertEquals(0, process.referenceCount());
+
+    intpA.open();
+    assertTrue(process.isRunning());
+    assertEquals(1, process.getNumIdleClient());
+    assertEquals(1, process.referenceCount());
+
+    intpA.interpret("1",
+        new InterpreterContext(
+            "id",
+            "title",
+            "text",
+            new HashMap<String, Object>(),
+            new GUI()));
+
+    intpB.open();
+    assertEquals(2, process.referenceCount());
+
+    intpA.close();
+    assertEquals(1, process.referenceCount());
+    intpB.close();
+    assertEquals(0, process.referenceCount());
+
+    assertFalse(process.isRunning());
+
+  }
+
+  @Test
+  public void testRemoteSchedulerSharing() throws TTransportException, 
IOException {
+    Properties p = new Properties();
+
+    RemoteInterpreter intpA = new RemoteInterpreter(
+        p,
+        MockInterpreterA.class.getName(),
+        new File("../bin/interpreter.sh").getAbsolutePath(),
+        "fake",
+        env
+        );
+
+    intpGroup.add(intpA);
+    intpA.setInterpreterGroup(intpGroup);
+
+    RemoteInterpreter intpB = new RemoteInterpreter(
+        p,
+        MockInterpreterB.class.getName(),
+        new File("../bin/interpreter.sh").getAbsolutePath(),
+        "fake",
+        env
+        );
+
+    intpGroup.add(intpB);
+    intpB.setInterpreterGroup(intpGroup);
+
+    intpA.open();
+    intpB.open();
+
+    long start = System.currentTimeMillis();
+    InterpreterResult ret = intpA.interpret("500",
+        new InterpreterContext(
+            "id",
+            "title",
+            "text",
+            new HashMap<String, Object>(),
+            new GUI()));
+    assertEquals("500", ret.message());
+
+    ret = intpB.interpret("500",
+        new InterpreterContext(
+            "id",
+            "title",
+            "text",
+            new HashMap<String, Object>(),
+            new GUI()));
+    assertEquals("1000", ret.message());
+    long end = System.currentTimeMillis();
+    assertTrue(end - start >= 1000);
+
+
+    intpA.close();
+    intpB.close();
+
+    RemoteInterpreterProcess process = intpA.getInterpreterProcess();
+    assertFalse(process.isRunning());
+  }
+
+  @Test
+  public void testRemoteSchedulerSharingSubmit() throws TTransportException, 
IOException, InterruptedException {
+    Properties p = new Properties();
+
+    final RemoteInterpreter intpA = new RemoteInterpreter(
+        p,
+        MockInterpreterA.class.getName(),
+        new File("../bin/interpreter.sh").getAbsolutePath(),
+        "fake",
+        env
+        );
+
+    intpGroup.add(intpA);
+    intpA.setInterpreterGroup(intpGroup);
+
+    final RemoteInterpreter intpB = new RemoteInterpreter(
+        p,
+        MockInterpreterB.class.getName(),
+        new File("../bin/interpreter.sh").getAbsolutePath(),
+        "fake",
+        env
+        );
+
+    intpGroup.add(intpB);
+    intpB.setInterpreterGroup(intpGroup);
+
+    intpA.open();
+    intpB.open();
+
+    long start = System.currentTimeMillis();
+    Job jobA = new Job("jobA", null) {
+
+      @Override
+      public int progress() {
+        return 0;
+      }
+
+      @Override
+      public Map<String, Object> info() {
+        return null;
+      }
+
+      @Override
+      protected Object jobRun() throws Throwable {
+        return intpA.interpret("500",
+            new InterpreterContext(
+                "jobA",
+                "title",
+                "text",
+                new HashMap<String, Object>(),
+                new GUI()));
+      }
+
+      @Override
+      protected boolean jobAbort() {
+        return false;
+      }
+
+    };
+    intpA.getScheduler().submit(jobA);
+
+    Job jobB = new Job("jobB", null) {
+
+      @Override
+      public int progress() {
+        return 0;
+      }
+
+      @Override
+      public Map<String, Object> info() {
+        return null;
+      }
+
+      @Override
+      protected Object jobRun() throws Throwable {
+        return intpB.interpret("500",
+            new InterpreterContext(
+                "jobB",
+                "title",
+                "text",
+                new HashMap<String, Object>(),
+                new GUI()));
+      }
+
+      @Override
+      protected boolean jobAbort() {
+        return false;
+      }
+
+    };
+    intpB.getScheduler().submit(jobB);
+
+    // wait until both job finished
+    while (jobA.getStatus() != Status.FINISHED ||
+           jobB.getStatus() != Status.FINISHED) {
+      Thread.sleep(100);
+    }
+
+    long end = System.currentTimeMillis();
+    assertTrue(end - start >= 1000);
+
+    assertEquals("1000", ((InterpreterResult) jobB.getReturn()).message());
+
+    intpA.close();
+    intpB.close();
+
+    RemoteInterpreterProcess process = intpA.getInterpreterProcess();
+    assertFalse(process.isRunning());
+  }
+
+  @Test
+  public void testRunOrderPreserved() throws InterruptedException {
+    Properties p = new Properties();
+
+    final RemoteInterpreter intpA = new RemoteInterpreter(
+        p,
+        MockInterpreterA.class.getName(),
+        new File("../bin/interpreter.sh").getAbsolutePath(),
+        "fake",
+        env
+        );
+
+    intpGroup.add(intpA);
+    intpA.setInterpreterGroup(intpGroup);
+
+    intpA.open();
+
+    int concurrency = 3;
+    final List<String> results = new LinkedList<String>();
+
+    Scheduler scheduler = intpA.getScheduler();
+    for (int i = 0; i < concurrency; i++) {
+      final String jobId = Integer.toString(i);
+      scheduler.submit(new Job(jobId, Integer.toString(i), null, 200) {
+
+        @Override
+        public int progress() {
+          return 0;
+        }
+
+        @Override
+        public Map<String, Object> info() {
+          return null;
+        }
+
+        @Override
+        protected Object jobRun() throws Throwable {
+          InterpreterResult ret = intpA.interpret(getJobName(), new 
InterpreterContext(
+              jobId,
+              "title",
+              "text",
+              new HashMap<String, Object>(),
+              new GUI()));
+
+          synchronized (results) {
+            results.add(ret.message());
+            results.notify();
+          }
+          return null;
+        }
+
+        @Override
+        protected boolean jobAbort() {
+          return false;
+        }
+
+      });
+    }
+
+    // wait for job finished
+    synchronized (results) {
+      while (results.size() != concurrency) {
+        results.wait(300);
+      }
+    }
+
+    int i = 0;
+    for (String result : results) {
+      assertEquals(Integer.toString(i++), result);
+    }
+    assertEquals(concurrency, i);
+
+    intpA.close();
+  }
+
+
+  @Test
+  public void testRunParallel() throws InterruptedException {
+    Properties p = new Properties();
+    p.put("parallel", "true");
+
+    final RemoteInterpreter intpA = new RemoteInterpreter(
+        p,
+        MockInterpreterA.class.getName(),
+        new File("../bin/interpreter.sh").getAbsolutePath(),
+        "fake",
+        env
+        );
+
+    intpGroup.add(intpA);
+    intpA.setInterpreterGroup(intpGroup);
+
+    intpA.open();
+
+    int concurrency = 4;
+    final int timeToSleep = 1000;
+    final List<String> results = new LinkedList<String>();
+    long start = System.currentTimeMillis();
+
+    Scheduler scheduler = intpA.getScheduler();
+    for (int i = 0; i < concurrency; i++) {
+      final String jobId = Integer.toString(i);
+      scheduler.submit(new Job(jobId, Integer.toString(i), null, 300) {
+
+        @Override
+        public int progress() {
+          return 0;
+        }
+
+        @Override
+        public Map<String, Object> info() {
+          return null;
+        }
+
+        @Override
+        protected Object jobRun() throws Throwable {
+          String stmt = Integer.toString(timeToSleep);
+          InterpreterResult ret = intpA.interpret(stmt, new InterpreterContext(
+              jobId,
+              "title",
+              "text",
+              new HashMap<String, Object>(),
+              new GUI()));
+
+          synchronized (results) {
+            results.add(ret.message());
+            results.notify();
+          }
+          return stmt;
+        }
+
+        @Override
+        protected boolean jobAbort() {
+          return false;
+        }
+
+      });
+    }
+
+    // wait for job finished
+    synchronized (results) {
+      while (results.size() != concurrency) {
+        results.wait(300);
+      }
+    }
+
+    long end = System.currentTimeMillis();
+
+    assertTrue(end - start < timeToSleep * concurrency);
+
+    intpA.close();
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/669d408d/zeppelin-interpreter/src/test/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterUtilsTest.java
----------------------------------------------------------------------
diff --git 
a/zeppelin-interpreter/src/test/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterUtilsTest.java
 
b/zeppelin-interpreter/src/test/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterUtilsTest.java
new file mode 100644
index 0000000..975d6ea
--- /dev/null
+++ 
b/zeppelin-interpreter/src/test/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterUtilsTest.java
@@ -0,0 +1,34 @@
+/*
+ * 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.interpreter.remote;
+
+import static org.junit.Assert.assertTrue;
+
+import java.io.IOException;
+
+import org.apache.zeppelin.interpreter.remote.RemoteInterpreterUtils;
+import org.junit.Test;
+
+public class RemoteInterpreterUtilsTest {
+
+  @Test
+  public void testFindRandomAvailablePortOnAllLocalInterfaces() throws 
IOException {
+    
assertTrue(RemoteInterpreterUtils.findRandomAvailablePortOnAllLocalInterfaces() 
> 0);
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/669d408d/zeppelin-interpreter/src/test/java/org/apache/zeppelin/interpreter/remote/mock/MockInterpreterA.java
----------------------------------------------------------------------
diff --git 
a/zeppelin-interpreter/src/test/java/org/apache/zeppelin/interpreter/remote/mock/MockInterpreterA.java
 
b/zeppelin-interpreter/src/test/java/org/apache/zeppelin/interpreter/remote/mock/MockInterpreterA.java
new file mode 100644
index 0000000..51f3c2c
--- /dev/null
+++ 
b/zeppelin-interpreter/src/test/java/org/apache/zeppelin/interpreter/remote/mock/MockInterpreterA.java
@@ -0,0 +1,101 @@
+/*
+ * 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.interpreter.remote.mock;
+
+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.InterpreterException;
+import org.apache.zeppelin.interpreter.InterpreterPropertyBuilder;
+import org.apache.zeppelin.interpreter.InterpreterResult;
+import org.apache.zeppelin.interpreter.InterpreterResult.Code;
+import org.apache.zeppelin.scheduler.Scheduler;
+import org.apache.zeppelin.scheduler.SchedulerFactory;
+
+public class MockInterpreterA extends Interpreter {
+  static {
+    Interpreter.register(
+        "interpreterA",
+        "group1",
+        MockInterpreterA.class.getName(),
+        new InterpreterPropertyBuilder()
+            .add("p1", "v1", "property1").build());
+
+  }
+
+  private String lastSt;
+
+  public MockInterpreterA(Properties property) {
+    super(property);
+  }
+
+  @Override
+  public void open() {
+    //new RuntimeException().printStackTrace();
+  }
+
+  @Override
+  public void close() {
+  }
+
+  public String getLastStatement() {
+    return lastSt;
+  }
+
+  @Override
+  public InterpreterResult interpret(String st, InterpreterContext context) {
+    try {
+      Thread.sleep(Long.parseLong(st));
+      this.lastSt = st;
+    } catch (NumberFormatException | InterruptedException e) {
+      throw new InterpreterException(e);
+    }
+    return new InterpreterResult(Code.SUCCESS, st);
+  }
+
+  @Override
+  public void cancel(InterpreterContext context) {
+
+  }
+
+  @Override
+  public FormType getFormType() {
+    return FormType.NATIVE;
+  }
+
+  @Override
+  public int getProgress(InterpreterContext context) {
+    return 0;
+  }
+
+  @Override
+  public List<String> completion(String buf, int cursor) {
+    return null;
+  }
+
+  @Override
+  public Scheduler getScheduler() {
+    if (getProperty("parallel") != null && 
getProperty("parallel").equals("true")) {
+      return 
SchedulerFactory.singleton().createOrGetParallelScheduler("interpreter_" + 
this.hashCode(), 10);
+    } else {
+      return 
SchedulerFactory.singleton().createOrGetFIFOScheduler("interpreter_" + 
this.hashCode());
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/669d408d/zeppelin-interpreter/src/test/java/org/apache/zeppelin/interpreter/remote/mock/MockInterpreterB.java
----------------------------------------------------------------------
diff --git 
a/zeppelin-interpreter/src/test/java/org/apache/zeppelin/interpreter/remote/mock/MockInterpreterB.java
 
b/zeppelin-interpreter/src/test/java/org/apache/zeppelin/interpreter/remote/mock/MockInterpreterB.java
new file mode 100644
index 0000000..c7097f2
--- /dev/null
+++ 
b/zeppelin-interpreter/src/test/java/org/apache/zeppelin/interpreter/remote/mock/MockInterpreterB.java
@@ -0,0 +1,118 @@
+/*
+ * 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.interpreter.remote.mock;
+
+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.InterpreterException;
+import org.apache.zeppelin.interpreter.InterpreterGroup;
+import org.apache.zeppelin.interpreter.InterpreterPropertyBuilder;
+import org.apache.zeppelin.interpreter.InterpreterResult;
+import org.apache.zeppelin.interpreter.InterpreterResult.Code;
+import org.apache.zeppelin.interpreter.WrappedInterpreter;
+import org.apache.zeppelin.scheduler.Scheduler;
+
+public class MockInterpreterB extends Interpreter {
+  static {
+    Interpreter.register(
+        "interpreterB",
+        "group1",
+        MockInterpreterA.class.getName(),
+        new InterpreterPropertyBuilder()
+            .add("p1", "v1", "property1").build());
+
+  }
+  public MockInterpreterB(Properties property) {
+    super(property);
+  }
+
+  @Override
+  public void open() {
+    //new RuntimeException().printStackTrace();
+  }
+
+  @Override
+  public void close() {
+  }
+
+  @Override
+  public InterpreterResult interpret(String st, InterpreterContext context) {
+    MockInterpreterA intpA = getInterpreterA();
+    String intpASt = intpA.getLastStatement();
+    long timeToSleep = Long.parseLong(st);
+    if (intpASt != null) {
+      timeToSleep += Long.parseLong(intpASt);
+    }
+    try {
+      Thread.sleep(timeToSleep);
+    } catch (NumberFormatException | InterruptedException e) {
+      throw new InterpreterException(e);
+    }
+    return new InterpreterResult(Code.SUCCESS, Long.toString(timeToSleep));
+  }
+
+  @Override
+  public void cancel(InterpreterContext context) {
+
+  }
+
+  @Override
+  public FormType getFormType() {
+    return FormType.NATIVE;
+  }
+
+  @Override
+  public int getProgress(InterpreterContext context) {
+    return 0;
+  }
+
+  @Override
+  public List<String> completion(String buf, int cursor) {
+    return null;
+  }
+
+  public MockInterpreterA getInterpreterA() {
+    InterpreterGroup interpreterGroup = getInterpreterGroup();
+    for (Interpreter intp : interpreterGroup) {
+      if (intp.getClassName().equals(MockInterpreterA.class.getName())) {
+        Interpreter p = intp;
+        while (p instanceof WrappedInterpreter) {
+          p = ((WrappedInterpreter) p).getInnerInterpreter();
+        }
+        return (MockInterpreterA) p;
+      }
+    }
+    return null;
+  }
+
+  @Override
+  public Scheduler getScheduler() {
+    InterpreterGroup interpreterGroup = getInterpreterGroup();
+    for (Interpreter intp : interpreterGroup) {
+      if (intp.getClassName().equals(MockInterpreterA.class.getName())) {
+        return intp.getScheduler();
+      }
+    }
+
+    return null;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/669d408d/zeppelin-interpreter/src/test/java/org/apache/zeppelin/scheduler/FIFOSchedulerTest.java
----------------------------------------------------------------------
diff --git 
a/zeppelin-interpreter/src/test/java/org/apache/zeppelin/scheduler/FIFOSchedulerTest.java
 
b/zeppelin-interpreter/src/test/java/org/apache/zeppelin/scheduler/FIFOSchedulerTest.java
new file mode 100644
index 0000000..3d8495c
--- /dev/null
+++ 
b/zeppelin-interpreter/src/test/java/org/apache/zeppelin/scheduler/FIFOSchedulerTest.java
@@ -0,0 +1,94 @@
+/*
+ * 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.scheduler;
+
+import org.apache.zeppelin.scheduler.Job;
+import org.apache.zeppelin.scheduler.Scheduler;
+import org.apache.zeppelin.scheduler.SchedulerFactory;
+import org.apache.zeppelin.scheduler.Job.Status;
+
+import junit.framework.TestCase;
+
+public class FIFOSchedulerTest extends TestCase {
+
+       private SchedulerFactory schedulerSvc;
+
+       @Override
+  public void setUp() throws Exception{
+               schedulerSvc = new SchedulerFactory();
+       }
+
+       @Override
+  public void tearDown(){
+
+       }
+
+       public void testRun() throws InterruptedException{
+               Scheduler s = schedulerSvc.createOrGetFIFOScheduler("test");
+               assertEquals(0, s.getJobsRunning().size());
+               assertEquals(0, s.getJobsWaiting().size());
+
+               Job job1 = new SleepingJob("job1", null, 500);
+               Job job2 = new SleepingJob("job2", null, 500);
+
+               s.submit(job1);
+               s.submit(job2);
+               Thread.sleep(200);
+
+               assertEquals(Status.RUNNING, job1.getStatus());
+               assertEquals(Status.PENDING, job2.getStatus());
+               assertEquals(1, s.getJobsRunning().size());
+               assertEquals(1, s.getJobsWaiting().size());
+
+
+               Thread.sleep(500);
+               assertEquals(Status.FINISHED, job1.getStatus());
+               assertEquals(Status.RUNNING, job2.getStatus());
+               assertTrue((500 < (Long)job1.getReturn()));
+               assertEquals(1, s.getJobsRunning().size());
+               assertEquals(0, s.getJobsWaiting().size());
+
+       }
+
+       public void testAbort() throws InterruptedException{
+               Scheduler s = schedulerSvc.createOrGetFIFOScheduler("test");
+               assertEquals(0, s.getJobsRunning().size());
+               assertEquals(0, s.getJobsWaiting().size());
+
+               Job job1 = new SleepingJob("job1", null, 500);
+               Job job2 = new SleepingJob("job2", null, 500);
+
+               s.submit(job1);
+               s.submit(job2);
+
+               Thread.sleep(200);
+
+               job1.abort();
+               job2.abort();
+
+               Thread.sleep(200);
+
+               assertEquals(Status.ABORT, job1.getStatus());
+               assertEquals(Status.ABORT, job2.getStatus());
+
+               assertTrue((500 > (Long)job1.getReturn()));
+               assertEquals(null, job2.getReturn());
+
+
+       }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/669d408d/zeppelin-interpreter/src/test/java/org/apache/zeppelin/scheduler/ParallelSchedulerTest.java
----------------------------------------------------------------------
diff --git 
a/zeppelin-interpreter/src/test/java/org/apache/zeppelin/scheduler/ParallelSchedulerTest.java
 
b/zeppelin-interpreter/src/test/java/org/apache/zeppelin/scheduler/ParallelSchedulerTest.java
new file mode 100644
index 0000000..682f283
--- /dev/null
+++ 
b/zeppelin-interpreter/src/test/java/org/apache/zeppelin/scheduler/ParallelSchedulerTest.java
@@ -0,0 +1,71 @@
+/*
+ * 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.scheduler;
+
+
+import org.apache.zeppelin.scheduler.Job;
+import org.apache.zeppelin.scheduler.Scheduler;
+import org.apache.zeppelin.scheduler.SchedulerFactory;
+import org.apache.zeppelin.scheduler.Job.Status;
+
+import junit.framework.TestCase;
+public class ParallelSchedulerTest extends TestCase {
+
+       private SchedulerFactory schedulerSvc;
+
+       @Override
+  public void setUp() throws Exception{
+               schedulerSvc = new SchedulerFactory();
+       }
+
+       @Override
+  public void tearDown(){
+
+       }
+
+       public void testRun() throws InterruptedException{
+               Scheduler s = schedulerSvc.createOrGetParallelScheduler("test", 
2);
+               assertEquals(0, s.getJobsRunning().size());
+               assertEquals(0, s.getJobsWaiting().size());
+
+               Job job1 = new SleepingJob("job1", null, 500);
+               Job job2 = new SleepingJob("job2", null, 500);
+               Job job3 = new SleepingJob("job3", null, 500);
+
+               s.submit(job1);
+               s.submit(job2);
+               s.submit(job3);
+               Thread.sleep(200);
+
+               assertEquals(Status.RUNNING, job1.getStatus());
+               assertEquals(Status.RUNNING, job2.getStatus());
+               assertEquals(Status.PENDING, job3.getStatus());
+               assertEquals(2, s.getJobsRunning().size());
+               assertEquals(1, s.getJobsWaiting().size());
+
+               Thread.sleep(500);
+
+               assertEquals(Status.FINISHED, job1.getStatus());
+               assertEquals(Status.FINISHED, job2.getStatus());
+               assertEquals(Status.RUNNING, job3.getStatus());
+               assertEquals(1, s.getJobsRunning().size());
+               assertEquals(0, s.getJobsWaiting().size());
+
+       }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/669d408d/zeppelin-interpreter/src/test/java/org/apache/zeppelin/scheduler/RemoteSchedulerTest.java
----------------------------------------------------------------------
diff --git 
a/zeppelin-interpreter/src/test/java/org/apache/zeppelin/scheduler/RemoteSchedulerTest.java
 
b/zeppelin-interpreter/src/test/java/org/apache/zeppelin/scheduler/RemoteSchedulerTest.java
new file mode 100644
index 0000000..2c13ab2
--- /dev/null
+++ 
b/zeppelin-interpreter/src/test/java/org/apache/zeppelin/scheduler/RemoteSchedulerTest.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.scheduler;
+
+import static org.junit.Assert.assertEquals;
+
+import java.io.File;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+
+import org.apache.zeppelin.display.GUI;
+import org.apache.zeppelin.interpreter.InterpreterContext;
+import org.apache.zeppelin.interpreter.InterpreterGroup;
+import org.apache.zeppelin.interpreter.remote.RemoteInterpreter;
+import org.apache.zeppelin.interpreter.remote.mock.MockInterpreterA;
+import org.apache.zeppelin.scheduler.Job;
+import org.apache.zeppelin.scheduler.Scheduler;
+import org.apache.zeppelin.scheduler.SchedulerFactory;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class RemoteSchedulerTest {
+
+  private SchedulerFactory schedulerSvc;
+
+  @Before
+  public void setUp() throws Exception{
+    schedulerSvc = new SchedulerFactory();
+  }
+
+  @After
+  public void tearDown(){
+
+  }
+
+  @Test
+  public void test() throws Exception {
+    Properties p = new Properties();
+    InterpreterGroup intpGroup = new InterpreterGroup();
+    Map<String, String> env = new HashMap<String, String>();
+    env.put("ZEPPELIN_CLASSPATH", new 
File("./target/test-classes").getAbsolutePath());
+
+    final RemoteInterpreter intpA = new RemoteInterpreter(
+        p,
+        MockInterpreterA.class.getName(),
+        new File("../bin/interpreter.sh").getAbsolutePath(),
+        "fake",
+        env
+        );
+
+    intpGroup.add(intpA);
+    intpA.setInterpreterGroup(intpGroup);
+
+    intpA.open();
+
+    Scheduler scheduler = schedulerSvc.createOrGetRemoteScheduler("test",
+        intpA.getInterpreterProcess(),
+        10);
+
+    Job job = new Job("jobId", "jobName", null, 200) {
+
+      @Override
+      public int progress() {
+        return 0;
+      }
+
+      @Override
+      public Map<String, Object> info() {
+        return null;
+      }
+
+      @Override
+      protected Object jobRun() throws Throwable {
+        intpA.interpret("1000", new InterpreterContext(
+            "jobId",
+            "title",
+            "text",
+            new HashMap<String, Object>(),
+            new GUI()));
+        return "1000";
+      }
+
+      @Override
+      protected boolean jobAbort() {
+        return false;
+      }
+    };
+    scheduler.submit(job);
+
+    while (job.isRunning() == false) {
+      Thread.sleep(100);
+    }
+
+    Thread.sleep(500);
+    assertEquals(0, scheduler.getJobsWaiting().size());
+    assertEquals(1, scheduler.getJobsRunning().size());
+
+    Thread.sleep(500);
+
+    assertEquals(0, scheduler.getJobsWaiting().size());
+    assertEquals(0, scheduler.getJobsRunning().size());
+
+    intpA.close();
+    schedulerSvc.removeScheduler("test");
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/669d408d/zeppelin-interpreter/src/test/java/org/apache/zeppelin/scheduler/SleepingJob.java
----------------------------------------------------------------------
diff --git 
a/zeppelin-interpreter/src/test/java/org/apache/zeppelin/scheduler/SleepingJob.java
 
b/zeppelin-interpreter/src/test/java/org/apache/zeppelin/scheduler/SleepingJob.java
new file mode 100644
index 0000000..15f86d7
--- /dev/null
+++ 
b/zeppelin-interpreter/src/test/java/org/apache/zeppelin/scheduler/SleepingJob.java
@@ -0,0 +1,75 @@
+/*
+ * 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.scheduler;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.zeppelin.scheduler.Job;
+import org.apache.zeppelin.scheduler.JobListener;
+
+public class SleepingJob extends Job{
+
+       private int time;
+       boolean abort = false;
+       private long start;
+       private int count;
+
+
+       public SleepingJob(String jobName, JobListener listener, int time){
+               super(jobName, listener);
+               this.time = time;
+               count = 0;
+       }
+       @Override
+  public Object jobRun() {
+               start = System.currentTimeMillis();
+               while(abort==false){
+                       count++;
+                       try {
+                               Thread.sleep(10);
+                       } catch (InterruptedException e) {
+                       }
+                       if(System.currentTimeMillis() - start>time) break;
+               }
+               return System.currentTimeMillis()-start;
+       }
+
+       @Override
+  public boolean jobAbort() {
+               abort = true;
+               return true;
+       }
+
+       @Override
+  public int progress() {
+               long p = (System.currentTimeMillis() - start)*100 / time;
+               if(p<0) p = 0;
+               if(p>100) p = 100;
+               return (int) p;
+       }
+
+       @Override
+  public Map<String, Object> info() {
+               Map<String, Object> i = new HashMap<String, Object>();
+               i.put("LoopCount", Integer.toString(count));
+               return i;
+       }
+
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/669d408d/zeppelin-interpreter/src/test/resources/log4j.properties
----------------------------------------------------------------------
diff --git a/zeppelin-interpreter/src/test/resources/log4j.properties 
b/zeppelin-interpreter/src/test/resources/log4j.properties
index 361ca2d..d8a7839 100644
--- a/zeppelin-interpreter/src/test/resources/log4j.properties
+++ b/zeppelin-interpreter/src/test/resources/log4j.properties
@@ -1,3 +1,20 @@
+#
+# 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.
+#
+
 # Direct log messages to stdout
 log4j.appender.stdout=org.apache.log4j.ConsoleAppender
 log4j.appender.stdout.Target=System.out

http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/669d408d/zeppelin-server/pom.xml
----------------------------------------------------------------------
diff --git a/zeppelin-server/pom.xml b/zeppelin-server/pom.xml
index b0b3e1f..4b2b4d9 100644
--- a/zeppelin-server/pom.xml
+++ b/zeppelin-server/pom.xml
@@ -1,14 +1,31 @@
 <?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ 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.
+  -->
+
 <project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd";>
   <modelVersion>4.0.0</modelVersion>
 
   <parent>
     <artifactId>zeppelin</artifactId>
-    <groupId>com.nflabs.zeppelin</groupId>
+    <groupId>org.apache.zeppelin</groupId>
     <version>0.5.0-SNAPSHOT</version>
   </parent>
 
-  <groupId>com.nflabs.zeppelin</groupId>
+  <groupId>org.apache.zeppelin</groupId>
   <artifactId>zeppelin-server</artifactId>
   <packaging>jar</packaging>
   <version>0.5.0-SNAPSHOT</version>
@@ -271,6 +288,26 @@
 
   <build>
     <plugins>
+      <plugin>
+        <groupId>org.apache.rat</groupId>
+        <artifactId>apache-rat-plugin</artifactId>
+        <configuration>
+          <excludes>
+            <exclude>**/.idea/</exclude>
+            <exclude>**/*.iml</exclude>
+            <exclude>.git/</exclude>
+            <exclude>.gitignore</exclude>
+            <exclude>**/.settings/*</exclude>
+            <exclude>**/.classpath</exclude>
+            <exclude>**/.project</exclude>
+            <exclude>**/target/**</exclude>
+            <exclude>**/derby.log</exclude>
+            <exclude>**/metastore_db/</exclude>
+            <exclude>**/README.md</exclude>
+            <exclude>src/test/java/com/webautomation/*</exclude>
+          </excludes>
+        </configuration>
+      </plugin>
 
       <plugin>
         <artifactId>maven-failsafe-plugin</artifactId>

http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/669d408d/zeppelin-server/src/main/java/com/nflabs/zeppelin/rest/InterpreterRestApi.java
----------------------------------------------------------------------
diff --git 
a/zeppelin-server/src/main/java/com/nflabs/zeppelin/rest/InterpreterRestApi.java
 
b/zeppelin-server/src/main/java/com/nflabs/zeppelin/rest/InterpreterRestApi.java
deleted file mode 100644
index 582ba32..0000000
--- 
a/zeppelin-server/src/main/java/com/nflabs/zeppelin/rest/InterpreterRestApi.java
+++ /dev/null
@@ -1,152 +0,0 @@
-package com.nflabs.zeppelin.rest;
-
-import java.io.IOException;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-
-import javax.ws.rs.DELETE;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.PUT;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.Response.Status;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.gson.Gson;
-import com.nflabs.zeppelin.interpreter.Interpreter;
-import com.nflabs.zeppelin.interpreter.Interpreter.RegisteredInterpreter;
-import com.nflabs.zeppelin.interpreter.InterpreterException;
-import com.nflabs.zeppelin.interpreter.InterpreterFactory;
-import com.nflabs.zeppelin.interpreter.InterpreterSetting;
-import com.nflabs.zeppelin.rest.message.NewInterpreterSettingRequest;
-import com.nflabs.zeppelin.rest.message.UpdateInterpreterSettingRequest;
-import com.nflabs.zeppelin.server.JsonResponse;
-import com.wordnik.swagger.annotations.Api;
-import com.wordnik.swagger.annotations.ApiOperation;
-import com.wordnik.swagger.annotations.ApiResponse;
-import com.wordnik.swagger.annotations.ApiResponses;
-
-/**
- * Interpreter Rest API
- *
- */
-@Path("/interpreter")
-@Produces("application/json")
-@Api(value = "/interpreter", description = "Zeppelin Interpreter REST API")
-public class InterpreterRestApi {
-  Logger logger = LoggerFactory.getLogger(InterpreterRestApi.class);
-
-  private InterpreterFactory interpreterFactory;
-
-  Gson gson = new Gson();
-
-  public InterpreterRestApi() {
-
-  }
-
-  public InterpreterRestApi(InterpreterFactory interpreterFactory) {
-    this.interpreterFactory = interpreterFactory;
-  }
-
-  /**
-   * List all interpreter settings
-     * @return
-   */
-  @GET
-  @Path("setting")
-  @ApiOperation(httpMethod = "GET", value = "List all interpreter setting")
-  @ApiResponses(value = {@ApiResponse(code = 500, message = "When something 
goes wrong")})
-  public Response listSettings() {
-    List<InterpreterSetting> interpreterSettings = null;
-    interpreterSettings = interpreterFactory.get();
-    return new JsonResponse(Status.OK, "", interpreterSettings).build();
-  }
-
-  /**
-   * Add new interpreter setting
-   * @param message
-   * @return
-   * @throws IOException
-   * @throws InterpreterException
-   */
-  @POST
-  @Path("setting")
-  @ApiOperation(httpMethod = "GET", value = "Create new interpreter setting")
-  @ApiResponses(value = {@ApiResponse(code = 201, message = "On success")})
-  public Response newSettings(String message) throws InterpreterException, 
IOException {
-    NewInterpreterSettingRequest request = gson.fromJson(message,
-        NewInterpreterSettingRequest.class);
-    Properties p = new Properties();
-    p.putAll(request.getProperties());
-    interpreterFactory.add(request.getName(), request.getGroup(), 
request.getOption(), p);
-    return new JsonResponse(Status.CREATED, "").build();
-  }
-
-  @PUT
-  @Path("setting/{settingId}")
-  public Response updateSetting(String message, @PathParam("settingId") String 
settingId) {
-    logger.info("Update interpreterSetting {}", settingId);
-
-    try {
-      UpdateInterpreterSettingRequest p = gson.fromJson(message,
-          UpdateInterpreterSettingRequest.class);
-      interpreterFactory.setPropertyAndRestart(settingId, p.getOption(), 
p.getProperties());
-    } catch (InterpreterException e) {
-      return new JsonResponse(Status.NOT_FOUND, e.getMessage(), e).build();
-    } catch (IOException e) {
-      return new JsonResponse(Status.INTERNAL_SERVER_ERROR, e.getMessage(), 
e).build();
-    }
-    InterpreterSetting setting = interpreterFactory.get(settingId);
-    if (setting == null) {
-      return new JsonResponse(Status.NOT_FOUND, "", settingId).build();
-    }
-    return new JsonResponse(Status.OK, "", setting).build();
-  }
-
-  @DELETE
-  @Path("setting/{settingId}")
-  @ApiOperation(httpMethod = "GET", value = "Remove interpreter setting")
-  @ApiResponses(value = {@ApiResponse(code = 500, message = "When something 
goes wrong")})
-  public Response removeSetting(@PathParam("settingId") String settingId) 
throws IOException {
-    logger.info("Remove interpreterSetting {}", settingId);
-    interpreterFactory.remove(settingId);
-    return new JsonResponse(Status.OK).build();
-  }
-
-  @PUT
-  @Path("setting/restart/{settingId}")
-  @ApiOperation(httpMethod = "GET", value = "restart interpreter setting")
-  @ApiResponses(value = {
-      @ApiResponse(code = 404, message = "Not found")})
-  public Response restartSetting(@PathParam("settingId") String settingId) {
-    logger.info("Restart interpreterSetting {}", settingId);
-    try {
-      interpreterFactory.restart(settingId);
-    } catch (InterpreterException e) {
-      return new JsonResponse(Status.NOT_FOUND, e.getMessage(), e).build();
-    }
-    InterpreterSetting setting = interpreterFactory.get(settingId);
-    if (setting == null) {
-      return new JsonResponse(Status.NOT_FOUND, "", settingId).build();
-    }
-    return new JsonResponse(Status.OK, "", setting).build();
-  }
-
-  /**
-   * List all available interpreters by group
-   */
-  @GET
-  @ApiOperation(httpMethod = "GET", value = "List all available interpreters")
-  @ApiResponses(value = {
-      @ApiResponse(code = 500, message = "When something goes wrong")})
-  public Response listInterpreter(String message) {
-    Map<String, RegisteredInterpreter> m = Interpreter.registeredInterpreters;
-    return new JsonResponse(Status.OK, "", m).build();
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/669d408d/zeppelin-server/src/main/java/com/nflabs/zeppelin/rest/NotebookResponse.java
----------------------------------------------------------------------
diff --git 
a/zeppelin-server/src/main/java/com/nflabs/zeppelin/rest/NotebookResponse.java 
b/zeppelin-server/src/main/java/com/nflabs/zeppelin/rest/NotebookResponse.java
deleted file mode 100644
index aa92577..0000000
--- 
a/zeppelin-server/src/main/java/com/nflabs/zeppelin/rest/NotebookResponse.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package com.nflabs.zeppelin.rest;
-
-import javax.xml.bind.annotation.XmlRootElement;
-
-/**
- * Response wrapper.
- * 
- * @author anthonycorbacho
- *
- */
-@XmlRootElement
-public class NotebookResponse {
-  private String msg;
-
-  public NotebookResponse() {}
-
-  public NotebookResponse(String msg) {
-    this.msg = msg;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/669d408d/zeppelin-server/src/main/java/com/nflabs/zeppelin/rest/NotebookRestApi.java
----------------------------------------------------------------------
diff --git 
a/zeppelin-server/src/main/java/com/nflabs/zeppelin/rest/NotebookRestApi.java 
b/zeppelin-server/src/main/java/com/nflabs/zeppelin/rest/NotebookRestApi.java
deleted file mode 100644
index 4f9ae4f..0000000
--- 
a/zeppelin-server/src/main/java/com/nflabs/zeppelin/rest/NotebookRestApi.java
+++ /dev/null
@@ -1,98 +0,0 @@
-package com.nflabs.zeppelin.rest;
-
-import java.io.IOException;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-
-import javax.ws.rs.GET;
-import javax.ws.rs.PUT;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.Response.Status;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.gson.Gson;
-import com.google.gson.reflect.TypeToken;
-import com.nflabs.zeppelin.interpreter.Interpreter;
-import com.nflabs.zeppelin.interpreter.Interpreter.RegisteredInterpreter;
-import com.nflabs.zeppelin.interpreter.InterpreterSetting;
-import com.nflabs.zeppelin.notebook.Notebook;
-import com.nflabs.zeppelin.rest.message.InterpreterSettingListForNoteBind;
-import com.nflabs.zeppelin.server.JsonResponse;
-
-/**
- * Rest api endpoint for the noteBook.
- */
-@Path("/notebook")
-@Produces("application/json")
-public class NotebookRestApi {
-  Logger logger = LoggerFactory.getLogger(NotebookRestApi.class);
-  Gson gson = new Gson();
-  private Notebook notebook;
-
-  public NotebookRestApi() {}
-
-  public NotebookRestApi(Notebook notebook) {
-    this.notebook = notebook;
-  }
-
-  /**
-   * bind a setting to note
-   * @throws IOException 
-   */
-  @PUT
-  @Path("interpreter/bind/{noteId}")
-  public Response bind(@PathParam("noteId") String noteId, String req) throws 
IOException {
-    List<String> settingIdList = gson.fromJson(req, new 
TypeToken<List<String>>(){}.getType());
-    notebook.bindInterpretersToNote(noteId, settingIdList);
-    return new JsonResponse(Status.OK).build();
-  }
-
-  /**
-   * list binded setting
-   */
-  @GET
-  @Path("interpreter/bind/{noteId}")
-  public Response bind(@PathParam("noteId") String noteId) {
-    List<InterpreterSettingListForNoteBind> settingList
-      = new LinkedList<InterpreterSettingListForNoteBind>();
-
-    List<InterpreterSetting> selectedSettings = 
notebook.getBindedInterpreterSettings(noteId);
-    for (InterpreterSetting setting : selectedSettings) {
-      settingList.add(new InterpreterSettingListForNoteBind(
-          setting.id(),
-          setting.getName(),
-          setting.getGroup(),
-          setting.getInterpreterGroup(),
-          true)
-      );
-    }
-
-    List<InterpreterSetting> availableSettings = 
notebook.getInterpreterFactory().get();
-    for (InterpreterSetting setting : availableSettings) {
-      boolean selected = false;
-      for (InterpreterSetting selectedSetting : selectedSettings) {
-        if (selectedSetting.id().equals(setting.id())) {
-          selected = true;
-          break;
-        }
-      }
-
-      if (!selected) {
-        settingList.add(new InterpreterSettingListForNoteBind(
-            setting.id(),
-            setting.getName(),
-            setting.getGroup(),
-            setting.getInterpreterGroup(),
-            false)
-        );
-      }
-    }
-    return new JsonResponse(Status.OK, "", settingList).build();
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/669d408d/zeppelin-server/src/main/java/com/nflabs/zeppelin/rest/ZeppelinRestApi.java
----------------------------------------------------------------------
diff --git 
a/zeppelin-server/src/main/java/com/nflabs/zeppelin/rest/ZeppelinRestApi.java 
b/zeppelin-server/src/main/java/com/nflabs/zeppelin/rest/ZeppelinRestApi.java
deleted file mode 100644
index 11b27a6..0000000
--- 
a/zeppelin-server/src/main/java/com/nflabs/zeppelin/rest/ZeppelinRestApi.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package com.nflabs.zeppelin.rest;
-
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.core.Response;
-
-import com.wordnik.swagger.annotations.Api;
-
-/**
- * Zeppelin root rest api endpoint.
- *
- * @author anthonycorbacho
- * @since 0.3.4
- */
-@Path("/")
-@Api(value = "/", description = "Zeppelin REST API root")
-public class ZeppelinRestApi {
-
-  /**
-   * Required by Swagger.
-   */
-  public ZeppelinRestApi() {
-    super();
-  }
-
-  /**
-   * Get the root endpoint Return always 200.
-   *
-   * @return 200 response
-   */
-  @GET
-  public Response getRoot() {
-    return Response.ok().build();
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/669d408d/zeppelin-server/src/main/java/com/nflabs/zeppelin/rest/message/InterpreterSettingListForNoteBind.java
----------------------------------------------------------------------
diff --git 
a/zeppelin-server/src/main/java/com/nflabs/zeppelin/rest/message/InterpreterSettingListForNoteBind.java
 
b/zeppelin-server/src/main/java/com/nflabs/zeppelin/rest/message/InterpreterSettingListForNoteBind.java
deleted file mode 100644
index e8f4056..0000000
--- 
a/zeppelin-server/src/main/java/com/nflabs/zeppelin/rest/message/InterpreterSettingListForNoteBind.java
+++ /dev/null
@@ -1,67 +0,0 @@
-package com.nflabs.zeppelin.rest.message;
-
-import java.util.List;
-
-import com.nflabs.zeppelin.interpreter.Interpreter;
-
-/**
- * InterpreterSetting information for binding
- */
-public class InterpreterSettingListForNoteBind {
-  String id;
-  String name;
-  String group;
-  private boolean selected;
-  private List<Interpreter> interpreters;
-  
-  public InterpreterSettingListForNoteBind(String id, String name,
-      String group, List<Interpreter> interpreters, boolean selected) {
-    super();
-    this.id = id;
-    this.name = name;
-    this.group = group;
-    this.interpreters = interpreters;
-    this.selected = selected;
-  }
-
-  public String getId() {
-    return id;
-  }
-
-  public void setId(String id) {
-    this.id = id;
-  }
-
-  public String getName() {
-    return name;
-  }
-
-  public void setName(String name) {
-    this.name = name;
-  }
-
-  public String getGroup() {
-    return group;
-  }
-
-  public void setGroup(String group) {
-    this.group = group;
-  }
-
-  public List<Interpreter> getInterpreterNames() {
-    return interpreters;
-  }
-
-  public void setInterpreterNames(List<Interpreter> interpreters) {
-    this.interpreters = interpreters;
-  }
-
-  public boolean isSelected() {
-    return selected;
-  }
-
-  public void setSelected(boolean selected) {
-    this.selected = selected;
-  }
-  
-}

http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/669d408d/zeppelin-server/src/main/java/com/nflabs/zeppelin/rest/message/NewInterpreterSettingRequest.java
----------------------------------------------------------------------
diff --git 
a/zeppelin-server/src/main/java/com/nflabs/zeppelin/rest/message/NewInterpreterSettingRequest.java
 
b/zeppelin-server/src/main/java/com/nflabs/zeppelin/rest/message/NewInterpreterSettingRequest.java
deleted file mode 100644
index 4817507..0000000
--- 
a/zeppelin-server/src/main/java/com/nflabs/zeppelin/rest/message/NewInterpreterSettingRequest.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package com.nflabs.zeppelin.rest.message;
-
-import java.util.Map;
-
-import com.nflabs.zeppelin.interpreter.InterpreterOption;
-
-/**
- *  NewInterpreterSetting rest api request message
- *
- */
-public class NewInterpreterSettingRequest {
-  String name;
-  String group;
-  InterpreterOption option;
-  Map<String, String> properties;
-
-  public NewInterpreterSettingRequest() {
-
-  }
-
-  public String getName() {
-    return name;
-  }
-
-  public String getGroup() {
-    return group;
-  }
-
-  public Map<String, String> getProperties() {
-    return properties;
-  }
-
-  public InterpreterOption getOption() {
-    return option;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/669d408d/zeppelin-server/src/main/java/com/nflabs/zeppelin/rest/message/UpdateInterpreterSettingRequest.java
----------------------------------------------------------------------
diff --git 
a/zeppelin-server/src/main/java/com/nflabs/zeppelin/rest/message/UpdateInterpreterSettingRequest.java
 
b/zeppelin-server/src/main/java/com/nflabs/zeppelin/rest/message/UpdateInterpreterSettingRequest.java
deleted file mode 100644
index 5f18a46..0000000
--- 
a/zeppelin-server/src/main/java/com/nflabs/zeppelin/rest/message/UpdateInterpreterSettingRequest.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package com.nflabs.zeppelin.rest.message;
-
-import java.util.Properties;
-
-import com.nflabs.zeppelin.interpreter.InterpreterOption;
-
-/**
- *
- */
-public class UpdateInterpreterSettingRequest {
-  InterpreterOption option;
-  Properties properties;
-
-  public UpdateInterpreterSettingRequest(InterpreterOption option,
-      Properties properties) {
-    super();
-    this.option = option;
-    this.properties = properties;
-  }
-  public InterpreterOption getOption() {
-    return option;
-  }
-  public Properties getProperties() {
-    return properties;
-  }
-
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/669d408d/zeppelin-server/src/main/java/com/nflabs/zeppelin/server/AppScriptServlet.java
----------------------------------------------------------------------
diff --git 
a/zeppelin-server/src/main/java/com/nflabs/zeppelin/server/AppScriptServlet.java
 
b/zeppelin-server/src/main/java/com/nflabs/zeppelin/server/AppScriptServlet.java
deleted file mode 100644
index d2b3cf5..0000000
--- 
a/zeppelin-server/src/main/java/com/nflabs/zeppelin/server/AppScriptServlet.java
+++ /dev/null
@@ -1,76 +0,0 @@
-package com.nflabs.zeppelin.server;
-
-import org.eclipse.jetty.servlet.DefaultServlet;
-import org.eclipse.jetty.util.resource.Resource;
-
-import java.io.InputStream;
-import java.io.IOException;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Set;
- 
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-/**
- * Simple servlet to dynamically set the Websocket port
- * in the JavaScript sent to the client
- */
-public class AppScriptServlet extends DefaultServlet {
-
-  // Hash containing the possible scripts that contain the getPort()
-  // function originally defined in app.js
-  private static Set<String> scriptPaths = new HashSet<String>(
-    Arrays.asList(
-      "/scripts/scripts.js",
-      "/scripts/app.js"
-    )
-  );
-
-  private int websocketPort;
-
-  public AppScriptServlet(int websocketPort) {
-    this.websocketPort = websocketPort;
-  }
-
-  @Override
-  protected void doGet(HttpServletRequest request, HttpServletResponse 
response)
-      throws ServletException,
-          IOException {
-    
-    // Process all requests not for the app script to the parent
-    // class
-    String uri = request.getRequestURI();
-    if (!scriptPaths.contains(uri)) {
-      super.doGet(request, response);
-      return;
-    }
-
-    // Read the script file chunk by chunk
-    Resource scriptFile = getResource(uri);
-    InputStream is = scriptFile.getInputStream();
-    StringBuffer script = new StringBuffer();
-    byte[] buffer = new byte[1024];
-    while (is.available() > 0) {
-      int numRead = is.read(buffer);
-      if (numRead <= 0) {
-        break;
-      }
-      script.append(new String(buffer, 0, numRead, "UTF-8"));
-    }
-
-    // Replace the string "function getPort(){...}" to return
-    // the proper value
-    int startIndex = script.indexOf("function getPort()");
-    int endIndex = script.indexOf("}", startIndex);
-
-    if (startIndex >= 0 && endIndex >= 0) {
-      String replaceString = "function getPort(){return " + websocketPort + 
"}";
-      script.replace(startIndex, endIndex + 1, replaceString);
-    }
-
-    response.getWriter().println(script.toString());
-  }
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/669d408d/zeppelin-server/src/main/java/com/nflabs/zeppelin/server/CorsFilter.java
----------------------------------------------------------------------
diff --git 
a/zeppelin-server/src/main/java/com/nflabs/zeppelin/server/CorsFilter.java 
b/zeppelin-server/src/main/java/com/nflabs/zeppelin/server/CorsFilter.java
deleted file mode 100644
index 9783ca3..0000000
--- a/zeppelin-server/src/main/java/com/nflabs/zeppelin/server/CorsFilter.java
+++ /dev/null
@@ -1,54 +0,0 @@
-package com.nflabs.zeppelin.server;
-
-import java.io.IOException;
-import java.text.DateFormat;
-import java.util.Date;
-import java.util.Locale;
-
-import javax.servlet.Filter;
-import javax.servlet.FilterChain;
-import javax.servlet.FilterConfig;
-import javax.servlet.ServletException;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-/**
- * Cors filter
- *
- */
-public class CorsFilter implements Filter {
-
-  @Override
-  public void doFilter(ServletRequest request, ServletResponse response, 
FilterChain filterChain)
-      throws IOException, ServletException {
-    if (((HttpServletRequest) request).getMethod().equals("OPTIONS")) {
-      HttpServletResponse resp = ((HttpServletResponse) response);
-      addCorsHeaders(resp);
-      return;
-    }
-
-    if (response instanceof HttpServletResponse) {
-      HttpServletResponse alteredResponse = ((HttpServletResponse) response);  
    
-      addCorsHeaders(alteredResponse);
-    }
-    filterChain.doFilter(request, response);
-  }
-
-  private void addCorsHeaders(HttpServletResponse response) {
-    response.addHeader("Access-Control-Allow-Origin", "*");
-    response.addHeader("Access-Control-Allow-Credentials", "true");
-    response.addHeader("Access-Control-Allow-Headers", 
"authorization,Content-Type");
-    response.addHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, 
PUT, HEAD, DELETE");
-    DateFormat fullDateFormatEN =
-        DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.FULL, new 
Locale("EN", "en"));
-    response.addHeader("Date", fullDateFormatEN.format(new Date()));
-  }
-
-  @Override
-  public void destroy() {}
-
-  @Override
-  public void init(FilterConfig filterConfig) throws ServletException {}
-}

http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/669d408d/zeppelin-server/src/main/java/com/nflabs/zeppelin/server/JsonResponse.java
----------------------------------------------------------------------
diff --git 
a/zeppelin-server/src/main/java/com/nflabs/zeppelin/server/JsonResponse.java 
b/zeppelin-server/src/main/java/com/nflabs/zeppelin/server/JsonResponse.java
deleted file mode 100644
index c5e81bc..0000000
--- a/zeppelin-server/src/main/java/com/nflabs/zeppelin/server/JsonResponse.java
+++ /dev/null
@@ -1,126 +0,0 @@
-package com.nflabs.zeppelin.server;
-
-import java.util.ArrayList;
-
-import javax.ws.rs.core.NewCookie;
-import javax.ws.rs.core.Response.ResponseBuilder;
-
-import com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
-import com.nflabs.zeppelin.interpreter.Interpreter;
-import com.nflabs.zeppelin.interpreter.InterpreterSerializer;
-
-/**
- * Json response builder.
- * 
- * @author Leemoonsoo
- *
- * @param <T>
- */
-public class JsonResponse<T> {
-  private javax.ws.rs.core.Response.Status status;
-  private String message;
-  private T body;
-  transient ArrayList<NewCookie> cookies;
-  transient boolean pretty = false;
-
-  public JsonResponse(javax.ws.rs.core.Response.Status status) {
-    this.status = status;
-    this.message = null;
-    this.body = null;
-
-  }
-
-  public JsonResponse(javax.ws.rs.core.Response.Status status, String message) 
{
-    this.status = status;
-    this.message = message;
-    this.body = null;
-  }
-
-  public JsonResponse(javax.ws.rs.core.Response.Status status, T body) {
-    this.status = status;
-    this.message = null;
-    this.body = body;
-  }
-
-  public JsonResponse(javax.ws.rs.core.Response.Status status, String message, 
T body) {
-    this.status = status;
-    this.message = message;
-    this.body = body;
-  }
-
-  public JsonResponse<T> setPretty(boolean pretty) {
-    this.pretty = pretty;
-    return this;
-  }
-
-  /**
-   * Add cookie for building.
-   * 
-   * @param newCookie
-   * @return
-   */
-  public JsonResponse<T> addCookie(NewCookie newCookie) {
-    if (cookies == null) {
-      cookies = new ArrayList<NewCookie>();
-    }
-    cookies.add(newCookie);
-
-    return this;
-  }
-
-  /**
-   * Add cookie for building.
-   * 
-   * @param name
-   * @param value
-   * @return
-   */
-  public JsonResponse<?> addCookie(String name, String value) {
-    return addCookie(new NewCookie(name, value));
-  }
-
-  public String toString() {
-    GsonBuilder gsonBuilder = new GsonBuilder()
-      .registerTypeAdapter(Interpreter.class, new InterpreterSerializer());    
-    if (pretty) {
-      gsonBuilder.setPrettyPrinting(); 
-    } 
-    Gson gson = gsonBuilder.create();
-    return gson.toJson(this);
-  }
-
-  public javax.ws.rs.core.Response.Status getCode() {
-    return status;
-  }
-
-  public void setCode(javax.ws.rs.core.Response.Status status) {
-    this.status = status;
-  }
-
-  public String getMessage() {
-    return message;
-  }
-
-  public void setMessage(String message) {
-    this.message = message;
-  }
-
-  public T getBody() {
-    return body;
-  }
-
-  public void setBody(T body) {
-    this.body = body;
-  }
-
-  public javax.ws.rs.core.Response build() {
-    ResponseBuilder r = 
javax.ws.rs.core.Response.status(status).entity(this.toString());
-    if (cookies != null) {
-      for (NewCookie nc : cookies) {
-        r.cookie(nc);
-      }
-    }
-    return r.build();
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/669d408d/zeppelin-server/src/main/java/com/nflabs/zeppelin/server/ZeppelinServer.java
----------------------------------------------------------------------
diff --git 
a/zeppelin-server/src/main/java/com/nflabs/zeppelin/server/ZeppelinServer.java 
b/zeppelin-server/src/main/java/com/nflabs/zeppelin/server/ZeppelinServer.java
deleted file mode 100644
index 9bd5d69..0000000
--- 
a/zeppelin-server/src/main/java/com/nflabs/zeppelin/server/ZeppelinServer.java
+++ /dev/null
@@ -1,311 +0,0 @@
-package com.nflabs.zeppelin.server;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.EnumSet;
-import java.util.HashSet;
-import java.util.Set;
-
-import javax.net.ssl.SSLContext;
-import javax.servlet.DispatcherType;
-import javax.ws.rs.core.Application;
-
-import org.apache.cxf.jaxrs.servlet.CXFNonSpringJaxrsServlet;
-import org.eclipse.jetty.server.Handler;
-import org.eclipse.jetty.server.Server;
-import org.eclipse.jetty.server.bio.SocketConnector;
-import org.eclipse.jetty.server.handler.ContextHandlerCollection;
-import org.eclipse.jetty.server.session.SessionHandler;
-import org.eclipse.jetty.server.ssl.SslSocketConnector;
-import org.eclipse.jetty.servlet.DefaultServlet;
-import org.eclipse.jetty.servlet.FilterHolder;
-import org.eclipse.jetty.servlet.ServletContextHandler;
-import org.eclipse.jetty.servlet.ServletHolder;
-import org.eclipse.jetty.util.ssl.SslContextFactory;
-import org.eclipse.jetty.webapp.WebAppContext;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.nflabs.zeppelin.conf.ZeppelinConfiguration;
-import com.nflabs.zeppelin.conf.ZeppelinConfiguration.ConfVars;
-import com.nflabs.zeppelin.interpreter.InterpreterFactory;
-import com.nflabs.zeppelin.notebook.Notebook;
-import com.nflabs.zeppelin.rest.InterpreterRestApi;
-import com.nflabs.zeppelin.rest.NotebookRestApi;
-import com.nflabs.zeppelin.rest.ZeppelinRestApi;
-import com.nflabs.zeppelin.scheduler.SchedulerFactory;
-import com.nflabs.zeppelin.socket.NotebookServer;
-import com.nflabs.zeppelin.socket.SslWebSocketServerFactory;
-import com.wordnik.swagger.jersey.config.JerseyJaxrsConfig;
-
-/**
- * Main class of Zeppelin.
- *
- * @author Leemoonsoo
- *
- */
-
-public class ZeppelinServer extends Application {
-  private static final Logger LOG = 
LoggerFactory.getLogger(ZeppelinServer.class);
-
-  private SchedulerFactory schedulerFactory;
-  public static Notebook notebook;
-
-  static NotebookServer notebookServer;
-
-  private InterpreterFactory replFactory;
-
-  public static void main(String[] args) throws Exception {
-    ZeppelinConfiguration conf = ZeppelinConfiguration.create();
-    conf.setProperty("args", args);
-
-    final Server jettyServer = setupJettyServer(conf);
-    notebookServer = setupNotebookServer(conf);
-
-    // REST api
-    final ServletContextHandler restApi = setupRestApiContextHandler();
-    /** NOTE: Swagger-core is included via the web.xml in zeppelin-web
-     * But the rest of swagger is configured here
-     */
-    final ServletContextHandler swagger = setupSwaggerContextHandler(conf);
-
-    // Web UI
-    final WebAppContext webApp = setupWebAppContext(conf);
-    //Below is commented since zeppelin-docs module is removed.
-    //final WebAppContext webAppSwagg = setupWebAppSwagger(conf);
-
-    // add all handlers
-    ContextHandlerCollection contexts = new ContextHandlerCollection();
-    //contexts.setHandlers(new Handler[]{swagger, restApi, webApp, 
webAppSwagg});
-    contexts.setHandlers(new Handler[]{swagger, restApi, webApp});
-    jettyServer.setHandler(contexts);
-
-    notebookServer.start();
-    LOG.info("Start zeppelin server");
-    jettyServer.start();
-    LOG.info("Started");
-
-    Runtime.getRuntime().addShutdownHook(new Thread(){
-      @Override public void run() {
-        LOG.info("Shutting down Zeppelin Server ... ");
-        try {
-          notebook.getInterpreterFactory().close();
-
-          jettyServer.stop();
-          notebookServer.stop();
-        } catch (Exception e) {
-          LOG.error("Error while stopping servlet container", e);
-        }
-        LOG.info("Bye");
-      }
-    });
-
-
-    // when zeppelin is started inside of ide (especially for eclipse)
-    // for graceful shutdown, input any key in console window
-    if (System.getenv("ZEPPELIN_IDENT_STRING") == null) {
-      try {
-        System.in.read();
-      } catch (IOException e) {
-      }
-      System.exit(0);
-    }
-
-    jettyServer.join();
-  }
-
-  private static Server setupJettyServer(ZeppelinConfiguration conf)
-      throws Exception {
-
-    SocketConnector connector;
-    if (conf.useSsl()) {
-      connector = new SslSocketConnector(getSslContextFactory(conf));
-    }
-    else {
-      connector = new SocketConnector();
-    }
-
-    // Set some timeout options to make debugging easier.
-    int timeout = 1000 * 30;
-    connector.setMaxIdleTime(timeout);
-    connector.setSoLingerTime(-1);
-    connector.setPort(conf.getServerPort());
-
-    final Server server = new Server();
-    server.addConnector(connector);
-
-    return server;
-  }
-
-  private static NotebookServer setupNotebookServer(ZeppelinConfiguration conf)
-      throws Exception {
-
-    NotebookServer server = new NotebookServer(conf.getWebSocketPort());
-
-    // Default WebSocketServer uses unencrypted connector, so only need to
-    // change the connector if SSL should be used.
-    if (conf.useSsl()) {
-      SslWebSocketServerFactory wsf = new 
SslWebSocketServerFactory(getSslContext(conf));
-      wsf.setNeedClientAuth(conf.useClientAuth());
-      server.setWebSocketFactory(wsf);
-    }
-
-    return server;
-  }
-
-  private static SslContextFactory getSslContextFactory(ZeppelinConfiguration 
conf)
-      throws Exception {
-
-    // Note that the API for the SslContextFactory is different for
-    // Jetty version 9
-    SslContextFactory sslContextFactory = new SslContextFactory();
-
-    // Set keystore
-    sslContextFactory.setKeyStore(conf.getKeyStorePath());
-    sslContextFactory.setKeyStoreType(conf.getKeyStoreType());
-    sslContextFactory.setKeyStorePassword(conf.getKeyStorePassword());
-    sslContextFactory.setKeyManagerPassword(conf.getKeyManagerPassword());
-
-    // Set truststore
-    sslContextFactory.setTrustStore(conf.getTrustStorePath());
-    sslContextFactory.setTrustStoreType(conf.getTrustStoreType());
-    sslContextFactory.setTrustStorePassword(conf.getTrustStorePassword());
-
-    sslContextFactory.setNeedClientAuth(conf.useClientAuth());
-
-    return sslContextFactory;
-  }
-
-  private static SSLContext getSslContext(ZeppelinConfiguration conf)
-      throws Exception {
-
-    SslContextFactory scf = getSslContextFactory(conf);
-    if (!scf.isStarted()) {
-      scf.start();
-    }
-    return scf.getSslContext();
-  }
-
-  private static ServletContextHandler setupRestApiContextHandler() {
-    final ServletHolder cxfServletHolder = new ServletHolder(new 
CXFNonSpringJaxrsServlet());
-    cxfServletHolder.setInitParameter("javax.ws.rs.Application", 
ZeppelinServer.class.getName());
-    cxfServletHolder.setName("rest");
-    cxfServletHolder.setForcedPath("rest");
-
-    final ServletContextHandler cxfContext = new ServletContextHandler();
-    cxfContext.setSessionHandler(new SessionHandler());
-    cxfContext.setContextPath("/api");
-    cxfContext.addServlet(cxfServletHolder, "/*");
-
-    cxfContext.addFilter(new FilterHolder(CorsFilter.class), "/*",
-        EnumSet.allOf(DispatcherType.class));
-    return cxfContext;
-  }
-
-  /**
-   * Swagger core handler - Needed for the RestFul api documentation.
-   *
-   * @return ServletContextHandler of Swagger
-   */
-  private static ServletContextHandler setupSwaggerContextHandler(
-    ZeppelinConfiguration conf) {
-
-    // Configure Swagger-core
-    final ServletHolder swaggerServlet =
-        new ServletHolder(new JerseyJaxrsConfig());
-    swaggerServlet.setName("JerseyJaxrsConfig");
-    swaggerServlet.setInitParameter("api.version", "1.0.0");
-    swaggerServlet.setInitParameter(
-        "swagger.api.basepath",
-        "http://localhost:"; + conf.getServerPort() + "/api");
-    swaggerServlet.setInitOrder(2);
-
-    // Setup the handler
-    final ServletContextHandler handler = new ServletContextHandler();
-    handler.setSessionHandler(new SessionHandler());
-    // Bind Swagger-core to the url HOST/api-docs
-    handler.addServlet(swaggerServlet, "/api-docs/*");
-
-    // And we are done
-    return handler;
-  }
-
-  private static WebAppContext setupWebAppContext(
-      ZeppelinConfiguration conf) {
-
-    WebAppContext webApp = new WebAppContext();
-    File warPath = new File(conf.getString(ConfVars.ZEPPELIN_WAR));
-    if (warPath.isDirectory()) {
-      // Development mode, read from FS
-      // webApp.setDescriptor(warPath+"/WEB-INF/web.xml");
-      webApp.setResourceBase(warPath.getPath());
-      webApp.setContextPath("/");
-      webApp.setParentLoaderPriority(true);
-    } else {
-      // use packaged WAR
-      webApp.setWar(warPath.getAbsolutePath());
-    }
-    // Explicit bind to root
-    webApp.addServlet(
-      new ServletHolder(new AppScriptServlet(conf.getWebSocketPort())),
-      "/*"
-    );
-    return webApp;
-  }
-
-  /**
-   * Handles the WebApplication for Swagger-ui.
-   *
-   * @return WebAppContext with swagger ui context
-   */
-  /*private static WebAppContext setupWebAppSwagger(
-      ZeppelinConfiguration conf) {
-
-    WebAppContext webApp = new WebAppContext();
-    File warPath = new File(conf.getString(ConfVars.ZEPPELIN_API_WAR));
-
-    if (warPath.isDirectory()) {
-      webApp.setResourceBase(warPath.getPath());
-    } else {
-      webApp.setWar(warPath.getAbsolutePath());
-    }
-    webApp.setContextPath("/docs");
-    webApp.setParentLoaderPriority(true);
-    // Bind swagger-ui to the path HOST/docs
-    webApp.addServlet(new ServletHolder(new DefaultServlet()), "/docs/*");
-    return webApp;
-  }*/
-
-  public ZeppelinServer() throws Exception {
-    ZeppelinConfiguration conf = ZeppelinConfiguration.create();
-
-    this.schedulerFactory = new SchedulerFactory();
-
-    this.replFactory = new InterpreterFactory(conf);
-    notebook = new Notebook(conf, schedulerFactory, replFactory, 
notebookServer);
-  }
-
-  @Override
-  public Set<Class<?>> getClasses() {
-    Set<Class<?>> classes = new HashSet<Class<?>>();
-    return classes;
-  }
-
-  @Override
-  public java.util.Set<java.lang.Object> getSingletons() {
-    Set<Object> singletons = new HashSet<Object>();
-
-    /** Rest-api root endpoint */
-    ZeppelinRestApi root = new ZeppelinRestApi();
-    singletons.add(root);
-
-    NotebookRestApi notebookApi = new NotebookRestApi(notebook);
-    singletons.add(notebookApi);
-
-    InterpreterRestApi interpreterApi = new InterpreterRestApi(replFactory);
-    singletons.add(interpreterApi);
-
-    return singletons;
-  }
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/669d408d/zeppelin-server/src/main/java/com/nflabs/zeppelin/socket/Message.java
----------------------------------------------------------------------
diff --git 
a/zeppelin-server/src/main/java/com/nflabs/zeppelin/socket/Message.java 
b/zeppelin-server/src/main/java/com/nflabs/zeppelin/socket/Message.java
deleted file mode 100644
index 6ed7db9..0000000
--- a/zeppelin-server/src/main/java/com/nflabs/zeppelin/socket/Message.java
+++ /dev/null
@@ -1,93 +0,0 @@
-package com.nflabs.zeppelin.socket;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * Zeppelin websocker massage template class.
- * 
- * @author Leemoonsoo
- *
- */
-public class Message {
-  /**
-   * Representation of event type.
-   * 
-   * @author Leemoonsoo
-   *
-   */
-  public static enum OP {
-    GET_NOTE, // [c-s] client load note
-              // @param id note id
-
-    NOTE, // [s-c] note info
-          // @param note serlialized Note object
-
-    PARAGRAPH, // [s-c] paragraph info
-               // @param paragraph serialized paragraph object
-
-    PROGRESS, // [s-c] progress update
-              // @param id paragraph id
-              // @param progress percentage progress
-
-    NEW_NOTE, // [c-s] create new notebook
-    DEL_NOTE, // [c-s] delete notebook
-              // @param id note id
-    NOTE_UPDATE,
-
-    RUN_PARAGRAPH, // [c-s] run paragraph
-                   // @param id paragraph id
-                  // @param paragraph paragraph content.ie. script
-                  // @param config paragraph config
-                  // @param params paragraph params
-
-    COMMIT_PARAGRAPH, // [c-s] commit paragraph
-                      // @param id paragraph id
-                      // @param title paragraph title
-                      // @param paragraph paragraph content.ie. script
-                      // @param config paragraph config
-                      // @param params paragraph params
-
-    CANCEL_PARAGRAPH, // [c-s] cancel paragraph run
-                      // @param id paragraph id
-
-    MOVE_PARAGRAPH, // [c-s] move paragraph order
-                    // @param id paragraph id
-                    // @param index index the paragraph want to go
-
-    INSERT_PARAGRAPH, // [c-s] create new paragraph below current paragraph
-                      // @param target index
-
-    COMPLETION, // [c-s] ask completion candidates
-                // @param id
-                // @param buf current code
-                // @param cursor cursor position in code
-
-    COMPLETION_LIST, // [s-c] send back completion candidates list
-                     // @param id
-                     // @param completions list of string
-
-    LIST_NOTES, // [c-s] ask list of note
-
-    NOTES_INFO, // [s-c] list of note infos
-                // @param notes serialized List<NoteInfo> object
-
-    PARAGRAPH_REMOVE,
-  }
-
-  public OP op;
-  public Map<String, Object> data = new HashMap<String, Object>();
-
-  public Message(OP op) {
-    this.op = op;
-  }
-
-  public Message put(String k, Object v) {
-    data.put(k, v);
-    return this;
-  }
-
-  public Object get(String k) {
-    return data.get(k);
-  }
-}

Reply via email to