You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zeppelin.apache.org by mo...@apache.org on 2017/01/30 20:42:44 UTC
[1/3] zeppelin git commit: [ZEPPELIN-2020] Invoke method from resource
Repository: zeppelin
Updated Branches:
refs/heads/master 65e1d3645 -> 42bcf4206
http://git-wip-us.apache.org/repos/asf/zeppelin/blob/42bcf420/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/thrift/ZeppelinServerResourceParagraphRunner.java
----------------------------------------------------------------------
diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/thrift/ZeppelinServerResourceParagraphRunner.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/thrift/ZeppelinServerResourceParagraphRunner.java
index 197a135..74cb25d 100644
--- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/thrift/ZeppelinServerResourceParagraphRunner.java
+++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/thrift/ZeppelinServerResourceParagraphRunner.java
@@ -51,7 +51,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
-@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2016-11-29")
+@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2017-1-25")
public class ZeppelinServerResourceParagraphRunner implements org.apache.thrift.TBase<ZeppelinServerResourceParagraphRunner, ZeppelinServerResourceParagraphRunner._Fields>, java.io.Serializable, Cloneable, Comparable<ZeppelinServerResourceParagraphRunner> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("ZeppelinServerResourceParagraphRunner");
http://git-wip-us.apache.org/repos/asf/zeppelin/blob/42bcf420/zeppelin-interpreter/src/main/java/org/apache/zeppelin/resource/LocalResourcePool.java
----------------------------------------------------------------------
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
index ef269e4..5a0193c 100644
--- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/resource/LocalResourcePool.java
+++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/resource/LocalResourcePool.java
@@ -72,7 +72,7 @@ public class LocalResourcePool implements ResourcePool {
public void put(String name, Object object) {
ResourceId resourceId = new ResourceId(resourcePoolId, name);
- Resource resource = new Resource(resourceId, object);
+ Resource resource = new Resource(this, resourceId, object);
resources.put(resourceId, resource);
}
@@ -80,7 +80,7 @@ public class LocalResourcePool implements ResourcePool {
public void put(String noteId, String paragraphId, String name, Object object) {
ResourceId resourceId = new ResourceId(resourcePoolId, noteId, paragraphId, name);
- Resource resource = new Resource(resourceId, object);
+ Resource resource = new Resource(this, resourceId, object);
resources.put(resourceId, resource);
}
http://git-wip-us.apache.org/repos/asf/zeppelin/blob/42bcf420/zeppelin-interpreter/src/main/java/org/apache/zeppelin/resource/RemoteResource.java
----------------------------------------------------------------------
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
index 5a8a9ea..6342231 100644
--- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/resource/RemoteResource.java
+++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/resource/RemoteResource.java
@@ -23,11 +23,11 @@ public class RemoteResource extends Resource {
ResourcePoolConnector resourcePoolConnector;
RemoteResource(ResourceId resourceId, Object r) {
- super(resourceId, r);
+ super(null, resourceId, r);
}
RemoteResource(ResourceId resourceId, boolean serializable, String className) {
- super(resourceId, serializable, className);
+ super(null, resourceId, serializable, className);
}
@Override
@@ -52,4 +52,43 @@ public class RemoteResource extends Resource {
public void setResourcePoolConnector(ResourcePoolConnector resourcePoolConnector) {
this.resourcePoolConnector = resourcePoolConnector;
}
+
+ /**
+ * Call a method of the object that this remote resource holds
+ * @param methodName name of method to call
+ * @param paramTypes method parameter types
+ * @param params method parameter values
+ * @return return value of the method. Null if return value is not serializable
+ */
+ @Override
+ public Object invokeMethod(
+ String methodName, Class [] paramTypes, Object [] params) {
+ ResourceId resourceId = getResourceId();
+ return resourcePoolConnector.invokeMethod(
+ resourceId,
+ methodName,
+ paramTypes,
+ params);
+ }
+
+ /**
+ * Call a method of the object that this remote resource holds and save return value as a resource
+ * @param methodName name of method to call
+ * @param paramTypes method parameter types
+ * @param params method parameter values
+ * @param returnResourceName name of resource that return value will be saved
+ * @return Resource that holds return value.
+ */
+ @Override
+ public Resource invokeMethod(
+ String methodName, Class [] paramTypes, Object [] params, String returnResourceName) {
+ ResourceId resourceId = getResourceId();
+ Resource resource = resourcePoolConnector.invokeMethod(
+ resourceId,
+ methodName,
+ paramTypes,
+ params,
+ returnResourceName);
+ return resource;
+ }
}
http://git-wip-us.apache.org/repos/asf/zeppelin/blob/42bcf420/zeppelin-interpreter/src/main/java/org/apache/zeppelin/resource/Resource.java
----------------------------------------------------------------------
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
index 6988b3e..a478c42 100644
--- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/resource/Resource.java
+++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/resource/Resource.java
@@ -16,7 +16,11 @@
*/
package org.apache.zeppelin.resource;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import java.io.*;
+import java.lang.reflect.Method;
import java.nio.ByteBuffer;
/**
@@ -24,6 +28,7 @@ import java.nio.ByteBuffer;
*/
public class Resource {
private final transient Object r;
+ private final transient LocalResourcePool pool;
private final boolean serializable;
private final ResourceId resourceId;
private final String className;
@@ -31,11 +36,13 @@ public class Resource {
/**
* Create local resource
+ *
* @param resourceId
- * @param r must not be null
+ * @param r must not be null
*/
- Resource(ResourceId resourceId, Object r) {
+ Resource(LocalResourcePool pool, ResourceId resourceId, Object r) {
this.r = r;
+ this.pool = pool;
this.resourceId = resourceId;
this.serializable = r instanceof Serializable;
this.className = r.getClass().getName();
@@ -43,10 +50,12 @@ public class Resource {
/**
* Create remote object
+ *
* @param resourceId
*/
- Resource(ResourceId resourceId, boolean serializable, String className) {
+ Resource(LocalResourcePool pool, ResourceId resourceId, boolean serializable, String className) {
this.r = null;
+ this.pool = pool;
this.resourceId = resourceId;
this.serializable = serializable;
this.className = className;
@@ -61,11 +70,10 @@ public class Resource {
}
/**
- *
* @return null when this is remote resource and not serializable.
*/
public Object get() {
- if (isLocal() || isSerializable()){
+ if (isLocal() || isSerializable()) {
return r;
} else {
return null;
@@ -78,6 +86,7 @@ public class Resource {
/**
* if it is remote object
+ *
* @return
*/
public boolean isRemote() {
@@ -86,6 +95,7 @@ public class Resource {
/**
* Whether it is locally accessible or not
+ *
* @return
*/
public boolean isLocal() {
@@ -93,6 +103,65 @@ public class Resource {
}
+ /**
+ * Call a method of the object that this resource holds
+ * @param methodName name of method to call
+ * @param paramTypes method parameter types
+ * @param params method parameter values
+ * @return return value of the method
+ */
+ public Object invokeMethod(
+ String methodName, Class [] paramTypes, Object [] params) {
+ if (r != null) {
+ try {
+ Method method = r.getClass().getMethod(
+ methodName,
+ paramTypes);
+ Object ret = method.invoke(r, params);
+ return ret;
+ } catch (Exception e) {
+ logException(e);
+ return null;
+ }
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * Call a method of the object that this resource holds and save return value as a resource
+ * @param methodName name of method to call
+ * @param paramTypes method parameter types
+ * @param params method parameter values
+ * @param returnResourceName name of resource that return value will be saved
+ * @return Resource that holds return value
+ */
+ public Resource invokeMethod(
+ String methodName, Class [] paramTypes, Object [] params, String returnResourceName) {
+ if (r != null) {
+ try {
+ Method method = r.getClass().getMethod(
+ methodName,
+ paramTypes);
+ Object ret = method.invoke(r, params);
+ pool.put(
+ resourceId.getNoteId(),
+ resourceId.getParagraphId(),
+ returnResourceName,
+ ret
+ );
+ return pool.get(
+ resourceId.getNoteId(),
+ resourceId.getParagraphId(),
+ returnResourceName);
+ } catch (Exception e) {
+ logException(e);
+ return null;
+ }
+ } else {
+ return null;
+ }
+ }
public static ByteBuffer serializeObject(Object o) throws IOException {
if (o == null || !(o instanceof Serializable)) {
@@ -129,4 +198,8 @@ public class Resource {
return object;
}
+ private void logException(Exception e) {
+ Logger logger = LoggerFactory.getLogger(Resource.class);
+ logger.error(e.getMessage(), e);
+ }
}
http://git-wip-us.apache.org/repos/asf/zeppelin/blob/42bcf420/zeppelin-interpreter/src/main/java/org/apache/zeppelin/resource/ResourcePoolConnector.java
----------------------------------------------------------------------
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
index af343db..f270d92 100644
--- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/resource/ResourcePoolConnector.java
+++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/resource/ResourcePoolConnector.java
@@ -31,4 +31,24 @@ public interface ResourcePoolConnector {
* @return
*/
public Object readResource(ResourceId id);
+
+ /**
+ * Invoke method of Resource and get return
+ * @return
+ */
+ public Object invokeMethod(
+ ResourceId id,
+ String methodName,
+ Class[] paramTypes,
+ Object[] params);
+
+ /**
+ * Invoke method, put result into resource pool and return
+ */
+ public Resource invokeMethod(
+ ResourceId id,
+ String methodName,
+ Class[] paramTypes,
+ Object[] params,
+ String returnResourceName);
}
http://git-wip-us.apache.org/repos/asf/zeppelin/blob/42bcf420/zeppelin-interpreter/src/main/thrift/RemoteInterpreterService.thrift
----------------------------------------------------------------------
diff --git a/zeppelin-interpreter/src/main/thrift/RemoteInterpreterService.thrift b/zeppelin-interpreter/src/main/thrift/RemoteInterpreterService.thrift
index 50a5eb7..08a15ad 100644
--- a/zeppelin-interpreter/src/main/thrift/RemoteInterpreterService.thrift
+++ b/zeppelin-interpreter/src/main/thrift/RemoteInterpreterService.thrift
@@ -55,7 +55,8 @@ enum RemoteInterpreterEventType {
ANGULAR_REGISTRY_PUSH = 11,
APP_STATUS_UPDATE = 12,
META_INFOS = 13,
- REMOTE_ZEPPELIN_SERVER_RESOURCE = 14
+ REMOTE_ZEPPELIN_SERVER_RESOURCE = 14,
+ RESOURCE_INVOKE_METHOD = 15
}
@@ -105,12 +106,16 @@ service RemoteInterpreterService {
void resourcePoolResponseGetAll(1: list<string> resources);
// as a response, ZeppelinServer send serialized value of resource
void resourceResponseGet(1: string resourceId, 2: binary object);
+ // as a response, ZeppelinServer send return object
+ void resourceResponseInvokeMethod(1: string invokeMessage, 2: binary object);
// get all resources in the interpreter process
list<string> resourcePoolGetAll();
// get value of resource
binary resourceGet(1: string sessionKey, 2: string paragraphId, 3: string resourceName);
// remove resource
bool resourceRemove(1: string sessionKey, 2: string paragraphId, 3:string resourceName);
+ // invoke method on resource
+ binary resourceInvokeMethod(1: string sessionKey, 2: string paragraphId, 3:string resourceName, 4:string invokeMessage);
void angularObjectUpdate(1: string name, 2: string sessionKey, 3: string paragraphId, 4: string
object);
http://git-wip-us.apache.org/repos/asf/zeppelin/blob/42bcf420/zeppelin-interpreter/src/test/java/org/apache/zeppelin/interpreter/remote/mock/MockInterpreterResourcePool.java
----------------------------------------------------------------------
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
index e49306d..80ac555 100644
--- 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
@@ -68,7 +68,7 @@ public class MockInterpreterResourcePool extends Interpreter {
String name = null;
if (stmt.length >= 2) {
String[] npn = stmt[1].split(":");
- if (npn.length == 3) {
+ if (npn.length >= 3) {
noteId = npn[0];
paragraphId = npn[1];
name = npn[2];
@@ -77,7 +77,7 @@ public class MockInterpreterResourcePool extends Interpreter {
}
}
String value = null;
- if (stmt.length == 3) {
+ if (stmt.length >= 3) {
value = stmt[2];
}
@@ -96,6 +96,14 @@ public class MockInterpreterResourcePool extends Interpreter {
ret = resourcePool.remove(noteId, paragraphId, name);
} else if (cmd.equals("getAll")) {
ret = resourcePool.getAll();
+ } else if (cmd.equals("invoke")) {
+ Resource resource = resourcePool.get(noteId, paragraphId, name);
+ if (stmt.length >=4) {
+ Resource res = resource.invokeMethod(value, null, null, stmt[3]);
+ ret = res.get();
+ } else {
+ ret = resource.invokeMethod(value, null, null);
+ }
}
try {
http://git-wip-us.apache.org/repos/asf/zeppelin/blob/42bcf420/zeppelin-interpreter/src/test/java/org/apache/zeppelin/resource/DistributedResourcePoolTest.java
----------------------------------------------------------------------
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
index 8095043..363ccf6 100644
--- a/zeppelin-interpreter/src/test/java/org/apache/zeppelin/resource/DistributedResourcePoolTest.java
+++ b/zeppelin-interpreter/src/test/java/org/apache/zeppelin/resource/DistributedResourcePoolTest.java
@@ -190,6 +190,17 @@ public class DistributedResourcePoolTest {
}
return null;
}
+
+ @Override
+ public Object invokeMethod(ResourceId id, String methodName, Class[] paramTypes, Object[] params) {
+ return null;
+ }
+
+ @Override
+ public Resource invokeMethod(ResourceId id, String methodName, Class[] paramTypes, Object[]
+ params, String returnResourceName) {
+ return null;
+ }
});
assertEquals(0, pool1.getAll().size());
@@ -249,4 +260,44 @@ public class DistributedResourcePoolTest {
String.class));
}
+
+ @Test
+ public void testResourceInvokeMethod() {
+ Gson gson = new Gson();
+ InterpreterResult ret;
+ intp1.interpret("put key1 hey", context);
+ intp2.interpret("put key2 world", context);
+
+ // invoke method in local resource pool
+ ret = intp1.interpret("invoke key1 length", context);
+ assertEquals("3", ret.message().get(0).getData());
+
+ // invoke method in remote resource pool
+ ret = intp1.interpret("invoke key2 length", context);
+ assertEquals("5", ret.message().get(0).getData());
+
+ // make sure no resources are automatically created
+ ret = intp1.interpret("getAll", context);
+ assertEquals(2, gson.fromJson(ret.message().get(0).getData(), ResourceSet.class).size());
+
+ // invoke method in local resource pool and save result
+ ret = intp1.interpret("invoke key1 length ret1", context);
+ assertEquals("3", ret.message().get(0).getData());
+
+ ret = intp1.interpret("getAll", context);
+ assertEquals(3, gson.fromJson(ret.message().get(0).getData(), ResourceSet.class).size());
+
+ ret = intp1.interpret("get ret1", context);
+ assertEquals("3", gson.fromJson(ret.message().get(0).getData(), String.class));
+
+ // invoke method in remote resource pool and save result
+ ret = intp1.interpret("invoke key2 length ret2", context);
+ assertEquals("5", ret.message().get(0).getData());
+
+ ret = intp1.interpret("getAll", context);
+ assertEquals(4, gson.fromJson(ret.message().get(0).getData(), ResourceSet.class).size());
+
+ ret = intp1.interpret("get ret2", context);
+ assertEquals("5", gson.fromJson(ret.message().get(0).getData(), String.class));
+ }
}
http://git-wip-us.apache.org/repos/asf/zeppelin/blob/42bcf420/zeppelin-interpreter/src/test/java/org/apache/zeppelin/resource/ResourceSetTest.java
----------------------------------------------------------------------
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
index ca64525..cc1cad1 100644
--- a/zeppelin-interpreter/src/test/java/org/apache/zeppelin/resource/ResourceSetTest.java
+++ b/zeppelin-interpreter/src/test/java/org/apache/zeppelin/resource/ResourceSetTest.java
@@ -29,8 +29,8 @@ public class ResourceSetTest {
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)));
+ set.add(new Resource(null, new ResourceId("poo1", "resource1"), "value1"));
+ set.add(new Resource(null, new ResourceId("poo1", "resource2"), new Integer(2)));
assertEquals(2, set.filterByNameRegex(".*").size());
assertEquals(1, set.filterByNameRegex("resource1").size());
assertEquals(1, set.filterByNameRegex("resource2").size());
@@ -42,8 +42,8 @@ public class ResourceSetTest {
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)));
+ set.add(new Resource(null, new ResourceId("poo1", "resource1"), "value1"));
+ set.add(new Resource(null, new ResourceId("poo1", "resource2"), new Integer(2)));
assertEquals(1, set.filterByClassnameRegex(".*String").size());
assertEquals(1, set.filterByClassnameRegex(String.class.getName()).size());
[3/3] zeppelin git commit: [ZEPPELIN-2020] Invoke method from resource
Posted by mo...@apache.org.
[ZEPPELIN-2020] Invoke method from resource
### What is this PR for?
This PR provides a way to invoke method remotely against the resource in the resource pool.
This will be particularly useful when the object in the resource pool is non-serializable (like jdbc connection, spark dataframe).
This PR extends data access API of Resource from
```
class Resource {
// get object
public Object get();
}
```
to
```
class Resource {
// get object
public Object get()
// call method of object and get return value
public Object invokeMethod(String methodName, Class [] paramTypes, Object [] params);
// call method of object and save return value into resourcepool
public Resource invokeMethod(String methodName, Class [] paramTypes, Object [] params, String returnResourceName);
}
```
### What type of PR is it?
Feature
### Todos
* [x] - API for remote method invocation and get result
* [x] - API for remote method invocation and store result into resource pool
* [x] - Unittest
### What is the Jira issue?
https://issues.apache.org/jira/browse/ZEPPELIN-2020
### How should this be tested?
Unittest included
### Questions:
* Does the licenses files need update? no
* Is there breaking changes for older versions? no
* Does this needs documentation? no
Author: Lee moon soo <mo...@apache.org>
Closes #1951 from Leemoonsoo/invoke_method_from_resource and squashes the following commits:
42d7eae [Lee moon soo] Add comments
30e62f2 [Lee moon soo] make RemoteResource.invokeMethod returns Resource when return resource name is specified
74b502e [Lee moon soo] Support method invocation on the resource in local,remote resource pool
Project: http://git-wip-us.apache.org/repos/asf/zeppelin/repo
Commit: http://git-wip-us.apache.org/repos/asf/zeppelin/commit/42bcf420
Tree: http://git-wip-us.apache.org/repos/asf/zeppelin/tree/42bcf420
Diff: http://git-wip-us.apache.org/repos/asf/zeppelin/diff/42bcf420
Branch: refs/heads/master
Commit: 42bcf4206ab27952311dd246d9e3778aa8dc2836
Parents: 65e1d36
Author: Lee moon soo <mo...@apache.org>
Authored: Sun Jan 29 08:23:52 2017 +0900
Committer: Lee moon soo <mo...@apache.org>
Committed: Tue Jan 31 05:42:38 2017 +0900
----------------------------------------------------------------------
.../InvokeResourceMethodEventMessage.java | 94 +
.../remote/RemoteInterpreterEventClient.java | 143 +
.../remote/RemoteInterpreterEventPoller.java | 95 +-
.../remote/RemoteInterpreterServer.java | 68 +
.../thrift/InterpreterCompletion.java | 2 +-
.../thrift/RemoteApplicationResult.java | 2 +-
.../thrift/RemoteInterpreterContext.java | 2 +-
.../thrift/RemoteInterpreterEvent.java | 2 +-
.../thrift/RemoteInterpreterEventType.java | 5 +-
.../thrift/RemoteInterpreterResult.java | 2 +-
.../thrift/RemoteInterpreterResultMessage.java | 2 +-
.../thrift/RemoteInterpreterService.java | 2729 +++++++++++++++---
.../ZeppelinServerResourceParagraphRunner.java | 2 +-
.../zeppelin/resource/LocalResourcePool.java | 4 +-
.../zeppelin/resource/RemoteResource.java | 43 +-
.../org/apache/zeppelin/resource/Resource.java | 83 +-
.../resource/ResourcePoolConnector.java | 20 +
.../main/thrift/RemoteInterpreterService.thrift | 7 +-
.../mock/MockInterpreterResourcePool.java | 12 +-
.../resource/DistributedResourcePoolTest.java | 51 +
.../zeppelin/resource/ResourceSetTest.java | 8 +-
21 files changed, 3007 insertions(+), 369 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/zeppelin/blob/42bcf420/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/InvokeResourceMethodEventMessage.java
----------------------------------------------------------------------
diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/InvokeResourceMethodEventMessage.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/InvokeResourceMethodEventMessage.java
new file mode 100644
index 0000000..a2b0690
--- /dev/null
+++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/InvokeResourceMethodEventMessage.java
@@ -0,0 +1,94 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.zeppelin.interpreter.remote;
+
+import org.apache.zeppelin.resource.ResourceId;
+
+/**
+ * message payload to invoke method of resource in the resourcepool
+ */
+public class InvokeResourceMethodEventMessage {
+ public final ResourceId resourceId;
+ public final String methodName;
+ public final String[] paramClassnames;
+ public final Object[] params;
+ public final String returnResourceName;
+
+ public InvokeResourceMethodEventMessage(
+ ResourceId resourceId,
+ String methodName,
+ Class[] paramtypes,
+ Object[] params,
+ String returnResourceName
+ ) {
+ this.resourceId = resourceId;
+ this.methodName = methodName;
+ if (paramtypes != null) {
+ paramClassnames = new String[paramtypes.length];
+ for (int i = 0; i < paramClassnames.length; i++) {
+ paramClassnames[i] = paramtypes[i].getName();
+ }
+ } else {
+ paramClassnames = null;
+ }
+
+ this.params = params;
+ this.returnResourceName = returnResourceName;
+ }
+
+ public Class [] getParamTypes() throws ClassNotFoundException {
+ if (paramClassnames == null) {
+ return null;
+ }
+
+ Class [] types = new Class[paramClassnames.length];
+ for (int i = 0; i < paramClassnames.length; i++) {
+ types[i] = this.getClass().getClassLoader().loadClass(paramClassnames[i]);
+ }
+
+ return types;
+ }
+
+ public boolean shouldPutResultIntoResourcePool() {
+ return (returnResourceName != null);
+ }
+
+ @Override
+ public int hashCode() {
+ String hash = resourceId.hashCode() + methodName;
+ if (paramClassnames != null) {
+ for (String name : paramClassnames) {
+ hash += name;
+ }
+ }
+ if (returnResourceName != null) {
+ hash += returnResourceName;
+ }
+
+ return hash.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (o instanceof InvokeResourceMethodEventMessage) {
+ InvokeResourceMethodEventMessage r = (InvokeResourceMethodEventMessage) o;
+ return r.hashCode() == hashCode();
+ } else {
+ return false;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/zeppelin/blob/42bcf420/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterEventClient.java
----------------------------------------------------------------------
diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterEventClient.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterEventClient.java
index 900d1ac..606d35f 100644
--- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterEventClient.java
+++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterEventClient.java
@@ -50,6 +50,7 @@ public class RemoteInterpreterEventClient implements ResourcePoolConnector {
private final List<RemoteInterpreterEvent> eventQueue = new LinkedList<>();
private final List<ResourceSet> getAllResourceResponse = new LinkedList<>();
private final Map<ResourceId, Object> getResourceResponse = new HashMap<>();
+ private final Map<InvokeResourceMethodEventMessage, Object> getInvokeResponse = new HashMap<>();
private final Gson gson = new Gson();
/**
@@ -165,6 +166,112 @@ public class RemoteInterpreterEventClient implements ResourcePoolConnector {
}
/**
+ * Invoke method and save result in resourcePool as another resource
+ * @param resourceId
+ * @param methodName
+ * @param paramTypes
+ * @param params
+ * @return
+ */
+ @Override
+ public Object invokeMethod(
+ ResourceId resourceId,
+ String methodName,
+ Class[] paramTypes,
+ Object[] params) {
+ logger.debug("Request Invoke method {} of Resource {}", methodName, resourceId.getName());
+
+ InvokeResourceMethodEventMessage invokeMethod = new InvokeResourceMethodEventMessage(
+ resourceId,
+ methodName,
+ paramTypes,
+ params,
+ null);
+
+ synchronized (getInvokeResponse) {
+ // wait for previous response consumed
+ while (getInvokeResponse.containsKey(invokeMethod)) {
+ try {
+ getInvokeResponse.wait();
+ } catch (InterruptedException e) {
+ logger.warn(e.getMessage(), e);
+ }
+ }
+ // send request
+ Gson gson = new Gson();
+
+ sendEvent(new RemoteInterpreterEvent(
+ RemoteInterpreterEventType.RESOURCE_INVOKE_METHOD,
+ gson.toJson(invokeMethod)));
+ // wait for response
+ while (!getInvokeResponse.containsKey(invokeMethod)) {
+ try {
+ getInvokeResponse.wait();
+ } catch (InterruptedException e) {
+ logger.warn(e.getMessage(), e);
+ }
+ }
+ Object o = getInvokeResponse.remove(invokeMethod);
+ getInvokeResponse.notifyAll();
+ return o;
+ }
+ }
+
+ /**
+ * Invoke method and save result in resourcePool as another resource
+ * @param resourceId
+ * @param methodName
+ * @param paramTypes
+ * @param params
+ * @param returnResourceName
+ * @return
+ */
+ @Override
+ public Resource invokeMethod(
+ ResourceId resourceId,
+ String methodName,
+ Class[] paramTypes,
+ Object[] params,
+ String returnResourceName) {
+ logger.debug("Request Invoke method {} of Resource {}", methodName, resourceId.getName());
+
+ InvokeResourceMethodEventMessage invokeMethod = new InvokeResourceMethodEventMessage(
+ resourceId,
+ methodName,
+ paramTypes,
+ params,
+ returnResourceName);
+
+ synchronized (getInvokeResponse) {
+ // wait for previous response consumed
+ while (getInvokeResponse.containsKey(invokeMethod)) {
+ try {
+ getInvokeResponse.wait();
+ } catch (InterruptedException e) {
+ logger.warn(e.getMessage(), e);
+ }
+ }
+ // send request
+ Gson gson = new Gson();
+
+ sendEvent(new RemoteInterpreterEvent(
+ RemoteInterpreterEventType.RESOURCE_INVOKE_METHOD,
+ gson.toJson(invokeMethod)));
+ // wait for response
+ while (!getInvokeResponse.containsKey(invokeMethod)) {
+ try {
+ getInvokeResponse.wait();
+ } catch (InterruptedException e) {
+ logger.warn(e.getMessage(), e);
+ }
+ }
+ Resource o = (Resource) getInvokeResponse.remove(invokeMethod);
+ getInvokeResponse.notifyAll();
+ return o;
+ }
+ }
+
+ /**
* Supposed to call from RemoteInterpreterEventPoller
*/
public void putResponseGetAllResources(List<String> resources) {
@@ -211,6 +318,42 @@ public class RemoteInterpreterEventClient implements ResourcePoolConnector {
/**
* Supposed to call from RemoteInterpreterEventPoller
+ * @param invokeMessage json serialized InvokeMessage
+ * @param object java serialized of the object
+ */
+ public void putResponseInvokeMethod(
+ InvokeResourceMethodEventMessage invokeMessage, ByteBuffer object) {
+ 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 (getInvokeResponse) {
+ getInvokeResponse.put(invokeMessage, o);
+ getInvokeResponse.notifyAll();
+ }
+ }
+
+ /**
+ * Supposed to call from RemoteInterpreterEventPoller
+ * @param invokeMessage invoke message
+ * @param resource remote resource
+ */
+ public void putResponseInvokeMethod(
+ InvokeResourceMethodEventMessage invokeMessage, Resource resource) {
+ synchronized (getInvokeResponse) {
+ getInvokeResponse.put(invokeMessage, resource);
+ getInvokeResponse.notifyAll();
+ }
+ }
+
+
+ /**
+ * Supposed to call from RemoteInterpreterEventPoller
* @return next available event
*/
public RemoteInterpreterEvent pollEvent() {
http://git-wip-us.apache.org/repos/asf/zeppelin/blob/42bcf420/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterEventPoller.java
----------------------------------------------------------------------
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 e2a8add..e794140 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
@@ -38,6 +38,8 @@ import org.apache.zeppelin.resource.ResourceSet;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
import java.nio.ByteBuffer;
import java.util.LinkedList;
import java.util.List;
@@ -62,6 +64,8 @@ public class RemoteInterpreterEventPoller extends Thread {
private RemoteInterpreterProcess interpreterProcess;
private InterpreterGroup interpreterGroup;
+ Gson gson = new Gson();
+
public RemoteInterpreterEventPoller(
RemoteInterpreterProcessListener listener,
ApplicationEventListener appListener) {
@@ -117,8 +121,6 @@ public class RemoteInterpreterEventPoller extends Thread {
interpreterProcess.releaseClient(client, broken);
}
- Gson gson = new Gson();
-
AngularObjectRegistry angularObjectRegistry = interpreterGroup.getAngularObjectRegistry();
try {
@@ -160,6 +162,12 @@ public class RemoteInterpreterEventPoller extends Thread {
logger.debug("RESOURCE_GET {} {}", resourceId.getResourcePoolId(), resourceId.getName());
Object o = getResource(resourceId);
sendResourceResponseGet(resourceId, o);
+ } else if (event.getType() == RemoteInterpreterEventType.RESOURCE_INVOKE_METHOD) {
+ String message = event.getData();
+ InvokeResourceMethodEventMessage invokeMethodMessage =
+ gson.fromJson(message, InvokeResourceMethodEventMessage.class);
+ Object ret = invokeResourceMethod(invokeMethodMessage);
+ sendInvokeMethodResult(invokeMethodMessage, ret);
} else if (event.getType() == RemoteInterpreterEventType.OUTPUT_APPEND) {
// on output append
Map<String, String> outputAppend = gson.fromJson(
@@ -383,8 +391,6 @@ public class RemoteInterpreterEventPoller extends Thread {
return resourceSet;
}
-
-
private void sendResourceResponseGet(ResourceId resourceId, Object o) {
Client client = null;
boolean broken = false;
@@ -444,6 +450,87 @@ public class RemoteInterpreterEventPoller extends Thread {
return null;
}
+ public void sendInvokeMethodResult(InvokeResourceMethodEventMessage message, Object o) {
+ Client client = null;
+ boolean broken = false;
+ try {
+ client = interpreterProcess.getClient();
+ Gson gson = new Gson();
+ String invokeMessage = gson.toJson(message);
+ ByteBuffer obj;
+ if (o == null) {
+ obj = ByteBuffer.allocate(0);
+ } else {
+ obj = Resource.serializeObject(o);
+ }
+ client.resourceResponseInvokeMethod(invokeMessage, obj);
+ } catch (Exception e) {
+ logger.error(e.getMessage(), e);
+ broken = true;
+ } finally {
+ if (client != null) {
+ interpreterProcess.releaseClient(client, broken);
+ }
+ }
+ }
+
+ private Object invokeResourceMethod(InvokeResourceMethodEventMessage message) {
+ ResourceId resourceId = message.resourceId;
+ InterpreterGroup intpGroup = InterpreterGroup.getByInterpreterGroupId(
+ resourceId.getResourcePoolId());
+ if (intpGroup == null) {
+ return null;
+ }
+
+ RemoteInterpreterProcess remoteInterpreterProcess = intpGroup.getRemoteInterpreterProcess();
+ if (remoteInterpreterProcess == null) {
+ ResourcePool localPool = intpGroup.getResourcePool();
+ if (localPool != null) {
+ Resource res = localPool.get(resourceId.getName());
+ if (res != null) {
+ try {
+ return res.invokeMethod(
+ message.methodName,
+ message.getParamTypes(),
+ message.params,
+ message.returnResourceName);
+ } catch (Exception e) {
+ logger.error(e.getMessage(), e);
+ return null;
+ }
+ } else {
+ // object is null. can't invoke any method
+ logger.error("Can't invoke method {} on null object", message.methodName);
+ return null;
+ }
+ } else {
+ logger.error("no resource pool");
+ return null;
+ }
+ } else if (interpreterProcess.isRunning()) {
+ Client client = null;
+ boolean broken = false;
+ try {
+ client = remoteInterpreterProcess.getClient();
+ ByteBuffer res = client.resourceInvokeMethod(
+ resourceId.getNoteId(),
+ resourceId.getParagraphId(),
+ resourceId.getName(),
+ gson.toJson(message));
+ 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) {
http://git-wip-us.apache.org/repos/asf/zeppelin/blob/42bcf420/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterServer.java
----------------------------------------------------------------------
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 879b4f5..8624b57 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
@@ -20,6 +20,7 @@ package org.apache.zeppelin.interpreter.remote;
import java.io.IOException;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
import java.net.URL;
import java.nio.ByteBuffer;
import java.util.*;
@@ -956,6 +957,73 @@ public class RemoteInterpreterServer
}
@Override
+ public ByteBuffer resourceInvokeMethod(
+ String noteId, String paragraphId, String resourceName, String invokeMessage) {
+ InvokeResourceMethodEventMessage message =
+ gson.fromJson(invokeMessage, InvokeResourceMethodEventMessage.class);
+
+ Resource resource = resourcePool.get(noteId, paragraphId, resourceName, false);
+ if (resource == null || resource.get() == null) {
+ return ByteBuffer.allocate(0);
+ } else {
+ try {
+ Object o = resource.get();
+ Method method = o.getClass().getMethod(
+ message.methodName,
+ message.getParamTypes());
+ Object ret = method.invoke(o, message.params);
+ if (message.shouldPutResultIntoResourcePool()) {
+ // if return resource name is specified,
+ // then put result into resource pool
+ // and return empty byte buffer
+ resourcePool.put(
+ noteId,
+ paragraphId,
+ message.returnResourceName,
+ ret);
+ return ByteBuffer.allocate(0);
+ } else {
+ // if return resource name is not specified,
+ // then return serialized result
+ ByteBuffer serialized = Resource.serializeObject(ret);
+ if (serialized == null) {
+ return ByteBuffer.allocate(0);
+ } else {
+ return serialized;
+ }
+ }
+ } catch (Exception e) {
+ logger.error(e.getMessage(), e);
+ return ByteBuffer.allocate(0);
+ }
+ }
+ }
+
+ /**
+ * Get payload of resource from remote
+ * @param invokeResourceMethodEventMessage json serialized InvokeResourcemethodEventMessage
+ * @param object java serialized of the object
+ * @throws TException
+ */
+ @Override
+ public void resourceResponseInvokeMethod(
+ String invokeResourceMethodEventMessage, ByteBuffer object) throws TException {
+ InvokeResourceMethodEventMessage message =
+ gson.fromJson(invokeResourceMethodEventMessage, InvokeResourceMethodEventMessage.class);
+
+ if (message.shouldPutResultIntoResourcePool()) {
+ Resource resource = resourcePool.get(
+ message.resourceId.getNoteId(),
+ message.resourceId.getParagraphId(),
+ message.returnResourceName,
+ true);
+ eventClient.putResponseInvokeMethod(message, resource);
+ } else {
+ eventClient.putResponseInvokeMethod(message, object);
+ }
+ }
+
+ @Override
public void angularRegistryPush(String registryAsString) throws TException {
try {
Map<String, Map<String, AngularObject>> deserializedRegistry = gson
http://git-wip-us.apache.org/repos/asf/zeppelin/blob/42bcf420/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/thrift/InterpreterCompletion.java
----------------------------------------------------------------------
diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/thrift/InterpreterCompletion.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/thrift/InterpreterCompletion.java
index 2d1c165..8a1bc7d 100644
--- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/thrift/InterpreterCompletion.java
+++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/thrift/InterpreterCompletion.java
@@ -51,7 +51,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
-@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2016-11-29")
+@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2017-1-25")
public class InterpreterCompletion implements org.apache.thrift.TBase<InterpreterCompletion, InterpreterCompletion._Fields>, java.io.Serializable, Cloneable, Comparable<InterpreterCompletion> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("InterpreterCompletion");
http://git-wip-us.apache.org/repos/asf/zeppelin/blob/42bcf420/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/thrift/RemoteApplicationResult.java
----------------------------------------------------------------------
diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/thrift/RemoteApplicationResult.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/thrift/RemoteApplicationResult.java
index 5c73049..ebb8579 100644
--- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/thrift/RemoteApplicationResult.java
+++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/thrift/RemoteApplicationResult.java
@@ -51,7 +51,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
-@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2016-11-29")
+@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2017-1-25")
public class RemoteApplicationResult implements org.apache.thrift.TBase<RemoteApplicationResult, RemoteApplicationResult._Fields>, java.io.Serializable, Cloneable, Comparable<RemoteApplicationResult> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("RemoteApplicationResult");
http://git-wip-us.apache.org/repos/asf/zeppelin/blob/42bcf420/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/thrift/RemoteInterpreterContext.java
----------------------------------------------------------------------
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 e721cb3..6a24e56 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.Logger;
import org.slf4j.LoggerFactory;
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
-@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2016-11-29")
+@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2017-1-25")
public class RemoteInterpreterContext implements org.apache.thrift.TBase<RemoteInterpreterContext, RemoteInterpreterContext._Fields>, java.io.Serializable, Cloneable, Comparable<RemoteInterpreterContext> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("RemoteInterpreterContext");
http://git-wip-us.apache.org/repos/asf/zeppelin/blob/42bcf420/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/thrift/RemoteInterpreterEvent.java
----------------------------------------------------------------------
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 5f4201a..39c4f81 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.Logger;
import org.slf4j.LoggerFactory;
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
-@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2016-11-29")
+@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2017-1-25")
public class RemoteInterpreterEvent implements org.apache.thrift.TBase<RemoteInterpreterEvent, RemoteInterpreterEvent._Fields>, java.io.Serializable, Cloneable, Comparable<RemoteInterpreterEvent> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("RemoteInterpreterEvent");
http://git-wip-us.apache.org/repos/asf/zeppelin/blob/42bcf420/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/thrift/RemoteInterpreterEventType.java
----------------------------------------------------------------------
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 fc20cd9..7ca406c 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
@@ -42,7 +42,8 @@ public enum RemoteInterpreterEventType implements org.apache.thrift.TEnum {
ANGULAR_REGISTRY_PUSH(11),
APP_STATUS_UPDATE(12),
META_INFOS(13),
- REMOTE_ZEPPELIN_SERVER_RESOURCE(14);
+ REMOTE_ZEPPELIN_SERVER_RESOURCE(14),
+ RESOURCE_INVOKE_METHOD(15);
private final int value;
@@ -91,6 +92,8 @@ public enum RemoteInterpreterEventType implements org.apache.thrift.TEnum {
return META_INFOS;
case 14:
return REMOTE_ZEPPELIN_SERVER_RESOURCE;
+ case 15:
+ return RESOURCE_INVOKE_METHOD;
default:
return null;
}
http://git-wip-us.apache.org/repos/asf/zeppelin/blob/42bcf420/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/thrift/RemoteInterpreterResult.java
----------------------------------------------------------------------
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 ce15084..4929efa 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.Logger;
import org.slf4j.LoggerFactory;
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
-@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2016-11-29")
+@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2017-1-25")
public class RemoteInterpreterResult implements org.apache.thrift.TBase<RemoteInterpreterResult, RemoteInterpreterResult._Fields>, java.io.Serializable, Cloneable, Comparable<RemoteInterpreterResult> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("RemoteInterpreterResult");
http://git-wip-us.apache.org/repos/asf/zeppelin/blob/42bcf420/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/thrift/RemoteInterpreterResultMessage.java
----------------------------------------------------------------------
diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/thrift/RemoteInterpreterResultMessage.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/thrift/RemoteInterpreterResultMessage.java
index c55c72e..eb1261e 100644
--- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/thrift/RemoteInterpreterResultMessage.java
+++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/thrift/RemoteInterpreterResultMessage.java
@@ -51,7 +51,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
-@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2016-11-29")
+@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2017-1-25")
public class RemoteInterpreterResultMessage implements org.apache.thrift.TBase<RemoteInterpreterResultMessage, RemoteInterpreterResultMessage._Fields>, java.io.Serializable, Cloneable, Comparable<RemoteInterpreterResultMessage> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("RemoteInterpreterResultMessage");
[2/3] zeppelin git commit: [ZEPPELIN-2020] Invoke method from resource
Posted by mo...@apache.org.
http://git-wip-us.apache.org/repos/asf/zeppelin/blob/42bcf420/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/thrift/RemoteInterpreterService.java
----------------------------------------------------------------------
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 feaebcc..7b2a76e 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,7 +51,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
-@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2016-11-29")
+@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2017-1-25")
public class RemoteInterpreterService {
public interface Iface {
@@ -82,12 +82,16 @@ public class RemoteInterpreterService {
public void resourceResponseGet(String resourceId, ByteBuffer object) throws org.apache.thrift.TException;
+ public void resourceResponseInvokeMethod(String invokeMessage, ByteBuffer object) throws org.apache.thrift.TException;
+
public List<String> resourcePoolGetAll() throws org.apache.thrift.TException;
public ByteBuffer resourceGet(String sessionKey, String paragraphId, String resourceName) throws org.apache.thrift.TException;
public boolean resourceRemove(String sessionKey, String paragraphId, String resourceName) throws org.apache.thrift.TException;
+ public ByteBuffer resourceInvokeMethod(String sessionKey, String paragraphId, String resourceName, String invokeMessage) throws org.apache.thrift.TException;
+
public void angularObjectUpdate(String name, String sessionKey, String paragraphId, String object) throws org.apache.thrift.TException;
public void angularObjectAdd(String name, String sessionKey, String paragraphId, String object) throws org.apache.thrift.TException;
@@ -134,12 +138,16 @@ public class RemoteInterpreterService {
public void resourceResponseGet(String resourceId, ByteBuffer object, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
+ public void resourceResponseInvokeMethod(String invokeMessage, ByteBuffer object, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
+
public void resourcePoolGetAll(org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
public void resourceGet(String sessionKey, String paragraphId, String resourceName, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
public void resourceRemove(String sessionKey, String paragraphId, String resourceName, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
+ public void resourceInvokeMethod(String sessionKey, String paragraphId, String resourceName, String invokeMessage, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
+
public void angularObjectUpdate(String name, String sessionKey, String paragraphId, String object, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
public void angularObjectAdd(String name, String sessionKey, String paragraphId, String object, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
@@ -473,6 +481,27 @@ public class RemoteInterpreterService {
return;
}
+ public void resourceResponseInvokeMethod(String invokeMessage, ByteBuffer object) throws org.apache.thrift.TException
+ {
+ send_resourceResponseInvokeMethod(invokeMessage, object);
+ recv_resourceResponseInvokeMethod();
+ }
+
+ public void send_resourceResponseInvokeMethod(String invokeMessage, ByteBuffer object) throws org.apache.thrift.TException
+ {
+ resourceResponseInvokeMethod_args args = new resourceResponseInvokeMethod_args();
+ args.setInvokeMessage(invokeMessage);
+ args.setObject(object);
+ sendBase("resourceResponseInvokeMethod", args);
+ }
+
+ public void recv_resourceResponseInvokeMethod() throws org.apache.thrift.TException
+ {
+ resourceResponseInvokeMethod_result result = new resourceResponseInvokeMethod_result();
+ receiveBase(result, "resourceResponseInvokeMethod");
+ return;
+ }
+
public List<String> resourcePoolGetAll() throws org.apache.thrift.TException
{
send_resourcePoolGetAll();
@@ -545,6 +574,32 @@ public class RemoteInterpreterService {
throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "resourceRemove failed: unknown result");
}
+ public ByteBuffer resourceInvokeMethod(String sessionKey, String paragraphId, String resourceName, String invokeMessage) throws org.apache.thrift.TException
+ {
+ send_resourceInvokeMethod(sessionKey, paragraphId, resourceName, invokeMessage);
+ return recv_resourceInvokeMethod();
+ }
+
+ public void send_resourceInvokeMethod(String sessionKey, String paragraphId, String resourceName, String invokeMessage) throws org.apache.thrift.TException
+ {
+ resourceInvokeMethod_args args = new resourceInvokeMethod_args();
+ args.setSessionKey(sessionKey);
+ args.setParagraphId(paragraphId);
+ args.setResourceName(resourceName);
+ args.setInvokeMessage(invokeMessage);
+ sendBase("resourceInvokeMethod", args);
+ }
+
+ public ByteBuffer recv_resourceInvokeMethod() throws org.apache.thrift.TException
+ {
+ resourceInvokeMethod_result result = new resourceInvokeMethod_result();
+ receiveBase(result, "resourceInvokeMethod");
+ if (result.isSetSuccess()) {
+ return result.success;
+ }
+ throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "resourceInvokeMethod failed: unknown result");
+ }
+
public void angularObjectUpdate(String name, String sessionKey, String paragraphId, String object) throws org.apache.thrift.TException
{
send_angularObjectUpdate(name, sessionKey, paragraphId, object);
@@ -1210,6 +1265,41 @@ public class RemoteInterpreterService {
}
}
+ public void resourceResponseInvokeMethod(String invokeMessage, ByteBuffer object, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
+ checkReady();
+ resourceResponseInvokeMethod_call method_call = new resourceResponseInvokeMethod_call(invokeMessage, object, resultHandler, this, ___protocolFactory, ___transport);
+ this.___currentMethod = method_call;
+ ___manager.call(method_call);
+ }
+
+ public static class resourceResponseInvokeMethod_call extends org.apache.thrift.async.TAsyncMethodCall {
+ private String invokeMessage;
+ private ByteBuffer object;
+ public resourceResponseInvokeMethod_call(String invokeMessage, 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.invokeMessage = invokeMessage;
+ 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("resourceResponseInvokeMethod", org.apache.thrift.protocol.TMessageType.CALL, 0));
+ resourceResponseInvokeMethod_args args = new resourceResponseInvokeMethod_args();
+ args.setInvokeMessage(invokeMessage);
+ 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_resourceResponseInvokeMethod();
+ }
+ }
+
public void resourcePoolGetAll(org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
checkReady();
resourcePoolGetAll_call method_call = new resourcePoolGetAll_call(resultHandler, this, ___protocolFactory, ___transport);
@@ -1315,6 +1405,47 @@ public class RemoteInterpreterService {
}
}
+ public void resourceInvokeMethod(String sessionKey, String paragraphId, String resourceName, String invokeMessage, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
+ checkReady();
+ resourceInvokeMethod_call method_call = new resourceInvokeMethod_call(sessionKey, paragraphId, resourceName, invokeMessage, resultHandler, this, ___protocolFactory, ___transport);
+ this.___currentMethod = method_call;
+ ___manager.call(method_call);
+ }
+
+ public static class resourceInvokeMethod_call extends org.apache.thrift.async.TAsyncMethodCall {
+ private String sessionKey;
+ private String paragraphId;
+ private String resourceName;
+ private String invokeMessage;
+ public resourceInvokeMethod_call(String sessionKey, String paragraphId, String resourceName, String invokeMessage, 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.sessionKey = sessionKey;
+ this.paragraphId = paragraphId;
+ this.resourceName = resourceName;
+ this.invokeMessage = invokeMessage;
+ }
+
+ public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
+ prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("resourceInvokeMethod", org.apache.thrift.protocol.TMessageType.CALL, 0));
+ resourceInvokeMethod_args args = new resourceInvokeMethod_args();
+ args.setSessionKey(sessionKey);
+ args.setParagraphId(paragraphId);
+ args.setResourceName(resourceName);
+ args.setInvokeMessage(invokeMessage);
+ 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_resourceInvokeMethod();
+ }
+ }
+
public void angularObjectUpdate(String name, String sessionKey, String paragraphId, String object, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
checkReady();
angularObjectUpdate_call method_call = new angularObjectUpdate_call(name, sessionKey, paragraphId, object, resultHandler, this, ___protocolFactory, ___transport);
@@ -1630,9 +1761,11 @@ public class RemoteInterpreterService {
processMap.put("getEvent", new getEvent());
processMap.put("resourcePoolResponseGetAll", new resourcePoolResponseGetAll());
processMap.put("resourceResponseGet", new resourceResponseGet());
+ processMap.put("resourceResponseInvokeMethod", new resourceResponseInvokeMethod());
processMap.put("resourcePoolGetAll", new resourcePoolGetAll());
processMap.put("resourceGet", new resourceGet());
processMap.put("resourceRemove", new resourceRemove());
+ processMap.put("resourceInvokeMethod", new resourceInvokeMethod());
processMap.put("angularObjectUpdate", new angularObjectUpdate());
processMap.put("angularObjectAdd", new angularObjectAdd());
processMap.put("angularObjectRemove", new angularObjectRemove());
@@ -1905,6 +2038,26 @@ public class RemoteInterpreterService {
}
}
+ public static class resourceResponseInvokeMethod<I extends Iface> extends org.apache.thrift.ProcessFunction<I, resourceResponseInvokeMethod_args> {
+ public resourceResponseInvokeMethod() {
+ super("resourceResponseInvokeMethod");
+ }
+
+ public resourceResponseInvokeMethod_args getEmptyArgsInstance() {
+ return new resourceResponseInvokeMethod_args();
+ }
+
+ protected boolean isOneway() {
+ return false;
+ }
+
+ public resourceResponseInvokeMethod_result getResult(I iface, resourceResponseInvokeMethod_args args) throws org.apache.thrift.TException {
+ resourceResponseInvokeMethod_result result = new resourceResponseInvokeMethod_result();
+ iface.resourceResponseInvokeMethod(args.invokeMessage, args.object);
+ return result;
+ }
+ }
+
public static class resourcePoolGetAll<I extends Iface> extends org.apache.thrift.ProcessFunction<I, resourcePoolGetAll_args> {
public resourcePoolGetAll() {
super("resourcePoolGetAll");
@@ -1966,6 +2119,26 @@ public class RemoteInterpreterService {
}
}
+ public static class resourceInvokeMethod<I extends Iface> extends org.apache.thrift.ProcessFunction<I, resourceInvokeMethod_args> {
+ public resourceInvokeMethod() {
+ super("resourceInvokeMethod");
+ }
+
+ public resourceInvokeMethod_args getEmptyArgsInstance() {
+ return new resourceInvokeMethod_args();
+ }
+
+ protected boolean isOneway() {
+ return false;
+ }
+
+ public resourceInvokeMethod_result getResult(I iface, resourceInvokeMethod_args args) throws org.apache.thrift.TException {
+ resourceInvokeMethod_result result = new resourceInvokeMethod_result();
+ result.success = iface.resourceInvokeMethod(args.sessionKey, args.paragraphId, args.resourceName, args.invokeMessage);
+ return result;
+ }
+ }
+
public static class angularObjectUpdate<I extends Iface> extends org.apache.thrift.ProcessFunction<I, angularObjectUpdate_args> {
public angularObjectUpdate() {
super("angularObjectUpdate");
@@ -2152,9 +2325,11 @@ public class RemoteInterpreterService {
processMap.put("getEvent", new getEvent());
processMap.put("resourcePoolResponseGetAll", new resourcePoolResponseGetAll());
processMap.put("resourceResponseGet", new resourceResponseGet());
+ processMap.put("resourceResponseInvokeMethod", new resourceResponseInvokeMethod());
processMap.put("resourcePoolGetAll", new resourcePoolGetAll());
processMap.put("resourceGet", new resourceGet());
processMap.put("resourceRemove", new resourceRemove());
+ processMap.put("resourceInvokeMethod", new resourceInvokeMethod());
processMap.put("angularObjectUpdate", new angularObjectUpdate());
processMap.put("angularObjectAdd", new angularObjectAdd());
processMap.put("angularObjectRemove", new angularObjectRemove());
@@ -2823,6 +2998,56 @@ public class RemoteInterpreterService {
}
}
+ public static class resourceResponseInvokeMethod<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, resourceResponseInvokeMethod_args, Void> {
+ public resourceResponseInvokeMethod() {
+ super("resourceResponseInvokeMethod");
+ }
+
+ public resourceResponseInvokeMethod_args getEmptyArgsInstance() {
+ return new resourceResponseInvokeMethod_args();
+ }
+
+ public AsyncMethodCallback<Void> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
+ final org.apache.thrift.AsyncProcessFunction fcall = this;
+ return new AsyncMethodCallback<Void>() {
+ public void onComplete(Void o) {
+ resourceResponseInvokeMethod_result result = new resourceResponseInvokeMethod_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;
+ resourceResponseInvokeMethod_result result = new resourceResponseInvokeMethod_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, resourceResponseInvokeMethod_args args, org.apache.thrift.async.AsyncMethodCallback<Void> resultHandler) throws TException {
+ iface.resourceResponseInvokeMethod(args.invokeMessage, args.object,resultHandler);
+ }
+ }
+
public static class resourcePoolGetAll<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, resourcePoolGetAll_args, List<String>> {
public resourcePoolGetAll() {
super("resourcePoolGetAll");
@@ -2977,6 +3202,57 @@ public class RemoteInterpreterService {
}
}
+ public static class resourceInvokeMethod<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, resourceInvokeMethod_args, ByteBuffer> {
+ public resourceInvokeMethod() {
+ super("resourceInvokeMethod");
+ }
+
+ public resourceInvokeMethod_args getEmptyArgsInstance() {
+ return new resourceInvokeMethod_args();
+ }
+
+ public AsyncMethodCallback<ByteBuffer> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
+ final org.apache.thrift.AsyncProcessFunction fcall = this;
+ return new AsyncMethodCallback<ByteBuffer>() {
+ public void onComplete(ByteBuffer o) {
+ resourceInvokeMethod_result result = new resourceInvokeMethod_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;
+ resourceInvokeMethod_result result = new resourceInvokeMethod_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, resourceInvokeMethod_args args, org.apache.thrift.async.AsyncMethodCallback<ByteBuffer> resultHandler) throws TException {
+ iface.resourceInvokeMethod(args.sessionKey, args.paragraphId, args.resourceName, args.invokeMessage,resultHandler);
+ }
+ }
+
public static class angularObjectUpdate<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, angularObjectUpdate_args, Void> {
public angularObjectUpdate() {
super("angularObjectUpdate");
@@ -13934,20 +14210,25 @@ public class RemoteInterpreterService {
}
- public static class resourcePoolGetAll_args implements org.apache.thrift.TBase<resourcePoolGetAll_args, resourcePoolGetAll_args._Fields>, java.io.Serializable, Cloneable, Comparable<resourcePoolGetAll_args> {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("resourcePoolGetAll_args");
+ public static class resourceResponseInvokeMethod_args implements org.apache.thrift.TBase<resourceResponseInvokeMethod_args, resourceResponseInvokeMethod_args._Fields>, java.io.Serializable, Cloneable, Comparable<resourceResponseInvokeMethod_args> {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("resourceResponseInvokeMethod_args");
+ private static final org.apache.thrift.protocol.TField INVOKE_MESSAGE_FIELD_DESC = new org.apache.thrift.protocol.TField("invokeMessage", 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<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
- schemes.put(StandardScheme.class, new resourcePoolGetAll_argsStandardSchemeFactory());
- schemes.put(TupleScheme.class, new resourcePoolGetAll_argsTupleSchemeFactory());
+ schemes.put(StandardScheme.class, new resourceResponseInvokeMethod_argsStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new resourceResponseInvokeMethod_argsTupleSchemeFactory());
}
+ public String invokeMessage; // 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 {
-;
+ INVOKE_MESSAGE((short)1, "invokeMessage"),
+ OBJECT((short)2, "object");
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
@@ -13962,6 +14243,10 @@ public class RemoteInterpreterService {
*/
public static _Fields findByThriftId(int fieldId) {
switch(fieldId) {
+ case 1: // INVOKE_MESSAGE
+ return INVOKE_MESSAGE;
+ case 2: // OBJECT
+ return OBJECT;
default:
return null;
}
@@ -14000,83 +14285,1684 @@ public class RemoteInterpreterService {
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.INVOKE_MESSAGE, new org.apache.thrift.meta_data.FieldMetaData("invokeMessage", 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(resourcePoolGetAll_args.class, metaDataMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(resourceResponseInvokeMethod_args.class, metaDataMap);
}
- public resourcePoolGetAll_args() {
+ public resourceResponseInvokeMethod_args() {
+ }
+
+ public resourceResponseInvokeMethod_args(
+ String invokeMessage,
+ ByteBuffer object)
+ {
+ this();
+ this.invokeMessage = invokeMessage;
+ this.object = org.apache.thrift.TBaseHelper.copyBinary(object);
}
/**
* Performs a deep copy on <i>other</i>.
*/
- public resourcePoolGetAll_args(resourcePoolGetAll_args other) {
+ public resourceResponseInvokeMethod_args(resourceResponseInvokeMethod_args other) {
+ if (other.isSetInvokeMessage()) {
+ this.invokeMessage = other.invokeMessage;
+ }
+ if (other.isSetObject()) {
+ this.object = org.apache.thrift.TBaseHelper.copyBinary(other.object);
+ }
}
- public resourcePoolGetAll_args deepCopy() {
- return new resourcePoolGetAll_args(this);
+ public resourceResponseInvokeMethod_args deepCopy() {
+ return new resourceResponseInvokeMethod_args(this);
}
@Override
public void clear() {
+ this.invokeMessage = null;
+ this.object = null;
}
- public void setFieldValue(_Fields field, Object value) {
- switch (field) {
- }
+ public String getInvokeMessage() {
+ return this.invokeMessage;
}
- public Object getFieldValue(_Fields field) {
- switch (field) {
- }
- throw new IllegalStateException();
+ public resourceResponseInvokeMethod_args setInvokeMessage(String invokeMessage) {
+ this.invokeMessage = invokeMessage;
+ return this;
}
- /** 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();
+ public void unsetInvokeMessage() {
+ this.invokeMessage = null;
}
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof resourcePoolGetAll_args)
- return this.equals((resourcePoolGetAll_args)that);
- return false;
+ /** Returns true if field invokeMessage is set (has been assigned a value) and false otherwise */
+ public boolean isSetInvokeMessage() {
+ return this.invokeMessage != null;
}
- public boolean equals(resourcePoolGetAll_args that) {
- if (that == null)
- return false;
-
- return true;
+ public void setInvokeMessageIsSet(boolean value) {
+ if (!value) {
+ this.invokeMessage = null;
+ }
}
- @Override
+ 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 resourceResponseInvokeMethod_args setObject(byte[] object) {
+ this.object = object == null ? (ByteBuffer)null : ByteBuffer.wrap(Arrays.copyOf(object, object.length));
+ return this;
+ }
+
+ public resourceResponseInvokeMethod_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 INVOKE_MESSAGE:
+ if (value == null) {
+ unsetInvokeMessage();
+ } else {
+ setInvokeMessage((String)value);
+ }
+ break;
+
+ case OBJECT:
+ if (value == null) {
+ unsetObject();
+ } else {
+ setObject((ByteBuffer)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case INVOKE_MESSAGE:
+ return getInvokeMessage();
+
+ case OBJECT:
+ return getObject();
+
+ }
+ 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 INVOKE_MESSAGE:
+ return isSetInvokeMessage();
+ case OBJECT:
+ return isSetObject();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof resourceResponseInvokeMethod_args)
+ return this.equals((resourceResponseInvokeMethod_args)that);
+ return false;
+ }
+
+ public boolean equals(resourceResponseInvokeMethod_args that) {
+ if (that == null)
+ return false;
+
+ boolean this_present_invokeMessage = true && this.isSetInvokeMessage();
+ boolean that_present_invokeMessage = true && that.isSetInvokeMessage();
+ if (this_present_invokeMessage || that_present_invokeMessage) {
+ if (!(this_present_invokeMessage && that_present_invokeMessage))
+ return false;
+ if (!this.invokeMessage.equals(that.invokeMessage))
+ 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;
+ }
+
+ @Override
+ public int hashCode() {
+ List<Object> list = new ArrayList<Object>();
+
+ boolean present_invokeMessage = true && (isSetInvokeMessage());
+ list.add(present_invokeMessage);
+ if (present_invokeMessage)
+ list.add(invokeMessage);
+
+ boolean present_object = true && (isSetObject());
+ list.add(present_object);
+ if (present_object)
+ list.add(object);
+
+ return list.hashCode();
+ }
+
+ @Override
+ public int compareTo(resourceResponseInvokeMethod_args other) {
+ if (!getClass().equals(other.getClass())) {
+ return getClass().getName().compareTo(other.getClass().getName());
+ }
+
+ int lastComparison = 0;
+
+ lastComparison = Boolean.valueOf(isSetInvokeMessage()).compareTo(other.isSetInvokeMessage());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetInvokeMessage()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.invokeMessage, other.invokeMessage);
+ 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;
+ }
+
+ 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("resourceResponseInvokeMethod_args(");
+ boolean first = true;
+
+ sb.append("invokeMessage:");
+ if (this.invokeMessage == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.invokeMessage);
+ }
+ 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();
+ }
+
+ 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 resourceResponseInvokeMethod_argsStandardSchemeFactory implements SchemeFactory {
+ public resourceResponseInvokeMethod_argsStandardScheme getScheme() {
+ return new resourceResponseInvokeMethod_argsStandardScheme();
+ }
+ }
+
+ private static class resourceResponseInvokeMethod_argsStandardScheme extends StandardScheme<resourceResponseInvokeMethod_args> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, resourceResponseInvokeMethod_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: // INVOKE_MESSAGE
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.invokeMessage = iprot.readString();
+ struct.setInvokeMessageIsSet(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);
+ }
+ 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, resourceResponseInvokeMethod_args struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ if (struct.invokeMessage != null) {
+ oprot.writeFieldBegin(INVOKE_MESSAGE_FIELD_DESC);
+ oprot.writeString(struct.invokeMessage);
+ oprot.writeFieldEnd();
+ }
+ if (struct.object != null) {
+ oprot.writeFieldBegin(OBJECT_FIELD_DESC);
+ oprot.writeBinary(struct.object);
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class resourceResponseInvokeMethod_argsTupleSchemeFactory implements SchemeFactory {
+ public resourceResponseInvokeMethod_argsTupleScheme getScheme() {
+ return new resourceResponseInvokeMethod_argsTupleScheme();
+ }
+ }
+
+ private static class resourceResponseInvokeMethod_argsTupleScheme extends TupleScheme<resourceResponseInvokeMethod_args> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, resourceResponseInvokeMethod_args struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ BitSet optionals = new BitSet();
+ if (struct.isSetInvokeMessage()) {
+ optionals.set(0);
+ }
+ if (struct.isSetObject()) {
+ optionals.set(1);
+ }
+ oprot.writeBitSet(optionals, 2);
+ if (struct.isSetInvokeMessage()) {
+ oprot.writeString(struct.invokeMessage);
+ }
+ if (struct.isSetObject()) {
+ oprot.writeBinary(struct.object);
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, resourceResponseInvokeMethod_args struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ BitSet incoming = iprot.readBitSet(2);
+ if (incoming.get(0)) {
+ struct.invokeMessage = iprot.readString();
+ struct.setInvokeMessageIsSet(true);
+ }
+ if (incoming.get(1)) {
+ struct.object = iprot.readBinary();
+ struct.setObjectIsSet(true);
+ }
+ }
+ }
+
+ }
+
+ public static class resourceResponseInvokeMethod_result implements org.apache.thrift.TBase<resourceResponseInvokeMethod_result, resourceResponseInvokeMethod_result._Fields>, java.io.Serializable, Cloneable, Comparable<resourceResponseInvokeMethod_result> {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("resourceResponseInvokeMethod_result");
+
+
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new resourceResponseInvokeMethod_resultStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new resourceResponseInvokeMethod_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<String, _Fields> byName = new HashMap<String, _Fields>();
+
+ 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(resourceResponseInvokeMethod_result.class, metaDataMap);
+ }
+
+ public resourceResponseInvokeMethod_result() {
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public resourceResponseInvokeMethod_result(resourceResponseInvokeMethod_result other) {
+ }
+
+ public resourceResponseInvokeMethod_result deepCopy() {
+ return new resourceResponseInvokeMethod_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 resourceResponseInvokeMethod_result)
+ return this.equals((resourceResponseInvokeMethod_result)that);
+ return false;
+ }
+
+ public boolean equals(resourceResponseInvokeMethod_result that) {
+ if (that == null)
+ return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ List<Object> list = new ArrayList<Object>();
+
+ return list.hashCode();
+ }
+
+ @Override
+ public int compareTo(resourceResponseInvokeMethod_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("resourceResponseInvokeMethod_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 resourceResponseInvokeMethod_resultStandardSchemeFactory implements SchemeFactory {
+ public resourceResponseInvokeMethod_resultStandardScheme getScheme() {
+ return new resourceResponseInvokeMethod_resultStandardScheme();
+ }
+ }
+
+ private static class resourceResponseInvokeMethod_resultStandardScheme extends StandardScheme<resourceResponseInvokeMethod_result> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, resourceResponseInvokeMethod_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, resourceResponseInvokeMethod_result struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class resourceResponseInvokeMethod_resultTupleSchemeFactory implements SchemeFactory {
+ public resourceResponseInvokeMethod_resultTupleScheme getScheme() {
+ return new resourceResponseInvokeMethod_resultTupleScheme();
+ }
+ }
+
+ private static class resourceResponseInvokeMethod_resultTupleScheme extends TupleScheme<resourceResponseInvokeMethod_result> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, resourceResponseInvokeMethod_result struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, resourceResponseInvokeMethod_result struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ }
+ }
+
+ }
+
+ public static class resourcePoolGetAll_args implements org.apache.thrift.TBase<resourcePoolGetAll_args, resourcePoolGetAll_args._Fields>, java.io.Serializable, Cloneable, Comparable<resourcePoolGetAll_args> {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("resourcePoolGetAll_args");
+
+
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new resourcePoolGetAll_argsStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new resourcePoolGetAll_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<String, _Fields> byName = new HashMap<String, _Fields>();
+
+ 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(resourcePoolGetAll_args.class, metaDataMap);
+ }
+
+ public resourcePoolGetAll_args() {
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public resourcePoolGetAll_args(resourcePoolGetAll_args other) {
+ }
+
+ public resourcePoolGetAll_args deepCopy() {
+ return new resourcePoolGetAll_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 resourcePoolGetAll_args)
+ return this.equals((resourcePoolGetAll_args)that);
+ return false;
+ }
+
+ public boolean equals(resourcePoolGetAll_args that) {
+ if (that == null)
+ return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ List<Object> list = new ArrayList<Object>();
+
+ return list.hashCode();
+ }
+
+ @Override
+ public int compareTo(resourcePoolGetAll_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("resourcePoolGetAll_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 resourcePoolGetAll_argsStandardSchemeFactory implements SchemeFactory {
+ public resourcePoolGetAll_argsStandardScheme getScheme() {
+ return new resourcePoolGetAll_argsStandardScheme();
+ }
+ }
+
+ private static class resourcePoolGetAll_argsStandardScheme extends StandardScheme<resourcePoolGetAll_args> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, resourcePoolGetAll_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, resourcePoolGetAll_args struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class resourcePoolGetAll_argsTupleSchemeFactory implements SchemeFactory {
+ public resourcePoolGetAll_argsTupleScheme getScheme() {
+ return new resourcePoolGetAll_argsTupleScheme();
+ }
+ }
+
+ private static class resourcePoolGetAll_argsTupleScheme extends TupleScheme<resourcePoolGetAll_args> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, resourcePoolGetAll_args struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, resourcePoolGetAll_args struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ }
+ }
+
+ }
+
+ public static class resourcePoolGetAll_result implements org.apache.thrift.TBase<resourcePoolGetAll_result, resourcePoolGetAll_result._Fields>, java.io.Serializable, Cloneable, Comparable<resourcePoolGetAll_result> {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("resourcePoolGetAll_result");
+
+ 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<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new resourcePoolGetAll_resultStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new resourcePoolGetAll_resultTupleSchemeFactory());
+ }
+
+ public List<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<String, _Fields> byName = new HashMap<String, _Fields>();
+
+ 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.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(resourcePoolGetAll_result.class, metaDataMap);
+ }
+
+ public resourcePoolGetAll_result() {
+ }
+
+ public resourcePoolGetAll_result(
+ List<String> success)
+ {
+ this();
+ this.success = success;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public resourcePoolGetAll_result(resourcePoolGetAll_result other) {
+ if (other.isSetSuccess()) {
+ List<String> __this__success = new ArrayList<String>(other.success);
+ this.success = __this__success;
+ }
+ }
+
+ public resourcePoolGetAll_result deepCopy() {
+ return new resourcePoolGetAll_result(this);
+ }
+
+ @Override
+ public void clear() {
+ this.success = null;
+ }
+
+ public int getSuccessSize() {
+ return (this.success == null) ? 0 : this.success.size();
+ }
+
+ public java.util.Iterator<String> getSuccessIterator() {
+ return (this.success == null) ? null : this.success.iterator();
+ }
+
+ public void addToSuccess(String elem) {
+ if (this.success == null) {
+ this.success = new ArrayList<String>();
+ }
+ this.success.add(elem);
+ }
+
+ public List<String> getSuccess() {
+ return this.success;
+ }
+
+ public resourcePoolGetAll_result setSuccess(List<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((List<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 resourcePoolGetAll_result)
+ return this.equals((resourcePoolGetAll_result)that);
+ return false;
+ }
+
+ public boolean equals(resourcePoolGetAll_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<Object> list = new ArrayList<Object>();
+
+ boolean present_success = true && (isSetSuccess());
+ list.add(present_success);
+ if (present_success)
+ list.add(success);
+
+ return list.hashCode();
+ }
+
+ @Override
+ public int compareTo(resourcePoolGetAll_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("resourcePoolGetAll_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 resourcePoolGetAll_resultStandardSchemeFactory implements SchemeFactory {
+ public resourcePoolGetAll_resultStandardScheme getScheme() {
+ return new resourcePoolGetAll_resultStandardScheme();
+ }
+ }
+
+ private static class resourcePoolGetAll_resultStandardScheme extends StandardScheme<resourcePoolGetAll_result> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, resourcePoolGetAll_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.LIST) {
+ {
+ org.apache.thrift.protocol.TList _list34 = iprot.readListBegin();
+ struct.success = new ArrayList<String>(_list34.size);
+ String _elem35;
+ for (int _i36 = 0; _i36 < _list34.size; ++_i36)
+ {
+ _elem35 = iprot.readString();
+ struct.success.add(_elem35);
+ }
+ iprot.readListEnd();
+ }
+ 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, resourcePoolGetAll_result struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ if (struct.success != null) {
+ oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
+ {
+ oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, struct.success.size()));
+ for (String _iter37 : struct.success)
+ {
+ oprot.writeString(_iter37);
+ }
+ oprot.writeListEnd();
+ }
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class resourcePoolGetAll_resultTupleSchemeFactory implements SchemeFactory {
+ public resourcePoolGetAll_resultTupleScheme getScheme() {
+ return new resourcePoolGetAll_resultTupleScheme();
+ }
+ }
+
+ private static class resourcePoolGetAll_resultTupleScheme extends TupleScheme<resourcePoolGetAll_result> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, resourcePoolGetAll_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.writeI32(struct.success.size());
+ for (String _iter38 : struct.success)
+ {
+ oprot.writeString(_iter38);
+ }
+ }
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, resourcePoolGetAll_result struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ BitSet incoming = iprot.readBitSet(1);
+ if (incoming.get(0)) {
+ {
+ org.apache.thrift.protocol.TList _list39 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32());
+ struct.success = new ArrayList<String>(_list39.size);
+ String _elem40;
+ for (int _i41 = 0; _i41 < _list39.size; ++_i41)
+ {
+ _elem40 = iprot.readString();
+ struct.success.add(_elem40);
+ }
+ }
+ struct.setSuccessIsSet(true);
+ }
+ }
+ }
+
+ }
+
+ public static class resourceGet_args implements org.apache.thrift.TBase<resourceGet_args, resourceGet_args._Fields>, java.io.Serializable, Cloneable, Comparable<resourceGet_args> {
+ 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 SESSION_KEY_FIELD_DESC = new org.apache.thrift.protocol.TField("sessionKey", org.apache.thrift.protocol.TType.STRING, (short)1);
+ private static final org.apache.thrift.protocol.TField PARAGRAPH_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("paragraphId", org.apache.thrift.protocol.TType.STRING, (short)2);
+ 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)3);
+
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new resourceGet_argsStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new resourceGet_argsTupleSchemeFactory());
+ }
+
+ public String sessionKey; // required
+ public String paragraphId; // required
+ 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 {
+ SESSION_KEY((short)1, "sessionKey"),
+ PARAGRAPH_ID((short)2, "paragraphId"),
+ RESOURCE_NAME((short)3, "resourceName");
+
+ private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
+
+ 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: // SESSION_KEY
+ return SESSION_KEY;
+ case 2: // PARAGRAPH_ID
+ return PARAGRAPH_ID;
+ case 3: // RESOURCE_NAME
+ return RESOURCE_NAME;
+ 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.SESSION_KEY, new org.apache.thrift.meta_data.FieldMetaData("sessionKey", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+ tmpMap.put(_Fields.PARAGRAPH_ID, new org.apache.thrift.meta_data.FieldMetaData("paragraphId", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+ 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(resourceGet_args.class, metaDataMap);
+ }
+
+ public resourceGet_args() {
+ }
+
+ public resourceGet_args(
+ String sessionKey,
+ String paragraphId,
+ String resourceName)
+ {
+ this();
+ this.sessionKey = sessionKey;
+ this.paragraphId = paragraphId;
+ this.resourceName = resourceName;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public resourceGet_args(resourceGet_args other) {
+ if (other.isSetSessionKey()) {
+ this.sessionKey = other.sessionKey;
+ }
+ if (other.isSetParagraphId()) {
+ this.paragraphId = other.paragraphId;
+ }
+ if (other.isSetResourceName()) {
+ this.resourceName = other.resourceName;
+ }
+ }
+
+ public resourceGet_args deepCopy() {
+ return new resourceGet_args(this);
+ }
+
+ @Override
+ public void clear() {
+ this.sessionKey = null;
+ this.paragraphId = null;
+ this.resourceName = null;
+ }
+
+ public String getSessionKey() {
+ return this.sessionKey;
+ }
+
+ public resourceGet_args setSessionKey(String sessionKey) {
+ this.sessionKey = sessionKey;
+ return this;
+ }
+
+ public void unsetSessionKey() {
+ this.sessionKey = null;
+ }
+
+ /** Returns true if field sessionKey is set (has been assigned a value) and false otherwise */
+ public boolean isSetSessionKey() {
+ return this.sessionKey != null;
+ }
+
+ public void setSessionKeyIsSet(boolean value) {
+ if (!value) {
+ this.sessionKey = null;
+ }
+ }
+
+ public String getParagraphId() {
+ return this.paragraphId;
+ }
+
+ public resourceGet_args setParagraphId(String paragraphId) {
+ this.paragraphId = paragraphId;
+ return this;
+ }
+
+ public void unsetParagraphId() {
+ this.paragraphId = null;
+ }
+
+ /** Returns true if field paragraphId is set (has been assigned a value) and false otherwise */
+ public boolean isSetParagraphId() {
+ return this.paragraphId != null;
+ }
+
+ public void setParagraphIdIsSet(boolean value) {
+ if (!value) {
+ this.paragraphId = 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 SESSION_KEY:
+ if (value == null) {
+ unsetSessionKey();
+ } else {
+ setSessionKey((String)value);
+ }
+ break;
+
+ case PARAGRAPH_ID:
+ if (value == null) {
+ unsetParagraphId();
+ } else {
+ setParagraphId((String)value);
+ }
+ break;
+
+ case RESOURCE_NAME:
+ if (value == null) {
+ unsetResourceName();
+ } else {
+ setResourceName((String)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case SESSION_KEY:
+ return getSessionKey();
+
+ case PARAGRAPH_ID:
+ return getParagraphId();
+
+ case RESOURCE_NAME:
+ return getResourceName();
+
+ }
+ 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 SESSION_KEY:
+ return isSetSessionKey();
+ case PARAGRAPH_ID:
+ return isSetParagraphId();
+ case RESOURCE_NAME:
+ return isSetResourceName();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof resourceGet_args)
+ return this.equals((resourceGet_args)that);
+ return false;
+ }
+
+ public boolean equals(resourceGet_args that) {
+ if (that == null)
+ return false;
+
+ boolean this_present_sessionKey = true && this.isSetSessionKey();
+ boolean that_present_sessionKey = true && that.isSetSessionKey();
+ if (this_present_sessionKey || that_present_sessionKey) {
+ if (!(this_present_sessionKey && that_present_sessionKey))
+ return false;
+ if (!this.sessionKey.equals(that.sessionKey))
+ return false;
+ }
+
+ boolean this_present_paragraphId = true && this.isSetParagraphId();
+ boolean that_present_paragraphId = true && that.isSetParagraphId();
+ if (this_present_paragraphId || that_present_paragraphId) {
+ if (!(this_present_paragraphId && that_present_paragraphId))
+ return false;
+ if (!this.paragraphId.equals(that.paragraphId))
+ 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;
+ }
+
+ @Override
public int hashCode() {
List<Object> list = new ArrayList<Object>();
+ boolean present_sessionKey = true && (isSetSessionKey());
+ list.add(present_sessionKey);
+ if (present_sessionKey)
+ list.add(sessionKey);
+
+ boolean present_paragraphId = true && (isSetParagraphId());
+ list.add(present_paragraphId);
+ if (present_paragraphId)
+ list.add(paragraphId);
+
+ boolean present_resourceName = true && (isSetResourceName());
+ list.add(present_resourceName);
+ if (present_resourceName)
+ list.add(resourceName);
+
return list.hashCode();
}
@Override
- public int compareTo(resourcePoolGetAll_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(isSetSessionKey()).compareTo(other.isSetSessionKey());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetSessionKey()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.sessionKey, other.sessionKey);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetParagraphId()).compareTo(other.isSetParagraphId());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetParagraphId()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.paragraphId, other.paragraphId);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ 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;
}
@@ -14094,9 +15980,32 @@ public class RemoteInterpreterService {
@Override
public String toString() {
- StringBuilder sb = new StringBuilder("resourcePoolGetAll_args(");
+ StringBuilder sb = new StringBuilder("resourceGet_args(");
boolean first = true;
+ sb.append("sessionKey:");
+ if (this.sessionKey == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.sessionKey);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("paragraphId:");
+ if (this.paragraphId == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.paragraphId);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("resourceName:");
+ if (this.resourceName == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.resourceName);
+ }
+ first = false;
sb.append(")");
return sb.toString();
}
@@ -14122,15 +16031,15 @@ public class RemoteInterpreterService {
}
}
- private static class resourcePoolGetAll_argsStandardSchemeFactory implements SchemeFactory {
- public resourcePoolGetAll_argsStandardScheme getScheme() {
- return new resourcePoolGetAll_argsStandardScheme();
+ private static class resourceGet_argsStandardSchemeFactory implements SchemeFactory {
+ public resourceGet_argsStandardScheme getScheme() {
+ return new resourceGet_argsStandardScheme();
}
}
- private static class resourcePoolGetAll_argsStandardScheme extends StandardScheme<resourcePoolGetAll_args> {
+ private static class resourceGet_argsStandardScheme extends StandardScheme<resourceGet_args> {
- public void read(org.apache.thrift.protocol.TProtocol iprot, resourcePoolGetAll_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)
@@ -14140,6 +16049,30 @@ public class RemoteInterpreterService {
break;
}
switch (schemeField.id) {
+ case 1: // SESSION_KEY
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.sessionKey = iprot.readString();
+ struct.setSessionKeyIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 2: // PARAGRAPH_ID
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.paragraphId = iprot.readString();
+ struct.setParagraphIdIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 3: // 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);
}
@@ -14151,49 +16084,97 @@ public class RemoteInterpreterService {
struct.validate();
}
- public void write(org.apache.thrift.protocol.TProtocol oprot, resourcePoolGetAll_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.sessionKey != null) {
+ oprot.writeFieldBegin(SESSION_KEY_FIELD_DESC);
+ oprot.writeString(struct.sessionKey);
+ oprot.writeFieldEnd();
+ }
+ if (struct.paragraphId != null) {
+ oprot.writeFieldBegin(PARAGRAPH_ID_FIELD_DESC);
+ oprot.writeString(struct.paragraphId);
+ oprot.writeFieldEnd();
+ }
+ if (struct.resourceName != null) {
+ oprot.writeFieldBegin(RESOURCE_NAME_FIELD_DESC);
+ oprot.writeString(struct.resourceName);
+ oprot.writeFieldEnd();
+ }
oprot.writeFieldStop();
oprot.writeStructEnd();
}
}
- private static class resourcePoolGetAll_argsTupleSchemeFactory implements SchemeFactory {
- public resourcePoolGetAll_argsTupleScheme getScheme() {
- return new resourcePoolGetAll_argsTupleScheme();
+ private static class resourceGet_argsTupleSchemeFactory implements SchemeFactory {
+ public resourceGet_argsTupleScheme getScheme() {
+ return new resourceGet_argsTupleScheme();
}
}
- private static class resourcePoolGetAll_argsTupleScheme extends TupleScheme<resourcePoolGetAll_args> {
+ private static class resourceGet_argsTupleScheme extends TupleScheme<resourceGet_args> {
@Override
- public void write(org.apache.thrift.protocol.TProtocol prot, resourcePoolGetAll_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.isSetSessionKey()) {
+ optionals.set(0);
+ }
+ if (struct.isSetParagraphId()) {
+ optionals.set(1);
+ }
+ if (struct.isSetResourceName()) {
+ optionals.set(2);
+ }
+ oprot.writeBitSet(optionals, 3);
+ if (struct.isSetSessionKey()) {
+ oprot.writeString(struct.sessionKey);
+ }
+ if (struct.isSetParagraphId()) {
+ oprot.writeString(struct.paragraphId);
+ }
+ if (struct.isSetResourceName()) {
+ oprot.writeString(struct.resourceName);
+ }
}
@Override
- public void read(org.apache.thrift.protocol.TProtocol prot, resourcePoolGetAll_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(3);
+ if (incoming.get(0)) {
+ struct.sessionKey = iprot.readString();
+ struct.setSessionKeyIsSet(true);
+ }
+ if (incoming.get(1)) {
+ struct.paragraphId = iprot.readString();
+ struct.setParagraphIdIsSet(true);
+ }
+ if (incoming.get(2)) {
+ struct.resourceName =
<TRUNCATED>