http://git-wip-us.apache.org/repos/asf/airavata/blob/0f781b2e/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/sdk/Container.java ---------------------------------------------------------------------- diff --git a/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/sdk/Container.java b/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/sdk/Container.java new file mode 100644 index 0000000..4b65a3d --- /dev/null +++ b/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/sdk/Container.java @@ -0,0 +1,373 @@ +/** + * Autogenerated by Thrift Compiler (0.9.3) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +package org.apache.airavata.cloud.aurora.client.sdk; + +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; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) +/** + * Describes a container to be used in a task + */ +public class Container extends org.apache.thrift.TUnion<Container, Container._Fields> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("Container"); + private static final org.apache.thrift.protocol.TField MESOS_FIELD_DESC = new org.apache.thrift.protocol.TField("mesos", org.apache.thrift.protocol.TType.STRUCT, (short)1); + private static final org.apache.thrift.protocol.TField DOCKER_FIELD_DESC = new org.apache.thrift.protocol.TField("docker", org.apache.thrift.protocol.TType.STRUCT, (short)2); + + /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + MESOS((short)1, "mesos"), + DOCKER((short)2, "docker"); + + 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: // MESOS + return MESOS; + case 2: // DOCKER + return DOCKER; + 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); + tmpMap.put(_Fields.MESOS, new org.apache.thrift.meta_data.FieldMetaData("mesos", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, MesosContainer.class))); + tmpMap.put(_Fields.DOCKER, new org.apache.thrift.meta_data.FieldMetaData("docker", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, DockerContainer.class))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(Container.class, metaDataMap); + } + + public Container() { + super(); + } + + public Container(_Fields setField, Object value) { + super(setField, value); + } + + public Container(Container other) { + super(other); + } + public Container deepCopy() { + return new Container(this); + } + + public static Container mesos(MesosContainer value) { + Container x = new Container(); + x.setMesos(value); + return x; + } + + public static Container docker(DockerContainer value) { + Container x = new Container(); + x.setDocker(value); + return x; + } + + + @Override + protected void checkType(_Fields setField, Object value) throws ClassCastException { + switch (setField) { + case MESOS: + if (value instanceof MesosContainer) { + break; + } + throw new ClassCastException("Was expecting value of type MesosContainer for field 'mesos', but got " + value.getClass().getSimpleName()); + case DOCKER: + if (value instanceof DockerContainer) { + break; + } + throw new ClassCastException("Was expecting value of type DockerContainer for field 'docker', but got " + value.getClass().getSimpleName()); + default: + throw new IllegalArgumentException("Unknown field id " + setField); + } + } + + @Override + protected Object standardSchemeReadValue(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TField field) throws org.apache.thrift.TException { + _Fields setField = _Fields.findByThriftId(field.id); + if (setField != null) { + switch (setField) { + case MESOS: + if (field.type == MESOS_FIELD_DESC.type) { + MesosContainer mesos; + mesos = new MesosContainer(); + mesos.read(iprot); + return mesos; + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); + return null; + } + case DOCKER: + if (field.type == DOCKER_FIELD_DESC.type) { + DockerContainer docker; + docker = new DockerContainer(); + docker.read(iprot); + return docker; + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); + return null; + } + default: + throw new IllegalStateException("setField wasn't null, but didn't match any of the case statements!"); + } + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); + return null; + } + } + + @Override + protected void standardSchemeWriteValue(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { + switch (setField_) { + case MESOS: + MesosContainer mesos = (MesosContainer)value_; + mesos.write(oprot); + return; + case DOCKER: + DockerContainer docker = (DockerContainer)value_; + docker.write(oprot); + return; + default: + throw new IllegalStateException("Cannot write union with unknown field " + setField_); + } + } + + @Override + protected Object tupleSchemeReadValue(org.apache.thrift.protocol.TProtocol iprot, short fieldID) throws org.apache.thrift.TException { + _Fields setField = _Fields.findByThriftId(fieldID); + if (setField != null) { + switch (setField) { + case MESOS: + MesosContainer mesos; + mesos = new MesosContainer(); + mesos.read(iprot); + return mesos; + case DOCKER: + DockerContainer docker; + docker = new DockerContainer(); + docker.read(iprot); + return docker; + default: + throw new IllegalStateException("setField wasn't null, but didn't match any of the case statements!"); + } + } else { + throw new TProtocolException("Couldn't find a field with field id " + fieldID); + } + } + + @Override + protected void tupleSchemeWriteValue(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { + switch (setField_) { + case MESOS: + MesosContainer mesos = (MesosContainer)value_; + mesos.write(oprot); + return; + case DOCKER: + DockerContainer docker = (DockerContainer)value_; + docker.write(oprot); + return; + default: + throw new IllegalStateException("Cannot write union with unknown field " + setField_); + } + } + + @Override + protected org.apache.thrift.protocol.TField getFieldDesc(_Fields setField) { + switch (setField) { + case MESOS: + return MESOS_FIELD_DESC; + case DOCKER: + return DOCKER_FIELD_DESC; + default: + throw new IllegalArgumentException("Unknown field id " + setField); + } + } + + @Override + protected org.apache.thrift.protocol.TStruct getStructDesc() { + return STRUCT_DESC; + } + + @Override + protected _Fields enumForId(short id) { + return _Fields.findByThriftIdOrThrow(id); + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + + public MesosContainer getMesos() { + if (getSetField() == _Fields.MESOS) { + return (MesosContainer)getFieldValue(); + } else { + throw new RuntimeException("Cannot get field 'mesos' because union is currently set to " + getFieldDesc(getSetField()).name); + } + } + + public void setMesos(MesosContainer value) { + if (value == null) throw new NullPointerException(); + setField_ = _Fields.MESOS; + value_ = value; + } + + public DockerContainer getDocker() { + if (getSetField() == _Fields.DOCKER) { + return (DockerContainer)getFieldValue(); + } else { + throw new RuntimeException("Cannot get field 'docker' because union is currently set to " + getFieldDesc(getSetField()).name); + } + } + + public void setDocker(DockerContainer value) { + if (value == null) throw new NullPointerException(); + setField_ = _Fields.DOCKER; + value_ = value; + } + + public boolean isSetMesos() { + return setField_ == _Fields.MESOS; + } + + + public boolean isSetDocker() { + return setField_ == _Fields.DOCKER; + } + + + public boolean equals(Object other) { + if (other instanceof Container) { + return equals((Container)other); + } else { + return false; + } + } + + public boolean equals(Container other) { + return other != null && getSetField() == other.getSetField() && getFieldValue().equals(other.getFieldValue()); + } + + @Override + public int compareTo(Container other) { + int lastComparison = org.apache.thrift.TBaseHelper.compareTo(getSetField(), other.getSetField()); + if (lastComparison == 0) { + return org.apache.thrift.TBaseHelper.compareTo(getFieldValue(), other.getFieldValue()); + } + return lastComparison; + } + + + @Override + public int hashCode() { + List<Object> list = new ArrayList<Object>(); + list.add(this.getClass().getName()); + org.apache.thrift.TFieldIdEnum setField = getSetField(); + if (setField != null) { + list.add(setField.getThriftFieldId()); + Object value = getFieldValue(); + if (value instanceof org.apache.thrift.TEnum) { + list.add(((org.apache.thrift.TEnum)getFieldValue()).getValue()); + } else { + list.add(value); + } + } + return list.hashCode(); + } + 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); + } + } + + +}
http://git-wip-us.apache.org/repos/asf/airavata/blob/0f781b2e/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/sdk/CronCollisionPolicy.java ---------------------------------------------------------------------- diff --git a/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/sdk/CronCollisionPolicy.java b/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/sdk/CronCollisionPolicy.java new file mode 100644 index 0000000..de69376 --- /dev/null +++ b/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/sdk/CronCollisionPolicy.java @@ -0,0 +1,61 @@ +/** + * Autogenerated by Thrift Compiler (0.9.3) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +package org.apache.airavata.cloud.aurora.client.sdk; + + +import java.util.Map; +import java.util.HashMap; +import org.apache.thrift.TEnum; + +/** + * Defines the policy for launching a new cron job when one is already running. + */ +public enum CronCollisionPolicy implements org.apache.thrift.TEnum { + /** + * Kills the existing job with the colliding name, and runs the new cron job. + */ + KILL_EXISTING(0), + /** + * Cancels execution of the new job, leaving the running job in tact. + */ + CANCEL_NEW(1), + /** + * DEPRECATED. For existing jobs, treated the same as CANCEL_NEW. + * createJob will reject jobs with this policy. + */ + RUN_OVERLAP(2); + + private final int value; + + private CronCollisionPolicy(int value) { + this.value = value; + } + + /** + * Get the integer value of this enum value, as defined in the Thrift IDL. + */ + public int getValue() { + return value; + } + + /** + * Find a the enum type by its integer value, as defined in the Thrift IDL. + * @return null if the value is not found. + */ + public static CronCollisionPolicy findByValue(int value) { + switch (value) { + case 0: + return KILL_EXISTING; + case 1: + return CANCEL_NEW; + case 2: + return RUN_OVERLAP; + default: + return null; + } + } +} http://git-wip-us.apache.org/repos/asf/airavata/blob/0f781b2e/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/sdk/DockerContainer.java ---------------------------------------------------------------------- diff --git a/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/sdk/DockerContainer.java b/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/sdk/DockerContainer.java new file mode 100644 index 0000000..28c14e9 --- /dev/null +++ b/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/sdk/DockerContainer.java @@ -0,0 +1,587 @@ +/** + * Autogenerated by Thrift Compiler (0.9.3) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +package org.apache.airavata.cloud.aurora.client.sdk; + +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; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) +/** + * Describes a docker container + */ +@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2016-10-21") +public class DockerContainer implements org.apache.thrift.TBase<DockerContainer, DockerContainer._Fields>, java.io.Serializable, Cloneable, Comparable<DockerContainer> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("DockerContainer"); + + private static final org.apache.thrift.protocol.TField IMAGE_FIELD_DESC = new org.apache.thrift.protocol.TField("image", org.apache.thrift.protocol.TType.STRING, (short)1); + private static final org.apache.thrift.protocol.TField PARAMETERS_FIELD_DESC = new org.apache.thrift.protocol.TField("parameters", org.apache.thrift.protocol.TType.LIST, (short)2); + + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new DockerContainerStandardSchemeFactory()); + schemes.put(TupleScheme.class, new DockerContainerTupleSchemeFactory()); + } + + /** + * The container image to be run + */ + public String image; // required + /** + * The arbitrary parameters to pass to container + */ + public List<DockerParameter> parameters; // optional + + /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + /** + * The container image to be run + */ + IMAGE((short)1, "image"), + /** + * The arbitrary parameters to pass to container + */ + PARAMETERS((short)2, "parameters"); + + 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: // IMAGE + return IMAGE; + case 2: // PARAMETERS + return PARAMETERS; + 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 _Fields optionals[] = {_Fields.PARAMETERS}; + 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.IMAGE, new org.apache.thrift.meta_data.FieldMetaData("image", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + tmpMap.put(_Fields.PARAMETERS, new org.apache.thrift.meta_data.FieldMetaData("parameters", org.apache.thrift.TFieldRequirementType.OPTIONAL, + 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, DockerParameter.class)))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(DockerContainer.class, metaDataMap); + } + + public DockerContainer() { + } + + public DockerContainer( + String image) + { + this(); + this.image = image; + } + + /** + * Performs a deep copy on <i>other</i>. + */ + public DockerContainer(DockerContainer other) { + if (other.isSetImage()) { + this.image = other.image; + } + if (other.isSetParameters()) { + List<DockerParameter> __this__parameters = new ArrayList<DockerParameter>(other.parameters.size()); + for (DockerParameter other_element : other.parameters) { + __this__parameters.add(new DockerParameter(other_element)); + } + this.parameters = __this__parameters; + } + } + + public DockerContainer deepCopy() { + return new DockerContainer(this); + } + + @Override + public void clear() { + this.image = null; + this.parameters = null; + } + + /** + * The container image to be run + */ + public String getImage() { + return this.image; + } + + /** + * The container image to be run + */ + public DockerContainer setImage(String image) { + this.image = image; + return this; + } + + public void unsetImage() { + this.image = null; + } + + /** Returns true if field image is set (has been assigned a value) and false otherwise */ + public boolean isSetImage() { + return this.image != null; + } + + public void setImageIsSet(boolean value) { + if (!value) { + this.image = null; + } + } + + public int getParametersSize() { + return (this.parameters == null) ? 0 : this.parameters.size(); + } + + public java.util.Iterator<DockerParameter> getParametersIterator() { + return (this.parameters == null) ? null : this.parameters.iterator(); + } + + public void addToParameters(DockerParameter elem) { + if (this.parameters == null) { + this.parameters = new ArrayList<DockerParameter>(); + } + this.parameters.add(elem); + } + + /** + * The arbitrary parameters to pass to container + */ + public List<DockerParameter> getParameters() { + return this.parameters; + } + + /** + * The arbitrary parameters to pass to container + */ + public DockerContainer setParameters(List<DockerParameter> parameters) { + this.parameters = parameters; + return this; + } + + public void unsetParameters() { + this.parameters = null; + } + + /** Returns true if field parameters is set (has been assigned a value) and false otherwise */ + public boolean isSetParameters() { + return this.parameters != null; + } + + public void setParametersIsSet(boolean value) { + if (!value) { + this.parameters = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case IMAGE: + if (value == null) { + unsetImage(); + } else { + setImage((String)value); + } + break; + + case PARAMETERS: + if (value == null) { + unsetParameters(); + } else { + setParameters((List<DockerParameter>)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case IMAGE: + return getImage(); + + case PARAMETERS: + return getParameters(); + + } + 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 IMAGE: + return isSetImage(); + case PARAMETERS: + return isSetParameters(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof DockerContainer) + return this.equals((DockerContainer)that); + return false; + } + + public boolean equals(DockerContainer that) { + if (that == null) + return false; + + boolean this_present_image = true && this.isSetImage(); + boolean that_present_image = true && that.isSetImage(); + if (this_present_image || that_present_image) { + if (!(this_present_image && that_present_image)) + return false; + if (!this.image.equals(that.image)) + return false; + } + + boolean this_present_parameters = true && this.isSetParameters(); + boolean that_present_parameters = true && that.isSetParameters(); + if (this_present_parameters || that_present_parameters) { + if (!(this_present_parameters && that_present_parameters)) + return false; + if (!this.parameters.equals(that.parameters)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + List<Object> list = new ArrayList<Object>(); + + boolean present_image = true && (isSetImage()); + list.add(present_image); + if (present_image) + list.add(image); + + boolean present_parameters = true && (isSetParameters()); + list.add(present_parameters); + if (present_parameters) + list.add(parameters); + + return list.hashCode(); + } + + @Override + public int compareTo(DockerContainer other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetImage()).compareTo(other.isSetImage()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetImage()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.image, other.image); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetParameters()).compareTo(other.isSetParameters()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetParameters()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.parameters, other.parameters); + 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("DockerContainer("); + boolean first = true; + + sb.append("image:"); + if (this.image == null) { + sb.append("null"); + } else { + sb.append(this.image); + } + first = false; + if (isSetParameters()) { + if (!first) sb.append(", "); + sb.append("parameters:"); + if (this.parameters == null) { + sb.append("null"); + } else { + sb.append(this.parameters); + } + 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 DockerContainerStandardSchemeFactory implements SchemeFactory { + public DockerContainerStandardScheme getScheme() { + return new DockerContainerStandardScheme(); + } + } + + private static class DockerContainerStandardScheme extends StandardScheme<DockerContainer> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, DockerContainer 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: // IMAGE + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.image = iprot.readString(); + struct.setImageIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // PARAMETERS + if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { + { + org.apache.thrift.protocol.TList _list24 = iprot.readListBegin(); + struct.parameters = new ArrayList<DockerParameter>(_list24.size); + DockerParameter _elem25; + for (int _i26 = 0; _i26 < _list24.size; ++_i26) + { + _elem25 = new DockerParameter(); + _elem25.read(iprot); + struct.parameters.add(_elem25); + } + iprot.readListEnd(); + } + struct.setParametersIsSet(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, DockerContainer struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.image != null) { + oprot.writeFieldBegin(IMAGE_FIELD_DESC); + oprot.writeString(struct.image); + oprot.writeFieldEnd(); + } + if (struct.parameters != null) { + if (struct.isSetParameters()) { + oprot.writeFieldBegin(PARAMETERS_FIELD_DESC); + { + oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.parameters.size())); + for (DockerParameter _iter27 : struct.parameters) + { + _iter27.write(oprot); + } + oprot.writeListEnd(); + } + oprot.writeFieldEnd(); + } + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class DockerContainerTupleSchemeFactory implements SchemeFactory { + public DockerContainerTupleScheme getScheme() { + return new DockerContainerTupleScheme(); + } + } + + private static class DockerContainerTupleScheme extends TupleScheme<DockerContainer> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, DockerContainer struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetImage()) { + optionals.set(0); + } + if (struct.isSetParameters()) { + optionals.set(1); + } + oprot.writeBitSet(optionals, 2); + if (struct.isSetImage()) { + oprot.writeString(struct.image); + } + if (struct.isSetParameters()) { + { + oprot.writeI32(struct.parameters.size()); + for (DockerParameter _iter28 : struct.parameters) + { + _iter28.write(oprot); + } + } + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, DockerContainer struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(2); + if (incoming.get(0)) { + struct.image = iprot.readString(); + struct.setImageIsSet(true); + } + if (incoming.get(1)) { + { + org.apache.thrift.protocol.TList _list29 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); + struct.parameters = new ArrayList<DockerParameter>(_list29.size); + DockerParameter _elem30; + for (int _i31 = 0; _i31 < _list29.size; ++_i31) + { + _elem30 = new DockerParameter(); + _elem30.read(iprot); + struct.parameters.add(_elem30); + } + } + struct.setParametersIsSet(true); + } + } + } + +} + http://git-wip-us.apache.org/repos/asf/airavata/blob/0f781b2e/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/sdk/DockerImage.java ---------------------------------------------------------------------- diff --git a/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/sdk/DockerImage.java b/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/sdk/DockerImage.java new file mode 100644 index 0000000..ee6ef50 --- /dev/null +++ b/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/sdk/DockerImage.java @@ -0,0 +1,530 @@ +/** + * Autogenerated by Thrift Compiler (0.9.3) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +package org.apache.airavata.cloud.aurora.client.sdk; + +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; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) +/** + * Describes an image for use with the Mesos unified containerizer in the Docker format + */ +@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2016-10-21") +public class DockerImage implements org.apache.thrift.TBase<DockerImage, DockerImage._Fields>, java.io.Serializable, Cloneable, Comparable<DockerImage> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("DockerImage"); + + private static final org.apache.thrift.protocol.TField NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("name", org.apache.thrift.protocol.TType.STRING, (short)1); + private static final org.apache.thrift.protocol.TField TAG_FIELD_DESC = new org.apache.thrift.protocol.TField("tag", org.apache.thrift.protocol.TType.STRING, (short)2); + + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new DockerImageStandardSchemeFactory()); + schemes.put(TupleScheme.class, new DockerImageTupleSchemeFactory()); + } + + /** + * The name of the image to run + */ + public String name; // required + /** + * The Docker tag identifying the image + */ + public String tag; // 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 { + /** + * The name of the image to run + */ + NAME((short)1, "name"), + /** + * The Docker tag identifying the image + */ + TAG((short)2, "tag"); + + 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: // NAME + return NAME; + case 2: // TAG + return TAG; + 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.NAME, new org.apache.thrift.meta_data.FieldMetaData("name", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + tmpMap.put(_Fields.TAG, new org.apache.thrift.meta_data.FieldMetaData("tag", 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(DockerImage.class, metaDataMap); + } + + public DockerImage() { + } + + public DockerImage( + String name, + String tag) + { + this(); + this.name = name; + this.tag = tag; + } + + /** + * Performs a deep copy on <i>other</i>. + */ + public DockerImage(DockerImage other) { + if (other.isSetName()) { + this.name = other.name; + } + if (other.isSetTag()) { + this.tag = other.tag; + } + } + + public DockerImage deepCopy() { + return new DockerImage(this); + } + + @Override + public void clear() { + this.name = null; + this.tag = null; + } + + /** + * The name of the image to run + */ + public String getName() { + return this.name; + } + + /** + * The name of the image to run + */ + public DockerImage setName(String name) { + this.name = name; + return this; + } + + public void unsetName() { + this.name = null; + } + + /** Returns true if field name is set (has been assigned a value) and false otherwise */ + public boolean isSetName() { + return this.name != null; + } + + public void setNameIsSet(boolean value) { + if (!value) { + this.name = null; + } + } + + /** + * The Docker tag identifying the image + */ + public String getTag() { + return this.tag; + } + + /** + * The Docker tag identifying the image + */ + public DockerImage setTag(String tag) { + this.tag = tag; + return this; + } + + public void unsetTag() { + this.tag = null; + } + + /** Returns true if field tag is set (has been assigned a value) and false otherwise */ + public boolean isSetTag() { + return this.tag != null; + } + + public void setTagIsSet(boolean value) { + if (!value) { + this.tag = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case NAME: + if (value == null) { + unsetName(); + } else { + setName((String)value); + } + break; + + case TAG: + if (value == null) { + unsetTag(); + } else { + setTag((String)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case NAME: + return getName(); + + case TAG: + return getTag(); + + } + 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 NAME: + return isSetName(); + case TAG: + return isSetTag(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof DockerImage) + return this.equals((DockerImage)that); + return false; + } + + public boolean equals(DockerImage that) { + if (that == null) + return false; + + boolean this_present_name = true && this.isSetName(); + boolean that_present_name = true && that.isSetName(); + if (this_present_name || that_present_name) { + if (!(this_present_name && that_present_name)) + return false; + if (!this.name.equals(that.name)) + return false; + } + + boolean this_present_tag = true && this.isSetTag(); + boolean that_present_tag = true && that.isSetTag(); + if (this_present_tag || that_present_tag) { + if (!(this_present_tag && that_present_tag)) + return false; + if (!this.tag.equals(that.tag)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + List<Object> list = new ArrayList<Object>(); + + boolean present_name = true && (isSetName()); + list.add(present_name); + if (present_name) + list.add(name); + + boolean present_tag = true && (isSetTag()); + list.add(present_tag); + if (present_tag) + list.add(tag); + + return list.hashCode(); + } + + @Override + public int compareTo(DockerImage other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetName()).compareTo(other.isSetName()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetName()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.name, other.name); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetTag()).compareTo(other.isSetTag()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetTag()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.tag, other.tag); + 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("DockerImage("); + boolean first = true; + + sb.append("name:"); + if (this.name == null) { + sb.append("null"); + } else { + sb.append(this.name); + } + first = false; + if (!first) sb.append(", "); + sb.append("tag:"); + if (this.tag == null) { + sb.append("null"); + } else { + sb.append(this.tag); + } + 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 DockerImageStandardSchemeFactory implements SchemeFactory { + public DockerImageStandardScheme getScheme() { + return new DockerImageStandardScheme(); + } + } + + private static class DockerImageStandardScheme extends StandardScheme<DockerImage> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, DockerImage 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: // NAME + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.name = iprot.readString(); + struct.setNameIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // TAG + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.tag = iprot.readString(); + struct.setTagIsSet(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, DockerImage struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.name != null) { + oprot.writeFieldBegin(NAME_FIELD_DESC); + oprot.writeString(struct.name); + oprot.writeFieldEnd(); + } + if (struct.tag != null) { + oprot.writeFieldBegin(TAG_FIELD_DESC); + oprot.writeString(struct.tag); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class DockerImageTupleSchemeFactory implements SchemeFactory { + public DockerImageTupleScheme getScheme() { + return new DockerImageTupleScheme(); + } + } + + private static class DockerImageTupleScheme extends TupleScheme<DockerImage> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, DockerImage struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetName()) { + optionals.set(0); + } + if (struct.isSetTag()) { + optionals.set(1); + } + oprot.writeBitSet(optionals, 2); + if (struct.isSetName()) { + oprot.writeString(struct.name); + } + if (struct.isSetTag()) { + oprot.writeString(struct.tag); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, DockerImage struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(2); + if (incoming.get(0)) { + struct.name = iprot.readString(); + struct.setNameIsSet(true); + } + if (incoming.get(1)) { + struct.tag = iprot.readString(); + struct.setTagIsSet(true); + } + } + } + +} + http://git-wip-us.apache.org/repos/asf/airavata/blob/0f781b2e/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/sdk/DockerParameter.java ---------------------------------------------------------------------- diff --git a/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/sdk/DockerParameter.java b/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/sdk/DockerParameter.java new file mode 100644 index 0000000..2cb00dd --- /dev/null +++ b/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/sdk/DockerParameter.java @@ -0,0 +1,530 @@ +/** + * Autogenerated by Thrift Compiler (0.9.3) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +package org.apache.airavata.cloud.aurora.client.sdk; + +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; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) +/** + * Describes a parameter passed to docker cli + */ +@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2016-10-21") +public class DockerParameter implements org.apache.thrift.TBase<DockerParameter, DockerParameter._Fields>, java.io.Serializable, Cloneable, Comparable<DockerParameter> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("DockerParameter"); + + private static final org.apache.thrift.protocol.TField NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("name", org.apache.thrift.protocol.TType.STRING, (short)1); + private static final org.apache.thrift.protocol.TField VALUE_FIELD_DESC = new org.apache.thrift.protocol.TField("value", org.apache.thrift.protocol.TType.STRING, (short)2); + + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new DockerParameterStandardSchemeFactory()); + schemes.put(TupleScheme.class, new DockerParameterTupleSchemeFactory()); + } + + /** + * a parameter to pass to docker. (e.g. volume) + */ + public String name; // required + /** + * the value to pass to a parameter (e.g. /src/webapp:/opt/webapp) + */ + public String value; // 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 { + /** + * a parameter to pass to docker. (e.g. volume) + */ + NAME((short)1, "name"), + /** + * the value to pass to a parameter (e.g. /src/webapp:/opt/webapp) + */ + VALUE((short)2, "value"); + + 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: // NAME + return NAME; + case 2: // VALUE + return VALUE; + 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.NAME, new org.apache.thrift.meta_data.FieldMetaData("name", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + tmpMap.put(_Fields.VALUE, new org.apache.thrift.meta_data.FieldMetaData("value", 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(DockerParameter.class, metaDataMap); + } + + public DockerParameter() { + } + + public DockerParameter( + String name, + String value) + { + this(); + this.name = name; + this.value = value; + } + + /** + * Performs a deep copy on <i>other</i>. + */ + public DockerParameter(DockerParameter other) { + if (other.isSetName()) { + this.name = other.name; + } + if (other.isSetValue()) { + this.value = other.value; + } + } + + public DockerParameter deepCopy() { + return new DockerParameter(this); + } + + @Override + public void clear() { + this.name = null; + this.value = null; + } + + /** + * a parameter to pass to docker. (e.g. volume) + */ + public String getName() { + return this.name; + } + + /** + * a parameter to pass to docker. (e.g. volume) + */ + public DockerParameter setName(String name) { + this.name = name; + return this; + } + + public void unsetName() { + this.name = null; + } + + /** Returns true if field name is set (has been assigned a value) and false otherwise */ + public boolean isSetName() { + return this.name != null; + } + + public void setNameIsSet(boolean value) { + if (!value) { + this.name = null; + } + } + + /** + * the value to pass to a parameter (e.g. /src/webapp:/opt/webapp) + */ + public String getValue() { + return this.value; + } + + /** + * the value to pass to a parameter (e.g. /src/webapp:/opt/webapp) + */ + public DockerParameter setValue(String value) { + this.value = value; + return this; + } + + public void unsetValue() { + this.value = null; + } + + /** Returns true if field value is set (has been assigned a value) and false otherwise */ + public boolean isSetValue() { + return this.value != null; + } + + public void setValueIsSet(boolean value) { + if (!value) { + this.value = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case NAME: + if (value == null) { + unsetName(); + } else { + setName((String)value); + } + break; + + case VALUE: + if (value == null) { + unsetValue(); + } else { + setValue((String)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case NAME: + return getName(); + + case VALUE: + return getValue(); + + } + 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 NAME: + return isSetName(); + case VALUE: + return isSetValue(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof DockerParameter) + return this.equals((DockerParameter)that); + return false; + } + + public boolean equals(DockerParameter that) { + if (that == null) + return false; + + boolean this_present_name = true && this.isSetName(); + boolean that_present_name = true && that.isSetName(); + if (this_present_name || that_present_name) { + if (!(this_present_name && that_present_name)) + return false; + if (!this.name.equals(that.name)) + return false; + } + + boolean this_present_value = true && this.isSetValue(); + boolean that_present_value = true && that.isSetValue(); + if (this_present_value || that_present_value) { + if (!(this_present_value && that_present_value)) + return false; + if (!this.value.equals(that.value)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + List<Object> list = new ArrayList<Object>(); + + boolean present_name = true && (isSetName()); + list.add(present_name); + if (present_name) + list.add(name); + + boolean present_value = true && (isSetValue()); + list.add(present_value); + if (present_value) + list.add(value); + + return list.hashCode(); + } + + @Override + public int compareTo(DockerParameter other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetName()).compareTo(other.isSetName()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetName()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.name, other.name); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetValue()).compareTo(other.isSetValue()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetValue()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.value, other.value); + 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("DockerParameter("); + boolean first = true; + + sb.append("name:"); + if (this.name == null) { + sb.append("null"); + } else { + sb.append(this.name); + } + first = false; + if (!first) sb.append(", "); + sb.append("value:"); + if (this.value == null) { + sb.append("null"); + } else { + sb.append(this.value); + } + 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 DockerParameterStandardSchemeFactory implements SchemeFactory { + public DockerParameterStandardScheme getScheme() { + return new DockerParameterStandardScheme(); + } + } + + private static class DockerParameterStandardScheme extends StandardScheme<DockerParameter> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, DockerParameter 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: // NAME + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.name = iprot.readString(); + struct.setNameIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // VALUE + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.value = iprot.readString(); + struct.setValueIsSet(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, DockerParameter struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.name != null) { + oprot.writeFieldBegin(NAME_FIELD_DESC); + oprot.writeString(struct.name); + oprot.writeFieldEnd(); + } + if (struct.value != null) { + oprot.writeFieldBegin(VALUE_FIELD_DESC); + oprot.writeString(struct.value); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class DockerParameterTupleSchemeFactory implements SchemeFactory { + public DockerParameterTupleScheme getScheme() { + return new DockerParameterTupleScheme(); + } + } + + private static class DockerParameterTupleScheme extends TupleScheme<DockerParameter> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, DockerParameter struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetName()) { + optionals.set(0); + } + if (struct.isSetValue()) { + optionals.set(1); + } + oprot.writeBitSet(optionals, 2); + if (struct.isSetName()) { + oprot.writeString(struct.name); + } + if (struct.isSetValue()) { + oprot.writeString(struct.value); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, DockerParameter struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(2); + if (incoming.get(0)) { + struct.name = iprot.readString(); + struct.setNameIsSet(true); + } + if (incoming.get(1)) { + struct.value = iprot.readString(); + struct.setValueIsSet(true); + } + } + } + +} + http://git-wip-us.apache.org/repos/asf/airavata/blob/0f781b2e/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/sdk/DrainHostsResult.java ---------------------------------------------------------------------- diff --git a/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/sdk/DrainHostsResult.java b/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/sdk/DrainHostsResult.java new file mode 100644 index 0000000..67a13a4 --- /dev/null +++ b/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/sdk/DrainHostsResult.java @@ -0,0 +1,452 @@ +/** + * Autogenerated by Thrift Compiler (0.9.3) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +package org.apache.airavata.cloud.aurora.client.sdk; + +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; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) +@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2016-10-21") +public class DrainHostsResult implements org.apache.thrift.TBase<DrainHostsResult, DrainHostsResult._Fields>, java.io.Serializable, Cloneable, Comparable<DrainHostsResult> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("DrainHostsResult"); + + private static final org.apache.thrift.protocol.TField STATUSES_FIELD_DESC = new org.apache.thrift.protocol.TField("statuses", org.apache.thrift.protocol.TType.SET, (short)1); + + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new DrainHostsResultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new DrainHostsResultTupleSchemeFactory()); + } + + public Set<HostStatus> statuses; // 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 { + STATUSES((short)1, "statuses"); + + 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: // STATUSES + return STATUSES; + 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.STATUSES, new org.apache.thrift.meta_data.FieldMetaData("statuses", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.SetMetaData(org.apache.thrift.protocol.TType.SET, + new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, HostStatus.class)))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(DrainHostsResult.class, metaDataMap); + } + + public DrainHostsResult() { + } + + public DrainHostsResult( + Set<HostStatus> statuses) + { + this(); + this.statuses = statuses; + } + + /** + * Performs a deep copy on <i>other</i>. + */ + public DrainHostsResult(DrainHostsResult other) { + if (other.isSetStatuses()) { + Set<HostStatus> __this__statuses = new HashSet<HostStatus>(other.statuses.size()); + for (HostStatus other_element : other.statuses) { + __this__statuses.add(new HostStatus(other_element)); + } + this.statuses = __this__statuses; + } + } + + public DrainHostsResult deepCopy() { + return new DrainHostsResult(this); + } + + @Override + public void clear() { + this.statuses = null; + } + + public int getStatusesSize() { + return (this.statuses == null) ? 0 : this.statuses.size(); + } + + public java.util.Iterator<HostStatus> getStatusesIterator() { + return (this.statuses == null) ? null : this.statuses.iterator(); + } + + public void addToStatuses(HostStatus elem) { + if (this.statuses == null) { + this.statuses = new HashSet<HostStatus>(); + } + this.statuses.add(elem); + } + + public Set<HostStatus> getStatuses() { + return this.statuses; + } + + public DrainHostsResult setStatuses(Set<HostStatus> statuses) { + this.statuses = statuses; + return this; + } + + public void unsetStatuses() { + this.statuses = null; + } + + /** Returns true if field statuses is set (has been assigned a value) and false otherwise */ + public boolean isSetStatuses() { + return this.statuses != null; + } + + public void setStatusesIsSet(boolean value) { + if (!value) { + this.statuses = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case STATUSES: + if (value == null) { + unsetStatuses(); + } else { + setStatuses((Set<HostStatus>)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case STATUSES: + return getStatuses(); + + } + 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 STATUSES: + return isSetStatuses(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof DrainHostsResult) + return this.equals((DrainHostsResult)that); + return false; + } + + public boolean equals(DrainHostsResult that) { + if (that == null) + return false; + + boolean this_present_statuses = true && this.isSetStatuses(); + boolean that_present_statuses = true && that.isSetStatuses(); + if (this_present_statuses || that_present_statuses) { + if (!(this_present_statuses && that_present_statuses)) + return false; + if (!this.statuses.equals(that.statuses)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + List<Object> list = new ArrayList<Object>(); + + boolean present_statuses = true && (isSetStatuses()); + list.add(present_statuses); + if (present_statuses) + list.add(statuses); + + return list.hashCode(); + } + + @Override + public int compareTo(DrainHostsResult other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetStatuses()).compareTo(other.isSetStatuses()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetStatuses()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.statuses, other.statuses); + 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("DrainHostsResult("); + boolean first = true; + + sb.append("statuses:"); + if (this.statuses == null) { + sb.append("null"); + } else { + sb.append(this.statuses); + } + 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 DrainHostsResultStandardSchemeFactory implements SchemeFactory { + public DrainHostsResultStandardScheme getScheme() { + return new DrainHostsResultStandardScheme(); + } + } + + private static class DrainHostsResultStandardScheme extends StandardScheme<DrainHostsResult> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, DrainHostsResult 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: // STATUSES + if (schemeField.type == org.apache.thrift.protocol.TType.SET) { + { + org.apache.thrift.protocol.TSet _set270 = iprot.readSetBegin(); + struct.statuses = new HashSet<HostStatus>(2*_set270.size); + HostStatus _elem271; + for (int _i272 = 0; _i272 < _set270.size; ++_i272) + { + _elem271 = new HostStatus(); + _elem271.read(iprot); + struct.statuses.add(_elem271); + } + iprot.readSetEnd(); + } + struct.setStatusesIsSet(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, DrainHostsResult struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.statuses != null) { + oprot.writeFieldBegin(STATUSES_FIELD_DESC); + { + oprot.writeSetBegin(new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRUCT, struct.statuses.size())); + for (HostStatus _iter273 : struct.statuses) + { + _iter273.write(oprot); + } + oprot.writeSetEnd(); + } + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class DrainHostsResultTupleSchemeFactory implements SchemeFactory { + public DrainHostsResultTupleScheme getScheme() { + return new DrainHostsResultTupleScheme(); + } + } + + private static class DrainHostsResultTupleScheme extends TupleScheme<DrainHostsResult> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, DrainHostsResult struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetStatuses()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetStatuses()) { + { + oprot.writeI32(struct.statuses.size()); + for (HostStatus _iter274 : struct.statuses) + { + _iter274.write(oprot); + } + } + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, DrainHostsResult struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + { + org.apache.thrift.protocol.TSet _set275 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); + struct.statuses = new HashSet<HostStatus>(2*_set275.size); + HostStatus _elem276; + for (int _i277 = 0; _i277 < _set275.size; ++_i277) + { + _elem276 = new HostStatus(); + _elem276.read(iprot); + struct.statuses.add(_elem276); + } + } + struct.setStatusesIsSet(true); + } + } + } + +} +
