/**
* Autogenerated by Thrift Compiler (0.7.0)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
*/
package org.apache.hadoop.corona;
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 org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class SessionDriverService {
/**
* The Session Driver manages the session for clients.
* The APIs below are invoked by the ClusterManager to convey information back to the
* SessionDriver asynchronously
*
* A sessionId is supplied for all calls in case the client is managing multiple sessions
*/
public interface Iface {
public void grantResource(String handle, List<ResourceGrant> granted) throws org.apache.thrift.TException;
public void revokeResource(String handle, List<ResourceGrant> revoked, boolean force) throws org.apache.thrift.TException;
}
public interface AsyncIface {
public void grantResource(String handle, List<ResourceGrant> granted, org.apache.thrift.async.AsyncMethodCallback<AsyncClient.grantResource_call> resultHandler) throws org.apache.thrift.TException;
public void revokeResource(String handle, List<ResourceGrant> revoked, boolean force, org.apache.thrift.async.AsyncMethodCallback<AsyncClient.revokeResource_call> 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 void grantResource(String handle, List<ResourceGrant> granted) throws org.apache.thrift.TException
{
send_grantResource(handle, granted);
recv_grantResource();
}
public void send_grantResource(String handle, List<ResourceGrant> granted) throws org.apache.thrift.TException
{
grantResource_args args = new grantResource_args();
args.setHandle(handle);
args.setGranted(granted);
sendBase("grantResource", args);
}
public void recv_grantResource() throws org.apache.thrift.TException
{
grantResource_result result = new grantResource_result();
receiveBase(result, "grantResource");
return;
}
public void revokeResource(String handle, List<ResourceGrant> revoked, boolean force) throws org.apache.thrift.TException
{
send_revokeResource(handle, revoked, force);
recv_revokeResource();
}
public void send_revokeResource(String handle, List<ResourceGrant> revoked, boolean force) throws org.apache.thrift.TException
{
revokeResource_args args = new revokeResource_args();
args.setHandle(handle);
args.setRevoked(revoked);
args.setForce(force);
sendBase("revokeResource", args);
}
public void recv_revokeResource() throws org.apache.thrift.TException
{
revokeResource_result result = new revokeResource_result();
receiveBase(result, "revokeResource");
return;
}
}
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 grantResource(String handle, List<ResourceGrant> granted, org.apache.thrift.async.AsyncMethodCallback<grantResource_call> resultHandler) throws org.apache.thrift.TException {
checkReady();
grantResource_call method_call = new grantResource_call(handle, granted, resultHandler, this, ___protocolFactory, ___transport);
this.___currentMethod = method_call;
___manager.call(method_call);
}
public static class grantResource_call extends org.apache.thrift.async.TAsyncMethodCall {
private String handle;
private List<ResourceGrant> granted;
public grantResource_call(String handle, List<ResourceGrant> granted, org.apache.thrift.async.AsyncMethodCallback<grantResource_call> 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.handle = handle;
this.granted = granted;
}
public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("grantResource", org.apache.thrift.protocol.TMessageType.CALL, 0));
grantResource_args args = new grantResource_args();
args.setHandle(handle);
args.setGranted(granted);
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_grantResource();
}
}
public void revokeResource(String handle, List<ResourceGrant> revoked, boolean force, org.apache.thrift.async.AsyncMethodCallback<revokeResource_call> resultHandler) throws org.apache.thrift.TException {
checkReady();
revokeResource_call method_call = new revokeResource_call(handle, revoked, force, resultHandler, this, ___protocolFactory, ___transport);
this.___currentMethod = method_call;
___manager.call(method_call);
}
public static class revokeResource_call extends org.apache.thrift.async.TAsyncMethodCall {
private String handle;
private List<ResourceGrant> revoked;
private boolean force;
public revokeResource_call(String handle, List<ResourceGrant> revoked, boolean force, org.apache.thrift.async.AsyncMethodCallback<revokeResource_call> 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.handle = handle;
this.revoked = revoked;
this.force = force;
}
public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("revokeResource", org.apache.thrift.protocol.TMessageType.CALL, 0));
revokeResource_args args = new revokeResource_args();
args.setHandle(handle);
args.setRevoked(revoked);
args.setForce(force);
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_revokeResource();
}
}
}
public static class Processor<I extends Iface> extends org.apache.thrift.TBaseProcessor 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("grantResource", new grantResource());
processMap.put("revokeResource", new revokeResource());
return processMap;
}
private static class grantResource<I extends Iface> extends org.apache.thrift.ProcessFunction<I, grantResource_args> {
public grantResource() {
super("grantResource");
}
protected grantResource_args getEmptyArgsInstance() {
return new grantResource_args();
}
protected grantResource_result getResult(I iface, grantResource_args args) throws org.apache.thrift.TException {
grantResource_result result = new grantResource_result();
iface.grantResource(args.handle, args.granted);
return result;
}
}
private static class revokeResource<I extends Iface> extends org.apache.thrift.ProcessFunction<I, revokeResource_args> {
public revokeResource() {
super("revokeResource");
}
protected revokeResource_args getEmptyArgsInstance() {
return new revokeResource_args();
}
protected revokeResource_result getResult(I iface, revokeResource_args args) throws org.apache.thrift.TException {
revokeResource_result result = new revokeResource_result();
iface.revokeResource(args.handle, args.revoked, args.force);
return result;
}
}
}
public static class grantResource_args implements org.apache.thrift.TBase<grantResource_args, grantResource_args._Fields>, java.io.Serializable, Cloneable {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("grantResource_args");
private static final org.apache.thrift.protocol.TField HANDLE_FIELD_DESC = new org.apache.thrift.protocol.TField("handle", org.apache.thrift.protocol.TType.STRING, (short)1);
private static final org.apache.thrift.protocol.TField GRANTED_FIELD_DESC = new org.apache.thrift.protocol.TField("granted", org.apache.thrift.protocol.TType.LIST, (short)2);
public String handle; // required
public List<ResourceGrant> granted; // 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 {
HANDLE((short)1, "handle"),
GRANTED((short)2, "granted");
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: // HANDLE
return HANDLE;
case 2: // GRANTED
return GRANTED;
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.HANDLE, new org.apache.thrift.meta_data.FieldMetaData("handle", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , "SessionHandle")));
tmpMap.put(_Fields.GRANTED, new org.apache.thrift.meta_data.FieldMetaData("granted", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST,
new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, ResourceGrant.class))));
metaDataMap = Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(grantResource_args.class, metaDataMap);
}
public grantResource_args() {
}
public grantResource_args(
String handle,
List<ResourceGrant> granted)
{
this();
this.handle = handle;
this.granted = granted;
}
/**
* Performs a deep copy on <i>other</i>.
*/
public grantResource_args(grantResource_args other) {
if (other.isSetHandle()) {
this.handle = other.handle;
}
if (other.isSetGranted()) {
List<ResourceGrant> __this__granted = new ArrayList<ResourceGrant>();
for (ResourceGrant other_element : other.granted) {
__this__granted.add(new ResourceGrant(other_element));
}
this.granted = __this__granted;
}
}
public grantResource_args deepCopy() {
return new grantResource_args(this);
}
@Override
public void clear() {
this.handle = null;
this.granted = null;
}
public String getHandle() {
return this.handle;
}
public grantResource_args setHandle(String handle) {
this.handle = handle;
return this;
}
public void unsetHandle() {
this.handle = null;
}
/** Returns true if field handle is set (has been assigned a value) and false otherwise */
public boolean isSetHandle() {
return this.handle != null;
}
public void setHandleIsSet(boolean value) {
if (!value) {
this.handle = null;
}
}
public int getGrantedSize() {
return (this.granted == null) ? 0 : this.granted.size();
}
public java.util.Iterator<ResourceGrant> getGrantedIterator() {
return (this.granted == null) ? null : this.granted.iterator();
}
public void addToGranted(ResourceGrant elem) {
if (this.granted == null) {
this.granted = new ArrayList<ResourceGrant>();
}
this.granted.add(elem);
}
public List<ResourceGrant> getGranted() {
return this.granted;
}
public grantResource_args setGranted(List<ResourceGrant> granted) {
this.granted = granted;
return this;
}
public void unsetGranted() {
this.granted = null;
}
/** Returns true if field granted is set (has been assigned a value) and false otherwise */
public boolean isSetGranted() {
return this.granted != null;
}
public void setGrantedIsSet(boolean value) {
if (!value) {
this.granted = null;
}
}
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case HANDLE:
if (value == null) {
unsetHandle();
} else {
setHandle((String)value);
}
break;
case GRANTED:
if (value == null) {
unsetGranted();
} else {
setGranted((List<ResourceGrant>)value);
}
break;
}
}
public Object getFieldValue(_Fields field) {
switch (field) {
case HANDLE:
return getHandle();
case GRANTED:
return getGranted();
}
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 HANDLE:
return isSetHandle();
case GRANTED:
return isSetGranted();
}
throw new IllegalStateException();
}
@Override
public boolean equals(Object that) {
if (that == null)
return false;
if (that instanceof grantResource_args)
return this.equals((grantResource_args)that);
return false;
}
public boolean equals(grantResource_args that) {
if (that == null)
return false;
boolean this_present_handle = true && this.isSetHandle();
boolean that_present_handle = true && that.isSetHandle();
if (this_present_handle || that_present_handle) {
if (!(this_present_handle && that_present_handle))
return false;
if (!this.handle.equals(that.handle))
return false;
}
boolean this_present_granted = true && this.isSetGranted();
boolean that_present_granted = true && that.isSetGranted();
if (this_present_granted || that_present_granted) {
if (!(this_present_granted && that_present_granted))
return false;
if (!this.granted.equals(that.granted))
return false;
}
return true;
}
@Override
public int hashCode() {
return 0;
}
public int compareTo(grantResource_args other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
grantResource_args typedOther = (grantResource_args)other;
lastComparison = Boolean.valueOf(isSetHandle()).compareTo(typedOther.isSetHandle());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetHandle()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.handle, typedOther.handle);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetGranted()).compareTo(typedOther.isSetGranted());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetGranted()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.granted, typedOther.granted);
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 {
org.apache.thrift.protocol.TField field;
iprot.readStructBegin();
while (true)
{
field = iprot.readFieldBegin();
if (field.type == org.apache.thrift.protocol.TType.STOP) {
break;
}
switch (field.id) {
case 1: // HANDLE
if (field.type == org.apache.thrift.protocol.TType.STRING) {
this.handle = iprot.readString();
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
}
break;
case 2: // GRANTED
if (field.type == org.apache.thrift.protocol.TType.LIST) {
{
org.apache.thrift.protocol.TList _list12 = iprot.readListBegin();
this.granted = new ArrayList<ResourceGrant>(_list12.size);
for (int _i13 = 0; _i13 < _list12.size; ++_i13)
{
ResourceGrant _elem14; // required
_elem14 = new ResourceGrant();
_elem14.read(iprot);
this.granted.add(_elem14);
}
iprot.readListEnd();
}
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
}
break;
default:
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
}
iprot.readFieldEnd();
}
iprot.readStructEnd();
// check for required fields of primitive type, which can't be checked in the validate method
validate();
}
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
validate();
oprot.writeStructBegin(STRUCT_DESC);
if (this.handle != null) {
oprot.writeFieldBegin(HANDLE_FIELD_DESC);
oprot.writeString(this.handle);
oprot.writeFieldEnd();
}
if (this.granted != null) {
oprot.writeFieldBegin(GRANTED_FIELD_DESC);
{
oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, this.granted.size()));
for (ResourceGrant _iter15 : this.granted)
{
_iter15.write(oprot);
}
oprot.writeListEnd();
}
oprot.writeFieldEnd();
}
oprot.writeFieldStop();
oprot.writeStructEnd();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("grantResource_args(");
boolean first = true;
sb.append("handle:");
if (this.handle == null) {
sb.append("null");
} else {
sb.append(this.handle);
}
first = false;
if (!first) sb.append(", ");
sb.append("granted:");
if (this.granted == null) {
sb.append("null");
} else {
sb.append(this.granted);
}
first = false;
sb.append(")");
return sb.toString();
}
public void validate() throws org.apache.thrift.TException {
// check for required fields
}
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);
}
}
}
public static class grantResource_result implements org.apache.thrift.TBase<grantResource_result, grantResource_result._Fields>, java.io.Serializable, Cloneable {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("grantResource_result");
/** 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(grantResource_result.class, metaDataMap);
}
public grantResource_result() {
}
/**
* Performs a deep copy on <i>other</i>.
*/
public grantResource_result(grantResource_result other) {
}
public grantResource_result deepCopy() {
return new grantResource_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 grantResource_result)
return this.equals((grantResource_result)that);
return false;
}
public boolean equals(grantResource_result that) {
if (that == null)
return false;
return true;
}
@Override
public int hashCode() {
return 0;
}
public int compareTo(grantResource_result other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
grantResource_result typedOther = (grantResource_result)other;
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 {
org.apache.thrift.protocol.TField field;
iprot.readStructBegin();
while (true)
{
field = iprot.readFieldBegin();
if (field.type == org.apache.thrift.protocol.TType.STOP) {
break;
}
switch (field.id) {
default:
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
}
iprot.readFieldEnd();
}
iprot.readStructEnd();
// check for required fields of primitive type, which can't be checked in the validate method
validate();
}
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
oprot.writeStructBegin(STRUCT_DESC);
oprot.writeFieldStop();
oprot.writeStructEnd();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("grantResource_result(");
boolean first = true;
sb.append(")");
return sb.toString();
}
public void validate() throws org.apache.thrift.TException {
// check for required fields
}
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);
}
}
}
public static class revokeResource_args implements org.apache.thrift.TBase<revokeResource_args, revokeResource_args._Fields>, java.io.Serializable, Cloneable {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("revokeResource_args");
private static final org.apache.thrift.protocol.TField HANDLE_FIELD_DESC = new org.apache.thrift.protocol.TField("handle", org.apache.thrift.protocol.TType.STRING, (short)1);
private static final org.apache.thrift.protocol.TField REVOKED_FIELD_DESC = new org.apache.thrift.protocol.TField("revoked", org.apache.thrift.protocol.TType.LIST, (short)2);
private static final org.apache.thrift.protocol.TField FORCE_FIELD_DESC = new org.apache.thrift.protocol.TField("force", org.apache.thrift.protocol.TType.BOOL, (short)3);
public String handle; // required
public List<ResourceGrant> revoked; // required
public boolean force; // 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 {
HANDLE((short)1, "handle"),
REVOKED((short)2, "revoked"),
FORCE((short)3, "force");
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: // HANDLE
return HANDLE;
case 2: // REVOKED
return REVOKED;
case 3: // FORCE
return FORCE;
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
private static final int __FORCE_ISSET_ID = 0;
private BitSet __isset_bit_vector = new BitSet(1);
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.HANDLE, new org.apache.thrift.meta_data.FieldMetaData("handle", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , "SessionHandle")));
tmpMap.put(_Fields.REVOKED, new org.apache.thrift.meta_data.FieldMetaData("revoked", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST,
new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, ResourceGrant.class))));
tmpMap.put(_Fields.FORCE, new org.apache.thrift.meta_data.FieldMetaData("force", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(revokeResource_args.class, metaDataMap);
}
public revokeResource_args() {
}
public revokeResource_args(
String handle,
List<ResourceGrant> revoked,
boolean force)
{
this();
this.handle = handle;
this.revoked = revoked;
this.force = force;
setForceIsSet(true);
}
/**
* Performs a deep copy on <i>other</i>.
*/
public revokeResource_args(revokeResource_args other) {
__isset_bit_vector.clear();
__isset_bit_vector.or(other.__isset_bit_vector);
if (other.isSetHandle()) {
this.handle = other.handle;
}
if (other.isSetRevoked()) {
List<ResourceGrant> __this__revoked = new ArrayList<ResourceGrant>();
for (ResourceGrant other_element : other.revoked) {
__this__revoked.add(new ResourceGrant(other_element));
}
this.revoked = __this__revoked;
}
this.force = other.force;
}
public revokeResource_args deepCopy() {
return new revokeResource_args(this);
}
@Override
public void clear() {
this.handle = null;
this.revoked = null;
setForceIsSet(false);
this.force = false;
}
public String getHandle() {
return this.handle;
}
public revokeResource_args setHandle(String handle) {
this.handle = handle;
return this;
}
public void unsetHandle() {
this.handle = null;
}
/** Returns true if field handle is set (has been assigned a value) and false otherwise */
public boolean isSetHandle() {
return this.handle != null;
}
public void setHandleIsSet(boolean value) {
if (!value) {
this.handle = null;
}
}
public int getRevokedSize() {
return (this.revoked == null) ? 0 : this.revoked.size();
}
public java.util.Iterator<ResourceGrant> getRevokedIterator() {
return (this.revoked == null) ? null : this.revoked.iterator();
}
public void addToRevoked(ResourceGrant elem) {
if (this.revoked == null) {
this.revoked = new ArrayList<ResourceGrant>();
}
this.revoked.add(elem);
}
public List<ResourceGrant> getRevoked() {
return this.revoked;
}
public revokeResource_args setRevoked(List<ResourceGrant> revoked) {
this.revoked = revoked;
return this;
}
public void unsetRevoked() {
this.revoked = null;
}
/** Returns true if field revoked is set (has been assigned a value) and false otherwise */
public boolean isSetRevoked() {
return this.revoked != null;
}
public void setRevokedIsSet(boolean value) {
if (!value) {
this.revoked = null;
}
}
public boolean isForce() {
return this.force;
}
public revokeResource_args setForce(boolean force) {
this.force = force;
setForceIsSet(true);
return this;
}
public void unsetForce() {
__isset_bit_vector.clear(__FORCE_ISSET_ID);
}
/** Returns true if field force is set (has been assigned a value) and false otherwise */
public boolean isSetForce() {
return __isset_bit_vector.get(__FORCE_ISSET_ID);
}
public void setForceIsSet(boolean value) {
__isset_bit_vector.set(__FORCE_ISSET_ID, value);
}
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case HANDLE:
if (value == null) {
unsetHandle();
} else {
setHandle((String)value);
}
break;
case REVOKED:
if (value == null) {
unsetRevoked();
} else {
setRevoked((List<ResourceGrant>)value);
}
break;
case FORCE:
if (value == null) {
unsetForce();
} else {
setForce((Boolean)value);
}
break;
}
}
public Object getFieldValue(_Fields field) {
switch (field) {
case HANDLE:
return getHandle();
case REVOKED:
return getRevoked();
case FORCE:
return Boolean.valueOf(isForce());
}
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 HANDLE:
return isSetHandle();
case REVOKED:
return isSetRevoked();
case FORCE:
return isSetForce();
}
throw new IllegalStateException();
}
@Override
public boolean equals(Object that) {
if (that == null)
return false;
if (that instanceof revokeResource_args)
return this.equals((revokeResource_args)that);
return false;
}
public boolean equals(revokeResource_args that) {
if (that == null)
return false;
boolean this_present_handle = true && this.isSetHandle();
boolean that_present_handle = true && that.isSetHandle();
if (this_present_handle || that_present_handle) {
if (!(this_present_handle && that_present_handle))
return false;
if (!this.handle.equals(that.handle))
return false;
}
boolean this_present_revoked = true && this.isSetRevoked();
boolean that_present_revoked = true && that.isSetRevoked();
if (this_present_revoked || that_present_revoked) {
if (!(this_present_revoked && that_present_revoked))
return false;
if (!this.revoked.equals(that.revoked))
return false;
}
boolean this_present_force = true;
boolean that_present_force = true;
if (this_present_force || that_present_force) {
if (!(this_present_force && that_present_force))
return false;
if (this.force != that.force)
return false;
}
return true;
}
@Override
public int hashCode() {
return 0;
}
public int compareTo(revokeResource_args other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
revokeResource_args typedOther = (revokeResource_args)other;
lastComparison = Boolean.valueOf(isSetHandle()).compareTo(typedOther.isSetHandle());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetHandle()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.handle, typedOther.handle);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetRevoked()).compareTo(typedOther.isSetRevoked());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetRevoked()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.revoked, typedOther.revoked);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetForce()).compareTo(typedOther.isSetForce());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetForce()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.force, typedOther.force);
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 {
org.apache.thrift.protocol.TField field;
iprot.readStructBegin();
while (true)
{
field = iprot.readFieldBegin();
if (field.type == org.apache.thrift.protocol.TType.STOP) {
break;
}
switch (field.id) {
case 1: // HANDLE
if (field.type == org.apache.thrift.protocol.TType.STRING) {
this.handle = iprot.readString();
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
}
break;
case 2: // REVOKED
if (field.type == org.apache.thrift.protocol.TType.LIST) {
{
org.apache.thrift.protocol.TList _list16 = iprot.readListBegin();
this.revoked = new ArrayList<ResourceGrant>(_list16.size);
for (int _i17 = 0; _i17 < _list16.size; ++_i17)
{
ResourceGrant _elem18; // required
_elem18 = new ResourceGrant();
_elem18.read(iprot);
this.revoked.add(_elem18);
}
iprot.readListEnd();
}
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
}
break;
case 3: // FORCE
if (field.type == org.apache.thrift.protocol.TType.BOOL) {
this.force = iprot.readBool();
setForceIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
}
break;
default:
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
}
iprot.readFieldEnd();
}
iprot.readStructEnd();
// check for required fields of primitive type, which can't be checked in the validate method
validate();
}
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
validate();
oprot.writeStructBegin(STRUCT_DESC);
if (this.handle != null) {
oprot.writeFieldBegin(HANDLE_FIELD_DESC);
oprot.writeString(this.handle);
oprot.writeFieldEnd();
}
if (this.revoked != null) {
oprot.writeFieldBegin(REVOKED_FIELD_DESC);
{
oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, this.revoked.size()));
for (ResourceGrant _iter19 : this.revoked)
{
_iter19.write(oprot);
}
oprot.writeListEnd();
}
oprot.writeFieldEnd();
}
oprot.writeFieldBegin(FORCE_FIELD_DESC);
oprot.writeBool(this.force);
oprot.writeFieldEnd();
oprot.writeFieldStop();
oprot.writeStructEnd();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("revokeResource_args(");
boolean first = true;
sb.append("handle:");
if (this.handle == null) {
sb.append("null");
} else {
sb.append(this.handle);
}
first = false;
if (!first) sb.append(", ");
sb.append("revoked:");
if (this.revoked == null) {
sb.append("null");
} else {
sb.append(this.revoked);
}
first = false;
if (!first) sb.append(", ");
sb.append("force:");
sb.append(this.force);
first = false;
sb.append(")");
return sb.toString();
}
public void validate() throws org.apache.thrift.TException {
// check for required fields
}
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 {
// it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
__isset_bit_vector = new BitSet(1);
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);
}
}
}
public static class revokeResource_result implements org.apache.thrift.TBase<revokeResource_result, revokeResource_result._Fields>, java.io.Serializable, Cloneable {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("revokeResource_result");
/** 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(revokeResource_result.class, metaDataMap);
}
public revokeResource_result() {
}
/**
* Performs a deep copy on <i>other</i>.
*/
public revokeResource_result(revokeResource_result other) {
}
public revokeResource_result deepCopy() {
return new revokeResource_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 revokeResource_result)
return this.equals((revokeResource_result)that);
return false;
}
public boolean equals(revokeResource_result that) {
if (that == null)
return false;
return true;
}
@Override
public int hashCode() {
return 0;
}
public int compareTo(revokeResource_result other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
revokeResource_result typedOther = (revokeResource_result)other;
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 {
org.apache.thrift.protocol.TField field;
iprot.readStructBegin();
while (true)
{
field = iprot.readFieldBegin();
if (field.type == org.apache.thrift.protocol.TType.STOP) {
break;
}
switch (field.id) {
default:
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
}
iprot.readFieldEnd();
}
iprot.readStructEnd();
// check for required fields of primitive type, which can't be checked in the validate method
validate();
}
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
oprot.writeStructBegin(STRUCT_DESC);
oprot.writeFieldStop();
oprot.writeStructEnd();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("revokeResource_result(");
boolean first = true;
sb.append(")");
return sb.toString();
}
public void validate() throws org.apache.thrift.TException {
// check for required fields
}
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);
}
}
}
}