diff --git a/flink/src/test/java/org/apache/zeppelin/flink/FlinkInterpreterTest.java b/flink/src/test/java/org/apache/zeppelin/flink/FlinkInterpreterTest.java index 9a61be637ec..5a915424b95 100644 --- a/flink/src/test/java/org/apache/zeppelin/flink/FlinkInterpreterTest.java +++ b/flink/src/test/java/org/apache/zeppelin/flink/FlinkInterpreterTest.java @@ -40,7 +40,7 @@ public static void setUp() { Properties p = new Properties(); flink = new FlinkInterpreter(p); flink.open(); - context = new InterpreterContext(null, null, null, null, null, null, null, null, null); + context = new InterpreterContext(null, null, null, null, null, null, null, null, null, null); } @AfterClass diff --git a/hive/src/test/java/org/apache/zeppelin/hive/HiveInterpreterTest.java b/hive/src/test/java/org/apache/zeppelin/hive/HiveInterpreterTest.java index c86fcf3371e..8f1285df98f 100644 --- a/hive/src/test/java/org/apache/zeppelin/hive/HiveInterpreterTest.java +++ b/hive/src/test/java/org/apache/zeppelin/hive/HiveInterpreterTest.java @@ -79,9 +79,9 @@ public void readTest() throws IOException { HiveInterpreter t = new HiveInterpreter(properties); t.open(); - assertTrue(t.interpret("show databases", new InterpreterContext("", "1", "","", null,null,null,null,null)).message().contains("SCHEMA_NAME")); + assertTrue(t.interpret("show databases", new InterpreterContext("", "1", "","", null,null,null,null,null,null)).message().contains("SCHEMA_NAME")); assertEquals("ID\tNAME\na\ta_name\nb\tb_name\n", - t.interpret("select * from test_table", new InterpreterContext("", "1", "","", null,null,null,null,null)).message()); + t.interpret("select * from test_table", new InterpreterContext("", "1", "","", null,null,null,null,null,null)).message()); } @Test @@ -101,7 +101,7 @@ public void readTestWithConfiguration() throws IOException { t.open(); assertEquals("ID\tNAME\na\ta_name\nb\tb_name\n", - t.interpret("(h2)\n select * from test_table", new InterpreterContext("", "1", "","", null,null,null,null,null)).message()); + t.interpret("(h2)\n select * from test_table", new InterpreterContext("", "1", "","", null,null,null,null,null,null)).message()); } @Test @@ -117,13 +117,13 @@ public void jdbcRestart() throws IOException, SQLException, ClassNotFoundExcepti t.open(); InterpreterResult interpreterResult = - t.interpret("select * from test_table", new InterpreterContext("", "1", "","", null,null,null,null,null)); + t.interpret("select * from test_table", new InterpreterContext("", "1", "","", null,null,null,null,null,null)); assertEquals("ID\tNAME\na\ta_name\nb\tb_name\n", interpreterResult.message()); t.getConnection("default").close(); interpreterResult = - t.interpret("select * from test_table", new InterpreterContext("", "1", "","", null,null,null,null,null)); + t.interpret("select * from test_table", new InterpreterContext("", "1", "","", null,null,null,null,null,null)); assertEquals("ID\tNAME\na\ta_name\nb\tb_name\n", interpreterResult.message()); } @@ -139,7 +139,7 @@ public void test() throws IOException { HiveInterpreter t = new HiveInterpreter(properties); t.open(); - InterpreterContext interpreterContext = new InterpreterContext(null, "a", null, null, null, null, null, null, null); + InterpreterContext interpreterContext = new InterpreterContext(null, "a", null, null, null, null, null, null, null, null); //simple select test InterpreterResult result = t.interpret("select * from test_table", interpreterContext); @@ -193,4 +193,4 @@ public void getPropertyKey() { assertEquals("get key of default", "default", hi.getPropertyKey(testCommand)); hi.close(); } -} \ No newline at end of file +} diff --git a/ignite/src/test/java/org/apache/zeppelin/ignite/IgniteInterpreterTest.java b/ignite/src/test/java/org/apache/zeppelin/ignite/IgniteInterpreterTest.java index cf9808389e5..5976e217b33 100644 --- a/ignite/src/test/java/org/apache/zeppelin/ignite/IgniteInterpreterTest.java +++ b/ignite/src/test/java/org/apache/zeppelin/ignite/IgniteInterpreterTest.java @@ -40,7 +40,7 @@ public class IgniteInterpreterTest { private static final String HOST = "127.0.0.1:47500..47509"; private static final InterpreterContext INTP_CONTEXT = - new InterpreterContext(null, null, null, null, null, null, null, null, null); + new InterpreterContext(null, null, null, null, null, null, null, null, null, null); private IgniteInterpreter intp; private Ignite ignite; diff --git a/ignite/src/test/java/org/apache/zeppelin/ignite/IgniteSqlInterpreterTest.java b/ignite/src/test/java/org/apache/zeppelin/ignite/IgniteSqlInterpreterTest.java index a6dcc66bd61..7f665236130 100644 --- a/ignite/src/test/java/org/apache/zeppelin/ignite/IgniteSqlInterpreterTest.java +++ b/ignite/src/test/java/org/apache/zeppelin/ignite/IgniteSqlInterpreterTest.java @@ -44,7 +44,7 @@ public class IgniteSqlInterpreterTest { private static final String HOST = "127.0.0.1:47500..47509"; private static final InterpreterContext INTP_CONTEXT = - new InterpreterContext(null, null, null, null, null, null, null, null, null); + new InterpreterContext(null, null, null, null, null, null, null, null, null, null); private Ignite ignite; private IgniteSqlInterpreter intp; diff --git a/jdbc/src/test/java/org/apache/zeppelin/jdbc/JDBCInterpreterTest.java b/jdbc/src/test/java/org/apache/zeppelin/jdbc/JDBCInterpreterTest.java index 5d376f27afd..049b137055b 100644 --- a/jdbc/src/test/java/org/apache/zeppelin/jdbc/JDBCInterpreterTest.java +++ b/jdbc/src/test/java/org/apache/zeppelin/jdbc/JDBCInterpreterTest.java @@ -94,7 +94,7 @@ public void testSelectQuery() throws SQLException, IOException { String sqlQuery = "select * from test_table"; - InterpreterResult interpreterResult = t.interpret(sqlQuery, new InterpreterContext("", "1", "","", null,null,null,null,null)); + InterpreterResult interpreterResult = t.interpret(sqlQuery, new InterpreterContext("", "1", "","", null,null,null,null,null,null)); assertEquals(InterpreterResult.Code.SUCCESS, interpreterResult.code()); assertEquals(InterpreterResult.Type.TABLE, interpreterResult.type()); @@ -116,7 +116,7 @@ public void testSelectQueryMaxResult() throws SQLException, IOException { String sqlQuery = "select * from test_table"; - InterpreterResult interpreterResult = t.interpret(sqlQuery, new InterpreterContext("", "1", "","", null,null,null,null,null)); + InterpreterResult interpreterResult = t.interpret(sqlQuery, new InterpreterContext("", "1", "","", null,null,null,null,null,null)); assertEquals(InterpreterResult.Code.SUCCESS, interpreterResult.code()); assertEquals(InterpreterResult.Type.TABLE, interpreterResult.type()); diff --git a/scalding/src/test/java/org/apache/zeppelin/scalding/ScaldingInterpreterTest.java b/scalding/src/test/java/org/apache/zeppelin/scalding/ScaldingInterpreterTest.java index 606d4d965bc..1a6f2b9ce5e 100644 --- a/scalding/src/test/java/org/apache/zeppelin/scalding/ScaldingInterpreterTest.java +++ b/scalding/src/test/java/org/apache/zeppelin/scalding/ScaldingInterpreterTest.java @@ -64,7 +64,7 @@ public void setUp() throws Exception { InterpreterGroup intpGroup = new InterpreterGroup(); context = new InterpreterContext("note", "id", "title", "text", new HashMap(), new GUI(), new AngularObjectRegistry( - intpGroup.getId(), null), + intpGroup.getId(), null), null, new LinkedList(), null); } diff --git a/spark/src/main/java/org/apache/zeppelin/spark/ZeppelinContext.java b/spark/src/main/java/org/apache/zeppelin/spark/ZeppelinContext.java index 926f3e7546b..c6c67d2a499 100644 --- a/spark/src/main/java/org/apache/zeppelin/spark/ZeppelinContext.java +++ b/spark/src/main/java/org/apache/zeppelin/spark/ZeppelinContext.java @@ -26,14 +26,12 @@ import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.Collection; -import java.util.HashMap; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import org.apache.spark.SparkContext; import org.apache.spark.sql.SQLContext; -import org.apache.spark.sql.SQLContext.QueryExecution; import org.apache.spark.sql.catalyst.expressions.Attribute; import org.apache.spark.sql.hive.HiveContext; import org.apache.zeppelin.display.AngularObject; @@ -45,15 +43,19 @@ import org.apache.zeppelin.interpreter.InterpreterContextRunner; import org.apache.zeppelin.interpreter.InterpreterException; import org.apache.zeppelin.spark.dep.SparkDependencyResolver; +import org.apache.zeppelin.resource.Resource; +import org.apache.zeppelin.resource.ResourcePool; +import org.apache.zeppelin.resource.ResourceSet; import scala.Tuple2; import scala.Unit; import scala.collection.Iterable; +import scala.collection.JavaConversions; /** * Spark context for zeppelin. */ -public class ZeppelinContext extends HashMap { +public class ZeppelinContext { private SparkDependencyResolver dep; private InterpreterContext interpreterContext; private int maxResult; @@ -754,4 +756,60 @@ private void angularUnbind(String name, String noteId) { AngularObjectRegistry registry = interpreterContext.getAngularObjectRegistry(); registry.remove(name, noteId, null); } + + + /** + * Add object into resource pool + * @param name + * @param value + */ + public void put(String name, Object value) { + ResourcePool resourcePool = interpreterContext.getResourcePool(); + resourcePool.put(name, value); + } + + /** + * Get object from resource pool + * Search local process first and then the other processes + * @param name + * @return null if resource not found + */ + public Object get(String name) { + ResourcePool resourcePool = interpreterContext.getResourcePool(); + Resource resource = resourcePool.get(name); + if (resource != null) { + return resource.get(); + } else { + return null; + } + } + + /** + * Remove object from resourcePool + * @param name + */ + public void remove(String name) { + ResourcePool resourcePool = interpreterContext.getResourcePool(); + resourcePool.remove(name); + } + + /** + * Check if resource pool has the object + * @param name + * @return + */ + public boolean containsKey(String name) { + ResourcePool resourcePool = interpreterContext.getResourcePool(); + Resource resource = resourcePool.get(name); + return resource != null; + } + + /** + * Get all resources + */ + public ResourceSet getAll() { + ResourcePool resourcePool = interpreterContext.getResourcePool(); + return resourcePool.getAll(); + } + } diff --git a/spark/src/test/java/org/apache/zeppelin/spark/DepInterpreterTest.java b/spark/src/test/java/org/apache/zeppelin/spark/DepInterpreterTest.java index 2b5613a2950..11c0beb16c6 100644 --- a/spark/src/test/java/org/apache/zeppelin/spark/DepInterpreterTest.java +++ b/spark/src/test/java/org/apache/zeppelin/spark/DepInterpreterTest.java @@ -60,6 +60,7 @@ public void setUp() throws Exception { context = new InterpreterContext("note", "id", "title", "text", new HashMap(), new GUI(), new AngularObjectRegistry(intpGroup.getId(), null), + null, new LinkedList(), null); } diff --git a/spark/src/test/java/org/apache/zeppelin/spark/SparkInterpreterTest.java b/spark/src/test/java/org/apache/zeppelin/spark/SparkInterpreterTest.java index 778966f2ba9..01b91cc6509 100644 --- a/spark/src/test/java/org/apache/zeppelin/spark/SparkInterpreterTest.java +++ b/spark/src/test/java/org/apache/zeppelin/spark/SparkInterpreterTest.java @@ -79,6 +79,7 @@ public void setUp() throws Exception { new HashMap(), new GUI(), new AngularObjectRegistry(intpGroup.getId(), null), + null, new LinkedList(), new InterpreterOutput(new InterpreterOutputListener() { @Override diff --git a/spark/src/test/java/org/apache/zeppelin/spark/SparkSqlInterpreterTest.java b/spark/src/test/java/org/apache/zeppelin/spark/SparkSqlInterpreterTest.java index 731eab61fb9..30de6d6cf0c 100644 --- a/spark/src/test/java/org/apache/zeppelin/spark/SparkSqlInterpreterTest.java +++ b/spark/src/test/java/org/apache/zeppelin/spark/SparkSqlInterpreterTest.java @@ -27,6 +27,7 @@ import org.apache.zeppelin.display.GUI; import org.apache.zeppelin.interpreter.*; import org.apache.zeppelin.interpreter.InterpreterResult.Type; +import org.apache.zeppelin.resource.LocalResourcePool; import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -66,6 +67,7 @@ public void setUp() throws Exception { } context = new InterpreterContext("note", "id", "title", "text", new HashMap(), new GUI(), new AngularObjectRegistry(intpGroup.getId(), null), + null, new LinkedList(), new InterpreterOutput(new InterpreterOutputListener() { @Override public void onAppend(InterpreterOutput out, byte[] line) { diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterContext.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterContext.java index e3f6b59bc41..fd76912f116 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterContext.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterContext.java @@ -22,6 +22,7 @@ import org.apache.zeppelin.display.AngularObjectRegistry; import org.apache.zeppelin.display.GUI; +import org.apache.zeppelin.resource.ResourcePool; /** * Interpreter context @@ -50,6 +51,7 @@ public static void remove() { private final Map config; private GUI gui; private AngularObjectRegistry angularObjectRegistry; + private ResourcePool resourcePool; private List runners; public InterpreterContext(String noteId, @@ -59,6 +61,7 @@ public InterpreterContext(String noteId, Map config, GUI gui, AngularObjectRegistry angularObjectRegistry, + ResourcePool resourcePool, List runners, InterpreterOutput out ) { @@ -69,6 +72,7 @@ public InterpreterContext(String noteId, this.config = config; this.gui = gui; this.angularObjectRegistry = angularObjectRegistry; + this.resourcePool = resourcePool; this.runners = runners; this.out = out; } @@ -102,6 +106,10 @@ public AngularObjectRegistry getAngularObjectRegistry() { return angularObjectRegistry; } + public ResourcePool getResourcePool() { + return resourcePool; + } + public List getRunners() { return runners; } diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterGroup.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterGroup.java index 5af624178cd..4d450be15a8 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterGroup.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterGroup.java @@ -17,14 +17,13 @@ package org.apache.zeppelin.interpreter; -import java.util.LinkedList; -import java.util.List; -import java.util.Properties; -import java.util.Random; +import java.util.*; +import java.util.concurrent.ConcurrentHashMap; import org.apache.log4j.Logger; import org.apache.zeppelin.display.AngularObjectRegistry; import org.apache.zeppelin.interpreter.remote.RemoteInterpreterProcess; +import org.apache.zeppelin.resource.ResourcePool; /** * InterpreterGroup is list of interpreters in the same group. @@ -37,13 +36,27 @@ public class InterpreterGroup extends LinkedList{ AngularObjectRegistry angularObjectRegistry; RemoteInterpreterProcess remoteInterpreterProcess; // attached remote interpreter process + ResourcePool resourcePool; + + private static final Map allInterpreterGroups = + new ConcurrentHashMap(); + + public static InterpreterGroup get(String id) { + return allInterpreterGroups.get(id); + } + + public static Collection getAll() { + return new LinkedList(allInterpreterGroups.values()); + } public InterpreterGroup(String id) { this.id = id; + allInterpreterGroups.put(id, this); } public InterpreterGroup() { getId(); + allInterpreterGroups.put(id, this); } private static String generateId() { @@ -135,5 +148,15 @@ public void run() { remoteInterpreterProcess.dereference(); } } + + allInterpreterGroups.remove(id); + } + + public void setResourcePool(ResourcePool resourcePool) { + this.resourcePool = resourcePool; + } + + public ResourcePool getResourcePool() { + return resourcePool; } } diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreter.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreter.java index d2a24e85a39..ba1e5a40131 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreter.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreter.java @@ -140,7 +140,8 @@ private synchronized void init() { try { for (Interpreter intp : this.getInterpreterGroup()) { logger.info("Create remote interpreter {}", intp.getClassName()); - client.createInterpreter(intp.getClassName(), (Map) property); + client.createInterpreter(getInterpreterGroup().getId(), + intp.getClassName(), (Map) property); } } catch (TException e) { @@ -169,7 +170,9 @@ public void close() { boolean broken = false; try { client = interpreterProcess.getClient(); - client.close(className); + if (client != null) { + client.close(className); + } } catch (TException e) { broken = true; throw new InterpreterException(e); @@ -288,6 +291,10 @@ public FormType getFormType() { @Override public int getProgress(InterpreterContext context) { RemoteInterpreterProcess interpreterProcess = getInterpreterProcess(); + if (interpreterProcess == null || !interpreterProcess.isRunning()) { + return 0; + } + Client client = null; try { client = interpreterProcess.getClient(); diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterEventClient.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterEventClient.java new file mode 100644 index 00000000000..158f145de45 --- /dev/null +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterEventClient.java @@ -0,0 +1,245 @@ +/* + * 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 com.google.gson.Gson; +import org.apache.zeppelin.display.AngularObject; +import org.apache.zeppelin.interpreter.InterpreterContextRunner; +import org.apache.zeppelin.interpreter.thrift.RemoteInterpreterEvent; +import org.apache.zeppelin.interpreter.thrift.RemoteInterpreterEventType; +import org.apache.zeppelin.resource.*; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.IOException; +import java.nio.ByteBuffer; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; + +/** + * Thread connection ZeppelinServer -> RemoteInterpreterServer does not provide + * remote method invocation from RemoteInterpreterServer -> ZeppelinServer + * + * This class provides event send and get response from RemoteInterpreterServer to + * ZeppelinServer. + * + * RemoteInterpreterEventPoller is counter part in ZeppelinServer + */ +public class RemoteInterpreterEventClient implements ResourcePoolConnector { + private final Logger logger = LoggerFactory.getLogger(RemoteInterpreterEvent.class); + private final List eventQueue = new LinkedList(); + private final List getAllResourceResponse = new LinkedList(); + private final Map getResourceResponse = new HashMap(); + private final Gson gson = new Gson(); + + /** + * Run paragraph + * @param runner + */ + public void run(InterpreterContextRunner runner) { + sendEvent(new RemoteInterpreterEvent( + RemoteInterpreterEventType.RUN_INTERPRETER_CONTEXT_RUNNER, + gson.toJson(runner))); + } + + /** + * notify new angularObject creation + * @param object + */ + public void angularObjectAdd(AngularObject object) { + sendEvent(new RemoteInterpreterEvent( + RemoteInterpreterEventType.ANGULAR_OBJECT_ADD, gson.toJson(object))); + } + + /** + * notify angularObject update + */ + public void angularObjectUpdate(AngularObject object) { + sendEvent(new RemoteInterpreterEvent( + RemoteInterpreterEventType.ANGULAR_OBJECT_UPDATE, gson.toJson(object))); + } + + /** + * notify angularObject removal + */ + public void angularObjectRemove(String name, String noteId, String paragraphId) { + Map removeObject = new HashMap(); + removeObject.put("name", name); + removeObject.put("noteId", noteId); + removeObject.put("paragraphId", paragraphId); + + sendEvent(new RemoteInterpreterEvent( + RemoteInterpreterEventType.ANGULAR_OBJECT_REMOVE, gson.toJson(removeObject))); + } + + + /** + * Get all resources except for specific resourcePool + * @return + */ + @Override + public ResourceSet getAllResources() { + // request + sendEvent(new RemoteInterpreterEvent(RemoteInterpreterEventType.RESOURCE_POOL_GET_ALL, null)); + + synchronized (getAllResourceResponse) { + while (getAllResourceResponse.isEmpty()) { + try { + getAllResourceResponse.wait(); + } catch (InterruptedException e) { + logger.warn(e.getMessage(), e); + } + } + ResourceSet resourceSet = getAllResourceResponse.remove(0); + return resourceSet; + } + } + + @Override + public Object readResource(ResourceId resourceId) { + logger.debug("Request Read Resource {} from ZeppelinServer", resourceId.getName()); + synchronized (getResourceResponse) { + // wait for previous response consumed + while (getResourceResponse.containsKey(resourceId)) { + try { + getResourceResponse.wait(); + } catch (InterruptedException e) { + logger.warn(e.getMessage(), e); + } + } + + // send request + Gson gson = new Gson(); + sendEvent(new RemoteInterpreterEvent( + RemoteInterpreterEventType.RESOURCE_GET, + gson.toJson(resourceId))); + + // wait for response + while (!getResourceResponse.containsKey(resourceId)) { + try { + getResourceResponse.wait(); + } catch (InterruptedException e) { + logger.warn(e.getMessage(), e); + } + } + Object o = getResourceResponse.remove(resourceId); + getResourceResponse.notifyAll(); + return o; + } + } + + /** + * Supposed to call from RemoteInterpreterEventPoller + */ + public void putResponseGetAllResources(List resources) { + logger.debug("ResourceSet from ZeppelinServer"); + ResourceSet resourceSet = new ResourceSet(); + + for (String res : resources) { + RemoteResource resource = gson.fromJson(res, RemoteResource.class); + resource.setResourcePoolConnector(this); + resourceSet.add(resource); + } + + synchronized (getAllResourceResponse) { + getAllResourceResponse.add(resourceSet); + getAllResourceResponse.notify(); + } + } + + /** + * Supposed to call from RemoteInterpreterEventPoller + * @param resourceId json serialized ResourceId + * @param object java serialized of the object + */ + public void putResponseGetResource(String resourceId, ByteBuffer object) { + ResourceId rid = gson.fromJson(resourceId, ResourceId.class); + + logger.debug("Response resource {} from RemoteInterpreter", rid.getName()); + + Object o = null; + try { + o = Resource.deserializeObject(object); + } catch (IOException e) { + logger.error(e.getMessage(), e); + } catch (ClassNotFoundException e) { + logger.error(e.getMessage(), e); + } + + synchronized (getResourceResponse) { + getResourceResponse.put(rid, o); + getResourceResponse.notifyAll(); + } + } + + + /** + * Supposed to call from RemoteInterpreterEventPoller + * @return next available event + */ + public RemoteInterpreterEvent pollEvent() { + synchronized (eventQueue) { + if (eventQueue.isEmpty()) { + try { + eventQueue.wait(1000); + } catch (InterruptedException e) { + } + } + + if (eventQueue.isEmpty()) { + return new RemoteInterpreterEvent(RemoteInterpreterEventType.NO_OP, ""); + } else { + RemoteInterpreterEvent event = eventQueue.remove(0); + logger.debug("Send event {}", event.getType()); + return event; + } + } + } + + public void onInterpreterOutputAppend(String noteId, String paragraphId, String output) { + Map appendOutput = new HashMap(); + appendOutput.put("noteId", noteId); + appendOutput.put("paragraphId", paragraphId); + appendOutput.put("data", output); + + sendEvent(new RemoteInterpreterEvent( + RemoteInterpreterEventType.OUTPUT_APPEND, + gson.toJson(appendOutput))); + } + + public void onInterpreterOutputUpdate(String noteId, String paragraphId, String output) { + Map appendOutput = new HashMap(); + appendOutput.put("noteId", noteId); + appendOutput.put("paragraphId", paragraphId); + appendOutput.put("data", output); + + sendEvent(new RemoteInterpreterEvent( + RemoteInterpreterEventType.OUTPUT_UPDATE, + gson.toJson(appendOutput))); + } + + + private void sendEvent(RemoteInterpreterEvent event) { + synchronized (eventQueue) { + eventQueue.add(event); + eventQueue.notifyAll(); + } + } + +} diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterEventPoller.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterEventPoller.java index b1055e21bd0..be28bbf1227 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterEventPoller.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterEventPoller.java @@ -28,13 +28,21 @@ import org.apache.zeppelin.interpreter.thrift.RemoteInterpreterEvent; import org.apache.zeppelin.interpreter.thrift.RemoteInterpreterEventType; import org.apache.zeppelin.interpreter.thrift.RemoteInterpreterService.Client; +import org.apache.zeppelin.resource.Resource; +import org.apache.zeppelin.resource.ResourceId; +import org.apache.zeppelin.resource.ResourcePool; +import org.apache.zeppelin.resource.ResourceSet; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import java.nio.ByteBuffer; +import java.util.Collections; +import java.util.LinkedList; +import java.util.List; import java.util.Map; /** - * + * Processes message from RemoteInterpreter process */ public class RemoteInterpreterEventPoller extends Thread { private static final Logger logger = LoggerFactory.getLogger(RemoteInterpreterEventPoller.class); @@ -117,6 +125,15 @@ public void run() { interpreterProcess.getInterpreterContextRunnerPool().run( runnerFromRemote.getNoteId(), runnerFromRemote.getParagraphId()); + } else if (event.getType() == RemoteInterpreterEventType.RESOURCE_POOL_GET_ALL) { + ResourceSet resourceSet = getAllResourcePoolExcept(); + sendResourcePoolResponseGetAll(resourceSet); + } else if (event.getType() == RemoteInterpreterEventType.RESOURCE_GET) { + String resourceIdString = event.getData(); + ResourceId resourceId = gson.fromJson(resourceIdString, ResourceId.class); + logger.debug("RESOURCE_GET {} {}", resourceId.getResourcePoolId(), resourceId.getName()); + Object o = getResource(resourceId); + sendResourceResponseGet(resourceId, o); } else if (event.getType() == RemoteInterpreterEventType.OUTPUT_APPEND) { // on output append Map outputAppend = gson.fromJson( @@ -143,6 +160,120 @@ public void run() { } } + private void sendResourcePoolResponseGetAll(ResourceSet resourceSet) { + Client client = null; + boolean broken = false; + try { + client = interpreterProcess.getClient(); + List resourceList = new LinkedList(); + Gson gson = new Gson(); + for (Resource r : resourceSet) { + resourceList.add(gson.toJson(r)); + } + client.resourcePoolResponseGetAll(resourceList); + } catch (Exception e) { + logger.error(e.getMessage(), e); + broken = true; + } finally { + if (client != null) { + interpreterProcess.releaseClient(client, broken); + } + } + } + + private ResourceSet getAllResourcePoolExcept() { + ResourceSet resourceSet = new ResourceSet(); + for (InterpreterGroup intpGroup : InterpreterGroup.getAll()) { + if (intpGroup.getId().equals(interpreterGroup.getId())) { + continue; + } + + RemoteInterpreterProcess remoteInterpreterProcess = intpGroup.getRemoteInterpreterProcess(); + if (remoteInterpreterProcess == null) { + ResourcePool localPool = intpGroup.getResourcePool(); + if (localPool != null) { + resourceSet.addAll(localPool.getAll()); + } + } else if (interpreterProcess.isRunning()) { + Client client = null; + boolean broken = false; + try { + client = remoteInterpreterProcess.getClient(); + List resourceList = client.resoucePoolGetAll(); + Gson gson = new Gson(); + for (String res : resourceList) { + resourceSet.add(gson.fromJson(res, Resource.class)); + } + } catch (Exception e) { + logger.error(e.getMessage(), e); + broken = true; + } finally { + if (client != null) { + intpGroup.getRemoteInterpreterProcess().releaseClient(client, broken); + } + } + } + } + return resourceSet; + } + + + + private void sendResourceResponseGet(ResourceId resourceId, Object o) { + Client client = null; + boolean broken = false; + try { + client = interpreterProcess.getClient(); + Gson gson = new Gson(); + String rid = gson.toJson(resourceId); + ByteBuffer obj; + if (o == null) { + obj = ByteBuffer.allocate(0); + } else { + obj = Resource.serializeObject(o); + } + client.resourceResponseGet(rid, obj); + } catch (Exception e) { + logger.error(e.getMessage(), e); + broken = true; + } finally { + if (client != null) { + interpreterProcess.releaseClient(client, broken); + } + } + } + + private Object getResource(ResourceId resourceId) { + InterpreterGroup intpGroup = InterpreterGroup.get(resourceId.getResourcePoolId()); + if (intpGroup == null) { + return null; + } + RemoteInterpreterProcess remoteInterpreterProcess = intpGroup.getRemoteInterpreterProcess(); + if (remoteInterpreterProcess == null) { + ResourcePool localPool = intpGroup.getResourcePool(); + if (localPool != null) { + return localPool.get(resourceId.getName()); + } + } else if (interpreterProcess.isRunning()) { + Client client = null; + boolean broken = false; + try { + client = remoteInterpreterProcess.getClient(); + ByteBuffer res = client.resourceGet(resourceId.getName()); + Object o = Resource.deserializeObject(res); + return o; + } catch (Exception e) { + logger.error(e.getMessage(), e); + broken = true; + } finally { + if (client != null) { + intpGroup.getRemoteInterpreterProcess().releaseClient(client, broken); + } + } + } + return null; + } + private void waitQuietly() { try { synchronized (this) { diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterProcess.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterProcess.java index 5612a2bcf10..98113f6f88b 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterProcess.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterProcess.java @@ -139,6 +139,9 @@ public int reference(InterpreterGroup interpreterGroup) { } public Client getClient() throws Exception { + if (clientPool == null || clientPool.isClosed()) { + return null; + } return clientPool.borrowObject(); } @@ -181,7 +184,8 @@ public int dereference() { } catch (Exception e) { // safely ignore exception while client.shutdown() may terminates remote process logger.info("Exception in RemoteInterpreterProcess while synchronized dereference, can " + - "safely ignore exception while client.shutdown() may terminates remote process", e); + "safely ignore exception while client.shutdown() may terminates remote process"); + logger.debug(e.getMessage(), e); } finally { if (client != null) { // no longer used @@ -287,8 +291,13 @@ public void updateRemoteAngularObject(String name, String noteId, String paragra } catch (TException e) { broken = true; logger.error("Can't update angular object", e); + } catch (NullPointerException e) { + logger.error("Remote interpreter process not started", e); + return; } finally { - releaseClient(client, broken); + if (client != null) { + releaseClient(client, broken); + } } } diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterServer.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterServer.java index a59293b483b..541f2056334 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterServer.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterServer.java @@ -18,9 +18,11 @@ package org.apache.zeppelin.interpreter.remote; +import java.io.IOException; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; import java.net.URL; +import java.nio.ByteBuffer; import java.util.HashMap; import java.util.LinkedList; import java.util.List; @@ -39,9 +41,9 @@ import org.apache.zeppelin.interpreter.InterpreterResult.Code; import org.apache.zeppelin.interpreter.thrift.RemoteInterpreterContext; import org.apache.zeppelin.interpreter.thrift.RemoteInterpreterEvent; -import org.apache.zeppelin.interpreter.thrift.RemoteInterpreterEventType; import org.apache.zeppelin.interpreter.thrift.RemoteInterpreterResult; import org.apache.zeppelin.interpreter.thrift.RemoteInterpreterService; +import org.apache.zeppelin.resource.*; import org.apache.zeppelin.scheduler.Job; import org.apache.zeppelin.scheduler.Job.Status; import org.apache.zeppelin.scheduler.JobListener; @@ -64,6 +66,7 @@ public class RemoteInterpreterServer InterpreterGroup interpreterGroup; AngularObjectRegistry angularObjectRegistry; + DistributedResourcePool resourcePool; Gson gson = new Gson(); RemoteInterpreterService.Processor processor; @@ -71,13 +74,10 @@ public class RemoteInterpreterServer private int port; private TThreadPoolServer server; - List eventQueue = new LinkedList(); + RemoteInterpreterEventClient eventClient = new RemoteInterpreterEventClient(); public RemoteInterpreterServer(int port) throws TTransportException { this.port = port; - interpreterGroup = new InterpreterGroup(); - angularObjectRegistry = new AngularObjectRegistry(interpreterGroup.getId(), this); - interpreterGroup.setAngularObjectRegistry(angularObjectRegistry); processor = new RemoteInterpreterService.Processor(this); TServerSocket serverTransport = new TServerSocket(port); @@ -93,8 +93,10 @@ public void run() { @Override public void shutdown() throws TException { - interpreterGroup.close(); - interpreterGroup.destroy(); + if (interpreterGroup != null) { + interpreterGroup.close(); + interpreterGroup.destroy(); + } server.stop(); @@ -140,8 +142,18 @@ public static void main(String[] args) @Override - public void createInterpreter(String className, Map properties) + public void createInterpreter(String interpreterGroupId, String className, Map + properties) throws TException { + + if (interpreterGroup == null) { + interpreterGroup = new InterpreterGroup(interpreterGroupId); + angularObjectRegistry = new AngularObjectRegistry(interpreterGroup.getId(), this); + resourcePool = new DistributedResourcePool(interpreterGroup.getId(), eventClient); + interpreterGroup.setAngularObjectRegistry(angularObjectRegistry); + interpreterGroup.setResourcePool(resourcePool); + } + try { Class replClass = (Class) Object.class.forName(className); Properties p = new Properties(); @@ -240,6 +252,7 @@ public RemoteInterpreterResult interpret(String className, String st, context.getGui()); } + class InterpretJobListener implements JobListener { @Override @@ -379,6 +392,7 @@ private InterpreterContext convert(RemoteInterpreterContext ric) { new TypeToken>() {}.getType()), gson.fromJson(ric.getGui(), GUI.class), interpreterGroup.getAngularObjectRegistry(), + interpreterGroup.getResourcePool(), contextRunners, createInterpreterOutput(ric.getNoteId(), ric.getParagraphId())); } @@ -387,30 +401,12 @@ private InterpreterOutput createInterpreterOutput(final String noteId, final Str return new InterpreterOutput(new InterpreterOutputListener() { @Override public void onAppend(InterpreterOutput out, byte[] line) { - Map appendOutput = new HashMap(); - appendOutput.put("noteId", noteId); - appendOutput.put("paragraphId", paragraphId); - appendOutput.put("data", new String(line)); - - Gson gson = new Gson(); - - sendEvent(new RemoteInterpreterEvent( - RemoteInterpreterEventType.OUTPUT_APPEND, - gson.toJson(appendOutput))); + eventClient.onInterpreterOutputAppend(noteId, paragraphId, new String(line)); } @Override public void onUpdate(InterpreterOutput out, byte[] output) { - Map appendOutput = new HashMap(); - appendOutput.put("noteId", noteId); - appendOutput.put("paragraphId", paragraphId); - appendOutput.put("data", new String(output)); - - Gson gson = new Gson(); - - sendEvent(new RemoteInterpreterEvent( - RemoteInterpreterEventType.OUTPUT_UPDATE, - gson.toJson(appendOutput))); + eventClient.onInterpreterOutputUpdate(noteId, paragraphId, new String(output)); } }); } @@ -427,10 +423,7 @@ public ParagraphRunner(RemoteInterpreterServer server, String noteId, String par @Override public void run() { - Gson gson = new Gson(); - server.sendEvent(new RemoteInterpreterEvent( - RemoteInterpreterEventType.RUN_INTERPRETER_CONTEXT_RUNNER, - gson.toJson(this))); + server.eventClient.run(this); } } @@ -447,6 +440,10 @@ private RemoteInterpreterResult convert(InterpreterResult result, @Override public String getStatus(String jobId) throws TException { + if (interpreterGroup == null) { + return "Unknown"; + } + synchronized (interpreterGroup) { for (Interpreter intp : interpreterGroup) { for (Job job : intp.getScheduler().getJobsRunning()) { @@ -469,50 +466,28 @@ public String getStatus(String jobId) @Override public void onAdd(String interpreterGroupId, AngularObject object) { - sendEvent(new RemoteInterpreterEvent( - RemoteInterpreterEventType.ANGULAR_OBJECT_ADD, gson.toJson(object))); + eventClient.angularObjectAdd(object); } @Override public void onUpdate(String interpreterGroupId, AngularObject object) { - sendEvent(new RemoteInterpreterEvent( - RemoteInterpreterEventType.ANGULAR_OBJECT_UPDATE, gson.toJson(object))); + eventClient.angularObjectUpdate(object); } @Override public void onRemove(String interpreterGroupId, String name, String noteId, String paragraphId) { - Map removeObject = new HashMap(); - removeObject.put("name", name); - removeObject.put("noteId", noteId); - - sendEvent(new RemoteInterpreterEvent( - RemoteInterpreterEventType.ANGULAR_OBJECT_REMOVE, gson.toJson(removeObject))); + eventClient.angularObjectRemove(name, noteId, paragraphId); } - private void sendEvent(RemoteInterpreterEvent event) { - synchronized (eventQueue) { - eventQueue.add(event); - eventQueue.notifyAll(); - } - } + /** + * Poll event from RemoteInterpreterEventPoller + * @return + * @throws TException + */ @Override public RemoteInterpreterEvent getEvent() throws TException { - synchronized (eventQueue) { - if (eventQueue.isEmpty()) { - try { - eventQueue.wait(1000); - } catch (InterruptedException e) { - logger.info("Exception in RemoteInterpreterServer while getEvent, eventQueue.wait", e); - } - } - - if (eventQueue.isEmpty()) { - return new RemoteInterpreterEvent(RemoteInterpreterEventType.NO_OP, ""); - } else { - return eventQueue.remove(0); - } - } + return eventClient.pollEvent(); } /** @@ -530,7 +505,7 @@ public void angularObjectUpdate(String name, String noteId, String paragraphId, // first try local objects AngularObject ao = registry.get(name, noteId, paragraphId); if (ao == null) { - logger.error("Angular object {} not exists", name); + logger.debug("Angular object {} not exists", name); return; } @@ -547,8 +522,8 @@ public void angularObjectUpdate(String name, String noteId, String paragraphId, ao.set(value, false); return; } catch (Exception e) { - // no luck - logger.info("Exception in RemoteInterpreterServer while angularObjectUpdate, no luck", e); + // it's not a previous object's type. proceed to treat as a generic type + logger.debug(e.getMessage(), e); } } @@ -559,8 +534,8 @@ public void angularObjectUpdate(String name, String noteId, String paragraphId, new TypeToken>() { }.getType()); } catch (Exception e) { - // no lock - logger.info("Exception in RemoteInterpreterServer while angularObjectUpdate, no lock", e); + // it's not a generic json object, too. okay, proceed to threat as a string type + logger.debug(e.getMessage(), e); } } @@ -594,8 +569,8 @@ public void angularObjectAdd(String name, String noteId, String paragraphId, Str new TypeToken>() { }.getType()); } catch (Exception e) { - // nolock - logger.info("Exception in RemoteInterpreterServer while angularObjectAdd, nolock", e); + // it's okay. proceed to treat object as a string + logger.debug(e.getMessage(), e); } // try string object type at last @@ -612,4 +587,52 @@ public void angularObjectRemove(String name, String noteId, String paragraphId) AngularObjectRegistry registry = interpreterGroup.getAngularObjectRegistry(); registry.remove(name, noteId, paragraphId, false); } + + @Override + public void resourcePoolResponseGetAll(List resources) throws TException { + eventClient.putResponseGetAllResources(resources); + } + + /** + * Get payload of resource from remote + * @param resourceId json serialized ResourceId + * @param object java serialized of the object + * @throws TException + */ + @Override + public void resourceResponseGet(String resourceId, ByteBuffer object) throws TException { + eventClient.putResponseGetResource(resourceId, object); + } + + @Override + public List resoucePoolGetAll() throws TException { + logger.debug("Request getAll from ZeppelinServer"); + + ResourceSet resourceSet = resourcePool.getAll(false); + List result = new LinkedList(); + Gson gson = new Gson(); + + for (Resource r : resourceSet) { + result.add(gson.toJson(r)); + } + + return result; + } + + @Override + public ByteBuffer resourceGet(String resourceName) throws TException { + logger.debug("Request resourceGet {} from ZeppelinServer", resourceName); + Resource resource = resourcePool.get(resourceName, false); + + if (resource == null || resource.get() == null || !resource.isSerializable()) { + return ByteBuffer.allocate(0); + } else { + try { + return Resource.serializeObject(resource.get()); + } catch (IOException e) { + logger.error(e.getMessage(), e); + return ByteBuffer.allocate(0); + } + } + } } diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterUtils.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterUtils.java index 4d2e46e96a9..a66b52ab229 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterUtils.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterUtils.java @@ -47,7 +47,8 @@ public static boolean checkIfRemoteEndpointAccessible(String host, int port) { discover.close(); return true; } catch (IOException e) { - LOGGER.info("Exception in RemoteInterpreterUtils while checkIfRemoteEndpointAccessible", e); + // end point is not accessible + LOGGER.debug(e.getMessage(), e); return false; } } diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/thrift/RemoteInterpreterContext.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/thrift/RemoteInterpreterContext.java index 175f482cadb..b6a3da1e4f5 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/thrift/RemoteInterpreterContext.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/thrift/RemoteInterpreterContext.java @@ -51,7 +51,7 @@ import org.slf4j.LoggerFactory; @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) -@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2016-1-4") +@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2016-1-24") public class RemoteInterpreterContext implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("RemoteInterpreterContext"); diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/thrift/RemoteInterpreterEvent.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/thrift/RemoteInterpreterEvent.java index 79203fbec29..e560ec886d9 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/thrift/RemoteInterpreterEvent.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/thrift/RemoteInterpreterEvent.java @@ -51,7 +51,7 @@ import org.slf4j.LoggerFactory; @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) -@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2016-1-4") +@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2016-1-24") public class RemoteInterpreterEvent implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("RemoteInterpreterEvent"); diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/thrift/RemoteInterpreterEventType.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/thrift/RemoteInterpreterEventType.java index d6503183d06..7cb7963130f 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/thrift/RemoteInterpreterEventType.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/thrift/RemoteInterpreterEventType.java @@ -34,8 +34,10 @@ public enum RemoteInterpreterEventType implements org.apache.thrift.TEnum { ANGULAR_OBJECT_UPDATE(3), ANGULAR_OBJECT_REMOVE(4), RUN_INTERPRETER_CONTEXT_RUNNER(5), - OUTPUT_APPEND(6), - OUTPUT_UPDATE(7); + RESOURCE_POOL_GET_ALL(6), + RESOURCE_GET(7), + OUTPUT_APPEND(8), + OUTPUT_UPDATE(9); private final int value; @@ -67,8 +69,12 @@ public static RemoteInterpreterEventType findByValue(int value) { case 5: return RUN_INTERPRETER_CONTEXT_RUNNER; case 6: - return OUTPUT_APPEND; + return RESOURCE_POOL_GET_ALL; case 7: + return RESOURCE_GET; + case 8: + return OUTPUT_APPEND; + case 9: return OUTPUT_UPDATE; default: return null; diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/thrift/RemoteInterpreterResult.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/thrift/RemoteInterpreterResult.java index cc50f9c89fe..6539756a645 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/thrift/RemoteInterpreterResult.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/thrift/RemoteInterpreterResult.java @@ -51,7 +51,7 @@ import org.slf4j.LoggerFactory; @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) -@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2016-1-4") +@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2016-1-24") public class RemoteInterpreterResult implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("RemoteInterpreterResult"); diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/thrift/RemoteInterpreterService.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/thrift/RemoteInterpreterService.java index fbcc5140dbd..abf4316829d 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/thrift/RemoteInterpreterService.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/thrift/RemoteInterpreterService.java @@ -51,12 +51,12 @@ import org.slf4j.LoggerFactory; @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) -@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2016-1-4") +@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2016-1-24") public class RemoteInterpreterService { public interface Iface { - public void createInterpreter(String className, Map properties) throws org.apache.thrift.TException; + public void createInterpreter(String intpGroupId, String className, Map properties) throws org.apache.thrift.TException; public void open(String className) throws org.apache.thrift.TException; @@ -78,6 +78,14 @@ public interface Iface { public RemoteInterpreterEvent getEvent() throws org.apache.thrift.TException; + public void resourcePoolResponseGetAll(List resources) throws org.apache.thrift.TException; + + public void resourceResponseGet(String resourceId, ByteBuffer object) throws org.apache.thrift.TException; + + public List resoucePoolGetAll() throws org.apache.thrift.TException; + + public ByteBuffer resourceGet(String resourceName) throws org.apache.thrift.TException; + public void angularObjectUpdate(String name, String noteId, String paragraphId, String object) throws org.apache.thrift.TException; public void angularObjectAdd(String name, String noteId, String paragraphId, String object) throws org.apache.thrift.TException; @@ -88,7 +96,7 @@ public interface Iface { public interface AsyncIface { - public void createInterpreter(String className, Map properties, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; + public void createInterpreter(String intpGroupId, String className, Map properties, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; public void open(String className, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; @@ -110,6 +118,14 @@ public interface AsyncIface { public void getEvent(org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; + public void resourcePoolResponseGetAll(List resources, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; + + public void resourceResponseGet(String resourceId, ByteBuffer object, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; + + public void resoucePoolGetAll(org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; + + public void resourceGet(String resourceName, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; + public void angularObjectUpdate(String name, String noteId, String paragraphId, String object, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; public void angularObjectAdd(String name, String noteId, String paragraphId, String object, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; @@ -138,15 +154,16 @@ public Client(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.prot super(iprot, oprot); } - public void createInterpreter(String className, Map properties) throws org.apache.thrift.TException + public void createInterpreter(String intpGroupId, String className, Map properties) throws org.apache.thrift.TException { - send_createInterpreter(className, properties); + send_createInterpreter(intpGroupId, className, properties); recv_createInterpreter(); } - public void send_createInterpreter(String className, Map properties) throws org.apache.thrift.TException + public void send_createInterpreter(String intpGroupId, String className, Map properties) throws org.apache.thrift.TException { createInterpreter_args args = new createInterpreter_args(); + args.setIntpGroupId(intpGroupId); args.setClassName(className); args.setProperties(properties); sendBase("createInterpreter", args); @@ -381,6 +398,92 @@ public RemoteInterpreterEvent recv_getEvent() throws org.apache.thrift.TExceptio throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "getEvent failed: unknown result"); } + public void resourcePoolResponseGetAll(List resources) throws org.apache.thrift.TException + { + send_resourcePoolResponseGetAll(resources); + recv_resourcePoolResponseGetAll(); + } + + public void send_resourcePoolResponseGetAll(List resources) throws org.apache.thrift.TException + { + resourcePoolResponseGetAll_args args = new resourcePoolResponseGetAll_args(); + args.setResources(resources); + sendBase("resourcePoolResponseGetAll", args); + } + + public void recv_resourcePoolResponseGetAll() throws org.apache.thrift.TException + { + resourcePoolResponseGetAll_result result = new resourcePoolResponseGetAll_result(); + receiveBase(result, "resourcePoolResponseGetAll"); + return; + } + + public void resourceResponseGet(String resourceId, ByteBuffer object) throws org.apache.thrift.TException + { + send_resourceResponseGet(resourceId, object); + recv_resourceResponseGet(); + } + + public void send_resourceResponseGet(String resourceId, ByteBuffer object) throws org.apache.thrift.TException + { + resourceResponseGet_args args = new resourceResponseGet_args(); + args.setResourceId(resourceId); + args.setObject(object); + sendBase("resourceResponseGet", args); + } + + public void recv_resourceResponseGet() throws org.apache.thrift.TException + { + resourceResponseGet_result result = new resourceResponseGet_result(); + receiveBase(result, "resourceResponseGet"); + return; + } + + public List resoucePoolGetAll() throws org.apache.thrift.TException + { + send_resoucePoolGetAll(); + return recv_resoucePoolGetAll(); + } + + public void send_resoucePoolGetAll() throws org.apache.thrift.TException + { + resoucePoolGetAll_args args = new resoucePoolGetAll_args(); + sendBase("resoucePoolGetAll", args); + } + + public List recv_resoucePoolGetAll() throws org.apache.thrift.TException + { + resoucePoolGetAll_result result = new resoucePoolGetAll_result(); + receiveBase(result, "resoucePoolGetAll"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "resoucePoolGetAll failed: unknown result"); + } + + public ByteBuffer resourceGet(String resourceName) throws org.apache.thrift.TException + { + send_resourceGet(resourceName); + return recv_resourceGet(); + } + + public void send_resourceGet(String resourceName) throws org.apache.thrift.TException + { + resourceGet_args args = new resourceGet_args(); + args.setResourceName(resourceName); + sendBase("resourceGet", args); + } + + public ByteBuffer recv_resourceGet() throws org.apache.thrift.TException + { + resourceGet_result result = new resourceGet_result(); + receiveBase(result, "resourceGet"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "resourceGet failed: unknown result"); + } + public void angularObjectUpdate(String name, String noteId, String paragraphId, String object) throws org.apache.thrift.TException { send_angularObjectUpdate(name, noteId, paragraphId, object); @@ -467,18 +570,20 @@ public AsyncClient(org.apache.thrift.protocol.TProtocolFactory protocolFactory, super(protocolFactory, clientManager, transport); } - public void createInterpreter(String className, Map properties, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { + public void createInterpreter(String intpGroupId, String className, Map properties, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { checkReady(); - createInterpreter_call method_call = new createInterpreter_call(className, properties, resultHandler, this, ___protocolFactory, ___transport); + createInterpreter_call method_call = new createInterpreter_call(intpGroupId, className, properties, resultHandler, this, ___protocolFactory, ___transport); this.___currentMethod = method_call; ___manager.call(method_call); } public static class createInterpreter_call extends org.apache.thrift.async.TAsyncMethodCall { + private String intpGroupId; private String className; private Map properties; - public createInterpreter_call(String className, Map properties, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException { + public createInterpreter_call(String intpGroupId, String className, Map properties, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException { super(client, protocolFactory, transport, resultHandler, false); + this.intpGroupId = intpGroupId; this.className = className; this.properties = properties; } @@ -486,6 +591,7 @@ public createInterpreter_call(String className, Map properties, o public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException { prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("createInterpreter", org.apache.thrift.protocol.TMessageType.CALL, 0)); createInterpreter_args args = new createInterpreter_args(); + args.setIntpGroupId(intpGroupId); args.setClassName(className); args.setProperties(properties); args.write(prot); @@ -834,6 +940,134 @@ public RemoteInterpreterEvent getResult() throws org.apache.thrift.TException { } } + public void resourcePoolResponseGetAll(List resources, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { + checkReady(); + resourcePoolResponseGetAll_call method_call = new resourcePoolResponseGetAll_call(resources, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class resourcePoolResponseGetAll_call extends org.apache.thrift.async.TAsyncMethodCall { + private List resources; + public resourcePoolResponseGetAll_call(List resources, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.resources = resources; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException { + prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("resourcePoolResponseGetAll", org.apache.thrift.protocol.TMessageType.CALL, 0)); + resourcePoolResponseGetAll_args args = new resourcePoolResponseGetAll_args(); + args.setResources(resources); + args.write(prot); + prot.writeMessageEnd(); + } + + public void getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport); + (new Client(prot)).recv_resourcePoolResponseGetAll(); + } + } + + public void resourceResponseGet(String resourceId, ByteBuffer object, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { + checkReady(); + resourceResponseGet_call method_call = new resourceResponseGet_call(resourceId, object, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class resourceResponseGet_call extends org.apache.thrift.async.TAsyncMethodCall { + private String resourceId; + private ByteBuffer object; + public resourceResponseGet_call(String resourceId, ByteBuffer object, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.resourceId = resourceId; + this.object = object; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException { + prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("resourceResponseGet", org.apache.thrift.protocol.TMessageType.CALL, 0)); + resourceResponseGet_args args = new resourceResponseGet_args(); + args.setResourceId(resourceId); + args.setObject(object); + args.write(prot); + prot.writeMessageEnd(); + } + + public void getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport); + (new Client(prot)).recv_resourceResponseGet(); + } + } + + public void resoucePoolGetAll(org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { + checkReady(); + resoucePoolGetAll_call method_call = new resoucePoolGetAll_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class resoucePoolGetAll_call extends org.apache.thrift.async.TAsyncMethodCall { + public resoucePoolGetAll_call(org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException { + prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("resoucePoolGetAll", org.apache.thrift.protocol.TMessageType.CALL, 0)); + resoucePoolGetAll_args args = new resoucePoolGetAll_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + public List getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_resoucePoolGetAll(); + } + } + + public void resourceGet(String resourceName, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { + checkReady(); + resourceGet_call method_call = new resourceGet_call(resourceName, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class resourceGet_call extends org.apache.thrift.async.TAsyncMethodCall { + private String resourceName; + public resourceGet_call(String resourceName, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.resourceName = resourceName; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException { + prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("resourceGet", org.apache.thrift.protocol.TMessageType.CALL, 0)); + resourceGet_args args = new resourceGet_args(); + args.setResourceName(resourceName); + args.write(prot); + prot.writeMessageEnd(); + } + + public ByteBuffer getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_resourceGet(); + } + } + public void angularObjectUpdate(String name, String noteId, String paragraphId, String object, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { checkReady(); angularObjectUpdate_call method_call = new angularObjectUpdate_call(name, noteId, paragraphId, object, resultHandler, this, ___protocolFactory, ___transport); @@ -978,6 +1212,10 @@ protected Processor(I iface, Map extends org.apache.thrift.ProcessFunction { + public resourcePoolResponseGetAll() { + super("resourcePoolResponseGetAll"); + } + + public resourcePoolResponseGetAll_args getEmptyArgsInstance() { + return new resourcePoolResponseGetAll_args(); + } + + protected boolean isOneway() { + return false; + } + + public resourcePoolResponseGetAll_result getResult(I iface, resourcePoolResponseGetAll_args args) throws org.apache.thrift.TException { + resourcePoolResponseGetAll_result result = new resourcePoolResponseGetAll_result(); + iface.resourcePoolResponseGetAll(args.resources); + return result; + } + } + + public static class resourceResponseGet extends org.apache.thrift.ProcessFunction { + public resourceResponseGet() { + super("resourceResponseGet"); + } + + public resourceResponseGet_args getEmptyArgsInstance() { + return new resourceResponseGet_args(); + } + + protected boolean isOneway() { + return false; + } + + public resourceResponseGet_result getResult(I iface, resourceResponseGet_args args) throws org.apache.thrift.TException { + resourceResponseGet_result result = new resourceResponseGet_result(); + iface.resourceResponseGet(args.resourceId, args.object); + return result; + } + } + + public static class resoucePoolGetAll extends org.apache.thrift.ProcessFunction { + public resoucePoolGetAll() { + super("resoucePoolGetAll"); + } + + public resoucePoolGetAll_args getEmptyArgsInstance() { + return new resoucePoolGetAll_args(); + } + + protected boolean isOneway() { + return false; + } + + public resoucePoolGetAll_result getResult(I iface, resoucePoolGetAll_args args) throws org.apache.thrift.TException { + resoucePoolGetAll_result result = new resoucePoolGetAll_result(); + result.success = iface.resoucePoolGetAll(); + return result; + } + } + + public static class resourceGet extends org.apache.thrift.ProcessFunction { + public resourceGet() { + super("resourceGet"); + } + + public resourceGet_args getEmptyArgsInstance() { + return new resourceGet_args(); + } + + protected boolean isOneway() { + return false; + } + + public resourceGet_result getResult(I iface, resourceGet_args args) throws org.apache.thrift.TException { + resourceGet_result result = new resourceGet_result(); + result.success = iface.resourceGet(args.resourceName); + return result; + } + } + public static class angularObjectUpdate extends org.apache.thrift.ProcessFunction { public angularObjectUpdate() { super("angularObjectUpdate"); @@ -1289,6 +1607,10 @@ protected AsyncProcessor(I iface, Map resultHandler) throws TException { - iface.createInterpreter(args.className, args.properties,resultHandler); + iface.createInterpreter(args.intpGroupId, args.className, args.properties,resultHandler); } } @@ -1852,20 +2174,20 @@ public void start(I iface, getEvent_args args, org.apache.thrift.async.AsyncMeth } } - public static class angularObjectUpdate extends org.apache.thrift.AsyncProcessFunction { - public angularObjectUpdate() { - super("angularObjectUpdate"); + public static class resourcePoolResponseGetAll extends org.apache.thrift.AsyncProcessFunction { + public resourcePoolResponseGetAll() { + super("resourcePoolResponseGetAll"); } - public angularObjectUpdate_args getEmptyArgsInstance() { - return new angularObjectUpdate_args(); + public resourcePoolResponseGetAll_args getEmptyArgsInstance() { + return new resourcePoolResponseGetAll_args(); } public AsyncMethodCallback getResultHandler(final AsyncFrameBuffer fb, final int seqid) { final org.apache.thrift.AsyncProcessFunction fcall = this; return new AsyncMethodCallback() { public void onComplete(Void o) { - angularObjectUpdate_result result = new angularObjectUpdate_result(); + resourcePoolResponseGetAll_result result = new resourcePoolResponseGetAll_result(); try { fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); return; @@ -1877,7 +2199,7 @@ public void onComplete(Void o) { public void onError(Exception e) { byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; org.apache.thrift.TBase msg; - angularObjectUpdate_result result = new angularObjectUpdate_result(); + resourcePoolResponseGetAll_result result = new resourcePoolResponseGetAll_result(); { msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); @@ -1897,25 +2219,25 @@ protected boolean isOneway() { return false; } - public void start(I iface, angularObjectUpdate_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws TException { - iface.angularObjectUpdate(args.name, args.noteId, args.paragraphId, args.object,resultHandler); + public void start(I iface, resourcePoolResponseGetAll_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws TException { + iface.resourcePoolResponseGetAll(args.resources,resultHandler); } } - public static class angularObjectAdd extends org.apache.thrift.AsyncProcessFunction { - public angularObjectAdd() { - super("angularObjectAdd"); + public static class resourceResponseGet extends org.apache.thrift.AsyncProcessFunction { + public resourceResponseGet() { + super("resourceResponseGet"); } - public angularObjectAdd_args getEmptyArgsInstance() { - return new angularObjectAdd_args(); + public resourceResponseGet_args getEmptyArgsInstance() { + return new resourceResponseGet_args(); } public AsyncMethodCallback getResultHandler(final AsyncFrameBuffer fb, final int seqid) { final org.apache.thrift.AsyncProcessFunction fcall = this; return new AsyncMethodCallback() { public void onComplete(Void o) { - angularObjectAdd_result result = new angularObjectAdd_result(); + resourceResponseGet_result result = new resourceResponseGet_result(); try { fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); return; @@ -1927,7 +2249,7 @@ public void onComplete(Void o) { public void onError(Exception e) { byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; org.apache.thrift.TBase msg; - angularObjectAdd_result result = new angularObjectAdd_result(); + resourceResponseGet_result result = new resourceResponseGet_result(); { msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); @@ -1947,25 +2269,26 @@ protected boolean isOneway() { return false; } - public void start(I iface, angularObjectAdd_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws TException { - iface.angularObjectAdd(args.name, args.noteId, args.paragraphId, args.object,resultHandler); + public void start(I iface, resourceResponseGet_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws TException { + iface.resourceResponseGet(args.resourceId, args.object,resultHandler); } } - public static class angularObjectRemove extends org.apache.thrift.AsyncProcessFunction { - public angularObjectRemove() { - super("angularObjectRemove"); + public static class resoucePoolGetAll extends org.apache.thrift.AsyncProcessFunction> { + public resoucePoolGetAll() { + super("resoucePoolGetAll"); } - public angularObjectRemove_args getEmptyArgsInstance() { - return new angularObjectRemove_args(); + public resoucePoolGetAll_args getEmptyArgsInstance() { + return new resoucePoolGetAll_args(); } - public AsyncMethodCallback getResultHandler(final AsyncFrameBuffer fb, final int seqid) { + public AsyncMethodCallback> getResultHandler(final AsyncFrameBuffer fb, final int seqid) { final org.apache.thrift.AsyncProcessFunction fcall = this; - return new AsyncMethodCallback() { - public void onComplete(Void o) { - angularObjectRemove_result result = new angularObjectRemove_result(); + return new AsyncMethodCallback>() { + public void onComplete(List o) { + resoucePoolGetAll_result result = new resoucePoolGetAll_result(); + result.success = o; try { fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); return; @@ -1977,7 +2300,7 @@ public void onComplete(Void o) { public void onError(Exception e) { byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; org.apache.thrift.TBase msg; - angularObjectRemove_result result = new angularObjectRemove_result(); + resoucePoolGetAll_result result = new resoucePoolGetAll_result(); { msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); @@ -1997,49 +2320,255 @@ protected boolean isOneway() { return false; } - public void start(I iface, angularObjectRemove_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws TException { - iface.angularObjectRemove(args.name, args.noteId, args.paragraphId,resultHandler); + public void start(I iface, resoucePoolGetAll_args args, org.apache.thrift.async.AsyncMethodCallback> resultHandler) throws TException { + iface.resoucePoolGetAll(resultHandler); } } - } - - public static class createInterpreter_args implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("createInterpreter_args"); - - private static final org.apache.thrift.protocol.TField CLASS_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("className", org.apache.thrift.protocol.TType.STRING, (short)1); - private static final org.apache.thrift.protocol.TField PROPERTIES_FIELD_DESC = new org.apache.thrift.protocol.TField("properties", org.apache.thrift.protocol.TType.MAP, (short)2); - - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - static { - schemes.put(StandardScheme.class, new createInterpreter_argsStandardSchemeFactory()); - schemes.put(TupleScheme.class, new createInterpreter_argsTupleSchemeFactory()); - } - - public String className; // required - public Map properties; // required - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - CLASS_NAME((short)1, "className"), - PROPERTIES((short)2, "properties"); - - private static final Map byName = new HashMap(); + public static class resourceGet extends org.apache.thrift.AsyncProcessFunction { + public resourceGet() { + super("resourceGet"); + } - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } + public resourceGet_args getEmptyArgsInstance() { + return new resourceGet_args(); } - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - case 1: // CLASS_NAME + public AsyncMethodCallback getResultHandler(final AsyncFrameBuffer fb, final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new AsyncMethodCallback() { + public void onComplete(ByteBuffer o) { + resourceGet_result result = new resourceGet_result(); + result.success = o; + try { + fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); + return; + } catch (Exception e) { + LOGGER.error("Exception writing to internal frame buffer", e); + } + fb.close(); + } + public void onError(Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TBase msg; + resourceGet_result result = new resourceGet_result(); + { + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb,msg,msgType,seqid); + return; + } catch (Exception ex) { + LOGGER.error("Exception writing to internal frame buffer", ex); + } + fb.close(); + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start(I iface, resourceGet_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws TException { + iface.resourceGet(args.resourceName,resultHandler); + } + } + + public static class angularObjectUpdate extends org.apache.thrift.AsyncProcessFunction { + public angularObjectUpdate() { + super("angularObjectUpdate"); + } + + public angularObjectUpdate_args getEmptyArgsInstance() { + return new angularObjectUpdate_args(); + } + + public AsyncMethodCallback getResultHandler(final AsyncFrameBuffer fb, final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new AsyncMethodCallback() { + public void onComplete(Void o) { + angularObjectUpdate_result result = new angularObjectUpdate_result(); + try { + fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); + return; + } catch (Exception e) { + LOGGER.error("Exception writing to internal frame buffer", e); + } + fb.close(); + } + public void onError(Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TBase msg; + angularObjectUpdate_result result = new angularObjectUpdate_result(); + { + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb,msg,msgType,seqid); + return; + } catch (Exception ex) { + LOGGER.error("Exception writing to internal frame buffer", ex); + } + fb.close(); + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start(I iface, angularObjectUpdate_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws TException { + iface.angularObjectUpdate(args.name, args.noteId, args.paragraphId, args.object,resultHandler); + } + } + + public static class angularObjectAdd extends org.apache.thrift.AsyncProcessFunction { + public angularObjectAdd() { + super("angularObjectAdd"); + } + + public angularObjectAdd_args getEmptyArgsInstance() { + return new angularObjectAdd_args(); + } + + public AsyncMethodCallback getResultHandler(final AsyncFrameBuffer fb, final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new AsyncMethodCallback() { + public void onComplete(Void o) { + angularObjectAdd_result result = new angularObjectAdd_result(); + try { + fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); + return; + } catch (Exception e) { + LOGGER.error("Exception writing to internal frame buffer", e); + } + fb.close(); + } + public void onError(Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TBase msg; + angularObjectAdd_result result = new angularObjectAdd_result(); + { + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb,msg,msgType,seqid); + return; + } catch (Exception ex) { + LOGGER.error("Exception writing to internal frame buffer", ex); + } + fb.close(); + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start(I iface, angularObjectAdd_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws TException { + iface.angularObjectAdd(args.name, args.noteId, args.paragraphId, args.object,resultHandler); + } + } + + public static class angularObjectRemove extends org.apache.thrift.AsyncProcessFunction { + public angularObjectRemove() { + super("angularObjectRemove"); + } + + public angularObjectRemove_args getEmptyArgsInstance() { + return new angularObjectRemove_args(); + } + + public AsyncMethodCallback getResultHandler(final AsyncFrameBuffer fb, final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new AsyncMethodCallback() { + public void onComplete(Void o) { + angularObjectRemove_result result = new angularObjectRemove_result(); + try { + fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); + return; + } catch (Exception e) { + LOGGER.error("Exception writing to internal frame buffer", e); + } + fb.close(); + } + public void onError(Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TBase msg; + angularObjectRemove_result result = new angularObjectRemove_result(); + { + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb,msg,msgType,seqid); + return; + } catch (Exception ex) { + LOGGER.error("Exception writing to internal frame buffer", ex); + } + fb.close(); + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start(I iface, angularObjectRemove_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws TException { + iface.angularObjectRemove(args.name, args.noteId, args.paragraphId,resultHandler); + } + } + + } + + public static class createInterpreter_args implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("createInterpreter_args"); + + private static final org.apache.thrift.protocol.TField INTP_GROUP_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("intpGroupId", org.apache.thrift.protocol.TType.STRING, (short)1); + private static final org.apache.thrift.protocol.TField CLASS_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("className", org.apache.thrift.protocol.TType.STRING, (short)2); + private static final org.apache.thrift.protocol.TField PROPERTIES_FIELD_DESC = new org.apache.thrift.protocol.TField("properties", org.apache.thrift.protocol.TType.MAP, (short)3); + + private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new createInterpreter_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new createInterpreter_argsTupleSchemeFactory()); + } + + public String intpGroupId; // required + public String className; // required + public Map properties; // required + + /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + INTP_GROUP_ID((short)1, "intpGroupId"), + CLASS_NAME((short)2, "className"), + PROPERTIES((short)3, "properties"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** + * Find the _Fields constant that matches fieldId, or null if its not found. + */ + public static _Fields findByThriftId(int fieldId) { + switch(fieldId) { + case 1: // INTP_GROUP_ID + return INTP_GROUP_ID; + case 2: // CLASS_NAME return CLASS_NAME; - case 2: // PROPERTIES + case 3: // PROPERTIES return PROPERTIES; default: return null; @@ -2084,6 +2613,8 @@ public String getFieldName() { public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; static { Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put(_Fields.INTP_GROUP_ID, new org.apache.thrift.meta_data.FieldMetaData("intpGroupId", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); tmpMap.put(_Fields.CLASS_NAME, new org.apache.thrift.meta_data.FieldMetaData("className", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); tmpMap.put(_Fields.PROPERTIES, new org.apache.thrift.meta_data.FieldMetaData("properties", org.apache.thrift.TFieldRequirementType.DEFAULT, @@ -2098,10 +2629,12 @@ public createInterpreter_args() { } public createInterpreter_args( + String intpGroupId, String className, Map properties) { this(); + this.intpGroupId = intpGroupId; this.className = className; this.properties = properties; } @@ -2110,6 +2643,9 @@ public createInterpreter_args( * Performs a deep copy on other. */ public createInterpreter_args(createInterpreter_args other) { + if (other.isSetIntpGroupId()) { + this.intpGroupId = other.intpGroupId; + } if (other.isSetClassName()) { this.className = other.className; } @@ -2125,10 +2661,35 @@ public createInterpreter_args deepCopy() { @Override public void clear() { + this.intpGroupId = null; this.className = null; this.properties = null; } + public String getIntpGroupId() { + return this.intpGroupId; + } + + public createInterpreter_args setIntpGroupId(String intpGroupId) { + this.intpGroupId = intpGroupId; + return this; + } + + public void unsetIntpGroupId() { + this.intpGroupId = null; + } + + /** Returns true if field intpGroupId is set (has been assigned a value) and false otherwise */ + public boolean isSetIntpGroupId() { + return this.intpGroupId != null; + } + + public void setIntpGroupIdIsSet(boolean value) { + if (!value) { + this.intpGroupId = null; + } + } + public String getClassName() { return this.className; } @@ -2190,6 +2751,14 @@ public void setPropertiesIsSet(boolean value) { public void setFieldValue(_Fields field, Object value) { switch (field) { + case INTP_GROUP_ID: + if (value == null) { + unsetIntpGroupId(); + } else { + setIntpGroupId((String)value); + } + break; + case CLASS_NAME: if (value == null) { unsetClassName(); @@ -2211,6 +2780,9 @@ public void setFieldValue(_Fields field, Object value) { public Object getFieldValue(_Fields field) { switch (field) { + case INTP_GROUP_ID: + return getIntpGroupId(); + case CLASS_NAME: return getClassName(); @@ -2228,6 +2800,8 @@ public boolean isSet(_Fields field) { } switch (field) { + case INTP_GROUP_ID: + return isSetIntpGroupId(); case CLASS_NAME: return isSetClassName(); case PROPERTIES: @@ -2249,6 +2823,15 @@ public boolean equals(createInterpreter_args that) { if (that == null) return false; + boolean this_present_intpGroupId = true && this.isSetIntpGroupId(); + boolean that_present_intpGroupId = true && that.isSetIntpGroupId(); + if (this_present_intpGroupId || that_present_intpGroupId) { + if (!(this_present_intpGroupId && that_present_intpGroupId)) + return false; + if (!this.intpGroupId.equals(that.intpGroupId)) + return false; + } + boolean this_present_className = true && this.isSetClassName(); boolean that_present_className = true && that.isSetClassName(); if (this_present_className || that_present_className) { @@ -2274,6 +2857,11 @@ public boolean equals(createInterpreter_args that) { public int hashCode() { List list = new ArrayList(); + boolean present_intpGroupId = true && (isSetIntpGroupId()); + list.add(present_intpGroupId); + if (present_intpGroupId) + list.add(intpGroupId); + boolean present_className = true && (isSetClassName()); list.add(present_className); if (present_className) @@ -2295,6 +2883,16 @@ public int compareTo(createInterpreter_args other) { int lastComparison = 0; + lastComparison = Boolean.valueOf(isSetIntpGroupId()).compareTo(other.isSetIntpGroupId()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetIntpGroupId()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.intpGroupId, other.intpGroupId); + if (lastComparison != 0) { + return lastComparison; + } + } lastComparison = Boolean.valueOf(isSetClassName()).compareTo(other.isSetClassName()); if (lastComparison != 0) { return lastComparison; @@ -2335,6 +2933,14 @@ public String toString() { StringBuilder sb = new StringBuilder("createInterpreter_args("); boolean first = true; + sb.append("intpGroupId:"); + if (this.intpGroupId == null) { + sb.append("null"); + } else { + sb.append(this.intpGroupId); + } + first = false; + if (!first) sb.append(", "); sb.append("className:"); if (this.className == null) { sb.append("null"); @@ -2393,15 +2999,23 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, createInterpreter_a break; } switch (schemeField.id) { - case 1: // CLASS_NAME + case 1: // INTP_GROUP_ID if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.className = iprot.readString(); + struct.intpGroupId = iprot.readString(); + struct.setIntpGroupIdIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // CLASS_NAME + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.className = iprot.readString(); struct.setClassNameIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; - case 2: // PROPERTIES + case 3: // PROPERTIES if (schemeField.type == org.apache.thrift.protocol.TType.MAP) { { org.apache.thrift.protocol.TMap _map0 = iprot.readMapBegin(); @@ -2436,6 +3050,11 @@ public void write(org.apache.thrift.protocol.TProtocol oprot, createInterpreter_ struct.validate(); oprot.writeStructBegin(STRUCT_DESC); + if (struct.intpGroupId != null) { + oprot.writeFieldBegin(INTP_GROUP_ID_FIELD_DESC); + oprot.writeString(struct.intpGroupId); + oprot.writeFieldEnd(); + } if (struct.className != null) { oprot.writeFieldBegin(CLASS_NAME_FIELD_DESC); oprot.writeString(struct.className); @@ -2472,13 +3091,19 @@ private static class createInterpreter_argsTupleScheme extends TupleScheme(2*_map6.size); @@ -8272,13 +8901,2615 @@ public shutdown_args deepCopy() { public void clear() { } - public void setFieldValue(_Fields field, Object value) { - switch (field) { + public void setFieldValue(_Fields field, Object value) { + switch (field) { + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + } + throw new IllegalStateException(); + } + + /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof shutdown_args) + return this.equals((shutdown_args)that); + return false; + } + + public boolean equals(shutdown_args that) { + if (that == null) + return false; + + return true; + } + + @Override + public int hashCode() { + List list = new ArrayList(); + + return list.hashCode(); + } + + @Override + public int compareTo(shutdown_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("shutdown_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { + try { + read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class shutdown_argsStandardSchemeFactory implements SchemeFactory { + public shutdown_argsStandardScheme getScheme() { + return new shutdown_argsStandardScheme(); + } + } + + private static class shutdown_argsStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, shutdown_args struct) throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) + { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, shutdown_args struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class shutdown_argsTupleSchemeFactory implements SchemeFactory { + public shutdown_argsTupleScheme getScheme() { + return new shutdown_argsTupleScheme(); + } + } + + private static class shutdown_argsTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, shutdown_args struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, shutdown_args struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + } + } + + } + + public static class shutdown_result implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("shutdown_result"); + + + private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new shutdown_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new shutdown_resultTupleSchemeFactory()); + } + + + /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { +; + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** + * Find the _Fields constant that matches fieldId, or null if its not found. + */ + public static _Fields findByThriftId(int fieldId) { + switch(fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception + * if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** + * Find the _Fields constant that matches name, or null if its not found. + */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(shutdown_result.class, metaDataMap); + } + + public shutdown_result() { + } + + /** + * Performs a deep copy on other. + */ + public shutdown_result(shutdown_result other) { + } + + public shutdown_result deepCopy() { + return new shutdown_result(this); + } + + @Override + public void clear() { + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + } + throw new IllegalStateException(); + } + + /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof shutdown_result) + return this.equals((shutdown_result)that); + return false; + } + + public boolean equals(shutdown_result that) { + if (that == null) + return false; + + return true; + } + + @Override + public int hashCode() { + List list = new ArrayList(); + + return list.hashCode(); + } + + @Override + public int compareTo(shutdown_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("shutdown_result("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { + try { + read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class shutdown_resultStandardSchemeFactory implements SchemeFactory { + public shutdown_resultStandardScheme getScheme() { + return new shutdown_resultStandardScheme(); + } + } + + private static class shutdown_resultStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, shutdown_result struct) throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) + { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, shutdown_result struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class shutdown_resultTupleSchemeFactory implements SchemeFactory { + public shutdown_resultTupleScheme getScheme() { + return new shutdown_resultTupleScheme(); + } + } + + private static class shutdown_resultTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, shutdown_result struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, shutdown_result struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + } + } + + } + + public static class getStatus_args implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getStatus_args"); + + private static final org.apache.thrift.protocol.TField JOB_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("jobId", org.apache.thrift.protocol.TType.STRING, (short)1); + + private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new getStatus_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new getStatus_argsTupleSchemeFactory()); + } + + public String jobId; // required + + /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + JOB_ID((short)1, "jobId"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** + * Find the _Fields constant that matches fieldId, or null if its not found. + */ + public static _Fields findByThriftId(int fieldId) { + switch(fieldId) { + case 1: // JOB_ID + return JOB_ID; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception + * if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** + * Find the _Fields constant that matches name, or null if its not found. + */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put(_Fields.JOB_ID, new org.apache.thrift.meta_data.FieldMetaData("jobId", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getStatus_args.class, metaDataMap); + } + + public getStatus_args() { + } + + public getStatus_args( + String jobId) + { + this(); + this.jobId = jobId; + } + + /** + * Performs a deep copy on other. + */ + public getStatus_args(getStatus_args other) { + if (other.isSetJobId()) { + this.jobId = other.jobId; + } + } + + public getStatus_args deepCopy() { + return new getStatus_args(this); + } + + @Override + public void clear() { + this.jobId = null; + } + + public String getJobId() { + return this.jobId; + } + + public getStatus_args setJobId(String jobId) { + this.jobId = jobId; + return this; + } + + public void unsetJobId() { + this.jobId = null; + } + + /** Returns true if field jobId is set (has been assigned a value) and false otherwise */ + public boolean isSetJobId() { + return this.jobId != null; + } + + public void setJobIdIsSet(boolean value) { + if (!value) { + this.jobId = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case JOB_ID: + if (value == null) { + unsetJobId(); + } else { + setJobId((String)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case JOB_ID: + return getJobId(); + + } + throw new IllegalStateException(); + } + + /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case JOB_ID: + return isSetJobId(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof getStatus_args) + return this.equals((getStatus_args)that); + return false; + } + + public boolean equals(getStatus_args that) { + if (that == null) + return false; + + boolean this_present_jobId = true && this.isSetJobId(); + boolean that_present_jobId = true && that.isSetJobId(); + if (this_present_jobId || that_present_jobId) { + if (!(this_present_jobId && that_present_jobId)) + return false; + if (!this.jobId.equals(that.jobId)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + List list = new ArrayList(); + + boolean present_jobId = true && (isSetJobId()); + list.add(present_jobId); + if (present_jobId) + list.add(jobId); + + return list.hashCode(); + } + + @Override + public int compareTo(getStatus_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetJobId()).compareTo(other.isSetJobId()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetJobId()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.jobId, other.jobId); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("getStatus_args("); + boolean first = true; + + sb.append("jobId:"); + if (this.jobId == null) { + sb.append("null"); + } else { + sb.append(this.jobId); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { + try { + read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class getStatus_argsStandardSchemeFactory implements SchemeFactory { + public getStatus_argsStandardScheme getScheme() { + return new getStatus_argsStandardScheme(); + } + } + + private static class getStatus_argsStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, getStatus_args struct) throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) + { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // JOB_ID + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.jobId = iprot.readString(); + struct.setJobIdIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, getStatus_args struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.jobId != null) { + oprot.writeFieldBegin(JOB_ID_FIELD_DESC); + oprot.writeString(struct.jobId); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class getStatus_argsTupleSchemeFactory implements SchemeFactory { + public getStatus_argsTupleScheme getScheme() { + return new getStatus_argsTupleScheme(); + } + } + + private static class getStatus_argsTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, getStatus_args struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetJobId()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetJobId()) { + oprot.writeString(struct.jobId); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, getStatus_args struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.jobId = iprot.readString(); + struct.setJobIdIsSet(true); + } + } + } + + } + + public static class getStatus_result implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getStatus_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.STRING, (short)0); + + private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new getStatus_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new getStatus_resultTupleSchemeFactory()); + } + + public String success; // required + + /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short)0, "success"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** + * Find the _Fields constant that matches fieldId, or null if its not found. + */ + public static _Fields findByThriftId(int fieldId) { + switch(fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception + * if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** + * Find the _Fields constant that matches name, or null if its not found. + */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put(_Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getStatus_result.class, metaDataMap); + } + + public getStatus_result() { + } + + public getStatus_result( + String success) + { + this(); + this.success = success; + } + + /** + * Performs a deep copy on other. + */ + public getStatus_result(getStatus_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + public getStatus_result deepCopy() { + return new getStatus_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + public String getSuccess() { + return this.success; + } + + public getStatus_result setSuccess(String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((String)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + + } + throw new IllegalStateException(); + } + + /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof getStatus_result) + return this.equals((getStatus_result)that); + return false; + } + + public boolean equals(getStatus_result that) { + if (that == null) + return false; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) + return false; + if (!this.success.equals(that.success)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + List list = new ArrayList(); + + boolean present_success = true && (isSetSuccess()); + list.add(present_success); + if (present_success) + list.add(success); + + return list.hashCode(); + } + + @Override + public int compareTo(getStatus_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("getStatus_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { + try { + read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class getStatus_resultStandardSchemeFactory implements SchemeFactory { + public getStatus_resultStandardScheme getScheme() { + return new getStatus_resultStandardScheme(); + } + } + + private static class getStatus_resultStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, getStatus_result struct) throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) + { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, getStatus_result struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class getStatus_resultTupleSchemeFactory implements SchemeFactory { + public getStatus_resultTupleScheme getScheme() { + return new getStatus_resultTupleScheme(); + } + } + + private static class getStatus_resultTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, getStatus_result struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, getStatus_result struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + + } + + public static class getEvent_args implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getEvent_args"); + + + private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new getEvent_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new getEvent_argsTupleSchemeFactory()); + } + + + /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { +; + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** + * Find the _Fields constant that matches fieldId, or null if its not found. + */ + public static _Fields findByThriftId(int fieldId) { + switch(fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception + * if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** + * Find the _Fields constant that matches name, or null if its not found. + */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getEvent_args.class, metaDataMap); + } + + public getEvent_args() { + } + + /** + * Performs a deep copy on other. + */ + public getEvent_args(getEvent_args other) { + } + + public getEvent_args deepCopy() { + return new getEvent_args(this); + } + + @Override + public void clear() { + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + } + throw new IllegalStateException(); + } + + /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof getEvent_args) + return this.equals((getEvent_args)that); + return false; + } + + public boolean equals(getEvent_args that) { + if (that == null) + return false; + + return true; + } + + @Override + public int hashCode() { + List list = new ArrayList(); + + return list.hashCode(); + } + + @Override + public int compareTo(getEvent_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("getEvent_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { + try { + read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class getEvent_argsStandardSchemeFactory implements SchemeFactory { + public getEvent_argsStandardScheme getScheme() { + return new getEvent_argsStandardScheme(); + } + } + + private static class getEvent_argsStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, getEvent_args struct) throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) + { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, getEvent_args struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class getEvent_argsTupleSchemeFactory implements SchemeFactory { + public getEvent_argsTupleScheme getScheme() { + return new getEvent_argsTupleScheme(); + } + } + + private static class getEvent_argsTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, getEvent_args struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, getEvent_args struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + } + } + + } + + public static class getEvent_result implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getEvent_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.STRUCT, (short)0); + + private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new getEvent_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new getEvent_resultTupleSchemeFactory()); + } + + public RemoteInterpreterEvent success; // required + + /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short)0, "success"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** + * Find the _Fields constant that matches fieldId, or null if its not found. + */ + public static _Fields findByThriftId(int fieldId) { + switch(fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception + * if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** + * Find the _Fields constant that matches name, or null if its not found. + */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put(_Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, RemoteInterpreterEvent.class))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getEvent_result.class, metaDataMap); + } + + public getEvent_result() { + } + + public getEvent_result( + RemoteInterpreterEvent success) + { + this(); + this.success = success; + } + + /** + * Performs a deep copy on other. + */ + public getEvent_result(getEvent_result other) { + if (other.isSetSuccess()) { + this.success = new RemoteInterpreterEvent(other.success); + } + } + + public getEvent_result deepCopy() { + return new getEvent_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + public RemoteInterpreterEvent getSuccess() { + return this.success; + } + + public getEvent_result setSuccess(RemoteInterpreterEvent success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((RemoteInterpreterEvent)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + + } + throw new IllegalStateException(); + } + + /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof getEvent_result) + return this.equals((getEvent_result)that); + return false; + } + + public boolean equals(getEvent_result that) { + if (that == null) + return false; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) + return false; + if (!this.success.equals(that.success)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + List list = new ArrayList(); + + boolean present_success = true && (isSetSuccess()); + list.add(present_success); + if (present_success) + list.add(success); + + return list.hashCode(); + } + + @Override + public int compareTo(getEvent_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("getEvent_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + if (success != null) { + success.validate(); + } + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { + try { + read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class getEvent_resultStandardSchemeFactory implements SchemeFactory { + public getEvent_resultStandardScheme getScheme() { + return new getEvent_resultStandardScheme(); + } + } + + private static class getEvent_resultStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, getEvent_result struct) throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) + { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.success = new RemoteInterpreterEvent(); + struct.success.read(iprot); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, getEvent_result struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + struct.success.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class getEvent_resultTupleSchemeFactory implements SchemeFactory { + public getEvent_resultTupleScheme getScheme() { + return new getEvent_resultTupleScheme(); + } + } + + private static class getEvent_resultTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, getEvent_result struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + struct.success.write(oprot); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, getEvent_result struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = new RemoteInterpreterEvent(); + struct.success.read(iprot); + struct.setSuccessIsSet(true); + } + } + } + + } + + public static class resourcePoolResponseGetAll_args implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("resourcePoolResponseGetAll_args"); + + private static final org.apache.thrift.protocol.TField RESOURCES_FIELD_DESC = new org.apache.thrift.protocol.TField("resources", org.apache.thrift.protocol.TType.LIST, (short)1); + + private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new resourcePoolResponseGetAll_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new resourcePoolResponseGetAll_argsTupleSchemeFactory()); + } + + public List resources; // required + + /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + RESOURCES((short)1, "resources"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** + * Find the _Fields constant that matches fieldId, or null if its not found. + */ + public static _Fields findByThriftId(int fieldId) { + switch(fieldId) { + case 1: // RESOURCES + return RESOURCES; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception + * if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** + * Find the _Fields constant that matches name, or null if its not found. + */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put(_Fields.RESOURCES, new org.apache.thrift.meta_data.FieldMetaData("resources", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(resourcePoolResponseGetAll_args.class, metaDataMap); + } + + public resourcePoolResponseGetAll_args() { + } + + public resourcePoolResponseGetAll_args( + List resources) + { + this(); + this.resources = resources; + } + + /** + * Performs a deep copy on other. + */ + public resourcePoolResponseGetAll_args(resourcePoolResponseGetAll_args other) { + if (other.isSetResources()) { + List __this__resources = new ArrayList(other.resources); + this.resources = __this__resources; + } + } + + public resourcePoolResponseGetAll_args deepCopy() { + return new resourcePoolResponseGetAll_args(this); + } + + @Override + public void clear() { + this.resources = null; + } + + public int getResourcesSize() { + return (this.resources == null) ? 0 : this.resources.size(); + } + + public java.util.Iterator getResourcesIterator() { + return (this.resources == null) ? null : this.resources.iterator(); + } + + public void addToResources(String elem) { + if (this.resources == null) { + this.resources = new ArrayList(); + } + this.resources.add(elem); + } + + public List getResources() { + return this.resources; + } + + public resourcePoolResponseGetAll_args setResources(List resources) { + this.resources = resources; + return this; + } + + public void unsetResources() { + this.resources = null; + } + + /** Returns true if field resources is set (has been assigned a value) and false otherwise */ + public boolean isSetResources() { + return this.resources != null; + } + + public void setResourcesIsSet(boolean value) { + if (!value) { + this.resources = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case RESOURCES: + if (value == null) { + unsetResources(); + } else { + setResources((List)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case RESOURCES: + return getResources(); + + } + throw new IllegalStateException(); + } + + /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case RESOURCES: + return isSetResources(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof resourcePoolResponseGetAll_args) + return this.equals((resourcePoolResponseGetAll_args)that); + return false; + } + + public boolean equals(resourcePoolResponseGetAll_args that) { + if (that == null) + return false; + + boolean this_present_resources = true && this.isSetResources(); + boolean that_present_resources = true && that.isSetResources(); + if (this_present_resources || that_present_resources) { + if (!(this_present_resources && that_present_resources)) + return false; + if (!this.resources.equals(that.resources)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + List list = new ArrayList(); + + boolean present_resources = true && (isSetResources()); + list.add(present_resources); + if (present_resources) + list.add(resources); + + return list.hashCode(); + } + + @Override + public int compareTo(resourcePoolResponseGetAll_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetResources()).compareTo(other.isSetResources()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetResources()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.resources, other.resources); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("resourcePoolResponseGetAll_args("); + boolean first = true; + + sb.append("resources:"); + if (this.resources == null) { + sb.append("null"); + } else { + sb.append(this.resources); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { + try { + read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class resourcePoolResponseGetAll_argsStandardSchemeFactory implements SchemeFactory { + public resourcePoolResponseGetAll_argsStandardScheme getScheme() { + return new resourcePoolResponseGetAll_argsStandardScheme(); + } + } + + private static class resourcePoolResponseGetAll_argsStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, resourcePoolResponseGetAll_args struct) throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) + { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // RESOURCES + if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { + { + org.apache.thrift.protocol.TList _list18 = iprot.readListBegin(); + struct.resources = new ArrayList(_list18.size); + String _elem19; + for (int _i20 = 0; _i20 < _list18.size; ++_i20) + { + _elem19 = iprot.readString(); + struct.resources.add(_elem19); + } + iprot.readListEnd(); + } + struct.setResourcesIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, resourcePoolResponseGetAll_args struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.resources != null) { + oprot.writeFieldBegin(RESOURCES_FIELD_DESC); + { + oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, struct.resources.size())); + for (String _iter21 : struct.resources) + { + oprot.writeString(_iter21); + } + oprot.writeListEnd(); + } + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class resourcePoolResponseGetAll_argsTupleSchemeFactory implements SchemeFactory { + public resourcePoolResponseGetAll_argsTupleScheme getScheme() { + return new resourcePoolResponseGetAll_argsTupleScheme(); + } + } + + private static class resourcePoolResponseGetAll_argsTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, resourcePoolResponseGetAll_args struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetResources()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetResources()) { + { + oprot.writeI32(struct.resources.size()); + for (String _iter22 : struct.resources) + { + oprot.writeString(_iter22); + } + } + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, resourcePoolResponseGetAll_args struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + { + org.apache.thrift.protocol.TList _list23 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32()); + struct.resources = new ArrayList(_list23.size); + String _elem24; + for (int _i25 = 0; _i25 < _list23.size; ++_i25) + { + _elem24 = iprot.readString(); + struct.resources.add(_elem24); + } + } + struct.setResourcesIsSet(true); + } + } + } + + } + + public static class resourcePoolResponseGetAll_result implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("resourcePoolResponseGetAll_result"); + + + private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new resourcePoolResponseGetAll_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new resourcePoolResponseGetAll_resultTupleSchemeFactory()); + } + + + /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { +; + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** + * Find the _Fields constant that matches fieldId, or null if its not found. + */ + public static _Fields findByThriftId(int fieldId) { + switch(fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception + * if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** + * Find the _Fields constant that matches name, or null if its not found. + */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(resourcePoolResponseGetAll_result.class, metaDataMap); + } + + public resourcePoolResponseGetAll_result() { + } + + /** + * Performs a deep copy on other. + */ + public resourcePoolResponseGetAll_result(resourcePoolResponseGetAll_result other) { + } + + public resourcePoolResponseGetAll_result deepCopy() { + return new resourcePoolResponseGetAll_result(this); + } + + @Override + public void clear() { + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + } + throw new IllegalStateException(); + } + + /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof resourcePoolResponseGetAll_result) + return this.equals((resourcePoolResponseGetAll_result)that); + return false; + } + + public boolean equals(resourcePoolResponseGetAll_result that) { + if (that == null) + return false; + + return true; + } + + @Override + public int hashCode() { + List list = new ArrayList(); + + return list.hashCode(); + } + + @Override + public int compareTo(resourcePoolResponseGetAll_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("resourcePoolResponseGetAll_result("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { + try { + read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class resourcePoolResponseGetAll_resultStandardSchemeFactory implements SchemeFactory { + public resourcePoolResponseGetAll_resultStandardScheme getScheme() { + return new resourcePoolResponseGetAll_resultStandardScheme(); + } + } + + private static class resourcePoolResponseGetAll_resultStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, resourcePoolResponseGetAll_result struct) throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) + { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, resourcePoolResponseGetAll_result struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class resourcePoolResponseGetAll_resultTupleSchemeFactory implements SchemeFactory { + public resourcePoolResponseGetAll_resultTupleScheme getScheme() { + return new resourcePoolResponseGetAll_resultTupleScheme(); + } + } + + private static class resourcePoolResponseGetAll_resultTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, resourcePoolResponseGetAll_result struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, resourcePoolResponseGetAll_result struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + } + } + + } + + public static class resourceResponseGet_args implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("resourceResponseGet_args"); + + private static final org.apache.thrift.protocol.TField RESOURCE_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("resourceId", org.apache.thrift.protocol.TType.STRING, (short)1); + private static final org.apache.thrift.protocol.TField OBJECT_FIELD_DESC = new org.apache.thrift.protocol.TField("object", org.apache.thrift.protocol.TType.STRING, (short)2); + + private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new resourceResponseGet_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new resourceResponseGet_argsTupleSchemeFactory()); + } + + public String resourceId; // required + public ByteBuffer object; // required + + /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + RESOURCE_ID((short)1, "resourceId"), + OBJECT((short)2, "object"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** + * Find the _Fields constant that matches fieldId, or null if its not found. + */ + public static _Fields findByThriftId(int fieldId) { + switch(fieldId) { + case 1: // RESOURCE_ID + return RESOURCE_ID; + case 2: // OBJECT + return OBJECT; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception + * if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** + * Find the _Fields constant that matches name, or null if its not found. + */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put(_Fields.RESOURCE_ID, new org.apache.thrift.meta_data.FieldMetaData("resourceId", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + tmpMap.put(_Fields.OBJECT, new org.apache.thrift.meta_data.FieldMetaData("object", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , true))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(resourceResponseGet_args.class, metaDataMap); + } + + public resourceResponseGet_args() { + } + + public resourceResponseGet_args( + String resourceId, + ByteBuffer object) + { + this(); + this.resourceId = resourceId; + this.object = org.apache.thrift.TBaseHelper.copyBinary(object); + } + + /** + * Performs a deep copy on other. + */ + public resourceResponseGet_args(resourceResponseGet_args other) { + if (other.isSetResourceId()) { + this.resourceId = other.resourceId; + } + if (other.isSetObject()) { + this.object = org.apache.thrift.TBaseHelper.copyBinary(other.object); + } + } + + public resourceResponseGet_args deepCopy() { + return new resourceResponseGet_args(this); + } + + @Override + public void clear() { + this.resourceId = null; + this.object = null; + } + + public String getResourceId() { + return this.resourceId; + } + + public resourceResponseGet_args setResourceId(String resourceId) { + this.resourceId = resourceId; + return this; + } + + public void unsetResourceId() { + this.resourceId = null; + } + + /** Returns true if field resourceId is set (has been assigned a value) and false otherwise */ + public boolean isSetResourceId() { + return this.resourceId != null; + } + + public void setResourceIdIsSet(boolean value) { + if (!value) { + this.resourceId = null; + } + } + + public byte[] getObject() { + setObject(org.apache.thrift.TBaseHelper.rightSize(object)); + return object == null ? null : object.array(); + } + + public ByteBuffer bufferForObject() { + return org.apache.thrift.TBaseHelper.copyBinary(object); + } + + public resourceResponseGet_args setObject(byte[] object) { + this.object = object == null ? (ByteBuffer)null : ByteBuffer.wrap(Arrays.copyOf(object, object.length)); + return this; + } + + public resourceResponseGet_args setObject(ByteBuffer object) { + this.object = org.apache.thrift.TBaseHelper.copyBinary(object); + return this; + } + + public void unsetObject() { + this.object = null; + } + + /** Returns true if field object is set (has been assigned a value) and false otherwise */ + public boolean isSetObject() { + return this.object != null; + } + + public void setObjectIsSet(boolean value) { + if (!value) { + this.object = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case RESOURCE_ID: + if (value == null) { + unsetResourceId(); + } else { + setResourceId((String)value); + } + break; + + case OBJECT: + if (value == null) { + unsetObject(); + } else { + setObject((ByteBuffer)value); + } + break; + } } public Object getFieldValue(_Fields field) { switch (field) { + case RESOURCE_ID: + return getResourceId(); + + case OBJECT: + return getObject(); + } throw new IllegalStateException(); } @@ -8290,6 +11521,10 @@ public boolean isSet(_Fields field) { } switch (field) { + case RESOURCE_ID: + return isSetResourceId(); + case OBJECT: + return isSetObject(); } throw new IllegalStateException(); } @@ -8298,15 +11533,33 @@ public boolean isSet(_Fields field) { public boolean equals(Object that) { if (that == null) return false; - if (that instanceof shutdown_args) - return this.equals((shutdown_args)that); + if (that instanceof resourceResponseGet_args) + return this.equals((resourceResponseGet_args)that); return false; } - public boolean equals(shutdown_args that) { + public boolean equals(resourceResponseGet_args that) { if (that == null) return false; + boolean this_present_resourceId = true && this.isSetResourceId(); + boolean that_present_resourceId = true && that.isSetResourceId(); + if (this_present_resourceId || that_present_resourceId) { + if (!(this_present_resourceId && that_present_resourceId)) + return false; + if (!this.resourceId.equals(that.resourceId)) + return false; + } + + boolean this_present_object = true && this.isSetObject(); + boolean that_present_object = true && that.isSetObject(); + if (this_present_object || that_present_object) { + if (!(this_present_object && that_present_object)) + return false; + if (!this.object.equals(that.object)) + return false; + } + return true; } @@ -8314,17 +11567,47 @@ public boolean equals(shutdown_args that) { public int hashCode() { List list = new ArrayList(); + boolean present_resourceId = true && (isSetResourceId()); + list.add(present_resourceId); + if (present_resourceId) + list.add(resourceId); + + boolean present_object = true && (isSetObject()); + list.add(present_object); + if (present_object) + list.add(object); + return list.hashCode(); } @Override - public int compareTo(shutdown_args other) { + public int compareTo(resourceResponseGet_args other) { if (!getClass().equals(other.getClass())) { return getClass().getName().compareTo(other.getClass().getName()); } int lastComparison = 0; + lastComparison = Boolean.valueOf(isSetResourceId()).compareTo(other.isSetResourceId()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetResourceId()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.resourceId, other.resourceId); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetObject()).compareTo(other.isSetObject()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetObject()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.object, other.object); + if (lastComparison != 0) { + return lastComparison; + } + } return 0; } @@ -8342,9 +11625,24 @@ public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache. @Override public String toString() { - StringBuilder sb = new StringBuilder("shutdown_args("); + StringBuilder sb = new StringBuilder("resourceResponseGet_args("); boolean first = true; + sb.append("resourceId:"); + if (this.resourceId == null) { + sb.append("null"); + } else { + sb.append(this.resourceId); + } + first = false; + if (!first) sb.append(", "); + sb.append("object:"); + if (this.object == null) { + sb.append("null"); + } else { + org.apache.thrift.TBaseHelper.toString(this.object, sb); + } + first = false; sb.append(")"); return sb.toString(); } @@ -8370,15 +11668,15 @@ private void readObject(java.io.ObjectInputStream in) throws java.io.IOException } } - private static class shutdown_argsStandardSchemeFactory implements SchemeFactory { - public shutdown_argsStandardScheme getScheme() { - return new shutdown_argsStandardScheme(); + private static class resourceResponseGet_argsStandardSchemeFactory implements SchemeFactory { + public resourceResponseGet_argsStandardScheme getScheme() { + return new resourceResponseGet_argsStandardScheme(); } } - private static class shutdown_argsStandardScheme extends StandardScheme { + private static class resourceResponseGet_argsStandardScheme extends StandardScheme { - public void read(org.apache.thrift.protocol.TProtocol iprot, shutdown_args struct) throws org.apache.thrift.TException { + public void read(org.apache.thrift.protocol.TProtocol iprot, resourceResponseGet_args struct) throws org.apache.thrift.TException { org.apache.thrift.protocol.TField schemeField; iprot.readStructBegin(); while (true) @@ -8388,6 +11686,22 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, shutdown_args struc break; } switch (schemeField.id) { + case 1: // RESOURCE_ID + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.resourceId = iprot.readString(); + struct.setResourceIdIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // OBJECT + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.object = iprot.readBinary(); + struct.setObjectIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; default: org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } @@ -8399,45 +11713,78 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, shutdown_args struc struct.validate(); } - public void write(org.apache.thrift.protocol.TProtocol oprot, shutdown_args struct) throws org.apache.thrift.TException { + public void write(org.apache.thrift.protocol.TProtocol oprot, resourceResponseGet_args struct) throws org.apache.thrift.TException { struct.validate(); oprot.writeStructBegin(STRUCT_DESC); + if (struct.resourceId != null) { + oprot.writeFieldBegin(RESOURCE_ID_FIELD_DESC); + oprot.writeString(struct.resourceId); + oprot.writeFieldEnd(); + } + if (struct.object != null) { + oprot.writeFieldBegin(OBJECT_FIELD_DESC); + oprot.writeBinary(struct.object); + oprot.writeFieldEnd(); + } oprot.writeFieldStop(); oprot.writeStructEnd(); } } - private static class shutdown_argsTupleSchemeFactory implements SchemeFactory { - public shutdown_argsTupleScheme getScheme() { - return new shutdown_argsTupleScheme(); + private static class resourceResponseGet_argsTupleSchemeFactory implements SchemeFactory { + public resourceResponseGet_argsTupleScheme getScheme() { + return new resourceResponseGet_argsTupleScheme(); } } - private static class shutdown_argsTupleScheme extends TupleScheme { + private static class resourceResponseGet_argsTupleScheme extends TupleScheme { @Override - public void write(org.apache.thrift.protocol.TProtocol prot, shutdown_args struct) throws org.apache.thrift.TException { + public void write(org.apache.thrift.protocol.TProtocol prot, resourceResponseGet_args struct) throws org.apache.thrift.TException { TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetResourceId()) { + optionals.set(0); + } + if (struct.isSetObject()) { + optionals.set(1); + } + oprot.writeBitSet(optionals, 2); + if (struct.isSetResourceId()) { + oprot.writeString(struct.resourceId); + } + if (struct.isSetObject()) { + oprot.writeBinary(struct.object); + } } @Override - public void read(org.apache.thrift.protocol.TProtocol prot, shutdown_args struct) throws org.apache.thrift.TException { + public void read(org.apache.thrift.protocol.TProtocol prot, resourceResponseGet_args struct) throws org.apache.thrift.TException { TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(2); + if (incoming.get(0)) { + struct.resourceId = iprot.readString(); + struct.setResourceIdIsSet(true); + } + if (incoming.get(1)) { + struct.object = iprot.readBinary(); + struct.setObjectIsSet(true); + } } } } - public static class shutdown_result implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("shutdown_result"); + public static class resourceResponseGet_result implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("resourceResponseGet_result"); private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); static { - schemes.put(StandardScheme.class, new shutdown_resultStandardSchemeFactory()); - schemes.put(TupleScheme.class, new shutdown_resultTupleSchemeFactory()); + schemes.put(StandardScheme.class, new resourceResponseGet_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new resourceResponseGet_resultTupleSchemeFactory()); } @@ -8500,20 +11847,20 @@ public String getFieldName() { static { Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(shutdown_result.class, metaDataMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(resourceResponseGet_result.class, metaDataMap); } - public shutdown_result() { + public resourceResponseGet_result() { } /** * Performs a deep copy on other. */ - public shutdown_result(shutdown_result other) { + public resourceResponseGet_result(resourceResponseGet_result other) { } - public shutdown_result deepCopy() { - return new shutdown_result(this); + public resourceResponseGet_result deepCopy() { + return new resourceResponseGet_result(this); } @Override @@ -8546,12 +11893,12 @@ public boolean isSet(_Fields field) { public boolean equals(Object that) { if (that == null) return false; - if (that instanceof shutdown_result) - return this.equals((shutdown_result)that); + if (that instanceof resourceResponseGet_result) + return this.equals((resourceResponseGet_result)that); return false; } - public boolean equals(shutdown_result that) { + public boolean equals(resourceResponseGet_result that) { if (that == null) return false; @@ -8566,7 +11913,7 @@ public int hashCode() { } @Override - public int compareTo(shutdown_result other) { + public int compareTo(resourceResponseGet_result other) { if (!getClass().equals(other.getClass())) { return getClass().getName().compareTo(other.getClass().getName()); } @@ -8590,7 +11937,7 @@ public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache. @Override public String toString() { - StringBuilder sb = new StringBuilder("shutdown_result("); + StringBuilder sb = new StringBuilder("resourceResponseGet_result("); boolean first = true; sb.append(")"); @@ -8618,15 +11965,15 @@ private void readObject(java.io.ObjectInputStream in) throws java.io.IOException } } - private static class shutdown_resultStandardSchemeFactory implements SchemeFactory { - public shutdown_resultStandardScheme getScheme() { - return new shutdown_resultStandardScheme(); + private static class resourceResponseGet_resultStandardSchemeFactory implements SchemeFactory { + public resourceResponseGet_resultStandardScheme getScheme() { + return new resourceResponseGet_resultStandardScheme(); } } - private static class shutdown_resultStandardScheme extends StandardScheme { + private static class resourceResponseGet_resultStandardScheme extends StandardScheme { - public void read(org.apache.thrift.protocol.TProtocol iprot, shutdown_result struct) throws org.apache.thrift.TException { + public void read(org.apache.thrift.protocol.TProtocol iprot, resourceResponseGet_result struct) throws org.apache.thrift.TException { org.apache.thrift.protocol.TField schemeField; iprot.readStructBegin(); while (true) @@ -8647,7 +11994,7 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, shutdown_result str struct.validate(); } - public void write(org.apache.thrift.protocol.TProtocol oprot, shutdown_result struct) throws org.apache.thrift.TException { + public void write(org.apache.thrift.protocol.TProtocol oprot, resourceResponseGet_result struct) throws org.apache.thrift.TException { struct.validate(); oprot.writeStructBegin(STRUCT_DESC); @@ -8657,43 +12004,41 @@ public void write(org.apache.thrift.protocol.TProtocol oprot, shutdown_result st } - private static class shutdown_resultTupleSchemeFactory implements SchemeFactory { - public shutdown_resultTupleScheme getScheme() { - return new shutdown_resultTupleScheme(); + private static class resourceResponseGet_resultTupleSchemeFactory implements SchemeFactory { + public resourceResponseGet_resultTupleScheme getScheme() { + return new resourceResponseGet_resultTupleScheme(); } } - private static class shutdown_resultTupleScheme extends TupleScheme { + private static class resourceResponseGet_resultTupleScheme extends TupleScheme { @Override - public void write(org.apache.thrift.protocol.TProtocol prot, shutdown_result struct) throws org.apache.thrift.TException { + public void write(org.apache.thrift.protocol.TProtocol prot, resourceResponseGet_result struct) throws org.apache.thrift.TException { TTupleProtocol oprot = (TTupleProtocol) prot; } @Override - public void read(org.apache.thrift.protocol.TProtocol prot, shutdown_result struct) throws org.apache.thrift.TException { + public void read(org.apache.thrift.protocol.TProtocol prot, resourceResponseGet_result struct) throws org.apache.thrift.TException { TTupleProtocol iprot = (TTupleProtocol) prot; } } } - public static class getStatus_args implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getStatus_args"); + public static class resoucePoolGetAll_args implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("resoucePoolGetAll_args"); - private static final org.apache.thrift.protocol.TField JOB_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("jobId", org.apache.thrift.protocol.TType.STRING, (short)1); private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); static { - schemes.put(StandardScheme.class, new getStatus_argsStandardSchemeFactory()); - schemes.put(TupleScheme.class, new getStatus_argsTupleSchemeFactory()); + schemes.put(StandardScheme.class, new resoucePoolGetAll_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new resoucePoolGetAll_argsTupleSchemeFactory()); } - public String jobId; // required /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ public enum _Fields implements org.apache.thrift.TFieldIdEnum { - JOB_ID((short)1, "jobId"); +; private static final Map byName = new HashMap(); @@ -8708,8 +12053,6 @@ public enum _Fields implements org.apache.thrift.TFieldIdEnum { */ public static _Fields findByThriftId(int fieldId) { switch(fieldId) { - case 1: // JOB_ID - return JOB_ID; default: return null; } @@ -8748,87 +12091,37 @@ public String getFieldName() { return _fieldName; } } - - // isset id assignments public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; static { Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); - tmpMap.put(_Fields.JOB_ID, new org.apache.thrift.meta_data.FieldMetaData("jobId", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getStatus_args.class, metaDataMap); - } - - public getStatus_args() { + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(resoucePoolGetAll_args.class, metaDataMap); } - public getStatus_args( - String jobId) - { - this(); - this.jobId = jobId; + public resoucePoolGetAll_args() { } /** * Performs a deep copy on other. */ - public getStatus_args(getStatus_args other) { - if (other.isSetJobId()) { - this.jobId = other.jobId; - } + public resoucePoolGetAll_args(resoucePoolGetAll_args other) { } - public getStatus_args deepCopy() { - return new getStatus_args(this); + public resoucePoolGetAll_args deepCopy() { + return new resoucePoolGetAll_args(this); } @Override public void clear() { - this.jobId = null; - } - - public String getJobId() { - return this.jobId; - } - - public getStatus_args setJobId(String jobId) { - this.jobId = jobId; - return this; - } - - public void unsetJobId() { - this.jobId = null; - } - - /** Returns true if field jobId is set (has been assigned a value) and false otherwise */ - public boolean isSetJobId() { - return this.jobId != null; - } - - public void setJobIdIsSet(boolean value) { - if (!value) { - this.jobId = null; - } } public void setFieldValue(_Fields field, Object value) { switch (field) { - case JOB_ID: - if (value == null) { - unsetJobId(); - } else { - setJobId((String)value); - } - break; - } } public Object getFieldValue(_Fields field) { switch (field) { - case JOB_ID: - return getJobId(); - } throw new IllegalStateException(); } @@ -8840,8 +12133,6 @@ public boolean isSet(_Fields field) { } switch (field) { - case JOB_ID: - return isSetJobId(); } throw new IllegalStateException(); } @@ -8850,24 +12141,15 @@ public boolean isSet(_Fields field) { public boolean equals(Object that) { if (that == null) return false; - if (that instanceof getStatus_args) - return this.equals((getStatus_args)that); + if (that instanceof resoucePoolGetAll_args) + return this.equals((resoucePoolGetAll_args)that); return false; } - public boolean equals(getStatus_args that) { + public boolean equals(resoucePoolGetAll_args that) { if (that == null) return false; - boolean this_present_jobId = true && this.isSetJobId(); - boolean that_present_jobId = true && that.isSetJobId(); - if (this_present_jobId || that_present_jobId) { - if (!(this_present_jobId && that_present_jobId)) - return false; - if (!this.jobId.equals(that.jobId)) - return false; - } - return true; } @@ -8875,32 +12157,17 @@ public boolean equals(getStatus_args that) { public int hashCode() { List list = new ArrayList(); - boolean present_jobId = true && (isSetJobId()); - list.add(present_jobId); - if (present_jobId) - list.add(jobId); - return list.hashCode(); } @Override - public int compareTo(getStatus_args other) { + public int compareTo(resoucePoolGetAll_args other) { if (!getClass().equals(other.getClass())) { return getClass().getName().compareTo(other.getClass().getName()); } int lastComparison = 0; - lastComparison = Boolean.valueOf(isSetJobId()).compareTo(other.isSetJobId()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetJobId()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.jobId, other.jobId); - if (lastComparison != 0) { - return lastComparison; - } - } return 0; } @@ -8918,16 +12185,9 @@ public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache. @Override public String toString() { - StringBuilder sb = new StringBuilder("getStatus_args("); + StringBuilder sb = new StringBuilder("resoucePoolGetAll_args("); boolean first = true; - sb.append("jobId:"); - if (this.jobId == null) { - sb.append("null"); - } else { - sb.append(this.jobId); - } - first = false; sb.append(")"); return sb.toString(); } @@ -8953,32 +12213,24 @@ private void readObject(java.io.ObjectInputStream in) throws java.io.IOException } } - private static class getStatus_argsStandardSchemeFactory implements SchemeFactory { - public getStatus_argsStandardScheme getScheme() { - return new getStatus_argsStandardScheme(); + private static class resoucePoolGetAll_argsStandardSchemeFactory implements SchemeFactory { + public resoucePoolGetAll_argsStandardScheme getScheme() { + return new resoucePoolGetAll_argsStandardScheme(); } } - private static class getStatus_argsStandardScheme extends StandardScheme { + private static class resoucePoolGetAll_argsStandardScheme extends StandardScheme { - public void read(org.apache.thrift.protocol.TProtocol iprot, getStatus_args struct) throws org.apache.thrift.TException { + public void read(org.apache.thrift.protocol.TProtocol iprot, resoucePoolGetAll_args struct) throws org.apache.thrift.TException { org.apache.thrift.protocol.TField schemeField; iprot.readStructBegin(); while (true) { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 1: // JOB_ID - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.jobId = iprot.readString(); - struct.setJobIdIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { default: org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } @@ -8990,67 +12242,49 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, getStatus_args stru struct.validate(); } - public void write(org.apache.thrift.protocol.TProtocol oprot, getStatus_args struct) throws org.apache.thrift.TException { + public void write(org.apache.thrift.protocol.TProtocol oprot, resoucePoolGetAll_args struct) throws org.apache.thrift.TException { struct.validate(); oprot.writeStructBegin(STRUCT_DESC); - if (struct.jobId != null) { - oprot.writeFieldBegin(JOB_ID_FIELD_DESC); - oprot.writeString(struct.jobId); - oprot.writeFieldEnd(); - } oprot.writeFieldStop(); oprot.writeStructEnd(); } } - private static class getStatus_argsTupleSchemeFactory implements SchemeFactory { - public getStatus_argsTupleScheme getScheme() { - return new getStatus_argsTupleScheme(); + private static class resoucePoolGetAll_argsTupleSchemeFactory implements SchemeFactory { + public resoucePoolGetAll_argsTupleScheme getScheme() { + return new resoucePoolGetAll_argsTupleScheme(); } } - private static class getStatus_argsTupleScheme extends TupleScheme { + private static class resoucePoolGetAll_argsTupleScheme extends TupleScheme { @Override - public void write(org.apache.thrift.protocol.TProtocol prot, getStatus_args struct) throws org.apache.thrift.TException { + public void write(org.apache.thrift.protocol.TProtocol prot, resoucePoolGetAll_args struct) throws org.apache.thrift.TException { TTupleProtocol oprot = (TTupleProtocol) prot; - BitSet optionals = new BitSet(); - if (struct.isSetJobId()) { - optionals.set(0); - } - oprot.writeBitSet(optionals, 1); - if (struct.isSetJobId()) { - oprot.writeString(struct.jobId); - } } @Override - public void read(org.apache.thrift.protocol.TProtocol prot, getStatus_args struct) throws org.apache.thrift.TException { + public void read(org.apache.thrift.protocol.TProtocol prot, resoucePoolGetAll_args struct) throws org.apache.thrift.TException { TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(1); - if (incoming.get(0)) { - struct.jobId = iprot.readString(); - struct.setJobIdIsSet(true); - } } } } - public static class getStatus_result implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getStatus_result"); + public static class resoucePoolGetAll_result implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("resoucePoolGetAll_result"); - private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.STRING, (short)0); + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.LIST, (short)0); private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); static { - schemes.put(StandardScheme.class, new getStatus_resultStandardSchemeFactory()); - schemes.put(TupleScheme.class, new getStatus_resultTupleSchemeFactory()); + schemes.put(StandardScheme.class, new resoucePoolGetAll_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new resoucePoolGetAll_resultTupleSchemeFactory()); } - public String success; // required + public List success; // required /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ public enum _Fields implements org.apache.thrift.TFieldIdEnum { @@ -9115,16 +12349,17 @@ public String getFieldName() { static { Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); tmpMap.put(_Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)))); metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getStatus_result.class, metaDataMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(resoucePoolGetAll_result.class, metaDataMap); } - public getStatus_result() { + public resoucePoolGetAll_result() { } - public getStatus_result( - String success) + public resoucePoolGetAll_result( + List success) { this(); this.success = success; @@ -9133,14 +12368,15 @@ public getStatus_result( /** * Performs a deep copy on other. */ - public getStatus_result(getStatus_result other) { + public resoucePoolGetAll_result(resoucePoolGetAll_result other) { if (other.isSetSuccess()) { - this.success = other.success; + List __this__success = new ArrayList(other.success); + this.success = __this__success; } } - public getStatus_result deepCopy() { - return new getStatus_result(this); + public resoucePoolGetAll_result deepCopy() { + return new resoucePoolGetAll_result(this); } @Override @@ -9148,11 +12384,26 @@ public void clear() { this.success = null; } - public String getSuccess() { + public int getSuccessSize() { + return (this.success == null) ? 0 : this.success.size(); + } + + public java.util.Iterator getSuccessIterator() { + return (this.success == null) ? null : this.success.iterator(); + } + + public void addToSuccess(String elem) { + if (this.success == null) { + this.success = new ArrayList(); + } + this.success.add(elem); + } + + public List getSuccess() { return this.success; } - public getStatus_result setSuccess(String success) { + public resoucePoolGetAll_result setSuccess(List success) { this.success = success; return this; } @@ -9178,7 +12429,7 @@ public void setFieldValue(_Fields field, Object value) { if (value == null) { unsetSuccess(); } else { - setSuccess((String)value); + setSuccess((List)value); } break; @@ -9211,12 +12462,12 @@ public boolean isSet(_Fields field) { public boolean equals(Object that) { if (that == null) return false; - if (that instanceof getStatus_result) - return this.equals((getStatus_result)that); + if (that instanceof resoucePoolGetAll_result) + return this.equals((resoucePoolGetAll_result)that); return false; } - public boolean equals(getStatus_result that) { + public boolean equals(resoucePoolGetAll_result that) { if (that == null) return false; @@ -9245,7 +12496,7 @@ public int hashCode() { } @Override - public int compareTo(getStatus_result other) { + public int compareTo(resoucePoolGetAll_result other) { if (!getClass().equals(other.getClass())) { return getClass().getName().compareTo(other.getClass().getName()); } @@ -9279,7 +12530,7 @@ public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache. @Override public String toString() { - StringBuilder sb = new StringBuilder("getStatus_result("); + StringBuilder sb = new StringBuilder("resoucePoolGetAll_result("); boolean first = true; sb.append("success:"); @@ -9314,15 +12565,15 @@ private void readObject(java.io.ObjectInputStream in) throws java.io.IOException } } - private static class getStatus_resultStandardSchemeFactory implements SchemeFactory { - public getStatus_resultStandardScheme getScheme() { - return new getStatus_resultStandardScheme(); + private static class resoucePoolGetAll_resultStandardSchemeFactory implements SchemeFactory { + public resoucePoolGetAll_resultStandardScheme getScheme() { + return new resoucePoolGetAll_resultStandardScheme(); } } - private static class getStatus_resultStandardScheme extends StandardScheme { + private static class resoucePoolGetAll_resultStandardScheme extends StandardScheme { - public void read(org.apache.thrift.protocol.TProtocol iprot, getStatus_result struct) throws org.apache.thrift.TException { + public void read(org.apache.thrift.protocol.TProtocol iprot, resoucePoolGetAll_result struct) throws org.apache.thrift.TException { org.apache.thrift.protocol.TField schemeField; iprot.readStructBegin(); while (true) @@ -9333,8 +12584,18 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, getStatus_result st } switch (schemeField.id) { case 0: // SUCCESS - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.success = iprot.readString(); + if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { + { + org.apache.thrift.protocol.TList _list26 = iprot.readListBegin(); + struct.success = new ArrayList(_list26.size); + String _elem27; + for (int _i28 = 0; _i28 < _list26.size; ++_i28) + { + _elem27 = iprot.readString(); + struct.success.add(_elem27); + } + iprot.readListEnd(); + } struct.setSuccessIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); @@ -9351,13 +12612,20 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, getStatus_result st struct.validate(); } - public void write(org.apache.thrift.protocol.TProtocol oprot, getStatus_result struct) throws org.apache.thrift.TException { + public void write(org.apache.thrift.protocol.TProtocol oprot, resoucePoolGetAll_result struct) throws org.apache.thrift.TException { struct.validate(); oprot.writeStructBegin(STRUCT_DESC); if (struct.success != null) { oprot.writeFieldBegin(SUCCESS_FIELD_DESC); - oprot.writeString(struct.success); + { + oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, struct.success.size())); + for (String _iter29 : struct.success) + { + oprot.writeString(_iter29); + } + oprot.writeListEnd(); + } oprot.writeFieldEnd(); } oprot.writeFieldStop(); @@ -9366,16 +12634,16 @@ public void write(org.apache.thrift.protocol.TProtocol oprot, getStatus_result s } - private static class getStatus_resultTupleSchemeFactory implements SchemeFactory { - public getStatus_resultTupleScheme getScheme() { - return new getStatus_resultTupleScheme(); + private static class resoucePoolGetAll_resultTupleSchemeFactory implements SchemeFactory { + public resoucePoolGetAll_resultTupleScheme getScheme() { + return new resoucePoolGetAll_resultTupleScheme(); } } - private static class getStatus_resultTupleScheme extends TupleScheme { + private static class resoucePoolGetAll_resultTupleScheme extends TupleScheme { @Override - public void write(org.apache.thrift.protocol.TProtocol prot, getStatus_result struct) throws org.apache.thrift.TException { + public void write(org.apache.thrift.protocol.TProtocol prot, resoucePoolGetAll_result struct) throws org.apache.thrift.TException { TTupleProtocol oprot = (TTupleProtocol) prot; BitSet optionals = new BitSet(); if (struct.isSetSuccess()) { @@ -9383,16 +12651,31 @@ public void write(org.apache.thrift.protocol.TProtocol prot, getStatus_result st } oprot.writeBitSet(optionals, 1); if (struct.isSetSuccess()) { - oprot.writeString(struct.success); + { + oprot.writeI32(struct.success.size()); + for (String _iter30 : struct.success) + { + oprot.writeString(_iter30); + } + } } } @Override - public void read(org.apache.thrift.protocol.TProtocol prot, getStatus_result struct) throws org.apache.thrift.TException { + public void read(org.apache.thrift.protocol.TProtocol prot, resoucePoolGetAll_result struct) throws org.apache.thrift.TException { TTupleProtocol iprot = (TTupleProtocol) prot; BitSet incoming = iprot.readBitSet(1); if (incoming.get(0)) { - struct.success = iprot.readString(); + { + org.apache.thrift.protocol.TList _list31 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32()); + struct.success = new ArrayList(_list31.size); + String _elem32; + for (int _i33 = 0; _i33 < _list31.size; ++_i33) + { + _elem32 = iprot.readString(); + struct.success.add(_elem32); + } + } struct.setSuccessIsSet(true); } } @@ -9400,20 +12683,22 @@ public void read(org.apache.thrift.protocol.TProtocol prot, getStatus_result str } - public static class getEvent_args implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getEvent_args"); + public static class resourceGet_args implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("resourceGet_args"); + private static final org.apache.thrift.protocol.TField RESOURCE_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("resourceName", org.apache.thrift.protocol.TType.STRING, (short)1); private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); static { - schemes.put(StandardScheme.class, new getEvent_argsStandardSchemeFactory()); - schemes.put(TupleScheme.class, new getEvent_argsTupleSchemeFactory()); + schemes.put(StandardScheme.class, new resourceGet_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new resourceGet_argsTupleSchemeFactory()); } + public String resourceName; // required /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ public enum _Fields implements org.apache.thrift.TFieldIdEnum { -; + RESOURCE_NAME((short)1, "resourceName"); private static final Map byName = new HashMap(); @@ -9428,6 +12713,8 @@ public enum _Fields implements org.apache.thrift.TFieldIdEnum { */ public static _Fields findByThriftId(int fieldId) { switch(fieldId) { + case 1: // RESOURCE_NAME + return RESOURCE_NAME; default: return null; } @@ -9466,37 +12753,87 @@ public String getFieldName() { return _fieldName; } } + + // isset id assignments public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; static { Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put(_Fields.RESOURCE_NAME, new org.apache.thrift.meta_data.FieldMetaData("resourceName", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getEvent_args.class, metaDataMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(resourceGet_args.class, metaDataMap); } - public getEvent_args() { + public resourceGet_args() { + } + + public resourceGet_args( + String resourceName) + { + this(); + this.resourceName = resourceName; } /** * Performs a deep copy on other. */ - public getEvent_args(getEvent_args other) { + public resourceGet_args(resourceGet_args other) { + if (other.isSetResourceName()) { + this.resourceName = other.resourceName; + } } - public getEvent_args deepCopy() { - return new getEvent_args(this); + public resourceGet_args deepCopy() { + return new resourceGet_args(this); } @Override public void clear() { + this.resourceName = null; + } + + public String getResourceName() { + return this.resourceName; + } + + public resourceGet_args setResourceName(String resourceName) { + this.resourceName = resourceName; + return this; + } + + public void unsetResourceName() { + this.resourceName = null; + } + + /** Returns true if field resourceName is set (has been assigned a value) and false otherwise */ + public boolean isSetResourceName() { + return this.resourceName != null; + } + + public void setResourceNameIsSet(boolean value) { + if (!value) { + this.resourceName = null; + } } public void setFieldValue(_Fields field, Object value) { switch (field) { + case RESOURCE_NAME: + if (value == null) { + unsetResourceName(); + } else { + setResourceName((String)value); + } + break; + } } public Object getFieldValue(_Fields field) { switch (field) { + case RESOURCE_NAME: + return getResourceName(); + } throw new IllegalStateException(); } @@ -9508,6 +12845,8 @@ public boolean isSet(_Fields field) { } switch (field) { + case RESOURCE_NAME: + return isSetResourceName(); } throw new IllegalStateException(); } @@ -9516,15 +12855,24 @@ public boolean isSet(_Fields field) { public boolean equals(Object that) { if (that == null) return false; - if (that instanceof getEvent_args) - return this.equals((getEvent_args)that); + if (that instanceof resourceGet_args) + return this.equals((resourceGet_args)that); return false; } - public boolean equals(getEvent_args that) { + public boolean equals(resourceGet_args that) { if (that == null) return false; + boolean this_present_resourceName = true && this.isSetResourceName(); + boolean that_present_resourceName = true && that.isSetResourceName(); + if (this_present_resourceName || that_present_resourceName) { + if (!(this_present_resourceName && that_present_resourceName)) + return false; + if (!this.resourceName.equals(that.resourceName)) + return false; + } + return true; } @@ -9532,17 +12880,32 @@ public boolean equals(getEvent_args that) { public int hashCode() { List list = new ArrayList(); + boolean present_resourceName = true && (isSetResourceName()); + list.add(present_resourceName); + if (present_resourceName) + list.add(resourceName); + return list.hashCode(); } @Override - public int compareTo(getEvent_args other) { + public int compareTo(resourceGet_args other) { if (!getClass().equals(other.getClass())) { return getClass().getName().compareTo(other.getClass().getName()); } int lastComparison = 0; + lastComparison = Boolean.valueOf(isSetResourceName()).compareTo(other.isSetResourceName()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetResourceName()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.resourceName, other.resourceName); + if (lastComparison != 0) { + return lastComparison; + } + } return 0; } @@ -9560,9 +12923,16 @@ public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache. @Override public String toString() { - StringBuilder sb = new StringBuilder("getEvent_args("); + StringBuilder sb = new StringBuilder("resourceGet_args("); boolean first = true; + sb.append("resourceName:"); + if (this.resourceName == null) { + sb.append("null"); + } else { + sb.append(this.resourceName); + } + first = false; sb.append(")"); return sb.toString(); } @@ -9588,15 +12958,15 @@ private void readObject(java.io.ObjectInputStream in) throws java.io.IOException } } - private static class getEvent_argsStandardSchemeFactory implements SchemeFactory { - public getEvent_argsStandardScheme getScheme() { - return new getEvent_argsStandardScheme(); + private static class resourceGet_argsStandardSchemeFactory implements SchemeFactory { + public resourceGet_argsStandardScheme getScheme() { + return new resourceGet_argsStandardScheme(); } } - private static class getEvent_argsStandardScheme extends StandardScheme { + private static class resourceGet_argsStandardScheme extends StandardScheme { - public void read(org.apache.thrift.protocol.TProtocol iprot, getEvent_args struct) throws org.apache.thrift.TException { + public void read(org.apache.thrift.protocol.TProtocol iprot, resourceGet_args struct) throws org.apache.thrift.TException { org.apache.thrift.protocol.TField schemeField; iprot.readStructBegin(); while (true) @@ -9606,6 +12976,14 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, getEvent_args struc break; } switch (schemeField.id) { + case 1: // RESOURCE_NAME + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.resourceName = iprot.readString(); + struct.setResourceNameIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; default: org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } @@ -9617,49 +12995,67 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, getEvent_args struc struct.validate(); } - public void write(org.apache.thrift.protocol.TProtocol oprot, getEvent_args struct) throws org.apache.thrift.TException { + public void write(org.apache.thrift.protocol.TProtocol oprot, resourceGet_args struct) throws org.apache.thrift.TException { struct.validate(); oprot.writeStructBegin(STRUCT_DESC); + if (struct.resourceName != null) { + oprot.writeFieldBegin(RESOURCE_NAME_FIELD_DESC); + oprot.writeString(struct.resourceName); + oprot.writeFieldEnd(); + } oprot.writeFieldStop(); oprot.writeStructEnd(); } } - private static class getEvent_argsTupleSchemeFactory implements SchemeFactory { - public getEvent_argsTupleScheme getScheme() { - return new getEvent_argsTupleScheme(); + private static class resourceGet_argsTupleSchemeFactory implements SchemeFactory { + public resourceGet_argsTupleScheme getScheme() { + return new resourceGet_argsTupleScheme(); } } - private static class getEvent_argsTupleScheme extends TupleScheme { + private static class resourceGet_argsTupleScheme extends TupleScheme { @Override - public void write(org.apache.thrift.protocol.TProtocol prot, getEvent_args struct) throws org.apache.thrift.TException { + public void write(org.apache.thrift.protocol.TProtocol prot, resourceGet_args struct) throws org.apache.thrift.TException { TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetResourceName()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetResourceName()) { + oprot.writeString(struct.resourceName); + } } @Override - public void read(org.apache.thrift.protocol.TProtocol prot, getEvent_args struct) throws org.apache.thrift.TException { + public void read(org.apache.thrift.protocol.TProtocol prot, resourceGet_args struct) throws org.apache.thrift.TException { TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.resourceName = iprot.readString(); + struct.setResourceNameIsSet(true); + } } } } - public static class getEvent_result implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getEvent_result"); + public static class resourceGet_result implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("resourceGet_result"); - private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.STRUCT, (short)0); + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.STRING, (short)0); private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); static { - schemes.put(StandardScheme.class, new getEvent_resultStandardSchemeFactory()); - schemes.put(TupleScheme.class, new getEvent_resultTupleSchemeFactory()); + schemes.put(StandardScheme.class, new resourceGet_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new resourceGet_resultTupleSchemeFactory()); } - public RemoteInterpreterEvent success; // required + public ByteBuffer success; // required /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ public enum _Fields implements org.apache.thrift.TFieldIdEnum { @@ -9724,32 +13120,32 @@ public String getFieldName() { static { Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); tmpMap.put(_Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, RemoteInterpreterEvent.class))); + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , true))); metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getEvent_result.class, metaDataMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(resourceGet_result.class, metaDataMap); } - public getEvent_result() { + public resourceGet_result() { } - public getEvent_result( - RemoteInterpreterEvent success) + public resourceGet_result( + ByteBuffer success) { this(); - this.success = success; + this.success = org.apache.thrift.TBaseHelper.copyBinary(success); } /** * Performs a deep copy on other. */ - public getEvent_result(getEvent_result other) { + public resourceGet_result(resourceGet_result other) { if (other.isSetSuccess()) { - this.success = new RemoteInterpreterEvent(other.success); + this.success = org.apache.thrift.TBaseHelper.copyBinary(other.success); } } - public getEvent_result deepCopy() { - return new getEvent_result(this); + public resourceGet_result deepCopy() { + return new resourceGet_result(this); } @Override @@ -9757,12 +13153,22 @@ public void clear() { this.success = null; } - public RemoteInterpreterEvent getSuccess() { - return this.success; + public byte[] getSuccess() { + setSuccess(org.apache.thrift.TBaseHelper.rightSize(success)); + return success == null ? null : success.array(); } - public getEvent_result setSuccess(RemoteInterpreterEvent success) { - this.success = success; + public ByteBuffer bufferForSuccess() { + return org.apache.thrift.TBaseHelper.copyBinary(success); + } + + public resourceGet_result setSuccess(byte[] success) { + this.success = success == null ? (ByteBuffer)null : ByteBuffer.wrap(Arrays.copyOf(success, success.length)); + return this; + } + + public resourceGet_result setSuccess(ByteBuffer success) { + this.success = org.apache.thrift.TBaseHelper.copyBinary(success); return this; } @@ -9787,7 +13193,7 @@ public void setFieldValue(_Fields field, Object value) { if (value == null) { unsetSuccess(); } else { - setSuccess((RemoteInterpreterEvent)value); + setSuccess((ByteBuffer)value); } break; @@ -9820,12 +13226,12 @@ public boolean isSet(_Fields field) { public boolean equals(Object that) { if (that == null) return false; - if (that instanceof getEvent_result) - return this.equals((getEvent_result)that); + if (that instanceof resourceGet_result) + return this.equals((resourceGet_result)that); return false; } - public boolean equals(getEvent_result that) { + public boolean equals(resourceGet_result that) { if (that == null) return false; @@ -9854,7 +13260,7 @@ public int hashCode() { } @Override - public int compareTo(getEvent_result other) { + public int compareTo(resourceGet_result other) { if (!getClass().equals(other.getClass())) { return getClass().getName().compareTo(other.getClass().getName()); } @@ -9888,14 +13294,14 @@ public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache. @Override public String toString() { - StringBuilder sb = new StringBuilder("getEvent_result("); + StringBuilder sb = new StringBuilder("resourceGet_result("); boolean first = true; sb.append("success:"); if (this.success == null) { sb.append("null"); } else { - sb.append(this.success); + org.apache.thrift.TBaseHelper.toString(this.success, sb); } first = false; sb.append(")"); @@ -9905,9 +13311,6 @@ public String toString() { public void validate() throws org.apache.thrift.TException { // check for required fields // check for sub-struct validity - if (success != null) { - success.validate(); - } } private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { @@ -9926,15 +13329,15 @@ private void readObject(java.io.ObjectInputStream in) throws java.io.IOException } } - private static class getEvent_resultStandardSchemeFactory implements SchemeFactory { - public getEvent_resultStandardScheme getScheme() { - return new getEvent_resultStandardScheme(); + private static class resourceGet_resultStandardSchemeFactory implements SchemeFactory { + public resourceGet_resultStandardScheme getScheme() { + return new resourceGet_resultStandardScheme(); } } - private static class getEvent_resultStandardScheme extends StandardScheme { + private static class resourceGet_resultStandardScheme extends StandardScheme { - public void read(org.apache.thrift.protocol.TProtocol iprot, getEvent_result struct) throws org.apache.thrift.TException { + public void read(org.apache.thrift.protocol.TProtocol iprot, resourceGet_result struct) throws org.apache.thrift.TException { org.apache.thrift.protocol.TField schemeField; iprot.readStructBegin(); while (true) @@ -9945,9 +13348,8 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, getEvent_result str } switch (schemeField.id) { case 0: // SUCCESS - if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { - struct.success = new RemoteInterpreterEvent(); - struct.success.read(iprot); + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readBinary(); struct.setSuccessIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); @@ -9964,13 +13366,13 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, getEvent_result str struct.validate(); } - public void write(org.apache.thrift.protocol.TProtocol oprot, getEvent_result struct) throws org.apache.thrift.TException { + public void write(org.apache.thrift.protocol.TProtocol oprot, resourceGet_result struct) throws org.apache.thrift.TException { struct.validate(); oprot.writeStructBegin(STRUCT_DESC); if (struct.success != null) { oprot.writeFieldBegin(SUCCESS_FIELD_DESC); - struct.success.write(oprot); + oprot.writeBinary(struct.success); oprot.writeFieldEnd(); } oprot.writeFieldStop(); @@ -9979,16 +13381,16 @@ public void write(org.apache.thrift.protocol.TProtocol oprot, getEvent_result st } - private static class getEvent_resultTupleSchemeFactory implements SchemeFactory { - public getEvent_resultTupleScheme getScheme() { - return new getEvent_resultTupleScheme(); + private static class resourceGet_resultTupleSchemeFactory implements SchemeFactory { + public resourceGet_resultTupleScheme getScheme() { + return new resourceGet_resultTupleScheme(); } } - private static class getEvent_resultTupleScheme extends TupleScheme { + private static class resourceGet_resultTupleScheme extends TupleScheme { @Override - public void write(org.apache.thrift.protocol.TProtocol prot, getEvent_result struct) throws org.apache.thrift.TException { + public void write(org.apache.thrift.protocol.TProtocol prot, resourceGet_result struct) throws org.apache.thrift.TException { TTupleProtocol oprot = (TTupleProtocol) prot; BitSet optionals = new BitSet(); if (struct.isSetSuccess()) { @@ -9996,17 +13398,16 @@ public void write(org.apache.thrift.protocol.TProtocol prot, getEvent_result str } oprot.writeBitSet(optionals, 1); if (struct.isSetSuccess()) { - struct.success.write(oprot); + oprot.writeBinary(struct.success); } } @Override - public void read(org.apache.thrift.protocol.TProtocol prot, getEvent_result struct) throws org.apache.thrift.TException { + public void read(org.apache.thrift.protocol.TProtocol prot, resourceGet_result struct) throws org.apache.thrift.TException { TTupleProtocol iprot = (TTupleProtocol) prot; BitSet incoming = iprot.readBitSet(1); if (incoming.get(0)) { - struct.success = new RemoteInterpreterEvent(); - struct.success.read(iprot); + struct.success = iprot.readBinary(); struct.setSuccessIsSet(true); } } diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/resource/ByteBufferInputStream.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/resource/ByteBufferInputStream.java new file mode 100644 index 00000000000..a8becb4aea1 --- /dev/null +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/resource/ByteBufferInputStream.java @@ -0,0 +1,58 @@ +/* + * 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.resource; + +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.nio.ByteBuffer; + +/** + * InputStream from bytebuffer + */ +public class ByteBufferInputStream extends InputStream { + + ByteBuffer buf; + + public ByteBufferInputStream(ByteBuffer buf) { + this.buf = buf; + } + + public int read() throws IOException { + if (!buf.hasRemaining()) { + return -1; + } + return buf.get() & 0xFF; + } + + public int read(byte[] bytes, int off, int len) throws IOException { + if (!buf.hasRemaining()) { + return -1; + } + len = Math.min(len, buf.remaining()); + buf.get(bytes, off, len); + return len; + } + + public static InputStream get(ByteBuffer buf) { + if (buf.hasArray()) { + return new ByteArrayInputStream(buf.array()); + } else { + return new ByteBufferInputStream(buf); + } + } +} diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/resource/DistributedResourcePool.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/resource/DistributedResourcePool.java new file mode 100644 index 00000000000..3f03b92609e --- /dev/null +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/resource/DistributedResourcePool.java @@ -0,0 +1,78 @@ +/* + * 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.resource; + +/** + * distributed resource pool + */ +public class DistributedResourcePool extends LocalResourcePool { + + private final ResourcePoolConnector connector; + + public DistributedResourcePool(String id, ResourcePoolConnector connector) { + super(id); + this.connector = connector; + } + + @Override + public Resource get(String name) { + return get(name, true); + } + + /** + * get resource by name. + * @param name + * @param remote false only return from local resource + * @return null if resource not found. + */ + public Resource get(String name, boolean remote) { + // try local first + Resource resource = super.get(name); + if (resource != null) { + return resource; + } + + if (remote) { + ResourceSet resources = connector.getAllResources().filterByName(name); + if (resources.isEmpty()) { + return null; + } else { + return resources.get(0); + } + } else { + return null; + } + } + + @Override + public ResourceSet getAll() { + return getAll(true); + } + + /** + * Get all resource from the pool + * @param remote false only return local resource + * @return + */ + public ResourceSet getAll(boolean remote) { + ResourceSet all = super.getAll(); + if (remote) { + all.addAll(connector.getAllResources()); + } + return all; + } +} diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/resource/LocalResourcePool.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/resource/LocalResourcePool.java new file mode 100644 index 00000000000..cc5f7e9515c --- /dev/null +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/resource/LocalResourcePool.java @@ -0,0 +1,77 @@ +/* + * 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.resource; + +import java.util.*; + +/** + * ResourcePool + */ +public class LocalResourcePool implements ResourcePool { + private final String resourcePoolId; + private final Map resources = Collections.synchronizedMap( + new HashMap()); + + /** + * @param id unique id + */ + public LocalResourcePool(String id) { + resourcePoolId = id; + } + + /** + * Get unique id of this resource pool + * @return + */ + @Override + public String id() { + return resourcePoolId; + } + + /** + * Get resource + * @return null if resource not found + */ + @Override + public Resource get(String name) { + ResourceId resourceId = new ResourceId(resourcePoolId, name); + return resources.get(resourceId); + } + + @Override + public ResourceSet getAll() { + return new ResourceSet(resources.values()); + } + + /** + * Put resource into the pull + * @param + * @param object object to put into the resource + */ + @Override + public void put(String name, Object object) { + ResourceId resourceId = new ResourceId(resourcePoolId, name); + + Resource resource = new Resource(resourceId, object); + resources.put(resourceId, resource); + } + + @Override + public Resource remove(String name) { + return resources.remove(new ResourceId(resourcePoolId, name)); + } +} diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/resource/RemoteResource.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/resource/RemoteResource.java new file mode 100644 index 00000000000..5a8a9ea11f3 --- /dev/null +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/resource/RemoteResource.java @@ -0,0 +1,55 @@ +/* + * 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.resource; + +/** + * Resource that can retrieve data from remote + */ +public class RemoteResource extends Resource { + ResourcePoolConnector resourcePoolConnector; + + RemoteResource(ResourceId resourceId, Object r) { + super(resourceId, r); + } + + RemoteResource(ResourceId resourceId, boolean serializable, String className) { + super(resourceId, serializable, className); + } + + @Override + public Object get() { + if (isSerializable()) { + Object o = resourcePoolConnector.readResource(getResourceId()); + return o; + } else { + return null; + } + } + + @Override + public boolean isLocal() { + return false; + } + + public ResourcePoolConnector getResourcePoolConnector() { + return resourcePoolConnector; + } + + public void setResourcePoolConnector(ResourcePoolConnector resourcePoolConnector) { + this.resourcePoolConnector = resourcePoolConnector; + } +} diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/resource/Resource.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/resource/Resource.java new file mode 100644 index 00000000000..6988b3ea762 --- /dev/null +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/resource/Resource.java @@ -0,0 +1,132 @@ +/* + * 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.resource; + +import java.io.*; +import java.nio.ByteBuffer; + +/** + * Information and reference to the resource + */ +public class Resource { + private final transient Object r; + private final boolean serializable; + private final ResourceId resourceId; + private final String className; + + + /** + * Create local resource + * @param resourceId + * @param r must not be null + */ + Resource(ResourceId resourceId, Object r) { + this.r = r; + this.resourceId = resourceId; + this.serializable = r instanceof Serializable; + this.className = r.getClass().getName(); + } + + /** + * Create remote object + * @param resourceId + */ + Resource(ResourceId resourceId, boolean serializable, String className) { + this.r = null; + this.resourceId = resourceId; + this.serializable = serializable; + this.className = className; + } + + public ResourceId getResourceId() { + return resourceId; + } + + public String getClassName() { + return className; + } + + /** + * + * @return null when this is remote resource and not serializable. + */ + public Object get() { + if (isLocal() || isSerializable()){ + return r; + } else { + return null; + } + } + + public boolean isSerializable() { + return serializable; + } + + /** + * if it is remote object + * @return + */ + public boolean isRemote() { + return !isLocal(); + } + + /** + * Whether it is locally accessible or not + * @return + */ + public boolean isLocal() { + return true; + } + + + + public static ByteBuffer serializeObject(Object o) throws IOException { + if (o == null || !(o instanceof Serializable)) { + return null; + } + + ByteArrayOutputStream out = new ByteArrayOutputStream(); + try { + ObjectOutputStream oos; + oos = new ObjectOutputStream(out); + oos.writeObject(o); + oos.close(); + out.close(); + } catch (Exception e) { + e.printStackTrace(); + } + return ByteBuffer.wrap(out.toByteArray()); + } + + public static Object deserializeObject(ByteBuffer buf) + throws IOException, ClassNotFoundException { + if (buf == null) { + return null; + } + InputStream ins = ByteBufferInputStream.get(buf); + ObjectInputStream oin; + Object object = null; + + oin = new ObjectInputStream(ins); + object = oin.readObject(); + oin.close(); + ins.close(); + + return object; + } + +} diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/resource/ResourceId.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/resource/ResourceId.java new file mode 100644 index 00000000000..a0d55e34f62 --- /dev/null +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/resource/ResourceId.java @@ -0,0 +1,53 @@ +/* + * 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.resource; + +/** + * Identifying resource + */ +public class ResourceId { + private final String resourcePoolId; + private final String name; + + ResourceId(String resourcePoolId, String name) { + this.resourcePoolId = resourcePoolId; + this.name = name; + } + + public String getResourcePoolId() { + return resourcePoolId; + } + + public String getName() { + return name; + } + + @Override + public int hashCode() { + return (resourcePoolId + name).hashCode(); + } + + @Override + public boolean equals(Object o) { + if (o instanceof ResourceId) { + ResourceId r = (ResourceId) o; + return (r.name.equals(name) && r.resourcePoolId.equals(resourcePoolId)); + } else { + return false; + } + } +} diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/resource/ResourcePool.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/resource/ResourcePool.java new file mode 100644 index 00000000000..6328b8d88e5 --- /dev/null +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/resource/ResourcePool.java @@ -0,0 +1,55 @@ +/* + * 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.resource; + +/** + * Interface for ResourcePool + */ +public interface ResourcePool { + /** + * Get unique id of the resource pool + * @return + */ + public String id(); + + /** + * Get resource from name + * @param name Resource name + * @return null if resource not found + */ + public Resource get(String name); + + /** + * Get all resources + * @return + */ + public ResourceSet getAll(); + + /** + * Put an object into resource pool + * @param name + * @param object + */ + public void put(String name, Object object); + + /** + * Remove object + * @param name Resource name to remove + * @return removed Resource. null if resource not found + */ + public Resource remove(String name); +} diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/resource/ResourcePoolConnector.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/resource/ResourcePoolConnector.java new file mode 100644 index 00000000000..af343db6b14 --- /dev/null +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/resource/ResourcePoolConnector.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.resource; + +/** + * Connect resource pools running in remote process + */ +public interface ResourcePoolConnector { + /** + * Get list of resources from all other resource pools in remote processes + * @return + */ + public ResourceSet getAllResources(); + + /** + * Read remote object + * @return + */ + public Object readResource(ResourceId id); +} diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/resource/ResourceSet.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/resource/ResourceSet.java new file mode 100644 index 00000000000..a03655b9f4a --- /dev/null +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/resource/ResourceSet.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.resource; + +import java.util.Collection; +import java.util.LinkedList; +import java.util.regex.Pattern; + +/** + * List of resources + */ +public class ResourceSet extends LinkedList { + + public ResourceSet(Collection resources) { + super(resources); + } + + public ResourceSet() { + super(); + } + + public ResourceSet filterByNameRegex(String regex) { + ResourceSet result = new ResourceSet(); + for (Resource r : this) { + if (Pattern.matches(regex, r.getResourceId().getName())) { + result.add(r); + } + } + return result; + } + + public ResourceSet filterByName(String name) { + ResourceSet result = new ResourceSet(); + for (Resource r : this) { + if (r.getResourceId().getName().equals(name)) { + result.add(r); + } + } + return result; + } + + public ResourceSet filterByClassnameRegex(String regex) { + ResourceSet result = new ResourceSet(); + for (Resource r : this) { + if (Pattern.matches(regex, r.getClassName())) { + result.add(r); + } + } + return result; + } + + public ResourceSet filterByClassname(String className) { + ResourceSet result = new ResourceSet(); + for (Resource r : this) { + if (r.getClassName().equals(className)) { + result.add(r); + } + } + return result; + } +} diff --git a/zeppelin-interpreter/src/main/thrift/RemoteInterpreterService.thrift b/zeppelin-interpreter/src/main/thrift/RemoteInterpreterService.thrift index 5cd14a2b765..3d6a62e3f47 100644 --- a/zeppelin-interpreter/src/main/thrift/RemoteInterpreterService.thrift +++ b/zeppelin-interpreter/src/main/thrift/RemoteInterpreterService.thrift @@ -43,8 +43,10 @@ enum RemoteInterpreterEventType { ANGULAR_OBJECT_UPDATE = 3, ANGULAR_OBJECT_REMOVE = 4, RUN_INTERPRETER_CONTEXT_RUNNER = 5, - OUTPUT_APPEND = 6, - OUTPUT_UPDATE = 7 + RESOURCE_POOL_GET_ALL = 6, + RESOURCE_GET = 7 + OUTPUT_APPEND = 8, + OUTPUT_UPDATE = 9 } struct RemoteInterpreterEvent { @@ -53,7 +55,7 @@ struct RemoteInterpreterEvent { } service RemoteInterpreterService { - void createInterpreter(1: string className, 2: map properties); + void createInterpreter(1: string intpGroupId, 2: string className, 3: map properties); void open(1: string className); void close(1: string className); @@ -67,8 +69,18 @@ service RemoteInterpreterService { string getStatus(1:string jobId); RemoteInterpreterEvent getEvent(); + + // as a response, ZeppelinServer send list of resources to Interpreter process + void resourcePoolResponseGetAll(1: list resources); + // as a response, ZeppelinServer send serialized value of resource + void resourceResponseGet(1: string resourceId, 2: binary object); + // get all resources in the interpreter process + list resoucePoolGetAll(); + // get value of resource + binary resourceGet(1: string resourceName); + void angularObjectUpdate(1: string name, 2: string noteId, 3: string paragraphId, 4: string object); void angularObjectAdd(1: string name, 2: string noteId, 3: string paragraphId, 4: string object); void angularObjectRemove(1: string name, 2: string noteId, 3: string paragraphId); -} \ No newline at end of file +} diff --git a/zeppelin-interpreter/src/test/java/org/apache/zeppelin/interpreter/InterpreterContextTest.java b/zeppelin-interpreter/src/test/java/org/apache/zeppelin/interpreter/InterpreterContextTest.java index 9c2732dd2f8..40fd2edbfe6 100644 --- a/zeppelin-interpreter/src/test/java/org/apache/zeppelin/interpreter/InterpreterContextTest.java +++ b/zeppelin-interpreter/src/test/java/org/apache/zeppelin/interpreter/InterpreterContextTest.java @@ -27,7 +27,7 @@ public class InterpreterContextTest { public void testThreadLocal() { assertNull(InterpreterContext.get()); - InterpreterContext.set(new InterpreterContext(null, null, null, null, null, null, null, null, null)); + InterpreterContext.set(new InterpreterContext(null, null, null, null, null, null, null, null, null, null)); assertNotNull(InterpreterContext.get()); InterpreterContext.remove(); diff --git a/zeppelin-interpreter/src/test/java/org/apache/zeppelin/interpreter/remote/RemoteAngularObjectTest.java b/zeppelin-interpreter/src/test/java/org/apache/zeppelin/interpreter/remote/RemoteAngularObjectTest.java index 4cd974dbb3c..097bfd4d005 100644 --- a/zeppelin-interpreter/src/test/java/org/apache/zeppelin/interpreter/remote/RemoteAngularObjectTest.java +++ b/zeppelin-interpreter/src/test/java/org/apache/zeppelin/interpreter/remote/RemoteAngularObjectTest.java @@ -34,6 +34,8 @@ import org.apache.zeppelin.interpreter.InterpreterGroup; import org.apache.zeppelin.interpreter.InterpreterResult; import org.apache.zeppelin.interpreter.remote.mock.MockInterpreterAngular; +import org.apache.zeppelin.resource.LocalResourcePool; +import org.apache.zeppelin.resource.ResourcePool; import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -84,6 +86,7 @@ public void setUp() throws Exception { new HashMap(), new GUI(), new AngularObjectRegistry(intpGroup.getId(), null), + new LocalResourcePool("pool1"), new LinkedList(), null); intp.open(); @@ -92,7 +95,7 @@ public void setUp() throws Exception { @After public void tearDown() throws Exception { intp.close(); - intpGroup.clone(); + intpGroup.close(); intpGroup.destroy(); } diff --git a/zeppelin-interpreter/src/test/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterOutputTestStream.java b/zeppelin-interpreter/src/test/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterOutputTestStream.java index 623a0379496..6a972d9a177 100644 --- a/zeppelin-interpreter/src/test/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterOutputTestStream.java +++ b/zeppelin-interpreter/src/test/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterOutputTestStream.java @@ -71,14 +71,15 @@ private RemoteInterpreter createMockInterpreter() { private InterpreterContext createInterpreterContext() { return new InterpreterContext( - "noteId", - "id", - "title", - "text", - new HashMap(), - new GUI(), - new AngularObjectRegistry(intpGroup.getId(), null), - new LinkedList(), null); + "noteId", + "id", + "title", + "text", + new HashMap(), + new GUI(), + new AngularObjectRegistry(intpGroup.getId(), null), + null, + new LinkedList(), null); } @Test 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 index 034a676c2ed..e95a6baaf3a 100644 --- 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 @@ -37,6 +37,7 @@ import org.apache.zeppelin.interpreter.InterpreterResult.Code; import org.apache.zeppelin.interpreter.remote.mock.MockInterpreterA; import org.apache.zeppelin.interpreter.remote.mock.MockInterpreterB; +import org.apache.zeppelin.resource.LocalResourcePool; import org.apache.zeppelin.scheduler.Job; import org.apache.zeppelin.scheduler.Job.Status; import org.apache.zeppelin.scheduler.Scheduler; @@ -121,6 +122,7 @@ public void testRemoteInterperterCall() throws TTransportException, IOException new HashMap(), new GUI(), new AngularObjectRegistry(intpGroup.getId(), null), + new LocalResourcePool("pool1"), new LinkedList(), null)); intpB.open(); @@ -154,6 +156,7 @@ public void testRemoteInterperterErrorStatus() throws TTransportException, IOExc new HashMap(), new GUI(), new AngularObjectRegistry(intpGroup.getId(), null), + new LocalResourcePool("pool1"), new LinkedList(), null)); assertEquals(Code.ERROR, ret.code()); @@ -202,6 +205,7 @@ public void testRemoteSchedulerSharing() throws TTransportException, IOException new HashMap(), new GUI(), new AngularObjectRegistry(intpGroup.getId(), null), + new LocalResourcePool("pool1"), new LinkedList(), null)); assertEquals("500", ret.message()); @@ -214,6 +218,7 @@ public void testRemoteSchedulerSharing() throws TTransportException, IOException new HashMap(), new GUI(), new AngularObjectRegistry(intpGroup.getId(), null), + new LocalResourcePool("pool1"), new LinkedList(), null)); assertEquals("1000", ret.message()); long end = System.currentTimeMillis(); @@ -265,6 +270,7 @@ protected Object jobRun() throws Throwable { new HashMap(), new GUI(), new AngularObjectRegistry(intpGroup.getId(), null), + new LocalResourcePool("pool1"), new LinkedList(), null)); } @@ -299,6 +305,7 @@ protected Object jobRun() throws Throwable { new HashMap(), new GUI(), new AngularObjectRegistry(intpGroup.getId(), null), + new LocalResourcePool("pool1"), new LinkedList(), null)); } @@ -364,6 +371,7 @@ protected Object jobRun() throws Throwable { new HashMap(), new GUI(), new AngularObjectRegistry(intpGroup.getId(), null), + new LocalResourcePool("pool1"), new LinkedList(), null)); synchronized (results) { @@ -441,6 +449,7 @@ protected Object jobRun() throws Throwable { new HashMap(), new GUI(), new AngularObjectRegistry(intpGroup.getId(), null), + new LocalResourcePool("pool1"), new LinkedList(), null)); synchronized (results) { @@ -539,6 +548,7 @@ protected Object jobRun() throws Throwable { new HashMap(), new GUI(), new AngularObjectRegistry(intpGroup.getId(), null), + new LocalResourcePool("pool1"), new LinkedList(), null)); } diff --git a/zeppelin-interpreter/src/test/java/org/apache/zeppelin/interpreter/remote/mock/MockInterpreterResourcePool.java b/zeppelin-interpreter/src/test/java/org/apache/zeppelin/interpreter/remote/mock/MockInterpreterResourcePool.java new file mode 100644 index 00000000000..1db68ad177f --- /dev/null +++ b/zeppelin-interpreter/src/test/java/org/apache/zeppelin/interpreter/remote/mock/MockInterpreterResourcePool.java @@ -0,0 +1,112 @@ +/* + * 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 java.util.concurrent.atomic.AtomicInteger; + +import com.google.gson.Gson; +import org.apache.zeppelin.display.AngularObjectRegistry; +import org.apache.zeppelin.display.AngularObjectWatcher; +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.resource.ResourcePool; + +public class MockInterpreterResourcePool extends Interpreter { + static { + Interpreter.register( + "resourcePoolTest", + "resourcePool", + MockInterpreterA.class.getName(), + new InterpreterPropertyBuilder() + .add("p1", "v1", "property1").build()); + + } + + AtomicInteger numWatch = new AtomicInteger(0); + + public MockInterpreterResourcePool(Properties property) { + super(property); + } + + @Override + public void open() { + } + + @Override + public void close() { + + } + + @Override + public InterpreterResult interpret(String st, InterpreterContext context) { + String[] stmt = st.split(" "); + String cmd = stmt[0]; + String name = null; + if (stmt.length >= 2) { + name = stmt[1]; + } + String value = null; + if (stmt.length == 3) { + value = stmt[2]; + } + + ResourcePool resourcePool = context.getResourcePool(); + Object ret = null; + if (cmd.equals("put")) { + resourcePool.put(name, value); + } else if (cmd.equalsIgnoreCase("get")) { + ret = resourcePool.get(name).get(); + } else if (cmd.equals("remove")) { + ret = resourcePool.remove(name); + } else if (cmd.equals("getAll")) { + ret = resourcePool.getAll(); + } + + try { + Thread.sleep(500); // wait for watcher executed + } catch (InterruptedException e) { + } + + Gson gson = new Gson(); + return new InterpreterResult(Code.SUCCESS, gson.toJson(ret)); + } + + @Override + public void cancel(InterpreterContext context) { + } + + @Override + public FormType getFormType() { + return FormType.NATIVE; + } + + @Override + public int getProgress(InterpreterContext context) { + return 0; + } + + @Override + public List completion(String buf, int cursor) { + return null; + } +} \ No newline at end of file diff --git a/zeppelin-interpreter/src/test/java/org/apache/zeppelin/resource/DistributedResourcePoolTest.java b/zeppelin-interpreter/src/test/java/org/apache/zeppelin/resource/DistributedResourcePoolTest.java new file mode 100644 index 00000000000..39c74bc6f01 --- /dev/null +++ b/zeppelin-interpreter/src/test/java/org/apache/zeppelin/resource/DistributedResourcePoolTest.java @@ -0,0 +1,199 @@ +/* + * 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.resource; + +import com.google.gson.Gson; +import org.apache.zeppelin.display.GUI; +import org.apache.zeppelin.interpreter.InterpreterContext; +import org.apache.zeppelin.interpreter.InterpreterContextRunner; +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.RemoteInterpreterEventPoller; +import org.apache.zeppelin.interpreter.remote.mock.MockInterpreterResourcePool; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +import java.io.File; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.Properties; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +/** + * Unittest for DistributedResourcePool + */ +public class DistributedResourcePoolTest { + private InterpreterGroup intpGroup1; + private InterpreterGroup intpGroup2; + private HashMap env; + private RemoteInterpreter intp1; + private RemoteInterpreter intp2; + private InterpreterContext context; + private RemoteInterpreterEventPoller eventPoller1; + private RemoteInterpreterEventPoller eventPoller2; + + + @Before + public void setUp() throws Exception { + env = new HashMap(); + env.put("ZEPPELIN_CLASSPATH", new File("./target/test-classes").getAbsolutePath()); + + Properties p = new Properties(); + + intp1 = new RemoteInterpreter( + p, + MockInterpreterResourcePool.class.getName(), + new File("../bin/interpreter.sh").getAbsolutePath(), + "fake", + env, + 10 * 1000, + null + ); + + intpGroup1 = new InterpreterGroup("intpGroup1"); + intpGroup1.add(intp1); + intp1.setInterpreterGroup(intpGroup1); + + intp2 = new RemoteInterpreter( + p, + MockInterpreterResourcePool.class.getName(), + new File("../bin/interpreter.sh").getAbsolutePath(), + "fake", + env, + 10 * 1000, + null + ); + + intpGroup2 = new InterpreterGroup("intpGroup2"); + intpGroup2.add(intp2); + intp2.setInterpreterGroup(intpGroup2); + + context = new InterpreterContext( + "note", + "id", + "title", + "text", + new HashMap(), + new GUI(), + null, + null, + new LinkedList(), + null); + + intp1.open(); + intp2.open(); + + eventPoller1 = new RemoteInterpreterEventPoller(null); + eventPoller1.setInterpreterGroup(intpGroup1); + eventPoller1.setInterpreterProcess(intpGroup1.getRemoteInterpreterProcess()); + + eventPoller2 = new RemoteInterpreterEventPoller(null); + eventPoller2.setInterpreterGroup(intpGroup2); + eventPoller2.setInterpreterProcess(intpGroup2.getRemoteInterpreterProcess()); + + eventPoller1.start(); + eventPoller2.start(); + } + + @After + public void tearDown() throws Exception { + eventPoller1.shutdown(); + intp1.close(); + intpGroup1.close(); + intpGroup1.destroy(); + eventPoller2.shutdown(); + intp2.close(); + intpGroup2.close(); + intpGroup2.destroy(); + } + + @Test + public void testRemoteDistributedResourcePool() { + Gson gson = new Gson(); + InterpreterResult ret; + intp1.interpret("put key1 value1", context); + intp2.interpret("put key2 value2", context); + + ret = intp1.interpret("getAll", context); + assertEquals(2, gson.fromJson(ret.message(), ResourceSet.class).size()); + + ret = intp2.interpret("getAll", context); + assertEquals(2, gson.fromJson(ret.message(), ResourceSet.class).size()); + + ret = intp1.interpret("get key1", context); + assertEquals("value1", gson.fromJson(ret.message(), String.class)); + + ret = intp1.interpret("get key2", context); + assertEquals("value2", gson.fromJson(ret.message(), String.class)); + } + + @Test + public void testDistributedResourcePool() { + final LocalResourcePool pool2 = new LocalResourcePool("pool2"); + final LocalResourcePool pool3 = new LocalResourcePool("pool3"); + + DistributedResourcePool pool1 = new DistributedResourcePool("pool1", new ResourcePoolConnector() { + @Override + public ResourceSet getAllResources() { + ResourceSet set = pool2.getAll(); + set.addAll(pool3.getAll()); + + ResourceSet remoteSet = new ResourceSet(); + Gson gson = new Gson(); + for (Resource s : set) { + RemoteResource remoteResource = gson.fromJson(gson.toJson(s), RemoteResource.class); + remoteResource.setResourcePoolConnector(this); + remoteSet.add(remoteResource); + } + return remoteSet; + } + + @Override + public Object readResource(ResourceId id) { + if (id.getResourcePoolId().equals(pool2.id())) { + return pool2.get(id.getName()).get(); + } + if (id.getResourcePoolId().equals(pool3.id())) { + return pool3.get(id.getName()).get(); + } + return null; + } + }); + + assertEquals(0, pool1.getAll().size()); + + + // test get() can get from pool + pool2.put("object1", "value2"); + assertEquals(1, pool1.getAll().size()); + assertTrue(pool1.get("object1").isRemote()); + assertEquals("value2", pool1.get("object1").get()); + + // test get() is locality aware + pool1.put("object1", "value1"); + assertEquals(1, pool2.getAll().size()); + assertEquals("value1", pool1.get("object1").get()); + + // test getAll() is locality aware + assertEquals("value1", pool1.getAll().get(0).get()); + assertEquals("value2", pool1.getAll().get(1).get()); + } +} diff --git a/zeppelin-interpreter/src/test/java/org/apache/zeppelin/resource/LocalResourcePoolTest.java b/zeppelin-interpreter/src/test/java/org/apache/zeppelin/resource/LocalResourcePoolTest.java new file mode 100644 index 00000000000..65d284bafa6 --- /dev/null +++ b/zeppelin-interpreter/src/test/java/org/apache/zeppelin/resource/LocalResourcePoolTest.java @@ -0,0 +1,48 @@ +/* + * 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.resource; + +import org.junit.Test; + +import static org.junit.Assert.*; + +/** + * Unittest for LocalResourcePool + */ +public class LocalResourcePoolTest { + + @Test + public void testGetPutResourcePool() { + + LocalResourcePool pool = new LocalResourcePool("pool1"); + assertEquals("pool1", pool.id()); + + assertNull(pool.get("notExists")); + pool.put("item1", "value1"); + Resource resource = pool.get("item1"); + assertNotNull(resource); + assertEquals(pool.id(), resource.getResourceId().getResourcePoolId()); + assertEquals("value1", resource.get()); + assertTrue(resource.isLocal()); + assertTrue(resource.isSerializable()); + + assertEquals(1, pool.getAll().size()); + + assertNotNull(pool.remove("item1")); + assertNull(pool.remove("item1")); + } +} diff --git a/zeppelin-interpreter/src/test/java/org/apache/zeppelin/resource/ResourceSetTest.java b/zeppelin-interpreter/src/test/java/org/apache/zeppelin/resource/ResourceSetTest.java new file mode 100644 index 00000000000..ca645250e24 --- /dev/null +++ b/zeppelin-interpreter/src/test/java/org/apache/zeppelin/resource/ResourceSetTest.java @@ -0,0 +1,53 @@ +/* + * 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.resource; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; + +/** + * Unit test for ResourceSet + */ +public class ResourceSetTest { + + @Test + public void testFilterByName() { + ResourceSet set = new ResourceSet(); + + set.add(new Resource(new ResourceId("poo1", "resource1"), "value1")); + set.add(new Resource(new ResourceId("poo1", "resource2"), new Integer(2))); + assertEquals(2, set.filterByNameRegex(".*").size()); + assertEquals(1, set.filterByNameRegex("resource1").size()); + assertEquals(1, set.filterByNameRegex("resource2").size()); + assertEquals(0, set.filterByNameRegex("res").size()); + assertEquals(2, set.filterByNameRegex("res.*").size()); + } + + @Test + public void testFilterByClassName() { + ResourceSet set = new ResourceSet(); + + set.add(new Resource(new ResourceId("poo1", "resource1"), "value1")); + set.add(new Resource(new ResourceId("poo1", "resource2"), new Integer(2))); + + assertEquals(1, set.filterByClassnameRegex(".*String").size()); + assertEquals(1, set.filterByClassnameRegex(String.class.getName()).size()); + assertEquals(1, set.filterByClassnameRegex(".*Integer").size()); + assertEquals(1, set.filterByClassnameRegex(Integer.class.getName()).size()); + } +} diff --git a/zeppelin-interpreter/src/test/java/org/apache/zeppelin/resource/ResourceTest.java b/zeppelin-interpreter/src/test/java/org/apache/zeppelin/resource/ResourceTest.java new file mode 100644 index 00000000000..fb8b27131f6 --- /dev/null +++ b/zeppelin-interpreter/src/test/java/org/apache/zeppelin/resource/ResourceTest.java @@ -0,0 +1,35 @@ +/* + * 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.resource; + +import org.junit.Test; + +import java.io.IOException; +import java.nio.ByteBuffer; + +import static org.junit.Assert.assertEquals; + +/** + * Test for Resource + */ +public class ResourceTest { + @Test + public void testSerializeDeserialize() throws IOException, ClassNotFoundException { + ByteBuffer buffer = Resource.serializeObject("hello"); + assertEquals("hello", Resource.deserializeObject(buffer)); + } +} 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 index 05bc6763363..7b7a7cfc6f6 100644 --- a/zeppelin-interpreter/src/test/java/org/apache/zeppelin/scheduler/RemoteSchedulerTest.java +++ b/zeppelin-interpreter/src/test/java/org/apache/zeppelin/scheduler/RemoteSchedulerTest.java @@ -34,13 +34,15 @@ import org.apache.zeppelin.interpreter.InterpreterContextRunner; import org.apache.zeppelin.interpreter.InterpreterGroup; import org.apache.zeppelin.interpreter.remote.RemoteInterpreter; +import org.apache.zeppelin.interpreter.remote.RemoteInterpreterProcessListener; import org.apache.zeppelin.interpreter.remote.mock.MockInterpreterA; +import org.apache.zeppelin.resource.LocalResourcePool; import org.apache.zeppelin.scheduler.Job.Status; import org.junit.After; import org.junit.Before; import org.junit.Test; -public class RemoteSchedulerTest { +public class RemoteSchedulerTest implements RemoteInterpreterProcessListener { private SchedulerFactory schedulerSvc; private static final int TICK_WAIT = 100; @@ -70,7 +72,7 @@ public void test() throws Exception { "fake", env, 10 * 1000, - null + this ); intpGroup.add(intpA); @@ -104,6 +106,7 @@ protected Object jobRun() throws Throwable { new HashMap(), new GUI(), new AngularObjectRegistry(intpGroup.getId(), null), + new LocalResourcePool("pool1"), new LinkedList(), null)); return "1000"; } @@ -154,7 +157,7 @@ public void testAbortOnPending() throws Exception { "fake", env, 10 * 1000, - null + this ); intpGroup.add(intpA); @@ -175,6 +178,7 @@ public void testAbortOnPending() throws Exception { new HashMap(), new GUI(), new AngularObjectRegistry(intpGroup.getId(), null), + new LocalResourcePool("pool1"), new LinkedList(), null); @Override @@ -211,6 +215,7 @@ protected boolean jobAbort() { new HashMap(), new GUI(), new AngularObjectRegistry(intpGroup.getId(), null), + new LocalResourcePool("pool1"), new LinkedList(), null); @Override @@ -270,4 +275,13 @@ protected boolean jobAbort() { schedulerSvc.removeScheduler("test"); } + @Override + public void onOutputAppend(String noteId, String paragraphId, String output) { + + } + + @Override + public void onOutputUpdated(String noteId, String paragraphId, String output) { + + } } diff --git a/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/Notebook.java b/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/Notebook.java index cae4210c45f..70a72f1b2dc 100644 --- a/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/Notebook.java +++ b/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/Notebook.java @@ -483,9 +483,12 @@ public void execute(JobExecutionContext context) throws JobExecutionException { boolean releaseResource = false; try { - releaseResource = (boolean) note.getConfig().get("releaseresource"); - } catch (java.lang.ClassCastException e) { - logger.error(e.toString(), e); + Map config = note.getConfig(); + if (config != null && config.containsKey("releaseresource")) { + releaseResource = (boolean) note.getConfig().get("releaseresource"); + } + } catch (ClassCastException e) { + logger.error(e.getMessage(), e); } if (releaseResource) { for (InterpreterSetting setting : note.getNoteReplLoader().getInterpreterSettings()) { diff --git a/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/Paragraph.java b/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/Paragraph.java index 65210f52bdb..bf17c358040 100644 --- a/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/Paragraph.java +++ b/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/Paragraph.java @@ -23,6 +23,7 @@ import org.apache.zeppelin.interpreter.*; import org.apache.zeppelin.interpreter.Interpreter.FormType; import org.apache.zeppelin.interpreter.InterpreterResult.Code; +import org.apache.zeppelin.resource.ResourcePool; import org.apache.zeppelin.scheduler.Job; import org.apache.zeppelin.scheduler.JobListener; import org.slf4j.Logger; @@ -256,10 +257,12 @@ protected boolean jobAbort() { private InterpreterContext getInterpreterContext() { AngularObjectRegistry registry = null; + ResourcePool resourcePool = null; if (!getNoteReplLoader().getInterpreterSettings().isEmpty()) { InterpreterSetting intpGroup = getNoteReplLoader().getInterpreterSettings().get(0); registry = intpGroup.getInterpreterGroup().getAngularObjectRegistry(); + resourcePool = intpGroup.getInterpreterGroup().getResourcePool(); } List runners = new LinkedList(); @@ -276,6 +279,7 @@ private InterpreterContext getInterpreterContext() { this.getConfig(), this.settings, registry, + resourcePool, runners, new InterpreterOutput(new InterpreterOutputListener() { @Override diff --git a/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/InterpreterFactoryTest.java b/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/InterpreterFactoryTest.java index 17d91ccb86f..67d04fa4183 100644 --- a/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/InterpreterFactoryTest.java +++ b/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/InterpreterFactoryTest.java @@ -56,7 +56,7 @@ public void setUp() throws Exception { System.setProperty(ConfVars.ZEPPELIN_INTERPRETERS.getVarName(), "org.apache.zeppelin.interpreter.mock.MockInterpreter1,org.apache.zeppelin.interpreter.mock.MockInterpreter2"); conf = new ZeppelinConfiguration(); factory = new InterpreterFactory(conf, new InterpreterOption(false), null, null, null); - context = new InterpreterContext("note", "id", "title", "text", null, null, null, null, null); + context = new InterpreterContext("note", "id", "title", "text", null, null, null, null, null, null); }