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/ConfigGroup.java ---------------------------------------------------------------------- diff --git a/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/sdk/ConfigGroup.java b/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/sdk/ConfigGroup.java new file mode 100644 index 0000000..c933d78 --- /dev/null +++ b/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/sdk/ConfigGroup.java @@ -0,0 +1,562 @@ +/** + * 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 ConfigGroup implements org.apache.thrift.TBase<ConfigGroup, ConfigGroup._Fields>, java.io.Serializable, Cloneable, Comparable<ConfigGroup> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("ConfigGroup"); + + private static final org.apache.thrift.protocol.TField CONFIG_FIELD_DESC = new org.apache.thrift.protocol.TField("config", org.apache.thrift.protocol.TType.STRUCT, (short)1); + private static final org.apache.thrift.protocol.TField INSTANCES_FIELD_DESC = new org.apache.thrift.protocol.TField("instances", org.apache.thrift.protocol.TType.SET, (short)3); + + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new ConfigGroupStandardSchemeFactory()); + schemes.put(TupleScheme.class, new ConfigGroupTupleSchemeFactory()); + } + + public TaskConfig config; // required + public Set<Range> instances; // 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 { + CONFIG((short)1, "config"), + INSTANCES((short)3, "instances"); + + 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: // CONFIG + return CONFIG; + case 3: // INSTANCES + return INSTANCES; + 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.CONFIG, new org.apache.thrift.meta_data.FieldMetaData("config", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TaskConfig.class))); + tmpMap.put(_Fields.INSTANCES, new org.apache.thrift.meta_data.FieldMetaData("instances", 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, Range.class)))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(ConfigGroup.class, metaDataMap); + } + + public ConfigGroup() { + } + + public ConfigGroup( + TaskConfig config, + Set<Range> instances) + { + this(); + this.config = config; + this.instances = instances; + } + + /** + * Performs a deep copy on <i>other</i>. + */ + public ConfigGroup(ConfigGroup other) { + if (other.isSetConfig()) { + this.config = new TaskConfig(other.config); + } + if (other.isSetInstances()) { + Set<Range> __this__instances = new HashSet<Range>(other.instances.size()); + for (Range other_element : other.instances) { + __this__instances.add(new Range(other_element)); + } + this.instances = __this__instances; + } + } + + public ConfigGroup deepCopy() { + return new ConfigGroup(this); + } + + @Override + public void clear() { + this.config = null; + this.instances = null; + } + + public TaskConfig getConfig() { + return this.config; + } + + public ConfigGroup setConfig(TaskConfig config) { + this.config = config; + return this; + } + + public void unsetConfig() { + this.config = null; + } + + /** Returns true if field config is set (has been assigned a value) and false otherwise */ + public boolean isSetConfig() { + return this.config != null; + } + + public void setConfigIsSet(boolean value) { + if (!value) { + this.config = null; + } + } + + public int getInstancesSize() { + return (this.instances == null) ? 0 : this.instances.size(); + } + + public java.util.Iterator<Range> getInstancesIterator() { + return (this.instances == null) ? null : this.instances.iterator(); + } + + public void addToInstances(Range elem) { + if (this.instances == null) { + this.instances = new HashSet<Range>(); + } + this.instances.add(elem); + } + + public Set<Range> getInstances() { + return this.instances; + } + + public ConfigGroup setInstances(Set<Range> instances) { + this.instances = instances; + return this; + } + + public void unsetInstances() { + this.instances = null; + } + + /** Returns true if field instances is set (has been assigned a value) and false otherwise */ + public boolean isSetInstances() { + return this.instances != null; + } + + public void setInstancesIsSet(boolean value) { + if (!value) { + this.instances = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case CONFIG: + if (value == null) { + unsetConfig(); + } else { + setConfig((TaskConfig)value); + } + break; + + case INSTANCES: + if (value == null) { + unsetInstances(); + } else { + setInstances((Set<Range>)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case CONFIG: + return getConfig(); + + case INSTANCES: + return getInstances(); + + } + 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 CONFIG: + return isSetConfig(); + case INSTANCES: + return isSetInstances(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof ConfigGroup) + return this.equals((ConfigGroup)that); + return false; + } + + public boolean equals(ConfigGroup that) { + if (that == null) + return false; + + boolean this_present_config = true && this.isSetConfig(); + boolean that_present_config = true && that.isSetConfig(); + if (this_present_config || that_present_config) { + if (!(this_present_config && that_present_config)) + return false; + if (!this.config.equals(that.config)) + return false; + } + + boolean this_present_instances = true && this.isSetInstances(); + boolean that_present_instances = true && that.isSetInstances(); + if (this_present_instances || that_present_instances) { + if (!(this_present_instances && that_present_instances)) + return false; + if (!this.instances.equals(that.instances)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + List<Object> list = new ArrayList<Object>(); + + boolean present_config = true && (isSetConfig()); + list.add(present_config); + if (present_config) + list.add(config); + + boolean present_instances = true && (isSetInstances()); + list.add(present_instances); + if (present_instances) + list.add(instances); + + return list.hashCode(); + } + + @Override + public int compareTo(ConfigGroup other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetConfig()).compareTo(other.isSetConfig()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetConfig()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.config, other.config); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetInstances()).compareTo(other.isSetInstances()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetInstances()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.instances, other.instances); + 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("ConfigGroup("); + boolean first = true; + + sb.append("config:"); + if (this.config == null) { + sb.append("null"); + } else { + sb.append(this.config); + } + first = false; + if (!first) sb.append(", "); + sb.append("instances:"); + if (this.instances == null) { + sb.append("null"); + } else { + sb.append(this.instances); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + if (config != null) { + config.validate(); + } + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { + try { + read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class ConfigGroupStandardSchemeFactory implements SchemeFactory { + public ConfigGroupStandardScheme getScheme() { + return new ConfigGroupStandardScheme(); + } + } + + private static class ConfigGroupStandardScheme extends StandardScheme<ConfigGroup> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, ConfigGroup 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: // CONFIG + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.config = new TaskConfig(); + struct.config.read(iprot); + struct.setConfigIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 3: // INSTANCES + if (schemeField.type == org.apache.thrift.protocol.TType.SET) { + { + org.apache.thrift.protocol.TSet _set92 = iprot.readSetBegin(); + struct.instances = new HashSet<Range>(2*_set92.size); + Range _elem93; + for (int _i94 = 0; _i94 < _set92.size; ++_i94) + { + _elem93 = new Range(); + _elem93.read(iprot); + struct.instances.add(_elem93); + } + iprot.readSetEnd(); + } + struct.setInstancesIsSet(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, ConfigGroup struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.config != null) { + oprot.writeFieldBegin(CONFIG_FIELD_DESC); + struct.config.write(oprot); + oprot.writeFieldEnd(); + } + if (struct.instances != null) { + oprot.writeFieldBegin(INSTANCES_FIELD_DESC); + { + oprot.writeSetBegin(new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRUCT, struct.instances.size())); + for (Range _iter95 : struct.instances) + { + _iter95.write(oprot); + } + oprot.writeSetEnd(); + } + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class ConfigGroupTupleSchemeFactory implements SchemeFactory { + public ConfigGroupTupleScheme getScheme() { + return new ConfigGroupTupleScheme(); + } + } + + private static class ConfigGroupTupleScheme extends TupleScheme<ConfigGroup> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, ConfigGroup struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetConfig()) { + optionals.set(0); + } + if (struct.isSetInstances()) { + optionals.set(1); + } + oprot.writeBitSet(optionals, 2); + if (struct.isSetConfig()) { + struct.config.write(oprot); + } + if (struct.isSetInstances()) { + { + oprot.writeI32(struct.instances.size()); + for (Range _iter96 : struct.instances) + { + _iter96.write(oprot); + } + } + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, ConfigGroup struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(2); + if (incoming.get(0)) { + struct.config = new TaskConfig(); + struct.config.read(iprot); + struct.setConfigIsSet(true); + } + if (incoming.get(1)) { + { + org.apache.thrift.protocol.TSet _set97 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); + struct.instances = new HashSet<Range>(2*_set97.size); + Range _elem98; + for (int _i99 = 0; _i99 < _set97.size; ++_i99) + { + _elem98 = new Range(); + _elem98.read(iprot); + struct.instances.add(_elem98); + } + } + struct.setInstancesIsSet(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/ConfigRewrite.java ---------------------------------------------------------------------- diff --git a/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/sdk/ConfigRewrite.java b/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/sdk/ConfigRewrite.java new file mode 100644 index 0000000..d27c587 --- /dev/null +++ b/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/sdk/ConfigRewrite.java @@ -0,0 +1,370 @@ +/** + * 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"}) +public class ConfigRewrite extends org.apache.thrift.TUnion<ConfigRewrite, ConfigRewrite._Fields> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("ConfigRewrite"); + private static final org.apache.thrift.protocol.TField JOB_REWRITE_FIELD_DESC = new org.apache.thrift.protocol.TField("jobRewrite", org.apache.thrift.protocol.TType.STRUCT, (short)1); + private static final org.apache.thrift.protocol.TField INSTANCE_REWRITE_FIELD_DESC = new org.apache.thrift.protocol.TField("instanceRewrite", 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 { + JOB_REWRITE((short)1, "jobRewrite"), + INSTANCE_REWRITE((short)2, "instanceRewrite"); + + 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: // JOB_REWRITE + return JOB_REWRITE; + case 2: // INSTANCE_REWRITE + return INSTANCE_REWRITE; + 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.JOB_REWRITE, new org.apache.thrift.meta_data.FieldMetaData("jobRewrite", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, JobConfigRewrite.class))); + tmpMap.put(_Fields.INSTANCE_REWRITE, new org.apache.thrift.meta_data.FieldMetaData("instanceRewrite", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, InstanceConfigRewrite.class))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(ConfigRewrite.class, metaDataMap); + } + + public ConfigRewrite() { + super(); + } + + public ConfigRewrite(_Fields setField, Object value) { + super(setField, value); + } + + public ConfigRewrite(ConfigRewrite other) { + super(other); + } + public ConfigRewrite deepCopy() { + return new ConfigRewrite(this); + } + + public static ConfigRewrite jobRewrite(JobConfigRewrite value) { + ConfigRewrite x = new ConfigRewrite(); + x.setJobRewrite(value); + return x; + } + + public static ConfigRewrite instanceRewrite(InstanceConfigRewrite value) { + ConfigRewrite x = new ConfigRewrite(); + x.setInstanceRewrite(value); + return x; + } + + + @Override + protected void checkType(_Fields setField, Object value) throws ClassCastException { + switch (setField) { + case JOB_REWRITE: + if (value instanceof JobConfigRewrite) { + break; + } + throw new ClassCastException("Was expecting value of type JobConfigRewrite for field 'jobRewrite', but got " + value.getClass().getSimpleName()); + case INSTANCE_REWRITE: + if (value instanceof InstanceConfigRewrite) { + break; + } + throw new ClassCastException("Was expecting value of type InstanceConfigRewrite for field 'instanceRewrite', 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 JOB_REWRITE: + if (field.type == JOB_REWRITE_FIELD_DESC.type) { + JobConfigRewrite jobRewrite; + jobRewrite = new JobConfigRewrite(); + jobRewrite.read(iprot); + return jobRewrite; + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); + return null; + } + case INSTANCE_REWRITE: + if (field.type == INSTANCE_REWRITE_FIELD_DESC.type) { + InstanceConfigRewrite instanceRewrite; + instanceRewrite = new InstanceConfigRewrite(); + instanceRewrite.read(iprot); + return instanceRewrite; + } 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 JOB_REWRITE: + JobConfigRewrite jobRewrite = (JobConfigRewrite)value_; + jobRewrite.write(oprot); + return; + case INSTANCE_REWRITE: + InstanceConfigRewrite instanceRewrite = (InstanceConfigRewrite)value_; + instanceRewrite.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 JOB_REWRITE: + JobConfigRewrite jobRewrite; + jobRewrite = new JobConfigRewrite(); + jobRewrite.read(iprot); + return jobRewrite; + case INSTANCE_REWRITE: + InstanceConfigRewrite instanceRewrite; + instanceRewrite = new InstanceConfigRewrite(); + instanceRewrite.read(iprot); + return instanceRewrite; + 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 JOB_REWRITE: + JobConfigRewrite jobRewrite = (JobConfigRewrite)value_; + jobRewrite.write(oprot); + return; + case INSTANCE_REWRITE: + InstanceConfigRewrite instanceRewrite = (InstanceConfigRewrite)value_; + instanceRewrite.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 JOB_REWRITE: + return JOB_REWRITE_FIELD_DESC; + case INSTANCE_REWRITE: + return INSTANCE_REWRITE_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 JobConfigRewrite getJobRewrite() { + if (getSetField() == _Fields.JOB_REWRITE) { + return (JobConfigRewrite)getFieldValue(); + } else { + throw new RuntimeException("Cannot get field 'jobRewrite' because union is currently set to " + getFieldDesc(getSetField()).name); + } + } + + public void setJobRewrite(JobConfigRewrite value) { + if (value == null) throw new NullPointerException(); + setField_ = _Fields.JOB_REWRITE; + value_ = value; + } + + public InstanceConfigRewrite getInstanceRewrite() { + if (getSetField() == _Fields.INSTANCE_REWRITE) { + return (InstanceConfigRewrite)getFieldValue(); + } else { + throw new RuntimeException("Cannot get field 'instanceRewrite' because union is currently set to " + getFieldDesc(getSetField()).name); + } + } + + public void setInstanceRewrite(InstanceConfigRewrite value) { + if (value == null) throw new NullPointerException(); + setField_ = _Fields.INSTANCE_REWRITE; + value_ = value; + } + + public boolean isSetJobRewrite() { + return setField_ == _Fields.JOB_REWRITE; + } + + + public boolean isSetInstanceRewrite() { + return setField_ == _Fields.INSTANCE_REWRITE; + } + + + public boolean equals(Object other) { + if (other instanceof ConfigRewrite) { + return equals((ConfigRewrite)other); + } else { + return false; + } + } + + public boolean equals(ConfigRewrite other) { + return other != null && getSetField() == other.getSetField() && getFieldValue().equals(other.getFieldValue()); + } + + @Override + public int compareTo(ConfigRewrite 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/ConfigSummary.java ---------------------------------------------------------------------- diff --git a/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/sdk/ConfigSummary.java b/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/sdk/ConfigSummary.java new file mode 100644 index 0000000..19ab13a --- /dev/null +++ b/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/sdk/ConfigSummary.java @@ -0,0 +1,562 @@ +/** + * 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 ConfigSummary implements org.apache.thrift.TBase<ConfigSummary, ConfigSummary._Fields>, java.io.Serializable, Cloneable, Comparable<ConfigSummary> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("ConfigSummary"); + + private static final org.apache.thrift.protocol.TField KEY_FIELD_DESC = new org.apache.thrift.protocol.TField("key", org.apache.thrift.protocol.TType.STRUCT, (short)1); + private static final org.apache.thrift.protocol.TField GROUPS_FIELD_DESC = new org.apache.thrift.protocol.TField("groups", org.apache.thrift.protocol.TType.SET, (short)2); + + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new ConfigSummaryStandardSchemeFactory()); + schemes.put(TupleScheme.class, new ConfigSummaryTupleSchemeFactory()); + } + + public JobKey key; // required + public Set<ConfigGroup> groups; // 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 { + KEY((short)1, "key"), + GROUPS((short)2, "groups"); + + 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: // KEY + return KEY; + case 2: // GROUPS + return GROUPS; + 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.KEY, new org.apache.thrift.meta_data.FieldMetaData("key", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, JobKey.class))); + tmpMap.put(_Fields.GROUPS, new org.apache.thrift.meta_data.FieldMetaData("groups", 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, ConfigGroup.class)))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(ConfigSummary.class, metaDataMap); + } + + public ConfigSummary() { + } + + public ConfigSummary( + JobKey key, + Set<ConfigGroup> groups) + { + this(); + this.key = key; + this.groups = groups; + } + + /** + * Performs a deep copy on <i>other</i>. + */ + public ConfigSummary(ConfigSummary other) { + if (other.isSetKey()) { + this.key = new JobKey(other.key); + } + if (other.isSetGroups()) { + Set<ConfigGroup> __this__groups = new HashSet<ConfigGroup>(other.groups.size()); + for (ConfigGroup other_element : other.groups) { + __this__groups.add(new ConfigGroup(other_element)); + } + this.groups = __this__groups; + } + } + + public ConfigSummary deepCopy() { + return new ConfigSummary(this); + } + + @Override + public void clear() { + this.key = null; + this.groups = null; + } + + public JobKey getKey() { + return this.key; + } + + public ConfigSummary setKey(JobKey key) { + this.key = key; + return this; + } + + public void unsetKey() { + this.key = null; + } + + /** Returns true if field key is set (has been assigned a value) and false otherwise */ + public boolean isSetKey() { + return this.key != null; + } + + public void setKeyIsSet(boolean value) { + if (!value) { + this.key = null; + } + } + + public int getGroupsSize() { + return (this.groups == null) ? 0 : this.groups.size(); + } + + public java.util.Iterator<ConfigGroup> getGroupsIterator() { + return (this.groups == null) ? null : this.groups.iterator(); + } + + public void addToGroups(ConfigGroup elem) { + if (this.groups == null) { + this.groups = new HashSet<ConfigGroup>(); + } + this.groups.add(elem); + } + + public Set<ConfigGroup> getGroups() { + return this.groups; + } + + public ConfigSummary setGroups(Set<ConfigGroup> groups) { + this.groups = groups; + return this; + } + + public void unsetGroups() { + this.groups = null; + } + + /** Returns true if field groups is set (has been assigned a value) and false otherwise */ + public boolean isSetGroups() { + return this.groups != null; + } + + public void setGroupsIsSet(boolean value) { + if (!value) { + this.groups = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case KEY: + if (value == null) { + unsetKey(); + } else { + setKey((JobKey)value); + } + break; + + case GROUPS: + if (value == null) { + unsetGroups(); + } else { + setGroups((Set<ConfigGroup>)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case KEY: + return getKey(); + + case GROUPS: + return getGroups(); + + } + 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 KEY: + return isSetKey(); + case GROUPS: + return isSetGroups(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof ConfigSummary) + return this.equals((ConfigSummary)that); + return false; + } + + public boolean equals(ConfigSummary that) { + if (that == null) + return false; + + boolean this_present_key = true && this.isSetKey(); + boolean that_present_key = true && that.isSetKey(); + if (this_present_key || that_present_key) { + if (!(this_present_key && that_present_key)) + return false; + if (!this.key.equals(that.key)) + return false; + } + + boolean this_present_groups = true && this.isSetGroups(); + boolean that_present_groups = true && that.isSetGroups(); + if (this_present_groups || that_present_groups) { + if (!(this_present_groups && that_present_groups)) + return false; + if (!this.groups.equals(that.groups)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + List<Object> list = new ArrayList<Object>(); + + boolean present_key = true && (isSetKey()); + list.add(present_key); + if (present_key) + list.add(key); + + boolean present_groups = true && (isSetGroups()); + list.add(present_groups); + if (present_groups) + list.add(groups); + + return list.hashCode(); + } + + @Override + public int compareTo(ConfigSummary other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetKey()).compareTo(other.isSetKey()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetKey()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.key, other.key); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetGroups()).compareTo(other.isSetGroups()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetGroups()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.groups, other.groups); + 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("ConfigSummary("); + boolean first = true; + + sb.append("key:"); + if (this.key == null) { + sb.append("null"); + } else { + sb.append(this.key); + } + first = false; + if (!first) sb.append(", "); + sb.append("groups:"); + if (this.groups == null) { + sb.append("null"); + } else { + sb.append(this.groups); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + if (key != null) { + key.validate(); + } + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { + try { + read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class ConfigSummaryStandardSchemeFactory implements SchemeFactory { + public ConfigSummaryStandardScheme getScheme() { + return new ConfigSummaryStandardScheme(); + } + } + + private static class ConfigSummaryStandardScheme extends StandardScheme<ConfigSummary> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, ConfigSummary 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: // KEY + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.key = new JobKey(); + struct.key.read(iprot); + struct.setKeyIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // GROUPS + if (schemeField.type == org.apache.thrift.protocol.TType.SET) { + { + org.apache.thrift.protocol.TSet _set100 = iprot.readSetBegin(); + struct.groups = new HashSet<ConfigGroup>(2*_set100.size); + ConfigGroup _elem101; + for (int _i102 = 0; _i102 < _set100.size; ++_i102) + { + _elem101 = new ConfigGroup(); + _elem101.read(iprot); + struct.groups.add(_elem101); + } + iprot.readSetEnd(); + } + struct.setGroupsIsSet(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, ConfigSummary struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.key != null) { + oprot.writeFieldBegin(KEY_FIELD_DESC); + struct.key.write(oprot); + oprot.writeFieldEnd(); + } + if (struct.groups != null) { + oprot.writeFieldBegin(GROUPS_FIELD_DESC); + { + oprot.writeSetBegin(new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRUCT, struct.groups.size())); + for (ConfigGroup _iter103 : struct.groups) + { + _iter103.write(oprot); + } + oprot.writeSetEnd(); + } + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class ConfigSummaryTupleSchemeFactory implements SchemeFactory { + public ConfigSummaryTupleScheme getScheme() { + return new ConfigSummaryTupleScheme(); + } + } + + private static class ConfigSummaryTupleScheme extends TupleScheme<ConfigSummary> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, ConfigSummary struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetKey()) { + optionals.set(0); + } + if (struct.isSetGroups()) { + optionals.set(1); + } + oprot.writeBitSet(optionals, 2); + if (struct.isSetKey()) { + struct.key.write(oprot); + } + if (struct.isSetGroups()) { + { + oprot.writeI32(struct.groups.size()); + for (ConfigGroup _iter104 : struct.groups) + { + _iter104.write(oprot); + } + } + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, ConfigSummary struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(2); + if (incoming.get(0)) { + struct.key = new JobKey(); + struct.key.read(iprot); + struct.setKeyIsSet(true); + } + if (incoming.get(1)) { + { + org.apache.thrift.protocol.TSet _set105 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); + struct.groups = new HashSet<ConfigGroup>(2*_set105.size); + ConfigGroup _elem106; + for (int _i107 = 0; _i107 < _set105.size; ++_i107) + { + _elem106 = new ConfigGroup(); + _elem106.read(iprot); + struct.groups.add(_elem106); + } + } + struct.setGroupsIsSet(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/ConfigSummaryResult.java ---------------------------------------------------------------------- diff --git a/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/sdk/ConfigSummaryResult.java b/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/sdk/ConfigSummaryResult.java new file mode 100644 index 0000000..b8d7178 --- /dev/null +++ b/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/sdk/ConfigSummaryResult.java @@ -0,0 +1,403 @@ +/** + * 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 ConfigSummaryResult implements org.apache.thrift.TBase<ConfigSummaryResult, ConfigSummaryResult._Fields>, java.io.Serializable, Cloneable, Comparable<ConfigSummaryResult> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("ConfigSummaryResult"); + + private static final org.apache.thrift.protocol.TField SUMMARY_FIELD_DESC = new org.apache.thrift.protocol.TField("summary", org.apache.thrift.protocol.TType.STRUCT, (short)1); + + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new ConfigSummaryResultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new ConfigSummaryResultTupleSchemeFactory()); + } + + public ConfigSummary summary; // 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 { + SUMMARY((short)1, "summary"); + + 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: // SUMMARY + return SUMMARY; + 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.SUMMARY, new org.apache.thrift.meta_data.FieldMetaData("summary", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, ConfigSummary.class))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(ConfigSummaryResult.class, metaDataMap); + } + + public ConfigSummaryResult() { + } + + public ConfigSummaryResult( + ConfigSummary summary) + { + this(); + this.summary = summary; + } + + /** + * Performs a deep copy on <i>other</i>. + */ + public ConfigSummaryResult(ConfigSummaryResult other) { + if (other.isSetSummary()) { + this.summary = new ConfigSummary(other.summary); + } + } + + public ConfigSummaryResult deepCopy() { + return new ConfigSummaryResult(this); + } + + @Override + public void clear() { + this.summary = null; + } + + public ConfigSummary getSummary() { + return this.summary; + } + + public ConfigSummaryResult setSummary(ConfigSummary summary) { + this.summary = summary; + return this; + } + + public void unsetSummary() { + this.summary = null; + } + + /** Returns true if field summary is set (has been assigned a value) and false otherwise */ + public boolean isSetSummary() { + return this.summary != null; + } + + public void setSummaryIsSet(boolean value) { + if (!value) { + this.summary = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case SUMMARY: + if (value == null) { + unsetSummary(); + } else { + setSummary((ConfigSummary)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case SUMMARY: + return getSummary(); + + } + 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 SUMMARY: + return isSetSummary(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof ConfigSummaryResult) + return this.equals((ConfigSummaryResult)that); + return false; + } + + public boolean equals(ConfigSummaryResult that) { + if (that == null) + return false; + + boolean this_present_summary = true && this.isSetSummary(); + boolean that_present_summary = true && that.isSetSummary(); + if (this_present_summary || that_present_summary) { + if (!(this_present_summary && that_present_summary)) + return false; + if (!this.summary.equals(that.summary)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + List<Object> list = new ArrayList<Object>(); + + boolean present_summary = true && (isSetSummary()); + list.add(present_summary); + if (present_summary) + list.add(summary); + + return list.hashCode(); + } + + @Override + public int compareTo(ConfigSummaryResult other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetSummary()).compareTo(other.isSetSummary()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSummary()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.summary, other.summary); + 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("ConfigSummaryResult("); + boolean first = true; + + sb.append("summary:"); + if (this.summary == null) { + sb.append("null"); + } else { + sb.append(this.summary); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + if (summary != null) { + summary.validate(); + } + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { + try { + read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class ConfigSummaryResultStandardSchemeFactory implements SchemeFactory { + public ConfigSummaryResultStandardScheme getScheme() { + return new ConfigSummaryResultStandardScheme(); + } + } + + private static class ConfigSummaryResultStandardScheme extends StandardScheme<ConfigSummaryResult> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, ConfigSummaryResult 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: // SUMMARY + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.summary = new ConfigSummary(); + struct.summary.read(iprot); + struct.setSummaryIsSet(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, ConfigSummaryResult struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.summary != null) { + oprot.writeFieldBegin(SUMMARY_FIELD_DESC); + struct.summary.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class ConfigSummaryResultTupleSchemeFactory implements SchemeFactory { + public ConfigSummaryResultTupleScheme getScheme() { + return new ConfigSummaryResultTupleScheme(); + } + } + + private static class ConfigSummaryResultTupleScheme extends TupleScheme<ConfigSummaryResult> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, ConfigSummaryResult struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetSummary()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSummary()) { + struct.summary.write(oprot); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, ConfigSummaryResult struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.summary = new ConfigSummary(); + struct.summary.read(iprot); + struct.setSummaryIsSet(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/Constraint.java ---------------------------------------------------------------------- diff --git a/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/sdk/Constraint.java b/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/sdk/Constraint.java new file mode 100644 index 0000000..e42a05c --- /dev/null +++ b/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/sdk/Constraint.java @@ -0,0 +1,520 @@ +/** + * 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"}) +/** + * A constraint that defines whether a task may be scheduled on a host. + */ +@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2016-10-21") +public class Constraint implements org.apache.thrift.TBase<Constraint, Constraint._Fields>, java.io.Serializable, Cloneable, Comparable<Constraint> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("Constraint"); + + 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 CONSTRAINT_FIELD_DESC = new org.apache.thrift.protocol.TField("constraint", org.apache.thrift.protocol.TType.STRUCT, (short)2); + + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new ConstraintStandardSchemeFactory()); + schemes.put(TupleScheme.class, new ConstraintTupleSchemeFactory()); + } + + /** + * Mesos slave attribute that the constraint is matched against. + */ + public String name; // required + public TaskConstraint constraint; // 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 { + /** + * Mesos slave attribute that the constraint is matched against. + */ + NAME((short)1, "name"), + CONSTRAINT((short)2, "constraint"); + + 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: // CONSTRAINT + return CONSTRAINT; + 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.CONSTRAINT, new org.apache.thrift.meta_data.FieldMetaData("constraint", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TaskConstraint.class))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(Constraint.class, metaDataMap); + } + + public Constraint() { + } + + public Constraint( + String name, + TaskConstraint constraint) + { + this(); + this.name = name; + this.constraint = constraint; + } + + /** + * Performs a deep copy on <i>other</i>. + */ + public Constraint(Constraint other) { + if (other.isSetName()) { + this.name = other.name; + } + if (other.isSetConstraint()) { + this.constraint = new TaskConstraint(other.constraint); + } + } + + public Constraint deepCopy() { + return new Constraint(this); + } + + @Override + public void clear() { + this.name = null; + this.constraint = null; + } + + /** + * Mesos slave attribute that the constraint is matched against. + */ + public String getName() { + return this.name; + } + + /** + * Mesos slave attribute that the constraint is matched against. + */ + public Constraint 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; + } + } + + public TaskConstraint getConstraint() { + return this.constraint; + } + + public Constraint setConstraint(TaskConstraint constraint) { + this.constraint = constraint; + return this; + } + + public void unsetConstraint() { + this.constraint = null; + } + + /** Returns true if field constraint is set (has been assigned a value) and false otherwise */ + public boolean isSetConstraint() { + return this.constraint != null; + } + + public void setConstraintIsSet(boolean value) { + if (!value) { + this.constraint = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case NAME: + if (value == null) { + unsetName(); + } else { + setName((String)value); + } + break; + + case CONSTRAINT: + if (value == null) { + unsetConstraint(); + } else { + setConstraint((TaskConstraint)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case NAME: + return getName(); + + case CONSTRAINT: + return getConstraint(); + + } + 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 CONSTRAINT: + return isSetConstraint(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof Constraint) + return this.equals((Constraint)that); + return false; + } + + public boolean equals(Constraint 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_constraint = true && this.isSetConstraint(); + boolean that_present_constraint = true && that.isSetConstraint(); + if (this_present_constraint || that_present_constraint) { + if (!(this_present_constraint && that_present_constraint)) + return false; + if (!this.constraint.equals(that.constraint)) + 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_constraint = true && (isSetConstraint()); + list.add(present_constraint); + if (present_constraint) + list.add(constraint); + + return list.hashCode(); + } + + @Override + public int compareTo(Constraint 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(isSetConstraint()).compareTo(other.isSetConstraint()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetConstraint()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.constraint, other.constraint); + 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("Constraint("); + 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("constraint:"); + if (this.constraint == null) { + sb.append("null"); + } else { + sb.append(this.constraint); + } + 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 ConstraintStandardSchemeFactory implements SchemeFactory { + public ConstraintStandardScheme getScheme() { + return new ConstraintStandardScheme(); + } + } + + private static class ConstraintStandardScheme extends StandardScheme<Constraint> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, Constraint 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: // CONSTRAINT + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.constraint = new TaskConstraint(); + struct.constraint.read(iprot); + struct.setConstraintIsSet(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, Constraint 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.constraint != null) { + oprot.writeFieldBegin(CONSTRAINT_FIELD_DESC); + struct.constraint.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class ConstraintTupleSchemeFactory implements SchemeFactory { + public ConstraintTupleScheme getScheme() { + return new ConstraintTupleScheme(); + } + } + + private static class ConstraintTupleScheme extends TupleScheme<Constraint> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, Constraint struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetName()) { + optionals.set(0); + } + if (struct.isSetConstraint()) { + optionals.set(1); + } + oprot.writeBitSet(optionals, 2); + if (struct.isSetName()) { + oprot.writeString(struct.name); + } + if (struct.isSetConstraint()) { + struct.constraint.write(oprot); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, Constraint 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.constraint = new TaskConstraint(); + struct.constraint.read(iprot); + struct.setConstraintIsSet(true); + } + } + } + +} +
