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/InstanceKey.java ---------------------------------------------------------------------- diff --git a/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/sdk/InstanceKey.java b/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/sdk/InstanceKey.java new file mode 100644 index 0000000..084970e --- /dev/null +++ b/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/sdk/InstanceKey.java @@ -0,0 +1,533 @@ +/** + * 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 unique identifier for the active task within a job. + */ +@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2016-10-21") +public class InstanceKey implements org.apache.thrift.TBase<InstanceKey, InstanceKey._Fields>, java.io.Serializable, Cloneable, Comparable<InstanceKey> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("InstanceKey"); + + private static final org.apache.thrift.protocol.TField JOB_KEY_FIELD_DESC = new org.apache.thrift.protocol.TField("jobKey", org.apache.thrift.protocol.TType.STRUCT, (short)1); + private static final org.apache.thrift.protocol.TField INSTANCE_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("instanceId", org.apache.thrift.protocol.TType.I32, (short)2); + + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new InstanceKeyStandardSchemeFactory()); + schemes.put(TupleScheme.class, new InstanceKeyTupleSchemeFactory()); + } + + /** + * Key identifying the job. + */ + public JobKey jobKey; // required + /** + * Unique instance ID for the active task in a job. + */ + public int instanceId; // 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 identifying the job. + */ + JOB_KEY((short)1, "jobKey"), + /** + * Unique instance ID for the active task in a job. + */ + INSTANCE_ID((short)2, "instanceId"); + + 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_KEY + return JOB_KEY; + case 2: // INSTANCE_ID + return INSTANCE_ID; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception + * if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** + * Find the _Fields constant that matches name, or null if its not found. + */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __INSTANCEID_ISSET_ID = 0; + private byte __isset_bitfield = 0; + 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_KEY, new org.apache.thrift.meta_data.FieldMetaData("jobKey", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, JobKey.class))); + tmpMap.put(_Fields.INSTANCE_ID, new org.apache.thrift.meta_data.FieldMetaData("instanceId", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(InstanceKey.class, metaDataMap); + } + + public InstanceKey() { + } + + public InstanceKey( + JobKey jobKey, + int instanceId) + { + this(); + this.jobKey = jobKey; + this.instanceId = instanceId; + setInstanceIdIsSet(true); + } + + /** + * Performs a deep copy on <i>other</i>. + */ + public InstanceKey(InstanceKey other) { + __isset_bitfield = other.__isset_bitfield; + if (other.isSetJobKey()) { + this.jobKey = new JobKey(other.jobKey); + } + this.instanceId = other.instanceId; + } + + public InstanceKey deepCopy() { + return new InstanceKey(this); + } + + @Override + public void clear() { + this.jobKey = null; + setInstanceIdIsSet(false); + this.instanceId = 0; + } + + /** + * Key identifying the job. + */ + public JobKey getJobKey() { + return this.jobKey; + } + + /** + * Key identifying the job. + */ + public InstanceKey setJobKey(JobKey jobKey) { + this.jobKey = jobKey; + return this; + } + + public void unsetJobKey() { + this.jobKey = null; + } + + /** Returns true if field jobKey is set (has been assigned a value) and false otherwise */ + public boolean isSetJobKey() { + return this.jobKey != null; + } + + public void setJobKeyIsSet(boolean value) { + if (!value) { + this.jobKey = null; + } + } + + /** + * Unique instance ID for the active task in a job. + */ + public int getInstanceId() { + return this.instanceId; + } + + /** + * Unique instance ID for the active task in a job. + */ + public InstanceKey setInstanceId(int instanceId) { + this.instanceId = instanceId; + setInstanceIdIsSet(true); + return this; + } + + public void unsetInstanceId() { + __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __INSTANCEID_ISSET_ID); + } + + /** Returns true if field instanceId is set (has been assigned a value) and false otherwise */ + public boolean isSetInstanceId() { + return EncodingUtils.testBit(__isset_bitfield, __INSTANCEID_ISSET_ID); + } + + public void setInstanceIdIsSet(boolean value) { + __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __INSTANCEID_ISSET_ID, value); + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case JOB_KEY: + if (value == null) { + unsetJobKey(); + } else { + setJobKey((JobKey)value); + } + break; + + case INSTANCE_ID: + if (value == null) { + unsetInstanceId(); + } else { + setInstanceId((Integer)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case JOB_KEY: + return getJobKey(); + + case INSTANCE_ID: + return getInstanceId(); + + } + 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 JOB_KEY: + return isSetJobKey(); + case INSTANCE_ID: + return isSetInstanceId(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof InstanceKey) + return this.equals((InstanceKey)that); + return false; + } + + public boolean equals(InstanceKey that) { + if (that == null) + return false; + + boolean this_present_jobKey = true && this.isSetJobKey(); + boolean that_present_jobKey = true && that.isSetJobKey(); + if (this_present_jobKey || that_present_jobKey) { + if (!(this_present_jobKey && that_present_jobKey)) + return false; + if (!this.jobKey.equals(that.jobKey)) + return false; + } + + boolean this_present_instanceId = true; + boolean that_present_instanceId = true; + if (this_present_instanceId || that_present_instanceId) { + if (!(this_present_instanceId && that_present_instanceId)) + return false; + if (this.instanceId != that.instanceId) + return false; + } + + return true; + } + + @Override + public int hashCode() { + List<Object> list = new ArrayList<Object>(); + + boolean present_jobKey = true && (isSetJobKey()); + list.add(present_jobKey); + if (present_jobKey) + list.add(jobKey); + + boolean present_instanceId = true; + list.add(present_instanceId); + if (present_instanceId) + list.add(instanceId); + + return list.hashCode(); + } + + @Override + public int compareTo(InstanceKey other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetJobKey()).compareTo(other.isSetJobKey()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetJobKey()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.jobKey, other.jobKey); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetInstanceId()).compareTo(other.isSetInstanceId()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetInstanceId()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.instanceId, other.instanceId); + 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("InstanceKey("); + boolean first = true; + + sb.append("jobKey:"); + if (this.jobKey == null) { + sb.append("null"); + } else { + sb.append(this.jobKey); + } + first = false; + if (!first) sb.append(", "); + sb.append("instanceId:"); + sb.append(this.instanceId); + 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 (jobKey != null) { + jobKey.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 { + // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor. + __isset_bitfield = 0; + 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 InstanceKeyStandardSchemeFactory implements SchemeFactory { + public InstanceKeyStandardScheme getScheme() { + return new InstanceKeyStandardScheme(); + } + } + + private static class InstanceKeyStandardScheme extends StandardScheme<InstanceKey> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, InstanceKey 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: // JOB_KEY + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.jobKey = new JobKey(); + struct.jobKey.read(iprot); + struct.setJobKeyIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // INSTANCE_ID + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.instanceId = iprot.readI32(); + struct.setInstanceIdIsSet(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, InstanceKey struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.jobKey != null) { + oprot.writeFieldBegin(JOB_KEY_FIELD_DESC); + struct.jobKey.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldBegin(INSTANCE_ID_FIELD_DESC); + oprot.writeI32(struct.instanceId); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class InstanceKeyTupleSchemeFactory implements SchemeFactory { + public InstanceKeyTupleScheme getScheme() { + return new InstanceKeyTupleScheme(); + } + } + + private static class InstanceKeyTupleScheme extends TupleScheme<InstanceKey> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, InstanceKey struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetJobKey()) { + optionals.set(0); + } + if (struct.isSetInstanceId()) { + optionals.set(1); + } + oprot.writeBitSet(optionals, 2); + if (struct.isSetJobKey()) { + struct.jobKey.write(oprot); + } + if (struct.isSetInstanceId()) { + oprot.writeI32(struct.instanceId); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, InstanceKey struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(2); + if (incoming.get(0)) { + struct.jobKey = new JobKey(); + struct.jobKey.read(iprot); + struct.setJobKeyIsSet(true); + } + if (incoming.get(1)) { + struct.instanceId = iprot.readI32(); + struct.setInstanceIdIsSet(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/InstanceTaskConfig.java ---------------------------------------------------------------------- diff --git a/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/sdk/InstanceTaskConfig.java b/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/sdk/InstanceTaskConfig.java new file mode 100644 index 0000000..2572eba --- /dev/null +++ b/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/sdk/InstanceTaskConfig.java @@ -0,0 +1,589 @@ +/** + * 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"}) +/** + * Maps instance IDs to TaskConfigs it. + */ +@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2016-10-21") +public class InstanceTaskConfig implements org.apache.thrift.TBase<InstanceTaskConfig, InstanceTaskConfig._Fields>, java.io.Serializable, Cloneable, Comparable<InstanceTaskConfig> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("InstanceTaskConfig"); + + private static final org.apache.thrift.protocol.TField TASK_FIELD_DESC = new org.apache.thrift.protocol.TField("task", 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)2); + + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new InstanceTaskConfigStandardSchemeFactory()); + schemes.put(TupleScheme.class, new InstanceTaskConfigTupleSchemeFactory()); + } + + /** + * A TaskConfig associated with instances. + */ + public TaskConfig task; // required + /** + * Instances associated with the TaskConfig. + */ + 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 { + /** + * A TaskConfig associated with instances. + */ + TASK((short)1, "task"), + /** + * Instances associated with the TaskConfig. + */ + INSTANCES((short)2, "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: // TASK + return TASK; + case 2: // 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.TASK, new org.apache.thrift.meta_data.FieldMetaData("task", 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(InstanceTaskConfig.class, metaDataMap); + } + + public InstanceTaskConfig() { + } + + public InstanceTaskConfig( + TaskConfig task, + Set<Range> instances) + { + this(); + this.task = task; + this.instances = instances; + } + + /** + * Performs a deep copy on <i>other</i>. + */ + public InstanceTaskConfig(InstanceTaskConfig other) { + if (other.isSetTask()) { + this.task = new TaskConfig(other.task); + } + 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 InstanceTaskConfig deepCopy() { + return new InstanceTaskConfig(this); + } + + @Override + public void clear() { + this.task = null; + this.instances = null; + } + + /** + * A TaskConfig associated with instances. + */ + public TaskConfig getTask() { + return this.task; + } + + /** + * A TaskConfig associated with instances. + */ + public InstanceTaskConfig setTask(TaskConfig task) { + this.task = task; + return this; + } + + public void unsetTask() { + this.task = null; + } + + /** Returns true if field task is set (has been assigned a value) and false otherwise */ + public boolean isSetTask() { + return this.task != null; + } + + public void setTaskIsSet(boolean value) { + if (!value) { + this.task = 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); + } + + /** + * Instances associated with the TaskConfig. + */ + public Set<Range> getInstances() { + return this.instances; + } + + /** + * Instances associated with the TaskConfig. + */ + public InstanceTaskConfig 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 TASK: + if (value == null) { + unsetTask(); + } else { + setTask((TaskConfig)value); + } + break; + + case INSTANCES: + if (value == null) { + unsetInstances(); + } else { + setInstances((Set<Range>)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case TASK: + return getTask(); + + 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 TASK: + return isSetTask(); + case INSTANCES: + return isSetInstances(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof InstanceTaskConfig) + return this.equals((InstanceTaskConfig)that); + return false; + } + + public boolean equals(InstanceTaskConfig that) { + if (that == null) + return false; + + boolean this_present_task = true && this.isSetTask(); + boolean that_present_task = true && that.isSetTask(); + if (this_present_task || that_present_task) { + if (!(this_present_task && that_present_task)) + return false; + if (!this.task.equals(that.task)) + 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_task = true && (isSetTask()); + list.add(present_task); + if (present_task) + list.add(task); + + boolean present_instances = true && (isSetInstances()); + list.add(present_instances); + if (present_instances) + list.add(instances); + + return list.hashCode(); + } + + @Override + public int compareTo(InstanceTaskConfig other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetTask()).compareTo(other.isSetTask()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetTask()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.task, other.task); + 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("InstanceTaskConfig("); + boolean first = true; + + sb.append("task:"); + if (this.task == null) { + sb.append("null"); + } else { + sb.append(this.task); + } + 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 (task != null) { + task.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 InstanceTaskConfigStandardSchemeFactory implements SchemeFactory { + public InstanceTaskConfigStandardScheme getScheme() { + return new InstanceTaskConfigStandardScheme(); + } + } + + private static class InstanceTaskConfigStandardScheme extends StandardScheme<InstanceTaskConfig> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, InstanceTaskConfig 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: // TASK + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.task = new TaskConfig(); + struct.task.read(iprot); + struct.setTaskIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // INSTANCES + if (schemeField.type == org.apache.thrift.protocol.TType.SET) { + { + org.apache.thrift.protocol.TSet _set198 = iprot.readSetBegin(); + struct.instances = new HashSet<Range>(2*_set198.size); + Range _elem199; + for (int _i200 = 0; _i200 < _set198.size; ++_i200) + { + _elem199 = new Range(); + _elem199.read(iprot); + struct.instances.add(_elem199); + } + 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, InstanceTaskConfig struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.task != null) { + oprot.writeFieldBegin(TASK_FIELD_DESC); + struct.task.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 _iter201 : struct.instances) + { + _iter201.write(oprot); + } + oprot.writeSetEnd(); + } + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class InstanceTaskConfigTupleSchemeFactory implements SchemeFactory { + public InstanceTaskConfigTupleScheme getScheme() { + return new InstanceTaskConfigTupleScheme(); + } + } + + private static class InstanceTaskConfigTupleScheme extends TupleScheme<InstanceTaskConfig> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, InstanceTaskConfig struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetTask()) { + optionals.set(0); + } + if (struct.isSetInstances()) { + optionals.set(1); + } + oprot.writeBitSet(optionals, 2); + if (struct.isSetTask()) { + struct.task.write(oprot); + } + if (struct.isSetInstances()) { + { + oprot.writeI32(struct.instances.size()); + for (Range _iter202 : struct.instances) + { + _iter202.write(oprot); + } + } + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, InstanceTaskConfig struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(2); + if (incoming.get(0)) { + struct.task = new TaskConfig(); + struct.task.read(iprot); + struct.setTaskIsSet(true); + } + if (incoming.get(1)) { + { + org.apache.thrift.protocol.TSet _set203 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); + struct.instances = new HashSet<Range>(2*_set203.size); + Range _elem204; + for (int _i205 = 0; _i205 < _set203.size; ++_i205) + { + _elem204 = new Range(); + _elem204.read(iprot); + struct.instances.add(_elem204); + } + } + 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/JobConfigRewrite.java ---------------------------------------------------------------------- diff --git a/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/sdk/JobConfigRewrite.java b/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/sdk/JobConfigRewrite.java new file mode 100644 index 0000000..d012b93 --- /dev/null +++ b/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/sdk/JobConfigRewrite.java @@ -0,0 +1,537 @@ +/** + * 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 JobConfigRewrite implements org.apache.thrift.TBase<JobConfigRewrite, JobConfigRewrite._Fields>, java.io.Serializable, Cloneable, Comparable<JobConfigRewrite> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("JobConfigRewrite"); + + private static final org.apache.thrift.protocol.TField OLD_JOB_FIELD_DESC = new org.apache.thrift.protocol.TField("oldJob", org.apache.thrift.protocol.TType.STRUCT, (short)1); + private static final org.apache.thrift.protocol.TField REWRITTEN_JOB_FIELD_DESC = new org.apache.thrift.protocol.TField("rewrittenJob", 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 JobConfigRewriteStandardSchemeFactory()); + schemes.put(TupleScheme.class, new JobConfigRewriteTupleSchemeFactory()); + } + + /** + * The original job configuration. + */ + public JobConfiguration oldJob; // required + /** + * The rewritten job configuration. + */ + public JobConfiguration rewrittenJob; // 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 original job configuration. + */ + OLD_JOB((short)1, "oldJob"), + /** + * The rewritten job configuration. + */ + REWRITTEN_JOB((short)2, "rewrittenJob"); + + 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: // OLD_JOB + return OLD_JOB; + case 2: // REWRITTEN_JOB + return REWRITTEN_JOB; + 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.OLD_JOB, new org.apache.thrift.meta_data.FieldMetaData("oldJob", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, JobConfiguration.class))); + tmpMap.put(_Fields.REWRITTEN_JOB, new org.apache.thrift.meta_data.FieldMetaData("rewrittenJob", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, JobConfiguration.class))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(JobConfigRewrite.class, metaDataMap); + } + + public JobConfigRewrite() { + } + + public JobConfigRewrite( + JobConfiguration oldJob, + JobConfiguration rewrittenJob) + { + this(); + this.oldJob = oldJob; + this.rewrittenJob = rewrittenJob; + } + + /** + * Performs a deep copy on <i>other</i>. + */ + public JobConfigRewrite(JobConfigRewrite other) { + if (other.isSetOldJob()) { + this.oldJob = new JobConfiguration(other.oldJob); + } + if (other.isSetRewrittenJob()) { + this.rewrittenJob = new JobConfiguration(other.rewrittenJob); + } + } + + public JobConfigRewrite deepCopy() { + return new JobConfigRewrite(this); + } + + @Override + public void clear() { + this.oldJob = null; + this.rewrittenJob = null; + } + + /** + * The original job configuration. + */ + public JobConfiguration getOldJob() { + return this.oldJob; + } + + /** + * The original job configuration. + */ + public JobConfigRewrite setOldJob(JobConfiguration oldJob) { + this.oldJob = oldJob; + return this; + } + + public void unsetOldJob() { + this.oldJob = null; + } + + /** Returns true if field oldJob is set (has been assigned a value) and false otherwise */ + public boolean isSetOldJob() { + return this.oldJob != null; + } + + public void setOldJobIsSet(boolean value) { + if (!value) { + this.oldJob = null; + } + } + + /** + * The rewritten job configuration. + */ + public JobConfiguration getRewrittenJob() { + return this.rewrittenJob; + } + + /** + * The rewritten job configuration. + */ + public JobConfigRewrite setRewrittenJob(JobConfiguration rewrittenJob) { + this.rewrittenJob = rewrittenJob; + return this; + } + + public void unsetRewrittenJob() { + this.rewrittenJob = null; + } + + /** Returns true if field rewrittenJob is set (has been assigned a value) and false otherwise */ + public boolean isSetRewrittenJob() { + return this.rewrittenJob != null; + } + + public void setRewrittenJobIsSet(boolean value) { + if (!value) { + this.rewrittenJob = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case OLD_JOB: + if (value == null) { + unsetOldJob(); + } else { + setOldJob((JobConfiguration)value); + } + break; + + case REWRITTEN_JOB: + if (value == null) { + unsetRewrittenJob(); + } else { + setRewrittenJob((JobConfiguration)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case OLD_JOB: + return getOldJob(); + + case REWRITTEN_JOB: + return getRewrittenJob(); + + } + 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 OLD_JOB: + return isSetOldJob(); + case REWRITTEN_JOB: + return isSetRewrittenJob(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof JobConfigRewrite) + return this.equals((JobConfigRewrite)that); + return false; + } + + public boolean equals(JobConfigRewrite that) { + if (that == null) + return false; + + boolean this_present_oldJob = true && this.isSetOldJob(); + boolean that_present_oldJob = true && that.isSetOldJob(); + if (this_present_oldJob || that_present_oldJob) { + if (!(this_present_oldJob && that_present_oldJob)) + return false; + if (!this.oldJob.equals(that.oldJob)) + return false; + } + + boolean this_present_rewrittenJob = true && this.isSetRewrittenJob(); + boolean that_present_rewrittenJob = true && that.isSetRewrittenJob(); + if (this_present_rewrittenJob || that_present_rewrittenJob) { + if (!(this_present_rewrittenJob && that_present_rewrittenJob)) + return false; + if (!this.rewrittenJob.equals(that.rewrittenJob)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + List<Object> list = new ArrayList<Object>(); + + boolean present_oldJob = true && (isSetOldJob()); + list.add(present_oldJob); + if (present_oldJob) + list.add(oldJob); + + boolean present_rewrittenJob = true && (isSetRewrittenJob()); + list.add(present_rewrittenJob); + if (present_rewrittenJob) + list.add(rewrittenJob); + + return list.hashCode(); + } + + @Override + public int compareTo(JobConfigRewrite other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetOldJob()).compareTo(other.isSetOldJob()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetOldJob()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.oldJob, other.oldJob); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetRewrittenJob()).compareTo(other.isSetRewrittenJob()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetRewrittenJob()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.rewrittenJob, other.rewrittenJob); + 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("JobConfigRewrite("); + boolean first = true; + + sb.append("oldJob:"); + if (this.oldJob == null) { + sb.append("null"); + } else { + sb.append(this.oldJob); + } + first = false; + if (!first) sb.append(", "); + sb.append("rewrittenJob:"); + if (this.rewrittenJob == null) { + sb.append("null"); + } else { + sb.append(this.rewrittenJob); + } + 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 (oldJob != null) { + oldJob.validate(); + } + if (rewrittenJob != null) { + rewrittenJob.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 JobConfigRewriteStandardSchemeFactory implements SchemeFactory { + public JobConfigRewriteStandardScheme getScheme() { + return new JobConfigRewriteStandardScheme(); + } + } + + private static class JobConfigRewriteStandardScheme extends StandardScheme<JobConfigRewrite> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, JobConfigRewrite 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: // OLD_JOB + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.oldJob = new JobConfiguration(); + struct.oldJob.read(iprot); + struct.setOldJobIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // REWRITTEN_JOB + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.rewrittenJob = new JobConfiguration(); + struct.rewrittenJob.read(iprot); + struct.setRewrittenJobIsSet(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, JobConfigRewrite struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.oldJob != null) { + oprot.writeFieldBegin(OLD_JOB_FIELD_DESC); + struct.oldJob.write(oprot); + oprot.writeFieldEnd(); + } + if (struct.rewrittenJob != null) { + oprot.writeFieldBegin(REWRITTEN_JOB_FIELD_DESC); + struct.rewrittenJob.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class JobConfigRewriteTupleSchemeFactory implements SchemeFactory { + public JobConfigRewriteTupleScheme getScheme() { + return new JobConfigRewriteTupleScheme(); + } + } + + private static class JobConfigRewriteTupleScheme extends TupleScheme<JobConfigRewrite> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, JobConfigRewrite struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetOldJob()) { + optionals.set(0); + } + if (struct.isSetRewrittenJob()) { + optionals.set(1); + } + oprot.writeBitSet(optionals, 2); + if (struct.isSetOldJob()) { + struct.oldJob.write(oprot); + } + if (struct.isSetRewrittenJob()) { + struct.rewrittenJob.write(oprot); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, JobConfigRewrite struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(2); + if (incoming.get(0)) { + struct.oldJob = new JobConfiguration(); + struct.oldJob.read(iprot); + struct.setOldJobIsSet(true); + } + if (incoming.get(1)) { + struct.rewrittenJob = new JobConfiguration(); + struct.rewrittenJob.read(iprot); + struct.setRewrittenJobIsSet(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/JobConfiguration.java ---------------------------------------------------------------------- diff --git a/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/sdk/JobConfiguration.java b/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/sdk/JobConfiguration.java new file mode 100644 index 0000000..ea56e88 --- /dev/null +++ b/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/sdk/JobConfiguration.java @@ -0,0 +1,1030 @@ +/** + * 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"}) +/** + * Description of an Aurora job. One task will be scheduled for each instance within the job. + */ +@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2016-10-21") +public class JobConfiguration implements org.apache.thrift.TBase<JobConfiguration, JobConfiguration._Fields>, java.io.Serializable, Cloneable, Comparable<JobConfiguration> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("JobConfiguration"); + + 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)9); + private static final org.apache.thrift.protocol.TField OWNER_FIELD_DESC = new org.apache.thrift.protocol.TField("owner", org.apache.thrift.protocol.TType.STRUCT, (short)7); + private static final org.apache.thrift.protocol.TField CRON_SCHEDULE_FIELD_DESC = new org.apache.thrift.protocol.TField("cronSchedule", org.apache.thrift.protocol.TType.STRING, (short)4); + private static final org.apache.thrift.protocol.TField CRON_COLLISION_POLICY_FIELD_DESC = new org.apache.thrift.protocol.TField("cronCollisionPolicy", org.apache.thrift.protocol.TType.I32, (short)5); + private static final org.apache.thrift.protocol.TField TASK_CONFIG_FIELD_DESC = new org.apache.thrift.protocol.TField("taskConfig", org.apache.thrift.protocol.TType.STRUCT, (short)6); + private static final org.apache.thrift.protocol.TField INSTANCE_COUNT_FIELD_DESC = new org.apache.thrift.protocol.TField("instanceCount", org.apache.thrift.protocol.TType.I32, (short)8); + + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new JobConfigurationStandardSchemeFactory()); + schemes.put(TupleScheme.class, new JobConfigurationTupleSchemeFactory()); + } + + /** + * Key for this job. If not specified name, owner.role, and a reasonable default environment are + * used to construct it server-side. + */ + public JobKey key; // required + /** + * Owner of this job. + */ + public Identity owner; // required + /** + * If present, the job will be handled as a cron job with this crontab-syntax schedule. + */ + public String cronSchedule; // optional + /** + * Collision policy to use when handling overlapping cron runs. Default is KILL_EXISTING. + * + * @see CronCollisionPolicy + */ + public CronCollisionPolicy cronCollisionPolicy; // required + /** + * Task configuration for this job. + */ + public TaskConfig taskConfig; // required + /** + * The number of instances in the job. Generated instance IDs for tasks will be in the range + * [0, instances). + */ + public int instanceCount; // 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 for this job. If not specified name, owner.role, and a reasonable default environment are + * used to construct it server-side. + */ + KEY((short)9, "key"), + /** + * Owner of this job. + */ + OWNER((short)7, "owner"), + /** + * If present, the job will be handled as a cron job with this crontab-syntax schedule. + */ + CRON_SCHEDULE((short)4, "cronSchedule"), + /** + * Collision policy to use when handling overlapping cron runs. Default is KILL_EXISTING. + * + * @see CronCollisionPolicy + */ + CRON_COLLISION_POLICY((short)5, "cronCollisionPolicy"), + /** + * Task configuration for this job. + */ + TASK_CONFIG((short)6, "taskConfig"), + /** + * The number of instances in the job. Generated instance IDs for tasks will be in the range + * [0, instances). + */ + INSTANCE_COUNT((short)8, "instanceCount"); + + 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 9: // KEY + return KEY; + case 7: // OWNER + return OWNER; + case 4: // CRON_SCHEDULE + return CRON_SCHEDULE; + case 5: // CRON_COLLISION_POLICY + return CRON_COLLISION_POLICY; + case 6: // TASK_CONFIG + return TASK_CONFIG; + case 8: // INSTANCE_COUNT + return INSTANCE_COUNT; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception + * if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** + * Find the _Fields constant that matches name, or null if its not found. + */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __INSTANCECOUNT_ISSET_ID = 0; + private byte __isset_bitfield = 0; + private static final _Fields optionals[] = {_Fields.CRON_SCHEDULE}; + 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.OWNER, new org.apache.thrift.meta_data.FieldMetaData("owner", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, Identity.class))); + tmpMap.put(_Fields.CRON_SCHEDULE, new org.apache.thrift.meta_data.FieldMetaData("cronSchedule", org.apache.thrift.TFieldRequirementType.OPTIONAL, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + tmpMap.put(_Fields.CRON_COLLISION_POLICY, new org.apache.thrift.meta_data.FieldMetaData("cronCollisionPolicy", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, CronCollisionPolicy.class))); + tmpMap.put(_Fields.TASK_CONFIG, new org.apache.thrift.meta_data.FieldMetaData("taskConfig", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TaskConfig.class))); + tmpMap.put(_Fields.INSTANCE_COUNT, new org.apache.thrift.meta_data.FieldMetaData("instanceCount", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(JobConfiguration.class, metaDataMap); + } + + public JobConfiguration() { + } + + public JobConfiguration( + JobKey key, + Identity owner, + CronCollisionPolicy cronCollisionPolicy, + TaskConfig taskConfig, + int instanceCount) + { + this(); + this.key = key; + this.owner = owner; + this.cronCollisionPolicy = cronCollisionPolicy; + this.taskConfig = taskConfig; + this.instanceCount = instanceCount; + setInstanceCountIsSet(true); + } + + /** + * Performs a deep copy on <i>other</i>. + */ + public JobConfiguration(JobConfiguration other) { + __isset_bitfield = other.__isset_bitfield; + if (other.isSetKey()) { + this.key = new JobKey(other.key); + } + if (other.isSetOwner()) { + this.owner = new Identity(other.owner); + } + if (other.isSetCronSchedule()) { + this.cronSchedule = other.cronSchedule; + } + if (other.isSetCronCollisionPolicy()) { + this.cronCollisionPolicy = other.cronCollisionPolicy; + } + if (other.isSetTaskConfig()) { + this.taskConfig = new TaskConfig(other.taskConfig); + } + this.instanceCount = other.instanceCount; + } + + public JobConfiguration deepCopy() { + return new JobConfiguration(this); + } + + @Override + public void clear() { + this.key = null; + this.owner = null; + this.cronSchedule = null; + this.cronCollisionPolicy = null; + this.taskConfig = null; + setInstanceCountIsSet(false); + this.instanceCount = 0; + } + + /** + * Key for this job. If not specified name, owner.role, and a reasonable default environment are + * used to construct it server-side. + */ + public JobKey getKey() { + return this.key; + } + + /** + * Key for this job. If not specified name, owner.role, and a reasonable default environment are + * used to construct it server-side. + */ + public JobConfiguration 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; + } + } + + /** + * Owner of this job. + */ + public Identity getOwner() { + return this.owner; + } + + /** + * Owner of this job. + */ + public JobConfiguration setOwner(Identity owner) { + this.owner = owner; + return this; + } + + public void unsetOwner() { + this.owner = null; + } + + /** Returns true if field owner is set (has been assigned a value) and false otherwise */ + public boolean isSetOwner() { + return this.owner != null; + } + + public void setOwnerIsSet(boolean value) { + if (!value) { + this.owner = null; + } + } + + /** + * If present, the job will be handled as a cron job with this crontab-syntax schedule. + */ + public String getCronSchedule() { + return this.cronSchedule; + } + + /** + * If present, the job will be handled as a cron job with this crontab-syntax schedule. + */ + public JobConfiguration setCronSchedule(String cronSchedule) { + this.cronSchedule = cronSchedule; + return this; + } + + public void unsetCronSchedule() { + this.cronSchedule = null; + } + + /** Returns true if field cronSchedule is set (has been assigned a value) and false otherwise */ + public boolean isSetCronSchedule() { + return this.cronSchedule != null; + } + + public void setCronScheduleIsSet(boolean value) { + if (!value) { + this.cronSchedule = null; + } + } + + /** + * Collision policy to use when handling overlapping cron runs. Default is KILL_EXISTING. + * + * @see CronCollisionPolicy + */ + public CronCollisionPolicy getCronCollisionPolicy() { + return this.cronCollisionPolicy; + } + + /** + * Collision policy to use when handling overlapping cron runs. Default is KILL_EXISTING. + * + * @see CronCollisionPolicy + */ + public JobConfiguration setCronCollisionPolicy(CronCollisionPolicy cronCollisionPolicy) { + this.cronCollisionPolicy = cronCollisionPolicy; + return this; + } + + public void unsetCronCollisionPolicy() { + this.cronCollisionPolicy = null; + } + + /** Returns true if field cronCollisionPolicy is set (has been assigned a value) and false otherwise */ + public boolean isSetCronCollisionPolicy() { + return this.cronCollisionPolicy != null; + } + + public void setCronCollisionPolicyIsSet(boolean value) { + if (!value) { + this.cronCollisionPolicy = null; + } + } + + /** + * Task configuration for this job. + */ + public TaskConfig getTaskConfig() { + return this.taskConfig; + } + + /** + * Task configuration for this job. + */ + public JobConfiguration setTaskConfig(TaskConfig taskConfig) { + this.taskConfig = taskConfig; + return this; + } + + public void unsetTaskConfig() { + this.taskConfig = null; + } + + /** Returns true if field taskConfig is set (has been assigned a value) and false otherwise */ + public boolean isSetTaskConfig() { + return this.taskConfig != null; + } + + public void setTaskConfigIsSet(boolean value) { + if (!value) { + this.taskConfig = null; + } + } + + /** + * The number of instances in the job. Generated instance IDs for tasks will be in the range + * [0, instances). + */ + public int getInstanceCount() { + return this.instanceCount; + } + + /** + * The number of instances in the job. Generated instance IDs for tasks will be in the range + * [0, instances). + */ + public JobConfiguration setInstanceCount(int instanceCount) { + this.instanceCount = instanceCount; + setInstanceCountIsSet(true); + return this; + } + + public void unsetInstanceCount() { + __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __INSTANCECOUNT_ISSET_ID); + } + + /** Returns true if field instanceCount is set (has been assigned a value) and false otherwise */ + public boolean isSetInstanceCount() { + return EncodingUtils.testBit(__isset_bitfield, __INSTANCECOUNT_ISSET_ID); + } + + public void setInstanceCountIsSet(boolean value) { + __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __INSTANCECOUNT_ISSET_ID, value); + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case KEY: + if (value == null) { + unsetKey(); + } else { + setKey((JobKey)value); + } + break; + + case OWNER: + if (value == null) { + unsetOwner(); + } else { + setOwner((Identity)value); + } + break; + + case CRON_SCHEDULE: + if (value == null) { + unsetCronSchedule(); + } else { + setCronSchedule((String)value); + } + break; + + case CRON_COLLISION_POLICY: + if (value == null) { + unsetCronCollisionPolicy(); + } else { + setCronCollisionPolicy((CronCollisionPolicy)value); + } + break; + + case TASK_CONFIG: + if (value == null) { + unsetTaskConfig(); + } else { + setTaskConfig((TaskConfig)value); + } + break; + + case INSTANCE_COUNT: + if (value == null) { + unsetInstanceCount(); + } else { + setInstanceCount((Integer)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case KEY: + return getKey(); + + case OWNER: + return getOwner(); + + case CRON_SCHEDULE: + return getCronSchedule(); + + case CRON_COLLISION_POLICY: + return getCronCollisionPolicy(); + + case TASK_CONFIG: + return getTaskConfig(); + + case INSTANCE_COUNT: + return getInstanceCount(); + + } + 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 OWNER: + return isSetOwner(); + case CRON_SCHEDULE: + return isSetCronSchedule(); + case CRON_COLLISION_POLICY: + return isSetCronCollisionPolicy(); + case TASK_CONFIG: + return isSetTaskConfig(); + case INSTANCE_COUNT: + return isSetInstanceCount(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof JobConfiguration) + return this.equals((JobConfiguration)that); + return false; + } + + public boolean equals(JobConfiguration 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_owner = true && this.isSetOwner(); + boolean that_present_owner = true && that.isSetOwner(); + if (this_present_owner || that_present_owner) { + if (!(this_present_owner && that_present_owner)) + return false; + if (!this.owner.equals(that.owner)) + return false; + } + + boolean this_present_cronSchedule = true && this.isSetCronSchedule(); + boolean that_present_cronSchedule = true && that.isSetCronSchedule(); + if (this_present_cronSchedule || that_present_cronSchedule) { + if (!(this_present_cronSchedule && that_present_cronSchedule)) + return false; + if (!this.cronSchedule.equals(that.cronSchedule)) + return false; + } + + boolean this_present_cronCollisionPolicy = true && this.isSetCronCollisionPolicy(); + boolean that_present_cronCollisionPolicy = true && that.isSetCronCollisionPolicy(); + if (this_present_cronCollisionPolicy || that_present_cronCollisionPolicy) { + if (!(this_present_cronCollisionPolicy && that_present_cronCollisionPolicy)) + return false; + if (!this.cronCollisionPolicy.equals(that.cronCollisionPolicy)) + return false; + } + + boolean this_present_taskConfig = true && this.isSetTaskConfig(); + boolean that_present_taskConfig = true && that.isSetTaskConfig(); + if (this_present_taskConfig || that_present_taskConfig) { + if (!(this_present_taskConfig && that_present_taskConfig)) + return false; + if (!this.taskConfig.equals(that.taskConfig)) + return false; + } + + boolean this_present_instanceCount = true; + boolean that_present_instanceCount = true; + if (this_present_instanceCount || that_present_instanceCount) { + if (!(this_present_instanceCount && that_present_instanceCount)) + return false; + if (this.instanceCount != that.instanceCount) + 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_owner = true && (isSetOwner()); + list.add(present_owner); + if (present_owner) + list.add(owner); + + boolean present_cronSchedule = true && (isSetCronSchedule()); + list.add(present_cronSchedule); + if (present_cronSchedule) + list.add(cronSchedule); + + boolean present_cronCollisionPolicy = true && (isSetCronCollisionPolicy()); + list.add(present_cronCollisionPolicy); + if (present_cronCollisionPolicy) + list.add(cronCollisionPolicy.getValue()); + + boolean present_taskConfig = true && (isSetTaskConfig()); + list.add(present_taskConfig); + if (present_taskConfig) + list.add(taskConfig); + + boolean present_instanceCount = true; + list.add(present_instanceCount); + if (present_instanceCount) + list.add(instanceCount); + + return list.hashCode(); + } + + @Override + public int compareTo(JobConfiguration 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(isSetOwner()).compareTo(other.isSetOwner()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetOwner()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.owner, other.owner); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetCronSchedule()).compareTo(other.isSetCronSchedule()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetCronSchedule()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.cronSchedule, other.cronSchedule); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetCronCollisionPolicy()).compareTo(other.isSetCronCollisionPolicy()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetCronCollisionPolicy()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.cronCollisionPolicy, other.cronCollisionPolicy); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetTaskConfig()).compareTo(other.isSetTaskConfig()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetTaskConfig()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.taskConfig, other.taskConfig); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetInstanceCount()).compareTo(other.isSetInstanceCount()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetInstanceCount()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.instanceCount, other.instanceCount); + 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("JobConfiguration("); + 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("owner:"); + if (this.owner == null) { + sb.append("null"); + } else { + sb.append(this.owner); + } + first = false; + if (isSetCronSchedule()) { + if (!first) sb.append(", "); + sb.append("cronSchedule:"); + if (this.cronSchedule == null) { + sb.append("null"); + } else { + sb.append(this.cronSchedule); + } + first = false; + } + if (!first) sb.append(", "); + sb.append("cronCollisionPolicy:"); + if (this.cronCollisionPolicy == null) { + sb.append("null"); + } else { + sb.append(this.cronCollisionPolicy); + } + first = false; + if (!first) sb.append(", "); + sb.append("taskConfig:"); + if (this.taskConfig == null) { + sb.append("null"); + } else { + sb.append(this.taskConfig); + } + first = false; + if (!first) sb.append(", "); + sb.append("instanceCount:"); + sb.append(this.instanceCount); + 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(); + } + if (owner != null) { + owner.validate(); + } + if (taskConfig != null) { + taskConfig.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 { + // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor. + __isset_bitfield = 0; + 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 JobConfigurationStandardSchemeFactory implements SchemeFactory { + public JobConfigurationStandardScheme getScheme() { + return new JobConfigurationStandardScheme(); + } + } + + private static class JobConfigurationStandardScheme extends StandardScheme<JobConfiguration> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, JobConfiguration 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 9: // 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 7: // OWNER + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.owner = new Identity(); + struct.owner.read(iprot); + struct.setOwnerIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 4: // CRON_SCHEDULE + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.cronSchedule = iprot.readString(); + struct.setCronScheduleIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 5: // CRON_COLLISION_POLICY + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.cronCollisionPolicy = org.apache.airavata.cloud.aurora.client.sdk.CronCollisionPolicy.findByValue(iprot.readI32()); + struct.setCronCollisionPolicyIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 6: // TASK_CONFIG + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.taskConfig = new TaskConfig(); + struct.taskConfig.read(iprot); + struct.setTaskConfigIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 8: // INSTANCE_COUNT + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.instanceCount = iprot.readI32(); + struct.setInstanceCountIsSet(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, JobConfiguration struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.cronSchedule != null) { + if (struct.isSetCronSchedule()) { + oprot.writeFieldBegin(CRON_SCHEDULE_FIELD_DESC); + oprot.writeString(struct.cronSchedule); + oprot.writeFieldEnd(); + } + } + if (struct.cronCollisionPolicy != null) { + oprot.writeFieldBegin(CRON_COLLISION_POLICY_FIELD_DESC); + oprot.writeI32(struct.cronCollisionPolicy.getValue()); + oprot.writeFieldEnd(); + } + if (struct.taskConfig != null) { + oprot.writeFieldBegin(TASK_CONFIG_FIELD_DESC); + struct.taskConfig.write(oprot); + oprot.writeFieldEnd(); + } + if (struct.owner != null) { + oprot.writeFieldBegin(OWNER_FIELD_DESC); + struct.owner.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldBegin(INSTANCE_COUNT_FIELD_DESC); + oprot.writeI32(struct.instanceCount); + oprot.writeFieldEnd(); + if (struct.key != null) { + oprot.writeFieldBegin(KEY_FIELD_DESC); + struct.key.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class JobConfigurationTupleSchemeFactory implements SchemeFactory { + public JobConfigurationTupleScheme getScheme() { + return new JobConfigurationTupleScheme(); + } + } + + private static class JobConfigurationTupleScheme extends TupleScheme<JobConfiguration> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, JobConfiguration struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetKey()) { + optionals.set(0); + } + if (struct.isSetOwner()) { + optionals.set(1); + } + if (struct.isSetCronSchedule()) { + optionals.set(2); + } + if (struct.isSetCronCollisionPolicy()) { + optionals.set(3); + } + if (struct.isSetTaskConfig()) { + optionals.set(4); + } + if (struct.isSetInstanceCount()) { + optionals.set(5); + } + oprot.writeBitSet(optionals, 6); + if (struct.isSetKey()) { + struct.key.write(oprot); + } + if (struct.isSetOwner()) { + struct.owner.write(oprot); + } + if (struct.isSetCronSchedule()) { + oprot.writeString(struct.cronSchedule); + } + if (struct.isSetCronCollisionPolicy()) { + oprot.writeI32(struct.cronCollisionPolicy.getValue()); + } + if (struct.isSetTaskConfig()) { + struct.taskConfig.write(oprot); + } + if (struct.isSetInstanceCount()) { + oprot.writeI32(struct.instanceCount); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, JobConfiguration struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(6); + if (incoming.get(0)) { + struct.key = new JobKey(); + struct.key.read(iprot); + struct.setKeyIsSet(true); + } + if (incoming.get(1)) { + struct.owner = new Identity(); + struct.owner.read(iprot); + struct.setOwnerIsSet(true); + } + if (incoming.get(2)) { + struct.cronSchedule = iprot.readString(); + struct.setCronScheduleIsSet(true); + } + if (incoming.get(3)) { + struct.cronCollisionPolicy = org.apache.airavata.cloud.aurora.client.sdk.CronCollisionPolicy.findByValue(iprot.readI32()); + struct.setCronCollisionPolicyIsSet(true); + } + if (incoming.get(4)) { + struct.taskConfig = new TaskConfig(); + struct.taskConfig.read(iprot); + struct.setTaskConfigIsSet(true); + } + if (incoming.get(5)) { + struct.instanceCount = iprot.readI32(); + struct.setInstanceCountIsSet(true); + } + } + } + +} +
