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/JobInstanceUpdateEvent.java ---------------------------------------------------------------------- diff --git a/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/sdk/JobInstanceUpdateEvent.java b/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/sdk/JobInstanceUpdateEvent.java new file mode 100644 index 0000000..84d6d9c --- /dev/null +++ b/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/sdk/JobInstanceUpdateEvent.java @@ -0,0 +1,647 @@ +/** + * 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 in job instance update lifecycle. + */ +@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2016-10-21") +public class JobInstanceUpdateEvent implements org.apache.thrift.TBase<JobInstanceUpdateEvent, JobInstanceUpdateEvent._Fields>, java.io.Serializable, Cloneable, Comparable<JobInstanceUpdateEvent> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("JobInstanceUpdateEvent"); + + 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)1); + private static final org.apache.thrift.protocol.TField TIMESTAMP_MS_FIELD_DESC = new org.apache.thrift.protocol.TField("timestampMs", org.apache.thrift.protocol.TType.I64, (short)2); + private static final org.apache.thrift.protocol.TField ACTION_FIELD_DESC = new org.apache.thrift.protocol.TField("action", org.apache.thrift.protocol.TType.I32, (short)3); + + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new JobInstanceUpdateEventStandardSchemeFactory()); + schemes.put(TupleScheme.class, new JobInstanceUpdateEventTupleSchemeFactory()); + } + + /** + * Job instance ID. + */ + public int instanceId; // required + /** + * Epoch timestamp in milliseconds. + */ + public long timestampMs; // required + /** + * Job update action taken on the instance. + * + * @see JobUpdateAction + */ + public JobUpdateAction action; // 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 { + /** + * Job instance ID. + */ + INSTANCE_ID((short)1, "instanceId"), + /** + * Epoch timestamp in milliseconds. + */ + TIMESTAMP_MS((short)2, "timestampMs"), + /** + * Job update action taken on the instance. + * + * @see JobUpdateAction + */ + ACTION((short)3, "action"); + + 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: // INSTANCE_ID + return INSTANCE_ID; + case 2: // TIMESTAMP_MS + return TIMESTAMP_MS; + case 3: // ACTION + return ACTION; + 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 static final int __TIMESTAMPMS_ISSET_ID = 1; + 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.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))); + tmpMap.put(_Fields.TIMESTAMP_MS, new org.apache.thrift.meta_data.FieldMetaData("timestampMs", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64))); + tmpMap.put(_Fields.ACTION, new org.apache.thrift.meta_data.FieldMetaData("action", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, JobUpdateAction.class))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(JobInstanceUpdateEvent.class, metaDataMap); + } + + public JobInstanceUpdateEvent() { + } + + public JobInstanceUpdateEvent( + int instanceId, + long timestampMs, + JobUpdateAction action) + { + this(); + this.instanceId = instanceId; + setInstanceIdIsSet(true); + this.timestampMs = timestampMs; + setTimestampMsIsSet(true); + this.action = action; + } + + /** + * Performs a deep copy on <i>other</i>. + */ + public JobInstanceUpdateEvent(JobInstanceUpdateEvent other) { + __isset_bitfield = other.__isset_bitfield; + this.instanceId = other.instanceId; + this.timestampMs = other.timestampMs; + if (other.isSetAction()) { + this.action = other.action; + } + } + + public JobInstanceUpdateEvent deepCopy() { + return new JobInstanceUpdateEvent(this); + } + + @Override + public void clear() { + setInstanceIdIsSet(false); + this.instanceId = 0; + setTimestampMsIsSet(false); + this.timestampMs = 0; + this.action = null; + } + + /** + * Job instance ID. + */ + public int getInstanceId() { + return this.instanceId; + } + + /** + * Job instance ID. + */ + public JobInstanceUpdateEvent 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); + } + + /** + * Epoch timestamp in milliseconds. + */ + public long getTimestampMs() { + return this.timestampMs; + } + + /** + * Epoch timestamp in milliseconds. + */ + public JobInstanceUpdateEvent setTimestampMs(long timestampMs) { + this.timestampMs = timestampMs; + setTimestampMsIsSet(true); + return this; + } + + public void unsetTimestampMs() { + __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __TIMESTAMPMS_ISSET_ID); + } + + /** Returns true if field timestampMs is set (has been assigned a value) and false otherwise */ + public boolean isSetTimestampMs() { + return EncodingUtils.testBit(__isset_bitfield, __TIMESTAMPMS_ISSET_ID); + } + + public void setTimestampMsIsSet(boolean value) { + __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __TIMESTAMPMS_ISSET_ID, value); + } + + /** + * Job update action taken on the instance. + * + * @see JobUpdateAction + */ + public JobUpdateAction getAction() { + return this.action; + } + + /** + * Job update action taken on the instance. + * + * @see JobUpdateAction + */ + public JobInstanceUpdateEvent setAction(JobUpdateAction action) { + this.action = action; + return this; + } + + public void unsetAction() { + this.action = null; + } + + /** Returns true if field action is set (has been assigned a value) and false otherwise */ + public boolean isSetAction() { + return this.action != null; + } + + public void setActionIsSet(boolean value) { + if (!value) { + this.action = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case INSTANCE_ID: + if (value == null) { + unsetInstanceId(); + } else { + setInstanceId((Integer)value); + } + break; + + case TIMESTAMP_MS: + if (value == null) { + unsetTimestampMs(); + } else { + setTimestampMs((Long)value); + } + break; + + case ACTION: + if (value == null) { + unsetAction(); + } else { + setAction((JobUpdateAction)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case INSTANCE_ID: + return getInstanceId(); + + case TIMESTAMP_MS: + return getTimestampMs(); + + case ACTION: + return getAction(); + + } + 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 INSTANCE_ID: + return isSetInstanceId(); + case TIMESTAMP_MS: + return isSetTimestampMs(); + case ACTION: + return isSetAction(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof JobInstanceUpdateEvent) + return this.equals((JobInstanceUpdateEvent)that); + return false; + } + + public boolean equals(JobInstanceUpdateEvent that) { + if (that == null) + 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; + } + + boolean this_present_timestampMs = true; + boolean that_present_timestampMs = true; + if (this_present_timestampMs || that_present_timestampMs) { + if (!(this_present_timestampMs && that_present_timestampMs)) + return false; + if (this.timestampMs != that.timestampMs) + return false; + } + + boolean this_present_action = true && this.isSetAction(); + boolean that_present_action = true && that.isSetAction(); + if (this_present_action || that_present_action) { + if (!(this_present_action && that_present_action)) + return false; + if (!this.action.equals(that.action)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + List<Object> list = new ArrayList<Object>(); + + boolean present_instanceId = true; + list.add(present_instanceId); + if (present_instanceId) + list.add(instanceId); + + boolean present_timestampMs = true; + list.add(present_timestampMs); + if (present_timestampMs) + list.add(timestampMs); + + boolean present_action = true && (isSetAction()); + list.add(present_action); + if (present_action) + list.add(action.getValue()); + + return list.hashCode(); + } + + @Override + public int compareTo(JobInstanceUpdateEvent other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + 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; + } + } + lastComparison = Boolean.valueOf(isSetTimestampMs()).compareTo(other.isSetTimestampMs()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetTimestampMs()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.timestampMs, other.timestampMs); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetAction()).compareTo(other.isSetAction()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetAction()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.action, other.action); + 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("JobInstanceUpdateEvent("); + boolean first = true; + + sb.append("instanceId:"); + sb.append(this.instanceId); + first = false; + if (!first) sb.append(", "); + sb.append("timestampMs:"); + sb.append(this.timestampMs); + first = false; + if (!first) sb.append(", "); + sb.append("action:"); + if (this.action == null) { + sb.append("null"); + } else { + sb.append(this.action); + } + 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 JobInstanceUpdateEventStandardSchemeFactory implements SchemeFactory { + public JobInstanceUpdateEventStandardScheme getScheme() { + return new JobInstanceUpdateEventStandardScheme(); + } + } + + private static class JobInstanceUpdateEventStandardScheme extends StandardScheme<JobInstanceUpdateEvent> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, JobInstanceUpdateEvent 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: // 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; + case 2: // TIMESTAMP_MS + if (schemeField.type == org.apache.thrift.protocol.TType.I64) { + struct.timestampMs = iprot.readI64(); + struct.setTimestampMsIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 3: // ACTION + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.action = org.apache.airavata.cloud.aurora.client.sdk.JobUpdateAction.findByValue(iprot.readI32()); + struct.setActionIsSet(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, JobInstanceUpdateEvent struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldBegin(INSTANCE_ID_FIELD_DESC); + oprot.writeI32(struct.instanceId); + oprot.writeFieldEnd(); + oprot.writeFieldBegin(TIMESTAMP_MS_FIELD_DESC); + oprot.writeI64(struct.timestampMs); + oprot.writeFieldEnd(); + if (struct.action != null) { + oprot.writeFieldBegin(ACTION_FIELD_DESC); + oprot.writeI32(struct.action.getValue()); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class JobInstanceUpdateEventTupleSchemeFactory implements SchemeFactory { + public JobInstanceUpdateEventTupleScheme getScheme() { + return new JobInstanceUpdateEventTupleScheme(); + } + } + + private static class JobInstanceUpdateEventTupleScheme extends TupleScheme<JobInstanceUpdateEvent> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, JobInstanceUpdateEvent struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetInstanceId()) { + optionals.set(0); + } + if (struct.isSetTimestampMs()) { + optionals.set(1); + } + if (struct.isSetAction()) { + optionals.set(2); + } + oprot.writeBitSet(optionals, 3); + if (struct.isSetInstanceId()) { + oprot.writeI32(struct.instanceId); + } + if (struct.isSetTimestampMs()) { + oprot.writeI64(struct.timestampMs); + } + if (struct.isSetAction()) { + oprot.writeI32(struct.action.getValue()); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, JobInstanceUpdateEvent struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(3); + if (incoming.get(0)) { + struct.instanceId = iprot.readI32(); + struct.setInstanceIdIsSet(true); + } + if (incoming.get(1)) { + struct.timestampMs = iprot.readI64(); + struct.setTimestampMsIsSet(true); + } + if (incoming.get(2)) { + struct.action = org.apache.airavata.cloud.aurora.client.sdk.JobUpdateAction.findByValue(iprot.readI32()); + struct.setActionIsSet(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/JobKey.java ---------------------------------------------------------------------- diff --git a/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/sdk/JobKey.java b/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/sdk/JobKey.java new file mode 100644 index 0000000..472cecf --- /dev/null +++ b/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/sdk/JobKey.java @@ -0,0 +1,647 @@ +/** + * 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 a Job. + */ +@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2016-10-21") +public class JobKey implements org.apache.thrift.TBase<JobKey, JobKey._Fields>, java.io.Serializable, Cloneable, Comparable<JobKey> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("JobKey"); + + private static final org.apache.thrift.protocol.TField ROLE_FIELD_DESC = new org.apache.thrift.protocol.TField("role", org.apache.thrift.protocol.TType.STRING, (short)1); + private static final org.apache.thrift.protocol.TField ENVIRONMENT_FIELD_DESC = new org.apache.thrift.protocol.TField("environment", org.apache.thrift.protocol.TType.STRING, (short)2); + private static final org.apache.thrift.protocol.TField NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("name", org.apache.thrift.protocol.TType.STRING, (short)3); + + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new JobKeyStandardSchemeFactory()); + schemes.put(TupleScheme.class, new JobKeyTupleSchemeFactory()); + } + + /** + * User role (Unix service account), for example "mesos" + */ + public String role; // required + /** + * Environment, for example "devel" + */ + public String environment; // required + /** + * Name, for example "labrat" + */ + public String name; // 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 { + /** + * User role (Unix service account), for example "mesos" + */ + ROLE((short)1, "role"), + /** + * Environment, for example "devel" + */ + ENVIRONMENT((short)2, "environment"), + /** + * Name, for example "labrat" + */ + NAME((short)3, "name"); + + 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: // ROLE + return ROLE; + case 2: // ENVIRONMENT + return ENVIRONMENT; + case 3: // NAME + return NAME; + 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.ROLE, new org.apache.thrift.meta_data.FieldMetaData("role", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + tmpMap.put(_Fields.ENVIRONMENT, new org.apache.thrift.meta_data.FieldMetaData("environment", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + tmpMap.put(_Fields.NAME, new org.apache.thrift.meta_data.FieldMetaData("name", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(JobKey.class, metaDataMap); + } + + public JobKey() { + } + + public JobKey( + String role, + String environment, + String name) + { + this(); + this.role = role; + this.environment = environment; + this.name = name; + } + + /** + * Performs a deep copy on <i>other</i>. + */ + public JobKey(JobKey other) { + if (other.isSetRole()) { + this.role = other.role; + } + if (other.isSetEnvironment()) { + this.environment = other.environment; + } + if (other.isSetName()) { + this.name = other.name; + } + } + + public JobKey deepCopy() { + return new JobKey(this); + } + + @Override + public void clear() { + this.role = null; + this.environment = null; + this.name = null; + } + + /** + * User role (Unix service account), for example "mesos" + */ + public String getRole() { + return this.role; + } + + /** + * User role (Unix service account), for example "mesos" + */ + public JobKey setRole(String role) { + this.role = role; + return this; + } + + public void unsetRole() { + this.role = null; + } + + /** Returns true if field role is set (has been assigned a value) and false otherwise */ + public boolean isSetRole() { + return this.role != null; + } + + public void setRoleIsSet(boolean value) { + if (!value) { + this.role = null; + } + } + + /** + * Environment, for example "devel" + */ + public String getEnvironment() { + return this.environment; + } + + /** + * Environment, for example "devel" + */ + public JobKey setEnvironment(String environment) { + this.environment = environment; + return this; + } + + public void unsetEnvironment() { + this.environment = null; + } + + /** Returns true if field environment is set (has been assigned a value) and false otherwise */ + public boolean isSetEnvironment() { + return this.environment != null; + } + + public void setEnvironmentIsSet(boolean value) { + if (!value) { + this.environment = null; + } + } + + /** + * Name, for example "labrat" + */ + public String getName() { + return this.name; + } + + /** + * Name, for example "labrat" + */ + public JobKey setName(String name) { + this.name = name; + return this; + } + + public void unsetName() { + this.name = null; + } + + /** Returns true if field name is set (has been assigned a value) and false otherwise */ + public boolean isSetName() { + return this.name != null; + } + + public void setNameIsSet(boolean value) { + if (!value) { + this.name = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case ROLE: + if (value == null) { + unsetRole(); + } else { + setRole((String)value); + } + break; + + case ENVIRONMENT: + if (value == null) { + unsetEnvironment(); + } else { + setEnvironment((String)value); + } + break; + + case NAME: + if (value == null) { + unsetName(); + } else { + setName((String)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case ROLE: + return getRole(); + + case ENVIRONMENT: + return getEnvironment(); + + case NAME: + return getName(); + + } + 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 ROLE: + return isSetRole(); + case ENVIRONMENT: + return isSetEnvironment(); + case NAME: + return isSetName(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof JobKey) + return this.equals((JobKey)that); + return false; + } + + public boolean equals(JobKey that) { + if (that == null) + return false; + + boolean this_present_role = true && this.isSetRole(); + boolean that_present_role = true && that.isSetRole(); + if (this_present_role || that_present_role) { + if (!(this_present_role && that_present_role)) + return false; + if (!this.role.equals(that.role)) + return false; + } + + boolean this_present_environment = true && this.isSetEnvironment(); + boolean that_present_environment = true && that.isSetEnvironment(); + if (this_present_environment || that_present_environment) { + if (!(this_present_environment && that_present_environment)) + return false; + if (!this.environment.equals(that.environment)) + return false; + } + + boolean this_present_name = true && this.isSetName(); + boolean that_present_name = true && that.isSetName(); + if (this_present_name || that_present_name) { + if (!(this_present_name && that_present_name)) + return false; + if (!this.name.equals(that.name)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + List<Object> list = new ArrayList<Object>(); + + boolean present_role = true && (isSetRole()); + list.add(present_role); + if (present_role) + list.add(role); + + boolean present_environment = true && (isSetEnvironment()); + list.add(present_environment); + if (present_environment) + list.add(environment); + + boolean present_name = true && (isSetName()); + list.add(present_name); + if (present_name) + list.add(name); + + return list.hashCode(); + } + + @Override + public int compareTo(JobKey other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetRole()).compareTo(other.isSetRole()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetRole()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.role, other.role); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetEnvironment()).compareTo(other.isSetEnvironment()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetEnvironment()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.environment, other.environment); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetName()).compareTo(other.isSetName()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetName()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.name, other.name); + if (lastComparison != 0) { + return lastComparison; + } + } + 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("JobKey("); + boolean first = true; + + sb.append("role:"); + if (this.role == null) { + sb.append("null"); + } else { + sb.append(this.role); + } + first = false; + if (!first) sb.append(", "); + sb.append("environment:"); + if (this.environment == null) { + sb.append("null"); + } else { + sb.append(this.environment); + } + first = false; + if (!first) sb.append(", "); + sb.append("name:"); + if (this.name == null) { + sb.append("null"); + } else { + sb.append(this.name); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { + try { + read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class JobKeyStandardSchemeFactory implements SchemeFactory { + public JobKeyStandardScheme getScheme() { + return new JobKeyStandardScheme(); + } + } + + private static class JobKeyStandardScheme extends StandardScheme<JobKey> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, JobKey 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: // ROLE + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.role = iprot.readString(); + struct.setRoleIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // ENVIRONMENT + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.environment = iprot.readString(); + struct.setEnvironmentIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 3: // NAME + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.name = iprot.readString(); + struct.setNameIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + 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, JobKey struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.role != null) { + oprot.writeFieldBegin(ROLE_FIELD_DESC); + oprot.writeString(struct.role); + oprot.writeFieldEnd(); + } + if (struct.environment != null) { + oprot.writeFieldBegin(ENVIRONMENT_FIELD_DESC); + oprot.writeString(struct.environment); + oprot.writeFieldEnd(); + } + if (struct.name != null) { + oprot.writeFieldBegin(NAME_FIELD_DESC); + oprot.writeString(struct.name); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class JobKeyTupleSchemeFactory implements SchemeFactory { + public JobKeyTupleScheme getScheme() { + return new JobKeyTupleScheme(); + } + } + + private static class JobKeyTupleScheme extends TupleScheme<JobKey> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, JobKey struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetRole()) { + optionals.set(0); + } + if (struct.isSetEnvironment()) { + optionals.set(1); + } + if (struct.isSetName()) { + optionals.set(2); + } + oprot.writeBitSet(optionals, 3); + if (struct.isSetRole()) { + oprot.writeString(struct.role); + } + if (struct.isSetEnvironment()) { + oprot.writeString(struct.environment); + } + if (struct.isSetName()) { + oprot.writeString(struct.name); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, JobKey struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(3); + if (incoming.get(0)) { + struct.role = iprot.readString(); + struct.setRoleIsSet(true); + } + if (incoming.get(1)) { + struct.environment = iprot.readString(); + struct.setEnvironmentIsSet(true); + } + if (incoming.get(2)) { + struct.name = iprot.readString(); + struct.setNameIsSet(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/JobStats.java ---------------------------------------------------------------------- diff --git a/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/sdk/JobStats.java b/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/sdk/JobStats.java new file mode 100644 index 0000000..3bd2305 --- /dev/null +++ b/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/sdk/JobStats.java @@ -0,0 +1,741 @@ +/** + * 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 JobStats implements org.apache.thrift.TBase<JobStats, JobStats._Fields>, java.io.Serializable, Cloneable, Comparable<JobStats> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("JobStats"); + + private static final org.apache.thrift.protocol.TField ACTIVE_TASK_COUNT_FIELD_DESC = new org.apache.thrift.protocol.TField("activeTaskCount", org.apache.thrift.protocol.TType.I32, (short)1); + private static final org.apache.thrift.protocol.TField FINISHED_TASK_COUNT_FIELD_DESC = new org.apache.thrift.protocol.TField("finishedTaskCount", org.apache.thrift.protocol.TType.I32, (short)2); + private static final org.apache.thrift.protocol.TField FAILED_TASK_COUNT_FIELD_DESC = new org.apache.thrift.protocol.TField("failedTaskCount", org.apache.thrift.protocol.TType.I32, (short)3); + private static final org.apache.thrift.protocol.TField PENDING_TASK_COUNT_FIELD_DESC = new org.apache.thrift.protocol.TField("pendingTaskCount", org.apache.thrift.protocol.TType.I32, (short)4); + + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new JobStatsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new JobStatsTupleSchemeFactory()); + } + + /** + * Number of tasks in active state for this job. + */ + public int activeTaskCount; // required + /** + * Number of tasks in finished state for this job. + */ + public int finishedTaskCount; // required + /** + * Number of failed tasks for this job. + */ + public int failedTaskCount; // required + /** + * Number of tasks in pending state for this job. + */ + public int pendingTaskCount; // 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 { + /** + * Number of tasks in active state for this job. + */ + ACTIVE_TASK_COUNT((short)1, "activeTaskCount"), + /** + * Number of tasks in finished state for this job. + */ + FINISHED_TASK_COUNT((short)2, "finishedTaskCount"), + /** + * Number of failed tasks for this job. + */ + FAILED_TASK_COUNT((short)3, "failedTaskCount"), + /** + * Number of tasks in pending state for this job. + */ + PENDING_TASK_COUNT((short)4, "pendingTaskCount"); + + 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: // ACTIVE_TASK_COUNT + return ACTIVE_TASK_COUNT; + case 2: // FINISHED_TASK_COUNT + return FINISHED_TASK_COUNT; + case 3: // FAILED_TASK_COUNT + return FAILED_TASK_COUNT; + case 4: // PENDING_TASK_COUNT + return PENDING_TASK_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 __ACTIVETASKCOUNT_ISSET_ID = 0; + private static final int __FINISHEDTASKCOUNT_ISSET_ID = 1; + private static final int __FAILEDTASKCOUNT_ISSET_ID = 2; + private static final int __PENDINGTASKCOUNT_ISSET_ID = 3; + 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.ACTIVE_TASK_COUNT, new org.apache.thrift.meta_data.FieldMetaData("activeTaskCount", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32))); + tmpMap.put(_Fields.FINISHED_TASK_COUNT, new org.apache.thrift.meta_data.FieldMetaData("finishedTaskCount", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32))); + tmpMap.put(_Fields.FAILED_TASK_COUNT, new org.apache.thrift.meta_data.FieldMetaData("failedTaskCount", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32))); + tmpMap.put(_Fields.PENDING_TASK_COUNT, new org.apache.thrift.meta_data.FieldMetaData("pendingTaskCount", 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(JobStats.class, metaDataMap); + } + + public JobStats() { + } + + public JobStats( + int activeTaskCount, + int finishedTaskCount, + int failedTaskCount, + int pendingTaskCount) + { + this(); + this.activeTaskCount = activeTaskCount; + setActiveTaskCountIsSet(true); + this.finishedTaskCount = finishedTaskCount; + setFinishedTaskCountIsSet(true); + this.failedTaskCount = failedTaskCount; + setFailedTaskCountIsSet(true); + this.pendingTaskCount = pendingTaskCount; + setPendingTaskCountIsSet(true); + } + + /** + * Performs a deep copy on <i>other</i>. + */ + public JobStats(JobStats other) { + __isset_bitfield = other.__isset_bitfield; + this.activeTaskCount = other.activeTaskCount; + this.finishedTaskCount = other.finishedTaskCount; + this.failedTaskCount = other.failedTaskCount; + this.pendingTaskCount = other.pendingTaskCount; + } + + public JobStats deepCopy() { + return new JobStats(this); + } + + @Override + public void clear() { + setActiveTaskCountIsSet(false); + this.activeTaskCount = 0; + setFinishedTaskCountIsSet(false); + this.finishedTaskCount = 0; + setFailedTaskCountIsSet(false); + this.failedTaskCount = 0; + setPendingTaskCountIsSet(false); + this.pendingTaskCount = 0; + } + + /** + * Number of tasks in active state for this job. + */ + public int getActiveTaskCount() { + return this.activeTaskCount; + } + + /** + * Number of tasks in active state for this job. + */ + public JobStats setActiveTaskCount(int activeTaskCount) { + this.activeTaskCount = activeTaskCount; + setActiveTaskCountIsSet(true); + return this; + } + + public void unsetActiveTaskCount() { + __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __ACTIVETASKCOUNT_ISSET_ID); + } + + /** Returns true if field activeTaskCount is set (has been assigned a value) and false otherwise */ + public boolean isSetActiveTaskCount() { + return EncodingUtils.testBit(__isset_bitfield, __ACTIVETASKCOUNT_ISSET_ID); + } + + public void setActiveTaskCountIsSet(boolean value) { + __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __ACTIVETASKCOUNT_ISSET_ID, value); + } + + /** + * Number of tasks in finished state for this job. + */ + public int getFinishedTaskCount() { + return this.finishedTaskCount; + } + + /** + * Number of tasks in finished state for this job. + */ + public JobStats setFinishedTaskCount(int finishedTaskCount) { + this.finishedTaskCount = finishedTaskCount; + setFinishedTaskCountIsSet(true); + return this; + } + + public void unsetFinishedTaskCount() { + __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __FINISHEDTASKCOUNT_ISSET_ID); + } + + /** Returns true if field finishedTaskCount is set (has been assigned a value) and false otherwise */ + public boolean isSetFinishedTaskCount() { + return EncodingUtils.testBit(__isset_bitfield, __FINISHEDTASKCOUNT_ISSET_ID); + } + + public void setFinishedTaskCountIsSet(boolean value) { + __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __FINISHEDTASKCOUNT_ISSET_ID, value); + } + + /** + * Number of failed tasks for this job. + */ + public int getFailedTaskCount() { + return this.failedTaskCount; + } + + /** + * Number of failed tasks for this job. + */ + public JobStats setFailedTaskCount(int failedTaskCount) { + this.failedTaskCount = failedTaskCount; + setFailedTaskCountIsSet(true); + return this; + } + + public void unsetFailedTaskCount() { + __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __FAILEDTASKCOUNT_ISSET_ID); + } + + /** Returns true if field failedTaskCount is set (has been assigned a value) and false otherwise */ + public boolean isSetFailedTaskCount() { + return EncodingUtils.testBit(__isset_bitfield, __FAILEDTASKCOUNT_ISSET_ID); + } + + public void setFailedTaskCountIsSet(boolean value) { + __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __FAILEDTASKCOUNT_ISSET_ID, value); + } + + /** + * Number of tasks in pending state for this job. + */ + public int getPendingTaskCount() { + return this.pendingTaskCount; + } + + /** + * Number of tasks in pending state for this job. + */ + public JobStats setPendingTaskCount(int pendingTaskCount) { + this.pendingTaskCount = pendingTaskCount; + setPendingTaskCountIsSet(true); + return this; + } + + public void unsetPendingTaskCount() { + __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __PENDINGTASKCOUNT_ISSET_ID); + } + + /** Returns true if field pendingTaskCount is set (has been assigned a value) and false otherwise */ + public boolean isSetPendingTaskCount() { + return EncodingUtils.testBit(__isset_bitfield, __PENDINGTASKCOUNT_ISSET_ID); + } + + public void setPendingTaskCountIsSet(boolean value) { + __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __PENDINGTASKCOUNT_ISSET_ID, value); + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case ACTIVE_TASK_COUNT: + if (value == null) { + unsetActiveTaskCount(); + } else { + setActiveTaskCount((Integer)value); + } + break; + + case FINISHED_TASK_COUNT: + if (value == null) { + unsetFinishedTaskCount(); + } else { + setFinishedTaskCount((Integer)value); + } + break; + + case FAILED_TASK_COUNT: + if (value == null) { + unsetFailedTaskCount(); + } else { + setFailedTaskCount((Integer)value); + } + break; + + case PENDING_TASK_COUNT: + if (value == null) { + unsetPendingTaskCount(); + } else { + setPendingTaskCount((Integer)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case ACTIVE_TASK_COUNT: + return getActiveTaskCount(); + + case FINISHED_TASK_COUNT: + return getFinishedTaskCount(); + + case FAILED_TASK_COUNT: + return getFailedTaskCount(); + + case PENDING_TASK_COUNT: + return getPendingTaskCount(); + + } + 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 ACTIVE_TASK_COUNT: + return isSetActiveTaskCount(); + case FINISHED_TASK_COUNT: + return isSetFinishedTaskCount(); + case FAILED_TASK_COUNT: + return isSetFailedTaskCount(); + case PENDING_TASK_COUNT: + return isSetPendingTaskCount(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof JobStats) + return this.equals((JobStats)that); + return false; + } + + public boolean equals(JobStats that) { + if (that == null) + return false; + + boolean this_present_activeTaskCount = true; + boolean that_present_activeTaskCount = true; + if (this_present_activeTaskCount || that_present_activeTaskCount) { + if (!(this_present_activeTaskCount && that_present_activeTaskCount)) + return false; + if (this.activeTaskCount != that.activeTaskCount) + return false; + } + + boolean this_present_finishedTaskCount = true; + boolean that_present_finishedTaskCount = true; + if (this_present_finishedTaskCount || that_present_finishedTaskCount) { + if (!(this_present_finishedTaskCount && that_present_finishedTaskCount)) + return false; + if (this.finishedTaskCount != that.finishedTaskCount) + return false; + } + + boolean this_present_failedTaskCount = true; + boolean that_present_failedTaskCount = true; + if (this_present_failedTaskCount || that_present_failedTaskCount) { + if (!(this_present_failedTaskCount && that_present_failedTaskCount)) + return false; + if (this.failedTaskCount != that.failedTaskCount) + return false; + } + + boolean this_present_pendingTaskCount = true; + boolean that_present_pendingTaskCount = true; + if (this_present_pendingTaskCount || that_present_pendingTaskCount) { + if (!(this_present_pendingTaskCount && that_present_pendingTaskCount)) + return false; + if (this.pendingTaskCount != that.pendingTaskCount) + return false; + } + + return true; + } + + @Override + public int hashCode() { + List<Object> list = new ArrayList<Object>(); + + boolean present_activeTaskCount = true; + list.add(present_activeTaskCount); + if (present_activeTaskCount) + list.add(activeTaskCount); + + boolean present_finishedTaskCount = true; + list.add(present_finishedTaskCount); + if (present_finishedTaskCount) + list.add(finishedTaskCount); + + boolean present_failedTaskCount = true; + list.add(present_failedTaskCount); + if (present_failedTaskCount) + list.add(failedTaskCount); + + boolean present_pendingTaskCount = true; + list.add(present_pendingTaskCount); + if (present_pendingTaskCount) + list.add(pendingTaskCount); + + return list.hashCode(); + } + + @Override + public int compareTo(JobStats other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetActiveTaskCount()).compareTo(other.isSetActiveTaskCount()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetActiveTaskCount()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.activeTaskCount, other.activeTaskCount); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetFinishedTaskCount()).compareTo(other.isSetFinishedTaskCount()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetFinishedTaskCount()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.finishedTaskCount, other.finishedTaskCount); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetFailedTaskCount()).compareTo(other.isSetFailedTaskCount()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetFailedTaskCount()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.failedTaskCount, other.failedTaskCount); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetPendingTaskCount()).compareTo(other.isSetPendingTaskCount()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetPendingTaskCount()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.pendingTaskCount, other.pendingTaskCount); + 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("JobStats("); + boolean first = true; + + sb.append("activeTaskCount:"); + sb.append(this.activeTaskCount); + first = false; + if (!first) sb.append(", "); + sb.append("finishedTaskCount:"); + sb.append(this.finishedTaskCount); + first = false; + if (!first) sb.append(", "); + sb.append("failedTaskCount:"); + sb.append(this.failedTaskCount); + first = false; + if (!first) sb.append(", "); + sb.append("pendingTaskCount:"); + sb.append(this.pendingTaskCount); + 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 JobStatsStandardSchemeFactory implements SchemeFactory { + public JobStatsStandardScheme getScheme() { + return new JobStatsStandardScheme(); + } + } + + private static class JobStatsStandardScheme extends StandardScheme<JobStats> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, JobStats 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: // ACTIVE_TASK_COUNT + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.activeTaskCount = iprot.readI32(); + struct.setActiveTaskCountIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // FINISHED_TASK_COUNT + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.finishedTaskCount = iprot.readI32(); + struct.setFinishedTaskCountIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 3: // FAILED_TASK_COUNT + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.failedTaskCount = iprot.readI32(); + struct.setFailedTaskCountIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 4: // PENDING_TASK_COUNT + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.pendingTaskCount = iprot.readI32(); + struct.setPendingTaskCountIsSet(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, JobStats struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldBegin(ACTIVE_TASK_COUNT_FIELD_DESC); + oprot.writeI32(struct.activeTaskCount); + oprot.writeFieldEnd(); + oprot.writeFieldBegin(FINISHED_TASK_COUNT_FIELD_DESC); + oprot.writeI32(struct.finishedTaskCount); + oprot.writeFieldEnd(); + oprot.writeFieldBegin(FAILED_TASK_COUNT_FIELD_DESC); + oprot.writeI32(struct.failedTaskCount); + oprot.writeFieldEnd(); + oprot.writeFieldBegin(PENDING_TASK_COUNT_FIELD_DESC); + oprot.writeI32(struct.pendingTaskCount); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class JobStatsTupleSchemeFactory implements SchemeFactory { + public JobStatsTupleScheme getScheme() { + return new JobStatsTupleScheme(); + } + } + + private static class JobStatsTupleScheme extends TupleScheme<JobStats> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, JobStats struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetActiveTaskCount()) { + optionals.set(0); + } + if (struct.isSetFinishedTaskCount()) { + optionals.set(1); + } + if (struct.isSetFailedTaskCount()) { + optionals.set(2); + } + if (struct.isSetPendingTaskCount()) { + optionals.set(3); + } + oprot.writeBitSet(optionals, 4); + if (struct.isSetActiveTaskCount()) { + oprot.writeI32(struct.activeTaskCount); + } + if (struct.isSetFinishedTaskCount()) { + oprot.writeI32(struct.finishedTaskCount); + } + if (struct.isSetFailedTaskCount()) { + oprot.writeI32(struct.failedTaskCount); + } + if (struct.isSetPendingTaskCount()) { + oprot.writeI32(struct.pendingTaskCount); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, JobStats struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(4); + if (incoming.get(0)) { + struct.activeTaskCount = iprot.readI32(); + struct.setActiveTaskCountIsSet(true); + } + if (incoming.get(1)) { + struct.finishedTaskCount = iprot.readI32(); + struct.setFinishedTaskCountIsSet(true); + } + if (incoming.get(2)) { + struct.failedTaskCount = iprot.readI32(); + struct.setFailedTaskCountIsSet(true); + } + if (incoming.get(3)) { + struct.pendingTaskCount = iprot.readI32(); + struct.setPendingTaskCountIsSet(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/JobSummary.java ---------------------------------------------------------------------- diff --git a/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/sdk/JobSummary.java b/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/sdk/JobSummary.java new file mode 100644 index 0000000..4f7cfba --- /dev/null +++ b/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/sdk/JobSummary.java @@ -0,0 +1,630 @@ +/** + * 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 JobSummary implements org.apache.thrift.TBase<JobSummary, JobSummary._Fields>, java.io.Serializable, Cloneable, Comparable<JobSummary> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("JobSummary"); + + private static final org.apache.thrift.protocol.TField JOB_FIELD_DESC = new org.apache.thrift.protocol.TField("job", org.apache.thrift.protocol.TType.STRUCT, (short)1); + private static final org.apache.thrift.protocol.TField STATS_FIELD_DESC = new org.apache.thrift.protocol.TField("stats", org.apache.thrift.protocol.TType.STRUCT, (short)2); + private static final org.apache.thrift.protocol.TField NEXT_CRON_RUN_MS_FIELD_DESC = new org.apache.thrift.protocol.TField("nextCronRunMs", org.apache.thrift.protocol.TType.I64, (short)3); + + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new JobSummaryStandardSchemeFactory()); + schemes.put(TupleScheme.class, new JobSummaryTupleSchemeFactory()); + } + + public JobConfiguration job; // required + public JobStats stats; // required + /** + * Timestamp of next cron run in ms since epoch, for a cron job + */ + public long nextCronRunMs; // 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 { + JOB((short)1, "job"), + STATS((short)2, "stats"), + /** + * Timestamp of next cron run in ms since epoch, for a cron job + */ + NEXT_CRON_RUN_MS((short)3, "nextCronRunMs"); + + 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 + return JOB; + case 2: // STATS + return STATS; + case 3: // NEXT_CRON_RUN_MS + return NEXT_CRON_RUN_MS; + 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 __NEXTCRONRUNMS_ISSET_ID = 0; + private byte __isset_bitfield = 0; + private static final _Fields optionals[] = {_Fields.NEXT_CRON_RUN_MS}; + 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, new org.apache.thrift.meta_data.FieldMetaData("job", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, JobConfiguration.class))); + tmpMap.put(_Fields.STATS, new org.apache.thrift.meta_data.FieldMetaData("stats", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, JobStats.class))); + tmpMap.put(_Fields.NEXT_CRON_RUN_MS, new org.apache.thrift.meta_data.FieldMetaData("nextCronRunMs", org.apache.thrift.TFieldRequirementType.OPTIONAL, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(JobSummary.class, metaDataMap); + } + + public JobSummary() { + } + + public JobSummary( + JobConfiguration job, + JobStats stats) + { + this(); + this.job = job; + this.stats = stats; + } + + /** + * Performs a deep copy on <i>other</i>. + */ + public JobSummary(JobSummary other) { + __isset_bitfield = other.__isset_bitfield; + if (other.isSetJob()) { + this.job = new JobConfiguration(other.job); + } + if (other.isSetStats()) { + this.stats = new JobStats(other.stats); + } + this.nextCronRunMs = other.nextCronRunMs; + } + + public JobSummary deepCopy() { + return new JobSummary(this); + } + + @Override + public void clear() { + this.job = null; + this.stats = null; + setNextCronRunMsIsSet(false); + this.nextCronRunMs = 0; + } + + public JobConfiguration getJob() { + return this.job; + } + + public JobSummary setJob(JobConfiguration job) { + this.job = job; + return this; + } + + public void unsetJob() { + this.job = null; + } + + /** Returns true if field job is set (has been assigned a value) and false otherwise */ + public boolean isSetJob() { + return this.job != null; + } + + public void setJobIsSet(boolean value) { + if (!value) { + this.job = null; + } + } + + public JobStats getStats() { + return this.stats; + } + + public JobSummary setStats(JobStats stats) { + this.stats = stats; + return this; + } + + public void unsetStats() { + this.stats = null; + } + + /** Returns true if field stats is set (has been assigned a value) and false otherwise */ + public boolean isSetStats() { + return this.stats != null; + } + + public void setStatsIsSet(boolean value) { + if (!value) { + this.stats = null; + } + } + + /** + * Timestamp of next cron run in ms since epoch, for a cron job + */ + public long getNextCronRunMs() { + return this.nextCronRunMs; + } + + /** + * Timestamp of next cron run in ms since epoch, for a cron job + */ + public JobSummary setNextCronRunMs(long nextCronRunMs) { + this.nextCronRunMs = nextCronRunMs; + setNextCronRunMsIsSet(true); + return this; + } + + public void unsetNextCronRunMs() { + __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __NEXTCRONRUNMS_ISSET_ID); + } + + /** Returns true if field nextCronRunMs is set (has been assigned a value) and false otherwise */ + public boolean isSetNextCronRunMs() { + return EncodingUtils.testBit(__isset_bitfield, __NEXTCRONRUNMS_ISSET_ID); + } + + public void setNextCronRunMsIsSet(boolean value) { + __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __NEXTCRONRUNMS_ISSET_ID, value); + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case JOB: + if (value == null) { + unsetJob(); + } else { + setJob((JobConfiguration)value); + } + break; + + case STATS: + if (value == null) { + unsetStats(); + } else { + setStats((JobStats)value); + } + break; + + case NEXT_CRON_RUN_MS: + if (value == null) { + unsetNextCronRunMs(); + } else { + setNextCronRunMs((Long)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case JOB: + return getJob(); + + case STATS: + return getStats(); + + case NEXT_CRON_RUN_MS: + return getNextCronRunMs(); + + } + 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: + return isSetJob(); + case STATS: + return isSetStats(); + case NEXT_CRON_RUN_MS: + return isSetNextCronRunMs(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof JobSummary) + return this.equals((JobSummary)that); + return false; + } + + public boolean equals(JobSummary that) { + if (that == null) + return false; + + boolean this_present_job = true && this.isSetJob(); + boolean that_present_job = true && that.isSetJob(); + if (this_present_job || that_present_job) { + if (!(this_present_job && that_present_job)) + return false; + if (!this.job.equals(that.job)) + return false; + } + + boolean this_present_stats = true && this.isSetStats(); + boolean that_present_stats = true && that.isSetStats(); + if (this_present_stats || that_present_stats) { + if (!(this_present_stats && that_present_stats)) + return false; + if (!this.stats.equals(that.stats)) + return false; + } + + boolean this_present_nextCronRunMs = true && this.isSetNextCronRunMs(); + boolean that_present_nextCronRunMs = true && that.isSetNextCronRunMs(); + if (this_present_nextCronRunMs || that_present_nextCronRunMs) { + if (!(this_present_nextCronRunMs && that_present_nextCronRunMs)) + return false; + if (this.nextCronRunMs != that.nextCronRunMs) + return false; + } + + return true; + } + + @Override + public int hashCode() { + List<Object> list = new ArrayList<Object>(); + + boolean present_job = true && (isSetJob()); + list.add(present_job); + if (present_job) + list.add(job); + + boolean present_stats = true && (isSetStats()); + list.add(present_stats); + if (present_stats) + list.add(stats); + + boolean present_nextCronRunMs = true && (isSetNextCronRunMs()); + list.add(present_nextCronRunMs); + if (present_nextCronRunMs) + list.add(nextCronRunMs); + + return list.hashCode(); + } + + @Override + public int compareTo(JobSummary other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetJob()).compareTo(other.isSetJob()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetJob()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.job, other.job); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetStats()).compareTo(other.isSetStats()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetStats()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.stats, other.stats); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetNextCronRunMs()).compareTo(other.isSetNextCronRunMs()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetNextCronRunMs()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.nextCronRunMs, other.nextCronRunMs); + 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("JobSummary("); + boolean first = true; + + sb.append("job:"); + if (this.job == null) { + sb.append("null"); + } else { + sb.append(this.job); + } + first = false; + if (!first) sb.append(", "); + sb.append("stats:"); + if (this.stats == null) { + sb.append("null"); + } else { + sb.append(this.stats); + } + first = false; + if (isSetNextCronRunMs()) { + if (!first) sb.append(", "); + sb.append("nextCronRunMs:"); + sb.append(this.nextCronRunMs); + 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 (job != null) { + job.validate(); + } + if (stats != null) { + stats.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 JobSummaryStandardSchemeFactory implements SchemeFactory { + public JobSummaryStandardScheme getScheme() { + return new JobSummaryStandardScheme(); + } + } + + private static class JobSummaryStandardScheme extends StandardScheme<JobSummary> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, JobSummary 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 + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.job = new JobConfiguration(); + struct.job.read(iprot); + struct.setJobIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // STATS + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.stats = new JobStats(); + struct.stats.read(iprot); + struct.setStatsIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 3: // NEXT_CRON_RUN_MS + if (schemeField.type == org.apache.thrift.protocol.TType.I64) { + struct.nextCronRunMs = iprot.readI64(); + struct.setNextCronRunMsIsSet(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, JobSummary struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.job != null) { + oprot.writeFieldBegin(JOB_FIELD_DESC); + struct.job.write(oprot); + oprot.writeFieldEnd(); + } + if (struct.stats != null) { + oprot.writeFieldBegin(STATS_FIELD_DESC); + struct.stats.write(oprot); + oprot.writeFieldEnd(); + } + if (struct.isSetNextCronRunMs()) { + oprot.writeFieldBegin(NEXT_CRON_RUN_MS_FIELD_DESC); + oprot.writeI64(struct.nextCronRunMs); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class JobSummaryTupleSchemeFactory implements SchemeFactory { + public JobSummaryTupleScheme getScheme() { + return new JobSummaryTupleScheme(); + } + } + + private static class JobSummaryTupleScheme extends TupleScheme<JobSummary> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, JobSummary struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetJob()) { + optionals.set(0); + } + if (struct.isSetStats()) { + optionals.set(1); + } + if (struct.isSetNextCronRunMs()) { + optionals.set(2); + } + oprot.writeBitSet(optionals, 3); + if (struct.isSetJob()) { + struct.job.write(oprot); + } + if (struct.isSetStats()) { + struct.stats.write(oprot); + } + if (struct.isSetNextCronRunMs()) { + oprot.writeI64(struct.nextCronRunMs); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, JobSummary struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(3); + if (incoming.get(0)) { + struct.job = new JobConfiguration(); + struct.job.read(iprot); + struct.setJobIsSet(true); + } + if (incoming.get(1)) { + struct.stats = new JobStats(); + struct.stats.read(iprot); + struct.setStatsIsSet(true); + } + if (incoming.get(2)) { + struct.nextCronRunMs = iprot.readI64(); + struct.setNextCronRunMsIsSet(true); + } + } + } + +} +
