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/TaskConstraint.java ---------------------------------------------------------------------- diff --git a/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/sdk/TaskConstraint.java b/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/sdk/TaskConstraint.java new file mode 100644 index 0000000..a6850cd --- /dev/null +++ b/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/sdk/TaskConstraint.java @@ -0,0 +1,373 @@ +/** + * Autogenerated by Thrift Compiler (0.9.3) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +package org.apache.airavata.cloud.aurora.client.sdk; + +import org.apache.thrift.scheme.IScheme; +import org.apache.thrift.scheme.SchemeFactory; +import org.apache.thrift.scheme.StandardScheme; + +import org.apache.thrift.scheme.TupleScheme; +import org.apache.thrift.protocol.TTupleProtocol; +import org.apache.thrift.protocol.TProtocolException; +import org.apache.thrift.EncodingUtils; +import org.apache.thrift.TException; +import org.apache.thrift.async.AsyncMethodCallback; +import org.apache.thrift.server.AbstractNonblockingServer.*; +import java.util.List; +import java.util.ArrayList; +import java.util.Map; +import java.util.HashMap; +import java.util.EnumMap; +import java.util.Set; +import java.util.HashSet; +import java.util.EnumSet; +import java.util.Collections; +import java.util.BitSet; +import java.nio.ByteBuffer; +import java.util.Arrays; +import javax.annotation.Generated; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) +/** + * Types of constraints that may be applied to a task. + */ +public class TaskConstraint extends org.apache.thrift.TUnion<TaskConstraint, TaskConstraint._Fields> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TaskConstraint"); + private static final org.apache.thrift.protocol.TField VALUE_FIELD_DESC = new org.apache.thrift.protocol.TField("value", org.apache.thrift.protocol.TType.STRUCT, (short)1); + private static final org.apache.thrift.protocol.TField LIMIT_FIELD_DESC = new org.apache.thrift.protocol.TField("limit", 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 { + VALUE((short)1, "value"), + LIMIT((short)2, "limit"); + + 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: // VALUE + return VALUE; + case 2: // LIMIT + return LIMIT; + 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.VALUE, new org.apache.thrift.meta_data.FieldMetaData("value", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, ValueConstraint.class))); + tmpMap.put(_Fields.LIMIT, new org.apache.thrift.meta_data.FieldMetaData("limit", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, LimitConstraint.class))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TaskConstraint.class, metaDataMap); + } + + public TaskConstraint() { + super(); + } + + public TaskConstraint(_Fields setField, Object value) { + super(setField, value); + } + + public TaskConstraint(TaskConstraint other) { + super(other); + } + public TaskConstraint deepCopy() { + return new TaskConstraint(this); + } + + public static TaskConstraint value(ValueConstraint value) { + TaskConstraint x = new TaskConstraint(); + x.setValue(value); + return x; + } + + public static TaskConstraint limit(LimitConstraint value) { + TaskConstraint x = new TaskConstraint(); + x.setLimit(value); + return x; + } + + + @Override + protected void checkType(_Fields setField, Object value) throws ClassCastException { + switch (setField) { + case VALUE: + if (value instanceof ValueConstraint) { + break; + } + throw new ClassCastException("Was expecting value of type ValueConstraint for field 'value', but got " + value.getClass().getSimpleName()); + case LIMIT: + if (value instanceof LimitConstraint) { + break; + } + throw new ClassCastException("Was expecting value of type LimitConstraint for field 'limit', 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 VALUE: + if (field.type == VALUE_FIELD_DESC.type) { + ValueConstraint value; + value = new ValueConstraint(); + value.read(iprot); + return value; + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); + return null; + } + case LIMIT: + if (field.type == LIMIT_FIELD_DESC.type) { + LimitConstraint limit; + limit = new LimitConstraint(); + limit.read(iprot); + return limit; + } 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 VALUE: + ValueConstraint value = (ValueConstraint)value_; + value.write(oprot); + return; + case LIMIT: + LimitConstraint limit = (LimitConstraint)value_; + limit.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 VALUE: + ValueConstraint value; + value = new ValueConstraint(); + value.read(iprot); + return value; + case LIMIT: + LimitConstraint limit; + limit = new LimitConstraint(); + limit.read(iprot); + return limit; + 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 VALUE: + ValueConstraint value = (ValueConstraint)value_; + value.write(oprot); + return; + case LIMIT: + LimitConstraint limit = (LimitConstraint)value_; + limit.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 VALUE: + return VALUE_FIELD_DESC; + case LIMIT: + return LIMIT_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 ValueConstraint getValue() { + if (getSetField() == _Fields.VALUE) { + return (ValueConstraint)getFieldValue(); + } else { + throw new RuntimeException("Cannot get field 'value' because union is currently set to " + getFieldDesc(getSetField()).name); + } + } + + public void setValue(ValueConstraint value) { + if (value == null) throw new NullPointerException(); + setField_ = _Fields.VALUE; + value_ = value; + } + + public LimitConstraint getLimit() { + if (getSetField() == _Fields.LIMIT) { + return (LimitConstraint)getFieldValue(); + } else { + throw new RuntimeException("Cannot get field 'limit' because union is currently set to " + getFieldDesc(getSetField()).name); + } + } + + public void setLimit(LimitConstraint value) { + if (value == null) throw new NullPointerException(); + setField_ = _Fields.LIMIT; + value_ = value; + } + + public boolean isSetValue() { + return setField_ == _Fields.VALUE; + } + + + public boolean isSetLimit() { + return setField_ == _Fields.LIMIT; + } + + + public boolean equals(Object other) { + if (other instanceof TaskConstraint) { + return equals((TaskConstraint)other); + } else { + return false; + } + } + + public boolean equals(TaskConstraint other) { + return other != null && getSetField() == other.getSetField() && getFieldValue().equals(other.getFieldValue()); + } + + @Override + public int compareTo(TaskConstraint 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/TaskEvent.java ---------------------------------------------------------------------- diff --git a/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/sdk/TaskEvent.java b/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/sdk/TaskEvent.java new file mode 100644 index 0000000..67c08cc --- /dev/null +++ b/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/sdk/TaskEvent.java @@ -0,0 +1,775 @@ +/** + * 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"}) +/** + * Event marking a state transition within a task's lifecycle. + */ +@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2016-10-21") +public class TaskEvent implements org.apache.thrift.TBase<TaskEvent, TaskEvent._Fields>, java.io.Serializable, Cloneable, Comparable<TaskEvent> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TaskEvent"); + + private static final org.apache.thrift.protocol.TField TIMESTAMP_FIELD_DESC = new org.apache.thrift.protocol.TField("timestamp", org.apache.thrift.protocol.TType.I64, (short)1); + private static final org.apache.thrift.protocol.TField STATUS_FIELD_DESC = new org.apache.thrift.protocol.TField("status", org.apache.thrift.protocol.TType.I32, (short)2); + private static final org.apache.thrift.protocol.TField MESSAGE_FIELD_DESC = new org.apache.thrift.protocol.TField("message", org.apache.thrift.protocol.TType.STRING, (short)3); + private static final org.apache.thrift.protocol.TField SCHEDULER_FIELD_DESC = new org.apache.thrift.protocol.TField("scheduler", org.apache.thrift.protocol.TType.STRING, (short)4); + + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new TaskEventStandardSchemeFactory()); + schemes.put(TupleScheme.class, new TaskEventTupleSchemeFactory()); + } + + /** + * Epoch timestamp in milliseconds. + */ + public long timestamp; // required + /** + * New status of the task. + * + * @see ScheduleStatus + */ + public ScheduleStatus status; // required + /** + * Audit message that explains why a transition occurred. + */ + public String message; // optional + /** + * Hostname of the scheduler machine that performed the event. + */ + public String scheduler; // optional + + /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + /** + * Epoch timestamp in milliseconds. + */ + TIMESTAMP((short)1, "timestamp"), + /** + * New status of the task. + * + * @see ScheduleStatus + */ + STATUS((short)2, "status"), + /** + * Audit message that explains why a transition occurred. + */ + MESSAGE((short)3, "message"), + /** + * Hostname of the scheduler machine that performed the event. + */ + SCHEDULER((short)4, "scheduler"); + + 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: // TIMESTAMP + return TIMESTAMP; + case 2: // STATUS + return STATUS; + case 3: // MESSAGE + return MESSAGE; + case 4: // SCHEDULER + return SCHEDULER; + 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 __TIMESTAMP_ISSET_ID = 0; + private byte __isset_bitfield = 0; + private static final _Fields optionals[] = {_Fields.MESSAGE,_Fields.SCHEDULER}; + 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.TIMESTAMP, new org.apache.thrift.meta_data.FieldMetaData("timestamp", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64))); + tmpMap.put(_Fields.STATUS, new org.apache.thrift.meta_data.FieldMetaData("status", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, ScheduleStatus.class))); + tmpMap.put(_Fields.MESSAGE, new org.apache.thrift.meta_data.FieldMetaData("message", org.apache.thrift.TFieldRequirementType.OPTIONAL, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + tmpMap.put(_Fields.SCHEDULER, new org.apache.thrift.meta_data.FieldMetaData("scheduler", org.apache.thrift.TFieldRequirementType.OPTIONAL, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TaskEvent.class, metaDataMap); + } + + public TaskEvent() { + } + + public TaskEvent( + long timestamp, + ScheduleStatus status) + { + this(); + this.timestamp = timestamp; + setTimestampIsSet(true); + this.status = status; + } + + /** + * Performs a deep copy on <i>other</i>. + */ + public TaskEvent(TaskEvent other) { + __isset_bitfield = other.__isset_bitfield; + this.timestamp = other.timestamp; + if (other.isSetStatus()) { + this.status = other.status; + } + if (other.isSetMessage()) { + this.message = other.message; + } + if (other.isSetScheduler()) { + this.scheduler = other.scheduler; + } + } + + public TaskEvent deepCopy() { + return new TaskEvent(this); + } + + @Override + public void clear() { + setTimestampIsSet(false); + this.timestamp = 0; + this.status = null; + this.message = null; + this.scheduler = null; + } + + /** + * Epoch timestamp in milliseconds. + */ + public long getTimestamp() { + return this.timestamp; + } + + /** + * Epoch timestamp in milliseconds. + */ + public TaskEvent setTimestamp(long timestamp) { + this.timestamp = timestamp; + setTimestampIsSet(true); + return this; + } + + public void unsetTimestamp() { + __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __TIMESTAMP_ISSET_ID); + } + + /** Returns true if field timestamp is set (has been assigned a value) and false otherwise */ + public boolean isSetTimestamp() { + return EncodingUtils.testBit(__isset_bitfield, __TIMESTAMP_ISSET_ID); + } + + public void setTimestampIsSet(boolean value) { + __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __TIMESTAMP_ISSET_ID, value); + } + + /** + * New status of the task. + * + * @see ScheduleStatus + */ + public ScheduleStatus getStatus() { + return this.status; + } + + /** + * New status of the task. + * + * @see ScheduleStatus + */ + public TaskEvent setStatus(ScheduleStatus status) { + this.status = status; + return this; + } + + public void unsetStatus() { + this.status = null; + } + + /** Returns true if field status is set (has been assigned a value) and false otherwise */ + public boolean isSetStatus() { + return this.status != null; + } + + public void setStatusIsSet(boolean value) { + if (!value) { + this.status = null; + } + } + + /** + * Audit message that explains why a transition occurred. + */ + public String getMessage() { + return this.message; + } + + /** + * Audit message that explains why a transition occurred. + */ + public TaskEvent setMessage(String message) { + this.message = message; + return this; + } + + public void unsetMessage() { + this.message = null; + } + + /** Returns true if field message is set (has been assigned a value) and false otherwise */ + public boolean isSetMessage() { + return this.message != null; + } + + public void setMessageIsSet(boolean value) { + if (!value) { + this.message = null; + } + } + + /** + * Hostname of the scheduler machine that performed the event. + */ + public String getScheduler() { + return this.scheduler; + } + + /** + * Hostname of the scheduler machine that performed the event. + */ + public TaskEvent setScheduler(String scheduler) { + this.scheduler = scheduler; + return this; + } + + public void unsetScheduler() { + this.scheduler = null; + } + + /** Returns true if field scheduler is set (has been assigned a value) and false otherwise */ + public boolean isSetScheduler() { + return this.scheduler != null; + } + + public void setSchedulerIsSet(boolean value) { + if (!value) { + this.scheduler = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case TIMESTAMP: + if (value == null) { + unsetTimestamp(); + } else { + setTimestamp((Long)value); + } + break; + + case STATUS: + if (value == null) { + unsetStatus(); + } else { + setStatus((ScheduleStatus)value); + } + break; + + case MESSAGE: + if (value == null) { + unsetMessage(); + } else { + setMessage((String)value); + } + break; + + case SCHEDULER: + if (value == null) { + unsetScheduler(); + } else { + setScheduler((String)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case TIMESTAMP: + return getTimestamp(); + + case STATUS: + return getStatus(); + + case MESSAGE: + return getMessage(); + + case SCHEDULER: + return getScheduler(); + + } + 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 TIMESTAMP: + return isSetTimestamp(); + case STATUS: + return isSetStatus(); + case MESSAGE: + return isSetMessage(); + case SCHEDULER: + return isSetScheduler(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof TaskEvent) + return this.equals((TaskEvent)that); + return false; + } + + public boolean equals(TaskEvent that) { + if (that == null) + return false; + + boolean this_present_timestamp = true; + boolean that_present_timestamp = true; + if (this_present_timestamp || that_present_timestamp) { + if (!(this_present_timestamp && that_present_timestamp)) + return false; + if (this.timestamp != that.timestamp) + return false; + } + + boolean this_present_status = true && this.isSetStatus(); + boolean that_present_status = true && that.isSetStatus(); + if (this_present_status || that_present_status) { + if (!(this_present_status && that_present_status)) + return false; + if (!this.status.equals(that.status)) + return false; + } + + boolean this_present_message = true && this.isSetMessage(); + boolean that_present_message = true && that.isSetMessage(); + if (this_present_message || that_present_message) { + if (!(this_present_message && that_present_message)) + return false; + if (!this.message.equals(that.message)) + return false; + } + + boolean this_present_scheduler = true && this.isSetScheduler(); + boolean that_present_scheduler = true && that.isSetScheduler(); + if (this_present_scheduler || that_present_scheduler) { + if (!(this_present_scheduler && that_present_scheduler)) + return false; + if (!this.scheduler.equals(that.scheduler)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + List<Object> list = new ArrayList<Object>(); + + boolean present_timestamp = true; + list.add(present_timestamp); + if (present_timestamp) + list.add(timestamp); + + boolean present_status = true && (isSetStatus()); + list.add(present_status); + if (present_status) + list.add(status.getValue()); + + boolean present_message = true && (isSetMessage()); + list.add(present_message); + if (present_message) + list.add(message); + + boolean present_scheduler = true && (isSetScheduler()); + list.add(present_scheduler); + if (present_scheduler) + list.add(scheduler); + + return list.hashCode(); + } + + @Override + public int compareTo(TaskEvent other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetTimestamp()).compareTo(other.isSetTimestamp()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetTimestamp()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.timestamp, other.timestamp); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetStatus()).compareTo(other.isSetStatus()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetStatus()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.status, other.status); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetMessage()).compareTo(other.isSetMessage()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetMessage()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.message, other.message); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetScheduler()).compareTo(other.isSetScheduler()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetScheduler()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.scheduler, other.scheduler); + 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("TaskEvent("); + boolean first = true; + + sb.append("timestamp:"); + sb.append(this.timestamp); + first = false; + if (!first) sb.append(", "); + sb.append("status:"); + if (this.status == null) { + sb.append("null"); + } else { + sb.append(this.status); + } + first = false; + if (isSetMessage()) { + if (!first) sb.append(", "); + sb.append("message:"); + if (this.message == null) { + sb.append("null"); + } else { + sb.append(this.message); + } + first = false; + } + if (isSetScheduler()) { + if (!first) sb.append(", "); + sb.append("scheduler:"); + if (this.scheduler == null) { + sb.append("null"); + } else { + sb.append(this.scheduler); + } + 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 { + // 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 TaskEventStandardSchemeFactory implements SchemeFactory { + public TaskEventStandardScheme getScheme() { + return new TaskEventStandardScheme(); + } + } + + private static class TaskEventStandardScheme extends StandardScheme<TaskEvent> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, TaskEvent 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: // TIMESTAMP + if (schemeField.type == org.apache.thrift.protocol.TType.I64) { + struct.timestamp = iprot.readI64(); + struct.setTimestampIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // STATUS + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.status = org.apache.airavata.cloud.aurora.client.sdk.ScheduleStatus.findByValue(iprot.readI32()); + struct.setStatusIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 3: // MESSAGE + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.message = iprot.readString(); + struct.setMessageIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 4: // SCHEDULER + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.scheduler = iprot.readString(); + struct.setSchedulerIsSet(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, TaskEvent struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldBegin(TIMESTAMP_FIELD_DESC); + oprot.writeI64(struct.timestamp); + oprot.writeFieldEnd(); + if (struct.status != null) { + oprot.writeFieldBegin(STATUS_FIELD_DESC); + oprot.writeI32(struct.status.getValue()); + oprot.writeFieldEnd(); + } + if (struct.message != null) { + if (struct.isSetMessage()) { + oprot.writeFieldBegin(MESSAGE_FIELD_DESC); + oprot.writeString(struct.message); + oprot.writeFieldEnd(); + } + } + if (struct.scheduler != null) { + if (struct.isSetScheduler()) { + oprot.writeFieldBegin(SCHEDULER_FIELD_DESC); + oprot.writeString(struct.scheduler); + oprot.writeFieldEnd(); + } + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class TaskEventTupleSchemeFactory implements SchemeFactory { + public TaskEventTupleScheme getScheme() { + return new TaskEventTupleScheme(); + } + } + + private static class TaskEventTupleScheme extends TupleScheme<TaskEvent> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, TaskEvent struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetTimestamp()) { + optionals.set(0); + } + if (struct.isSetStatus()) { + optionals.set(1); + } + if (struct.isSetMessage()) { + optionals.set(2); + } + if (struct.isSetScheduler()) { + optionals.set(3); + } + oprot.writeBitSet(optionals, 4); + if (struct.isSetTimestamp()) { + oprot.writeI64(struct.timestamp); + } + if (struct.isSetStatus()) { + oprot.writeI32(struct.status.getValue()); + } + if (struct.isSetMessage()) { + oprot.writeString(struct.message); + } + if (struct.isSetScheduler()) { + oprot.writeString(struct.scheduler); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, TaskEvent struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(4); + if (incoming.get(0)) { + struct.timestamp = iprot.readI64(); + struct.setTimestampIsSet(true); + } + if (incoming.get(1)) { + struct.status = org.apache.airavata.cloud.aurora.client.sdk.ScheduleStatus.findByValue(iprot.readI32()); + struct.setStatusIsSet(true); + } + if (incoming.get(2)) { + struct.message = iprot.readString(); + struct.setMessageIsSet(true); + } + if (incoming.get(3)) { + struct.scheduler = iprot.readString(); + struct.setSchedulerIsSet(true); + } + } + } + +} +
