adding java multiplexing client for AIRAVATA-1632
Project: http://git-wip-us.apache.org/repos/asf/airavata-sandbox/repo Commit: http://git-wip-us.apache.org/repos/asf/airavata-sandbox/commit/e33bf99b Tree: http://git-wip-us.apache.org/repos/asf/airavata-sandbox/tree/e33bf99b Diff: http://git-wip-us.apache.org/repos/asf/airavata-sandbox/diff/e33bf99b Branch: refs/heads/master Commit: e33bf99b040eb59add06d73b25c3e5a042dbd1da Parents: 62ad0a5 Author: Suresh Marru <[email protected]> Authored: Wed Mar 18 00:33:15 2015 -0400 Committer: Suresh Marru <[email protected]> Committed: Wed Mar 18 00:33:15 2015 -0400 ---------------------------------------------------------------------- .../mock-airavata-api-client.iml | 22 + .../mock-airavata-api-client/pom.xml | 46 + .../airavata/api/client/TestAiravataClient.java | 46 + .../api/client/MockAiravataClientFactory.java | 65 + .../CredentialManagementService.java | 3 +- .../management/GatewayManagementService.java | 1830 ++++++++++++++++++ .../src/main/java/MockAiravataAPIServer.java | 328 ---- .../handlers/CredentialManagementHandler.java | 44 + .../api/handlers/GatewayManagementHandler.java | 37 + .../api/server/MockAiravataAPIServer.java | 72 + .../generate-thrift-stubs.sh | 3 +- .../mock-gateway-management-api.thrift | 39 + airavata-mock-multiplexed-api/pom.xml | 15 +- 13 files changed, 2211 insertions(+), 339 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/airavata-sandbox/blob/e33bf99b/airavata-mock-multiplexed-api/mock-airavata-api-client/mock-airavata-api-client.iml ---------------------------------------------------------------------- diff --git a/airavata-mock-multiplexed-api/mock-airavata-api-client/mock-airavata-api-client.iml b/airavata-mock-multiplexed-api/mock-airavata-api-client/mock-airavata-api-client.iml new file mode 100644 index 0000000..3c58000 --- /dev/null +++ b/airavata-mock-multiplexed-api/mock-airavata-api-client/mock-airavata-api-client.iml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4"> + <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8" inherit-compiler-output="false"> + <output url="file://$MODULE_DIR$/target/classes" /> + <output-test url="file://$MODULE_DIR$/target/test-classes" /> + <content url="file://$MODULE_DIR$"> + <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" /> + <excludeFolder url="file://$MODULE_DIR$/target" /> + </content> + <orderEntry type="inheritedJdk" /> + <orderEntry type="sourceFolder" forTests="false" /> + <orderEntry type="module" module-name="mock-airavata-api-stubs" /> + <orderEntry type="library" name="Maven: org.apache.thrift:libthrift:0.9.2" level="project" /> + <orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.10" level="project" /> + <orderEntry type="library" name="Maven: org.apache.httpcomponents:httpclient:4.2.5" level="project" /> + <orderEntry type="library" name="Maven: commons-logging:commons-logging:1.1.1" level="project" /> + <orderEntry type="library" name="Maven: commons-codec:commons-codec:1.6" level="project" /> + <orderEntry type="library" name="Maven: org.apache.httpcomponents:httpcore:4.2.4" level="project" /> + <orderEntry type="library" name="Maven: org.slf4j:slf4j-log4j12:1.7.10" level="project" /> + <orderEntry type="library" name="Maven: log4j:log4j:1.2.16" level="project" /> + </component> +</module> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata-sandbox/blob/e33bf99b/airavata-mock-multiplexed-api/mock-airavata-api-client/pom.xml ---------------------------------------------------------------------- diff --git a/airavata-mock-multiplexed-api/mock-airavata-api-client/pom.xml b/airavata-mock-multiplexed-api/mock-airavata-api-client/pom.xml new file mode 100644 index 0000000..19362fc --- /dev/null +++ b/airavata-mock-multiplexed-api/mock-airavata-api-client/pom.xml @@ -0,0 +1,46 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!--Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file + distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under + the Apache License, Version 2.0 (theà "License"); you may not use this file except in compliance with the License. You may + obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to + in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF + ANY ~ KIND, either express or implied. See the License for the specific language governing permissions and limitations under + the License. --> + +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + + <modelVersion>4.0.0</modelVersion> + + <parent> + <artifactId>mock-airavata-api</artifactId> + <groupId>org.apache.airavata</groupId> + <version>0.15-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + + <name>Airavata API Server</name> + <artifactId>mock-airavata-api-client</artifactId> + <packaging>jar</packaging> + <url>http://airavata.apache.org/</url> + + <dependencies> + + <dependency> + <groupId>org.apache.airavata</groupId> + <artifactId>mock-airavata-api-stubs</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.apache.thrift</groupId> + <artifactId>libthrift</artifactId> + <version>${thrift.version}</version> + </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-log4j12</artifactId> + <version>${org.slf4j.version}</version> + </dependency> + </dependencies> + +</project> http://git-wip-us.apache.org/repos/asf/airavata-sandbox/blob/e33bf99b/airavata-mock-multiplexed-api/mock-airavata-api-client/src/main/java/org/apache/airavata/api/client/TestAiravataClient.java ---------------------------------------------------------------------- diff --git a/airavata-mock-multiplexed-api/mock-airavata-api-client/src/main/java/org/apache/airavata/api/client/TestAiravataClient.java b/airavata-mock-multiplexed-api/mock-airavata-api-client/src/main/java/org/apache/airavata/api/client/TestAiravataClient.java new file mode 100644 index 0000000..3a2f1d8 --- /dev/null +++ b/airavata-mock-multiplexed-api/mock-airavata-api-client/src/main/java/org/apache/airavata/api/client/TestAiravataClient.java @@ -0,0 +1,46 @@ +/* +* +* 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.airavata.api.client; + +import org.apache.airavata.api.credentials.CredentialManagementService; +import org.apache.airavata.api.gateway.management.GatewayManagementService; + +public class TestAiravataClient { + + public static void main(String [] args) { + System.out.println("Testing Airavata API"); + + CredentialManagementService.Client credentialManagementClient = null; + GatewayManagementService.Client gatewatManagementClient = null; + try { + credentialManagementClient = MockAiravataClientFactory.createCredentialManagementClient("localhost", 9190); + System.out.println("SSH Key is " + credentialManagementClient.generateAndRegisterSSHKeys("test", "test")); + + gatewatManagementClient = MockAiravataClientFactory.createGatewayManagementClient("localhost", 9190); + System.out.println("Test Gateway Name is " + gatewatManagementClient.registerGateway("test")); + + } catch (Exception e) { + e.printStackTrace(); + } + + } +} http://git-wip-us.apache.org/repos/asf/airavata-sandbox/blob/e33bf99b/airavata-mock-multiplexed-api/mock-airavata-api-java-stubs/src/main/java/org/apache/airavata/api/client/MockAiravataClientFactory.java ---------------------------------------------------------------------- diff --git a/airavata-mock-multiplexed-api/mock-airavata-api-java-stubs/src/main/java/org/apache/airavata/api/client/MockAiravataClientFactory.java b/airavata-mock-multiplexed-api/mock-airavata-api-java-stubs/src/main/java/org/apache/airavata/api/client/MockAiravataClientFactory.java new file mode 100644 index 0000000..effd75a --- /dev/null +++ b/airavata-mock-multiplexed-api/mock-airavata-api-java-stubs/src/main/java/org/apache/airavata/api/client/MockAiravataClientFactory.java @@ -0,0 +1,65 @@ +/* +* +* 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.airavata.api.client; + +import org.apache.airavata.api.credentials.CredentialManagementService; +import org.apache.airavata.api.gateway.management.GatewayManagementService; +import org.apache.thrift.protocol.TBinaryProtocol; +import org.apache.thrift.protocol.TMultiplexedProtocol; +import org.apache.thrift.protocol.TProtocol; +import org.apache.thrift.transport.TSocket; +import org.apache.thrift.transport.TTransport; +import org.apache.thrift.transport.TTransportException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + + +public class MockAiravataClientFactory { + + private final static Logger logger = LoggerFactory.getLogger(MockAiravataClientFactory.class); + + public static CredentialManagementService.Client createCredentialManagementClient(String serverHost, int serverPort) throws Exception{ + try { + TTransport transport = new TSocket(serverHost, serverPort); + transport.open(); + TProtocol protocol = new TBinaryProtocol(transport); + TMultiplexedProtocol multiplexedProtocol = new TMultiplexedProtocol(protocol, "CredentialManagementService"); + return new CredentialManagementService.Client(multiplexedProtocol); + } catch (TTransportException e) { + e.printStackTrace(); + throw new Exception("Could not connect to API Server"); + } + } + + public static GatewayManagementService.Client createGatewayManagementClient(String serverHost, int serverPort) throws Exception{ + try { + TTransport transport = new TSocket(serverHost, serverPort); + transport.open(); + TProtocol protocol = new TBinaryProtocol(transport); + TMultiplexedProtocol multiplexedProtocol = new TMultiplexedProtocol(protocol, "GatewayManagementService"); + return new GatewayManagementService.Client(multiplexedProtocol); + } catch (TTransportException e) { + e.printStackTrace(); + throw new Exception("Could not connect to API Server"); + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata-sandbox/blob/e33bf99b/airavata-mock-multiplexed-api/mock-airavata-api-java-stubs/src/main/java/org/apache/airavata/api/credentials/CredentialManagementService.java ---------------------------------------------------------------------- diff --git a/airavata-mock-multiplexed-api/mock-airavata-api-java-stubs/src/main/java/org/apache/airavata/api/credentials/CredentialManagementService.java b/airavata-mock-multiplexed-api/mock-airavata-api-java-stubs/src/main/java/org/apache/airavata/api/credentials/CredentialManagementService.java index 7e4215a..b7a4001 100644 --- a/airavata-mock-multiplexed-api/mock-airavata-api-java-stubs/src/main/java/org/apache/airavata/api/credentials/CredentialManagementService.java +++ b/airavata-mock-multiplexed-api/mock-airavata-api-java-stubs/src/main/java/org/apache/airavata/api/credentials/CredentialManagementService.java @@ -50,8 +50,7 @@ import javax.annotation.Generated; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) -@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2015-3-16") +@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2015-3-18") @SuppressWarnings("all") public class CredentialManagementService { public interface Iface { http://git-wip-us.apache.org/repos/asf/airavata-sandbox/blob/e33bf99b/airavata-mock-multiplexed-api/mock-airavata-api-java-stubs/src/main/java/org/apache/airavata/api/gateway/management/GatewayManagementService.java ---------------------------------------------------------------------- diff --git a/airavata-mock-multiplexed-api/mock-airavata-api-java-stubs/src/main/java/org/apache/airavata/api/gateway/management/GatewayManagementService.java b/airavata-mock-multiplexed-api/mock-airavata-api-java-stubs/src/main/java/org/apache/airavata/api/gateway/management/GatewayManagementService.java new file mode 100644 index 0000000..9293ac4 --- /dev/null +++ b/airavata-mock-multiplexed-api/mock-airavata-api-java-stubs/src/main/java/org/apache/airavata/api/gateway/management/GatewayManagementService.java @@ -0,0 +1,1830 @@ +/** + * 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. + */ + +/** + * Autogenerated by Thrift Compiler (0.9.2) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +package org.apache.airavata.api.gateway.management; + +import org.apache.thrift.scheme.IScheme; +import org.apache.thrift.scheme.SchemeFactory; +import org.apache.thrift.scheme.StandardScheme; + +import org.apache.thrift.scheme.TupleScheme; +import org.apache.thrift.protocol.TTupleProtocol; +import org.apache.thrift.protocol.TProtocolException; +import org.apache.thrift.EncodingUtils; +import org.apache.thrift.TException; +import org.apache.thrift.async.AsyncMethodCallback; +import org.apache.thrift.server.AbstractNonblockingServer.*; +import java.util.List; +import java.util.ArrayList; +import java.util.Map; +import java.util.HashMap; +import java.util.EnumMap; +import java.util.Set; +import java.util.HashSet; +import java.util.EnumSet; +import java.util.Collections; +import java.util.BitSet; +import java.nio.ByteBuffer; +import java.util.Arrays; +import javax.annotation.Generated; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2015-3-18") +@SuppressWarnings("all") public class GatewayManagementService { + + public interface Iface { + + public String registerGateway(String gatewayName) throws org.apache.thrift.TException; + + public String getGatewayName(String gatewayId) throws org.apache.thrift.TException; + + } + + public interface AsyncIface { + + public void registerGateway(String gatewayName, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; + + public void getGatewayName(String gatewayId, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; + + } + + public static class Client extends org.apache.thrift.TServiceClient implements Iface { + public static class Factory implements org.apache.thrift.TServiceClientFactory<Client> { + public Factory() {} + public Client getClient(org.apache.thrift.protocol.TProtocol prot) { + return new Client(prot); + } + public Client getClient(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) { + return new Client(iprot, oprot); + } + } + + public Client(org.apache.thrift.protocol.TProtocol prot) + { + super(prot, prot); + } + + public Client(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) { + super(iprot, oprot); + } + + public String registerGateway(String gatewayName) throws org.apache.thrift.TException + { + send_registerGateway(gatewayName); + return recv_registerGateway(); + } + + public void send_registerGateway(String gatewayName) throws org.apache.thrift.TException + { + registerGateway_args args = new registerGateway_args(); + args.setGatewayName(gatewayName); + sendBase("registerGateway", args); + } + + public String recv_registerGateway() throws org.apache.thrift.TException + { + registerGateway_result result = new registerGateway_result(); + receiveBase(result, "registerGateway"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "registerGateway failed: unknown result"); + } + + public String getGatewayName(String gatewayId) throws org.apache.thrift.TException + { + send_getGatewayName(gatewayId); + return recv_getGatewayName(); + } + + public void send_getGatewayName(String gatewayId) throws org.apache.thrift.TException + { + getGatewayName_args args = new getGatewayName_args(); + args.setGatewayId(gatewayId); + sendBase("getGatewayName", args); + } + + public String recv_getGatewayName() throws org.apache.thrift.TException + { + getGatewayName_result result = new getGatewayName_result(); + receiveBase(result, "getGatewayName"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "getGatewayName failed: unknown result"); + } + + } + public static class AsyncClient extends org.apache.thrift.async.TAsyncClient implements AsyncIface { + public static class Factory implements org.apache.thrift.async.TAsyncClientFactory<AsyncClient> { + private org.apache.thrift.async.TAsyncClientManager clientManager; + private org.apache.thrift.protocol.TProtocolFactory protocolFactory; + public Factory(org.apache.thrift.async.TAsyncClientManager clientManager, org.apache.thrift.protocol.TProtocolFactory protocolFactory) { + this.clientManager = clientManager; + this.protocolFactory = protocolFactory; + } + public AsyncClient getAsyncClient(org.apache.thrift.transport.TNonblockingTransport transport) { + return new AsyncClient(protocolFactory, clientManager, transport); + } + } + + public AsyncClient(org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.async.TAsyncClientManager clientManager, org.apache.thrift.transport.TNonblockingTransport transport) { + super(protocolFactory, clientManager, transport); + } + + public void registerGateway(String gatewayName, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { + checkReady(); + registerGateway_call method_call = new registerGateway_call(gatewayName, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class registerGateway_call extends org.apache.thrift.async.TAsyncMethodCall { + private String gatewayName; + public registerGateway_call(String gatewayName, 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.gatewayName = gatewayName; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException { + prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("registerGateway", org.apache.thrift.protocol.TMessageType.CALL, 0)); + registerGateway_args args = new registerGateway_args(); + args.setGatewayName(gatewayName); + args.write(prot); + prot.writeMessageEnd(); + } + + public String 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_registerGateway(); + } + } + + public void getGatewayName(String gatewayId, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { + checkReady(); + getGatewayName_call method_call = new getGatewayName_call(gatewayId, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class getGatewayName_call extends org.apache.thrift.async.TAsyncMethodCall { + private String gatewayId; + public getGatewayName_call(String gatewayId, 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.gatewayId = gatewayId; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException { + prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("getGatewayName", org.apache.thrift.protocol.TMessageType.CALL, 0)); + getGatewayName_args args = new getGatewayName_args(); + args.setGatewayId(gatewayId); + args.write(prot); + prot.writeMessageEnd(); + } + + public String 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_getGatewayName(); + } + } + + } + + public static class Processor<I extends Iface> extends org.apache.thrift.TBaseProcessor<I> implements org.apache.thrift.TProcessor { + private static final Logger LOGGER = LoggerFactory.getLogger(Processor.class.getName()); + public Processor(I iface) { + super(iface, getProcessMap(new HashMap<String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>>())); + } + + protected Processor(I iface, Map<String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>> processMap) { + super(iface, getProcessMap(processMap)); + } + + private static <I extends Iface> Map<String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>> getProcessMap(Map<String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>> processMap) { + processMap.put("registerGateway", new registerGateway()); + processMap.put("getGatewayName", new getGatewayName()); + return processMap; + } + + public static class registerGateway<I extends Iface> extends org.apache.thrift.ProcessFunction<I, registerGateway_args> { + public registerGateway() { + super("registerGateway"); + } + + public registerGateway_args getEmptyArgsInstance() { + return new registerGateway_args(); + } + + protected boolean isOneway() { + return false; + } + + public registerGateway_result getResult(I iface, registerGateway_args args) throws org.apache.thrift.TException { + registerGateway_result result = new registerGateway_result(); + result.success = iface.registerGateway(args.gatewayName); + return result; + } + } + + public static class getGatewayName<I extends Iface> extends org.apache.thrift.ProcessFunction<I, getGatewayName_args> { + public getGatewayName() { + super("getGatewayName"); + } + + public getGatewayName_args getEmptyArgsInstance() { + return new getGatewayName_args(); + } + + protected boolean isOneway() { + return false; + } + + public getGatewayName_result getResult(I iface, getGatewayName_args args) throws org.apache.thrift.TException { + getGatewayName_result result = new getGatewayName_result(); + result.success = iface.getGatewayName(args.gatewayId); + return result; + } + } + + } + + public static class AsyncProcessor<I extends AsyncIface> extends org.apache.thrift.TBaseAsyncProcessor<I> { + private static final Logger LOGGER = LoggerFactory.getLogger(AsyncProcessor.class.getName()); + public AsyncProcessor(I iface) { + super(iface, getProcessMap(new HashMap<String, org.apache.thrift.AsyncProcessFunction<I, ? extends org.apache.thrift.TBase, ?>>())); + } + + protected AsyncProcessor(I iface, Map<String, org.apache.thrift.AsyncProcessFunction<I, ? extends org.apache.thrift.TBase, ?>> processMap) { + super(iface, getProcessMap(processMap)); + } + + private static <I extends AsyncIface> Map<String, org.apache.thrift.AsyncProcessFunction<I, ? extends org.apache.thrift.TBase,?>> getProcessMap(Map<String, org.apache.thrift.AsyncProcessFunction<I, ? extends org.apache.thrift.TBase, ?>> processMap) { + processMap.put("registerGateway", new registerGateway()); + processMap.put("getGatewayName", new getGatewayName()); + return processMap; + } + + public static class registerGateway<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, registerGateway_args, String> { + public registerGateway() { + super("registerGateway"); + } + + public registerGateway_args getEmptyArgsInstance() { + return new registerGateway_args(); + } + + public AsyncMethodCallback<String> getResultHandler(final AsyncFrameBuffer fb, final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new AsyncMethodCallback<String>() { + public void onComplete(String o) { + registerGateway_result result = new registerGateway_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; + registerGateway_result result = new registerGateway_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, registerGateway_args args, org.apache.thrift.async.AsyncMethodCallback<String> resultHandler) throws TException { + iface.registerGateway(args.gatewayName,resultHandler); + } + } + + public static class getGatewayName<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, getGatewayName_args, String> { + public getGatewayName() { + super("getGatewayName"); + } + + public getGatewayName_args getEmptyArgsInstance() { + return new getGatewayName_args(); + } + + public AsyncMethodCallback<String> getResultHandler(final AsyncFrameBuffer fb, final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new AsyncMethodCallback<String>() { + public void onComplete(String o) { + getGatewayName_result result = new getGatewayName_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; + getGatewayName_result result = new getGatewayName_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, getGatewayName_args args, org.apache.thrift.async.AsyncMethodCallback<String> resultHandler) throws TException { + iface.getGatewayName(args.gatewayId,resultHandler); + } + } + + } + + public static class registerGateway_args implements org.apache.thrift.TBase<registerGateway_args, registerGateway_args._Fields>, java.io.Serializable, Cloneable, Comparable<registerGateway_args> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("registerGateway_args"); + + private static final org.apache.thrift.protocol.TField GATEWAY_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("gatewayName", org.apache.thrift.protocol.TType.STRING, (short)1); + + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new registerGateway_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new registerGateway_argsTupleSchemeFactory()); + } + + public String gatewayName; // required + + /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ + @SuppressWarnings("all") public enum _Fields implements org.apache.thrift.TFieldIdEnum { + GATEWAY_NAME((short)1, "gatewayName"); + + 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: // GATEWAY_NAME + return GATEWAY_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.GATEWAY_NAME, new org.apache.thrift.meta_data.FieldMetaData("gatewayName", org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(registerGateway_args.class, metaDataMap); + } + + public registerGateway_args() { + } + + public registerGateway_args( + String gatewayName) + { + this(); + this.gatewayName = gatewayName; + } + + /** + * Performs a deep copy on <i>other</i>. + */ + public registerGateway_args(registerGateway_args other) { + if (other.isSetGatewayName()) { + this.gatewayName = other.gatewayName; + } + } + + public registerGateway_args deepCopy() { + return new registerGateway_args(this); + } + + @Override + public void clear() { + this.gatewayName = null; + } + + public String getGatewayName() { + return this.gatewayName; + } + + public registerGateway_args setGatewayName(String gatewayName) { + this.gatewayName = gatewayName; + return this; + } + + public void unsetGatewayName() { + this.gatewayName = null; + } + + /** Returns true if field gatewayName is set (has been assigned a value) and false otherwise */ + public boolean isSetGatewayName() { + return this.gatewayName != null; + } + + public void setGatewayNameIsSet(boolean value) { + if (!value) { + this.gatewayName = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case GATEWAY_NAME: + if (value == null) { + unsetGatewayName(); + } else { + setGatewayName((String)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case GATEWAY_NAME: + return getGatewayName(); + + } + 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 GATEWAY_NAME: + return isSetGatewayName(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof registerGateway_args) + return this.equals((registerGateway_args)that); + return false; + } + + public boolean equals(registerGateway_args that) { + if (that == null) + return false; + + boolean this_present_gatewayName = true && this.isSetGatewayName(); + boolean that_present_gatewayName = true && that.isSetGatewayName(); + if (this_present_gatewayName || that_present_gatewayName) { + if (!(this_present_gatewayName && that_present_gatewayName)) + return false; + if (!this.gatewayName.equals(that.gatewayName)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + List<Object> list = new ArrayList<Object>(); + + boolean present_gatewayName = true && (isSetGatewayName()); + list.add(present_gatewayName); + if (present_gatewayName) + list.add(gatewayName); + + return list.hashCode(); + } + + @Override + public int compareTo(registerGateway_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetGatewayName()).compareTo(other.isSetGatewayName()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetGatewayName()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.gatewayName, other.gatewayName); + 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("registerGateway_args("); + boolean first = true; + + sb.append("gatewayName:"); + if (this.gatewayName == null) { + sb.append("null"); + } else { + sb.append(this.gatewayName); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + if (gatewayName == null) { + throw new org.apache.thrift.protocol.TProtocolException("Required field 'gatewayName' was not present! Struct: " + toString()); + } + // 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 registerGateway_argsStandardSchemeFactory implements SchemeFactory { + public registerGateway_argsStandardScheme getScheme() { + return new registerGateway_argsStandardScheme(); + } + } + + private static class registerGateway_argsStandardScheme extends StandardScheme<registerGateway_args> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, registerGateway_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: // GATEWAY_NAME + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.gatewayName = iprot.readString(); + struct.setGatewayNameIsSet(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, registerGateway_args struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.gatewayName != null) { + oprot.writeFieldBegin(GATEWAY_NAME_FIELD_DESC); + oprot.writeString(struct.gatewayName); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class registerGateway_argsTupleSchemeFactory implements SchemeFactory { + public registerGateway_argsTupleScheme getScheme() { + return new registerGateway_argsTupleScheme(); + } + } + + private static class registerGateway_argsTupleScheme extends TupleScheme<registerGateway_args> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, registerGateway_args struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + oprot.writeString(struct.gatewayName); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, registerGateway_args struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + struct.gatewayName = iprot.readString(); + struct.setGatewayNameIsSet(true); + } + } + + } + + public static class registerGateway_result implements org.apache.thrift.TBase<registerGateway_result, registerGateway_result._Fields>, java.io.Serializable, Cloneable, Comparable<registerGateway_result> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("registerGateway_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.STRING, (short)0); + + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new registerGateway_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new registerGateway_resultTupleSchemeFactory()); + } + + public String success; // required + + /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ + @SuppressWarnings("all") 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.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(registerGateway_result.class, metaDataMap); + } + + public registerGateway_result() { + } + + public registerGateway_result( + String success) + { + this(); + this.success = success; + } + + /** + * Performs a deep copy on <i>other</i>. + */ + public registerGateway_result(registerGateway_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + public registerGateway_result deepCopy() { + return new registerGateway_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + public String getSuccess() { + return this.success; + } + + public registerGateway_result setSuccess(String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((String)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + + } + throw new IllegalStateException(); + } + + /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof registerGateway_result) + return this.equals((registerGateway_result)that); + return false; + } + + public boolean equals(registerGateway_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(registerGateway_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("registerGateway_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 registerGateway_resultStandardSchemeFactory implements SchemeFactory { + public registerGateway_resultStandardScheme getScheme() { + return new registerGateway_resultStandardScheme(); + } + } + + private static class registerGateway_resultStandardScheme extends StandardScheme<registerGateway_result> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, registerGateway_result struct) throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) + { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, registerGateway_result struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class registerGateway_resultTupleSchemeFactory implements SchemeFactory { + public registerGateway_resultTupleScheme getScheme() { + return new registerGateway_resultTupleScheme(); + } + } + + private static class registerGateway_resultTupleScheme extends TupleScheme<registerGateway_result> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, registerGateway_result struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, registerGateway_result struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + + } + + public static class getGatewayName_args implements org.apache.thrift.TBase<getGatewayName_args, getGatewayName_args._Fields>, java.io.Serializable, Cloneable, Comparable<getGatewayName_args> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getGatewayName_args"); + + private static final org.apache.thrift.protocol.TField GATEWAY_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("gatewayId", org.apache.thrift.protocol.TType.STRING, (short)1); + + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new getGatewayName_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new getGatewayName_argsTupleSchemeFactory()); + } + + public String gatewayId; // required + + /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ + @SuppressWarnings("all") public enum _Fields implements org.apache.thrift.TFieldIdEnum { + GATEWAY_ID((short)1, "gatewayId"); + + 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: // GATEWAY_ID + return GATEWAY_ID; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception + * if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** + * Find the _Fields constant that matches name, or null if its not found. + */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put(_Fields.GATEWAY_ID, new org.apache.thrift.meta_data.FieldMetaData("gatewayId", org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getGatewayName_args.class, metaDataMap); + } + + public getGatewayName_args() { + } + + public getGatewayName_args( + String gatewayId) + { + this(); + this.gatewayId = gatewayId; + } + + /** + * Performs a deep copy on <i>other</i>. + */ + public getGatewayName_args(getGatewayName_args other) { + if (other.isSetGatewayId()) { + this.gatewayId = other.gatewayId; + } + } + + public getGatewayName_args deepCopy() { + return new getGatewayName_args(this); + } + + @Override + public void clear() { + this.gatewayId = null; + } + + public String getGatewayId() { + return this.gatewayId; + } + + public getGatewayName_args setGatewayId(String gatewayId) { + this.gatewayId = gatewayId; + return this; + } + + public void unsetGatewayId() { + this.gatewayId = null; + } + + /** Returns true if field gatewayId is set (has been assigned a value) and false otherwise */ + public boolean isSetGatewayId() { + return this.gatewayId != null; + } + + public void setGatewayIdIsSet(boolean value) { + if (!value) { + this.gatewayId = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case GATEWAY_ID: + if (value == null) { + unsetGatewayId(); + } else { + setGatewayId((String)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case GATEWAY_ID: + return getGatewayId(); + + } + 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 GATEWAY_ID: + return isSetGatewayId(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof getGatewayName_args) + return this.equals((getGatewayName_args)that); + return false; + } + + public boolean equals(getGatewayName_args that) { + if (that == null) + return false; + + boolean this_present_gatewayId = true && this.isSetGatewayId(); + boolean that_present_gatewayId = true && that.isSetGatewayId(); + if (this_present_gatewayId || that_present_gatewayId) { + if (!(this_present_gatewayId && that_present_gatewayId)) + return false; + if (!this.gatewayId.equals(that.gatewayId)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + List<Object> list = new ArrayList<Object>(); + + boolean present_gatewayId = true && (isSetGatewayId()); + list.add(present_gatewayId); + if (present_gatewayId) + list.add(gatewayId); + + return list.hashCode(); + } + + @Override + public int compareTo(getGatewayName_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetGatewayId()).compareTo(other.isSetGatewayId()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetGatewayId()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.gatewayId, other.gatewayId); + 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("getGatewayName_args("); + boolean first = true; + + sb.append("gatewayId:"); + if (this.gatewayId == null) { + sb.append("null"); + } else { + sb.append(this.gatewayId); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + if (gatewayId == null) { + throw new org.apache.thrift.protocol.TProtocolException("Required field 'gatewayId' was not present! Struct: " + toString()); + } + // 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 getGatewayName_argsStandardSchemeFactory implements SchemeFactory { + public getGatewayName_argsStandardScheme getScheme() { + return new getGatewayName_argsStandardScheme(); + } + } + + private static class getGatewayName_argsStandardScheme extends StandardScheme<getGatewayName_args> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, getGatewayName_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: // GATEWAY_ID + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.gatewayId = iprot.readString(); + struct.setGatewayIdIsSet(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, getGatewayName_args struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.gatewayId != null) { + oprot.writeFieldBegin(GATEWAY_ID_FIELD_DESC); + oprot.writeString(struct.gatewayId); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class getGatewayName_argsTupleSchemeFactory implements SchemeFactory { + public getGatewayName_argsTupleScheme getScheme() { + return new getGatewayName_argsTupleScheme(); + } + } + + private static class getGatewayName_argsTupleScheme extends TupleScheme<getGatewayName_args> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, getGatewayName_args struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + oprot.writeString(struct.gatewayId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, getGatewayName_args struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + struct.gatewayId = iprot.readString(); + struct.setGatewayIdIsSet(true); + } + } + + } + + public static class getGatewayName_result implements org.apache.thrift.TBase<getGatewayName_result, getGatewayName_result._Fields>, java.io.Serializable, Cloneable, Comparable<getGatewayName_result> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getGatewayName_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.STRING, (short)0); + + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new getGatewayName_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new getGatewayName_resultTupleSchemeFactory()); + } + + public String success; // required + + /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ + @SuppressWarnings("all") 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.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getGatewayName_result.class, metaDataMap); + } + + public getGatewayName_result() { + } + + public getGatewayName_result( + String success) + { + this(); + this.success = success; + } + + /** + * Performs a deep copy on <i>other</i>. + */ + public getGatewayName_result(getGatewayName_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + public getGatewayName_result deepCopy() { + return new getGatewayName_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + public String getSuccess() { + return this.success; + } + + public getGatewayName_result setSuccess(String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((String)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + + } + throw new IllegalStateException(); + } + + /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof getGatewayName_result) + return this.equals((getGatewayName_result)that); + return false; + } + + public boolean equals(getGatewayName_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(getGatewayName_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("getGatewayName_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 getGatewayName_resultStandardSchemeFactory implements SchemeFactory { + public getGatewayName_resultStandardScheme getScheme() { + return new getGatewayName_resultStandardScheme(); + } + } + + private static class getGatewayName_resultStandardScheme extends StandardScheme<getGatewayName_result> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, getGatewayName_result struct) throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) + { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, getGatewayName_result struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class getGatewayName_resultTupleSchemeFactory implements SchemeFactory { + public getGatewayName_resultTupleScheme getScheme() { + return new getGatewayName_resultTupleScheme(); + } + } + + private static class getGatewayName_resultTupleScheme extends TupleScheme<getGatewayName_result> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, getGatewayName_result struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, getGatewayName_result struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + + } + +}
