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/HostStatus.java ---------------------------------------------------------------------- diff --git a/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/sdk/HostStatus.java b/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/sdk/HostStatus.java new file mode 100644 index 0000000..70ddf9c --- /dev/null +++ b/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/sdk/HostStatus.java @@ -0,0 +1,519 @@ +/** + * 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 HostStatus implements org.apache.thrift.TBase<HostStatus, HostStatus._Fields>, java.io.Serializable, Cloneable, Comparable<HostStatus> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("HostStatus"); + + private static final org.apache.thrift.protocol.TField HOST_FIELD_DESC = new org.apache.thrift.protocol.TField("host", org.apache.thrift.protocol.TType.STRING, (short)1); + private static final org.apache.thrift.protocol.TField MODE_FIELD_DESC = new org.apache.thrift.protocol.TField("mode", org.apache.thrift.protocol.TType.I32, (short)2); + + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new HostStatusStandardSchemeFactory()); + schemes.put(TupleScheme.class, new HostStatusTupleSchemeFactory()); + } + + public String host; // required + /** + * + * @see MaintenanceMode + */ + public MaintenanceMode mode; // 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 { + HOST((short)1, "host"), + /** + * + * @see MaintenanceMode + */ + MODE((short)2, "mode"); + + 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: // HOST + return HOST; + case 2: // MODE + return MODE; + 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.HOST, new org.apache.thrift.meta_data.FieldMetaData("host", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + tmpMap.put(_Fields.MODE, new org.apache.thrift.meta_data.FieldMetaData("mode", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, MaintenanceMode.class))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(HostStatus.class, metaDataMap); + } + + public HostStatus() { + } + + public HostStatus( + String host, + MaintenanceMode mode) + { + this(); + this.host = host; + this.mode = mode; + } + + /** + * Performs a deep copy on <i>other</i>. + */ + public HostStatus(HostStatus other) { + if (other.isSetHost()) { + this.host = other.host; + } + if (other.isSetMode()) { + this.mode = other.mode; + } + } + + public HostStatus deepCopy() { + return new HostStatus(this); + } + + @Override + public void clear() { + this.host = null; + this.mode = null; + } + + public String getHost() { + return this.host; + } + + public HostStatus setHost(String host) { + this.host = host; + return this; + } + + public void unsetHost() { + this.host = null; + } + + /** Returns true if field host is set (has been assigned a value) and false otherwise */ + public boolean isSetHost() { + return this.host != null; + } + + public void setHostIsSet(boolean value) { + if (!value) { + this.host = null; + } + } + + /** + * + * @see MaintenanceMode + */ + public MaintenanceMode getMode() { + return this.mode; + } + + /** + * + * @see MaintenanceMode + */ + public HostStatus setMode(MaintenanceMode mode) { + this.mode = mode; + return this; + } + + public void unsetMode() { + this.mode = null; + } + + /** Returns true if field mode is set (has been assigned a value) and false otherwise */ + public boolean isSetMode() { + return this.mode != null; + } + + public void setModeIsSet(boolean value) { + if (!value) { + this.mode = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case HOST: + if (value == null) { + unsetHost(); + } else { + setHost((String)value); + } + break; + + case MODE: + if (value == null) { + unsetMode(); + } else { + setMode((MaintenanceMode)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case HOST: + return getHost(); + + case MODE: + return getMode(); + + } + 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 HOST: + return isSetHost(); + case MODE: + return isSetMode(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof HostStatus) + return this.equals((HostStatus)that); + return false; + } + + public boolean equals(HostStatus that) { + if (that == null) + return false; + + boolean this_present_host = true && this.isSetHost(); + boolean that_present_host = true && that.isSetHost(); + if (this_present_host || that_present_host) { + if (!(this_present_host && that_present_host)) + return false; + if (!this.host.equals(that.host)) + return false; + } + + boolean this_present_mode = true && this.isSetMode(); + boolean that_present_mode = true && that.isSetMode(); + if (this_present_mode || that_present_mode) { + if (!(this_present_mode && that_present_mode)) + return false; + if (!this.mode.equals(that.mode)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + List<Object> list = new ArrayList<Object>(); + + boolean present_host = true && (isSetHost()); + list.add(present_host); + if (present_host) + list.add(host); + + boolean present_mode = true && (isSetMode()); + list.add(present_mode); + if (present_mode) + list.add(mode.getValue()); + + return list.hashCode(); + } + + @Override + public int compareTo(HostStatus other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetHost()).compareTo(other.isSetHost()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetHost()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.host, other.host); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetMode()).compareTo(other.isSetMode()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetMode()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.mode, other.mode); + 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("HostStatus("); + boolean first = true; + + sb.append("host:"); + if (this.host == null) { + sb.append("null"); + } else { + sb.append(this.host); + } + first = false; + if (!first) sb.append(", "); + sb.append("mode:"); + if (this.mode == null) { + sb.append("null"); + } else { + sb.append(this.mode); + } + 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 HostStatusStandardSchemeFactory implements SchemeFactory { + public HostStatusStandardScheme getScheme() { + return new HostStatusStandardScheme(); + } + } + + private static class HostStatusStandardScheme extends StandardScheme<HostStatus> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, HostStatus 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: // HOST + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.host = iprot.readString(); + struct.setHostIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // MODE + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.mode = org.apache.airavata.cloud.aurora.client.sdk.MaintenanceMode.findByValue(iprot.readI32()); + struct.setModeIsSet(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, HostStatus struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.host != null) { + oprot.writeFieldBegin(HOST_FIELD_DESC); + oprot.writeString(struct.host); + oprot.writeFieldEnd(); + } + if (struct.mode != null) { + oprot.writeFieldBegin(MODE_FIELD_DESC); + oprot.writeI32(struct.mode.getValue()); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class HostStatusTupleSchemeFactory implements SchemeFactory { + public HostStatusTupleScheme getScheme() { + return new HostStatusTupleScheme(); + } + } + + private static class HostStatusTupleScheme extends TupleScheme<HostStatus> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, HostStatus struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetHost()) { + optionals.set(0); + } + if (struct.isSetMode()) { + optionals.set(1); + } + oprot.writeBitSet(optionals, 2); + if (struct.isSetHost()) { + oprot.writeString(struct.host); + } + if (struct.isSetMode()) { + oprot.writeI32(struct.mode.getValue()); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, HostStatus struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(2); + if (incoming.get(0)) { + struct.host = iprot.readString(); + struct.setHostIsSet(true); + } + if (incoming.get(1)) { + struct.mode = org.apache.airavata.cloud.aurora.client.sdk.MaintenanceMode.findByValue(iprot.readI32()); + struct.setModeIsSet(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/Hosts.java ---------------------------------------------------------------------- diff --git a/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/sdk/Hosts.java b/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/sdk/Hosts.java new file mode 100644 index 0000000..4c5aee0 --- /dev/null +++ b/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/sdk/Hosts.java @@ -0,0 +1,447 @@ +/** + * 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 Hosts implements org.apache.thrift.TBase<Hosts, Hosts._Fields>, java.io.Serializable, Cloneable, Comparable<Hosts> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("Hosts"); + + private static final org.apache.thrift.protocol.TField HOST_NAMES_FIELD_DESC = new org.apache.thrift.protocol.TField("hostNames", org.apache.thrift.protocol.TType.SET, (short)1); + + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new HostsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new HostsTupleSchemeFactory()); + } + + public Set<String> hostNames; // 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 { + HOST_NAMES((short)1, "hostNames"); + + 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: // HOST_NAMES + return HOST_NAMES; + 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.HOST_NAMES, new org.apache.thrift.meta_data.FieldMetaData("hostNames", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.SetMetaData(org.apache.thrift.protocol.TType.SET, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(Hosts.class, metaDataMap); + } + + public Hosts() { + } + + public Hosts( + Set<String> hostNames) + { + this(); + this.hostNames = hostNames; + } + + /** + * Performs a deep copy on <i>other</i>. + */ + public Hosts(Hosts other) { + if (other.isSetHostNames()) { + Set<String> __this__hostNames = new HashSet<String>(other.hostNames); + this.hostNames = __this__hostNames; + } + } + + public Hosts deepCopy() { + return new Hosts(this); + } + + @Override + public void clear() { + this.hostNames = null; + } + + public int getHostNamesSize() { + return (this.hostNames == null) ? 0 : this.hostNames.size(); + } + + public java.util.Iterator<String> getHostNamesIterator() { + return (this.hostNames == null) ? null : this.hostNames.iterator(); + } + + public void addToHostNames(String elem) { + if (this.hostNames == null) { + this.hostNames = new HashSet<String>(); + } + this.hostNames.add(elem); + } + + public Set<String> getHostNames() { + return this.hostNames; + } + + public Hosts setHostNames(Set<String> hostNames) { + this.hostNames = hostNames; + return this; + } + + public void unsetHostNames() { + this.hostNames = null; + } + + /** Returns true if field hostNames is set (has been assigned a value) and false otherwise */ + public boolean isSetHostNames() { + return this.hostNames != null; + } + + public void setHostNamesIsSet(boolean value) { + if (!value) { + this.hostNames = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case HOST_NAMES: + if (value == null) { + unsetHostNames(); + } else { + setHostNames((Set<String>)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case HOST_NAMES: + return getHostNames(); + + } + 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 HOST_NAMES: + return isSetHostNames(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof Hosts) + return this.equals((Hosts)that); + return false; + } + + public boolean equals(Hosts that) { + if (that == null) + return false; + + boolean this_present_hostNames = true && this.isSetHostNames(); + boolean that_present_hostNames = true && that.isSetHostNames(); + if (this_present_hostNames || that_present_hostNames) { + if (!(this_present_hostNames && that_present_hostNames)) + return false; + if (!this.hostNames.equals(that.hostNames)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + List<Object> list = new ArrayList<Object>(); + + boolean present_hostNames = true && (isSetHostNames()); + list.add(present_hostNames); + if (present_hostNames) + list.add(hostNames); + + return list.hashCode(); + } + + @Override + public int compareTo(Hosts other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetHostNames()).compareTo(other.isSetHostNames()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetHostNames()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.hostNames, other.hostNames); + 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("Hosts("); + boolean first = true; + + sb.append("hostNames:"); + if (this.hostNames == null) { + sb.append("null"); + } else { + sb.append(this.hostNames); + } + 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 HostsStandardSchemeFactory implements SchemeFactory { + public HostsStandardScheme getScheme() { + return new HostsStandardScheme(); + } + } + + private static class HostsStandardScheme extends StandardScheme<Hosts> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, Hosts 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: // HOST_NAMES + if (schemeField.type == org.apache.thrift.protocol.TType.SET) { + { + org.apache.thrift.protocol.TSet _set182 = iprot.readSetBegin(); + struct.hostNames = new HashSet<String>(2*_set182.size); + String _elem183; + for (int _i184 = 0; _i184 < _set182.size; ++_i184) + { + _elem183 = iprot.readString(); + struct.hostNames.add(_elem183); + } + iprot.readSetEnd(); + } + struct.setHostNamesIsSet(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, Hosts struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.hostNames != null) { + oprot.writeFieldBegin(HOST_NAMES_FIELD_DESC); + { + oprot.writeSetBegin(new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, struct.hostNames.size())); + for (String _iter185 : struct.hostNames) + { + oprot.writeString(_iter185); + } + oprot.writeSetEnd(); + } + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class HostsTupleSchemeFactory implements SchemeFactory { + public HostsTupleScheme getScheme() { + return new HostsTupleScheme(); + } + } + + private static class HostsTupleScheme extends TupleScheme<Hosts> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, Hosts struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetHostNames()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetHostNames()) { + { + oprot.writeI32(struct.hostNames.size()); + for (String _iter186 : struct.hostNames) + { + oprot.writeString(_iter186); + } + } + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, Hosts struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + { + org.apache.thrift.protocol.TSet _set187 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, iprot.readI32()); + struct.hostNames = new HashSet<String>(2*_set187.size); + String _elem188; + for (int _i189 = 0; _i189 < _set187.size; ++_i189) + { + _elem188 = iprot.readString(); + struct.hostNames.add(_elem188); + } + } + struct.setHostNamesIsSet(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/Identity.java ---------------------------------------------------------------------- diff --git a/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/sdk/Identity.java b/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/sdk/Identity.java new file mode 100644 index 0000000..242a140 --- /dev/null +++ b/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/sdk/Identity.java @@ -0,0 +1,398 @@ +/** + * 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 Identity implements org.apache.thrift.TBase<Identity, Identity._Fields>, java.io.Serializable, Cloneable, Comparable<Identity> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("Identity"); + + private static final org.apache.thrift.protocol.TField USER_FIELD_DESC = new org.apache.thrift.protocol.TField("user", org.apache.thrift.protocol.TType.STRING, (short)2); + + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new IdentityStandardSchemeFactory()); + schemes.put(TupleScheme.class, new IdentityTupleSchemeFactory()); + } + + public String user; // 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((short)2, "user"); + + 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 2: // USER + return USER; + 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.USER, new org.apache.thrift.meta_data.FieldMetaData("user", 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(Identity.class, metaDataMap); + } + + public Identity() { + } + + public Identity( + String user) + { + this(); + this.user = user; + } + + /** + * Performs a deep copy on <i>other</i>. + */ + public Identity(Identity other) { + if (other.isSetUser()) { + this.user = other.user; + } + } + + public Identity deepCopy() { + return new Identity(this); + } + + @Override + public void clear() { + this.user = null; + } + + public String getUser() { + return this.user; + } + + public Identity setUser(String user) { + this.user = user; + return this; + } + + public void unsetUser() { + this.user = null; + } + + /** Returns true if field user is set (has been assigned a value) and false otherwise */ + public boolean isSetUser() { + return this.user != null; + } + + public void setUserIsSet(boolean value) { + if (!value) { + this.user = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case USER: + if (value == null) { + unsetUser(); + } else { + setUser((String)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case USER: + return getUser(); + + } + 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 USER: + return isSetUser(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof Identity) + return this.equals((Identity)that); + return false; + } + + public boolean equals(Identity that) { + if (that == null) + return false; + + boolean this_present_user = true && this.isSetUser(); + boolean that_present_user = true && that.isSetUser(); + if (this_present_user || that_present_user) { + if (!(this_present_user && that_present_user)) + return false; + if (!this.user.equals(that.user)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + List<Object> list = new ArrayList<Object>(); + + boolean present_user = true && (isSetUser()); + list.add(present_user); + if (present_user) + list.add(user); + + return list.hashCode(); + } + + @Override + public int compareTo(Identity other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetUser()).compareTo(other.isSetUser()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetUser()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.user, other.user); + 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("Identity("); + boolean first = true; + + sb.append("user:"); + if (this.user == null) { + sb.append("null"); + } else { + sb.append(this.user); + } + 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 IdentityStandardSchemeFactory implements SchemeFactory { + public IdentityStandardScheme getScheme() { + return new IdentityStandardScheme(); + } + } + + private static class IdentityStandardScheme extends StandardScheme<Identity> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, Identity 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 2: // USER + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.user = iprot.readString(); + struct.setUserIsSet(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, Identity struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.user != null) { + oprot.writeFieldBegin(USER_FIELD_DESC); + oprot.writeString(struct.user); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class IdentityTupleSchemeFactory implements SchemeFactory { + public IdentityTupleScheme getScheme() { + return new IdentityTupleScheme(); + } + } + + private static class IdentityTupleScheme extends TupleScheme<Identity> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, Identity struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetUser()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetUser()) { + oprot.writeString(struct.user); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, Identity struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.user = iprot.readString(); + struct.setUserIsSet(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/Image.java ---------------------------------------------------------------------- diff --git a/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/sdk/Image.java b/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/sdk/Image.java new file mode 100644 index 0000000..e7bdf1a --- /dev/null +++ b/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/sdk/Image.java @@ -0,0 +1,373 @@ +/** + * Autogenerated by Thrift Compiler (0.9.3) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +package org.apache.airavata.cloud.aurora.client.sdk; + +import org.apache.thrift.scheme.IScheme; +import org.apache.thrift.scheme.SchemeFactory; +import org.apache.thrift.scheme.StandardScheme; + +import org.apache.thrift.scheme.TupleScheme; +import org.apache.thrift.protocol.TTupleProtocol; +import org.apache.thrift.protocol.TProtocolException; +import org.apache.thrift.EncodingUtils; +import org.apache.thrift.TException; +import org.apache.thrift.async.AsyncMethodCallback; +import org.apache.thrift.server.AbstractNonblockingServer.*; +import java.util.List; +import java.util.ArrayList; +import java.util.Map; +import java.util.HashMap; +import java.util.EnumMap; +import java.util.Set; +import java.util.HashSet; +import java.util.EnumSet; +import java.util.Collections; +import java.util.BitSet; +import java.nio.ByteBuffer; +import java.util.Arrays; +import javax.annotation.Generated; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) +/** + * Describes an image to be used with the Mesos unified containerizer + */ +public class Image extends org.apache.thrift.TUnion<Image, Image._Fields> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("Image"); + private static final org.apache.thrift.protocol.TField DOCKER_FIELD_DESC = new org.apache.thrift.protocol.TField("docker", org.apache.thrift.protocol.TType.STRUCT, (short)1); + private static final org.apache.thrift.protocol.TField APPC_FIELD_DESC = new org.apache.thrift.protocol.TField("appc", 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 { + DOCKER((short)1, "docker"), + APPC((short)2, "appc"); + + 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: // DOCKER + return DOCKER; + case 2: // APPC + return APPC; + 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.DOCKER, new org.apache.thrift.meta_data.FieldMetaData("docker", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, DockerImage.class))); + tmpMap.put(_Fields.APPC, new org.apache.thrift.meta_data.FieldMetaData("appc", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, AppcImage.class))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(Image.class, metaDataMap); + } + + public Image() { + super(); + } + + public Image(_Fields setField, Object value) { + super(setField, value); + } + + public Image(Image other) { + super(other); + } + public Image deepCopy() { + return new Image(this); + } + + public static Image docker(DockerImage value) { + Image x = new Image(); + x.setDocker(value); + return x; + } + + public static Image appc(AppcImage value) { + Image x = new Image(); + x.setAppc(value); + return x; + } + + + @Override + protected void checkType(_Fields setField, Object value) throws ClassCastException { + switch (setField) { + case DOCKER: + if (value instanceof DockerImage) { + break; + } + throw new ClassCastException("Was expecting value of type DockerImage for field 'docker', but got " + value.getClass().getSimpleName()); + case APPC: + if (value instanceof AppcImage) { + break; + } + throw new ClassCastException("Was expecting value of type AppcImage for field 'appc', 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 DOCKER: + if (field.type == DOCKER_FIELD_DESC.type) { + DockerImage docker; + docker = new DockerImage(); + docker.read(iprot); + return docker; + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); + return null; + } + case APPC: + if (field.type == APPC_FIELD_DESC.type) { + AppcImage appc; + appc = new AppcImage(); + appc.read(iprot); + return appc; + } 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 DOCKER: + DockerImage docker = (DockerImage)value_; + docker.write(oprot); + return; + case APPC: + AppcImage appc = (AppcImage)value_; + appc.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 DOCKER: + DockerImage docker; + docker = new DockerImage(); + docker.read(iprot); + return docker; + case APPC: + AppcImage appc; + appc = new AppcImage(); + appc.read(iprot); + return appc; + 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 DOCKER: + DockerImage docker = (DockerImage)value_; + docker.write(oprot); + return; + case APPC: + AppcImage appc = (AppcImage)value_; + appc.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 DOCKER: + return DOCKER_FIELD_DESC; + case APPC: + return APPC_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 DockerImage getDocker() { + if (getSetField() == _Fields.DOCKER) { + return (DockerImage)getFieldValue(); + } else { + throw new RuntimeException("Cannot get field 'docker' because union is currently set to " + getFieldDesc(getSetField()).name); + } + } + + public void setDocker(DockerImage value) { + if (value == null) throw new NullPointerException(); + setField_ = _Fields.DOCKER; + value_ = value; + } + + public AppcImage getAppc() { + if (getSetField() == _Fields.APPC) { + return (AppcImage)getFieldValue(); + } else { + throw new RuntimeException("Cannot get field 'appc' because union is currently set to " + getFieldDesc(getSetField()).name); + } + } + + public void setAppc(AppcImage value) { + if (value == null) throw new NullPointerException(); + setField_ = _Fields.APPC; + value_ = value; + } + + public boolean isSetDocker() { + return setField_ == _Fields.DOCKER; + } + + + public boolean isSetAppc() { + return setField_ == _Fields.APPC; + } + + + public boolean equals(Object other) { + if (other instanceof Image) { + return equals((Image)other); + } else { + return false; + } + } + + public boolean equals(Image other) { + return other != null && getSetField() == other.getSetField() && getFieldValue().equals(other.getFieldValue()); + } + + @Override + public int compareTo(Image 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/InstanceConfigRewrite.java ---------------------------------------------------------------------- diff --git a/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/sdk/InstanceConfigRewrite.java b/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/sdk/InstanceConfigRewrite.java new file mode 100644 index 0000000..ff21dbc --- /dev/null +++ b/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/sdk/InstanceConfigRewrite.java @@ -0,0 +1,659 @@ +/** + * 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 InstanceConfigRewrite implements org.apache.thrift.TBase<InstanceConfigRewrite, InstanceConfigRewrite._Fields>, java.io.Serializable, Cloneable, Comparable<InstanceConfigRewrite> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("InstanceConfigRewrite"); + + private static final org.apache.thrift.protocol.TField INSTANCE_KEY_FIELD_DESC = new org.apache.thrift.protocol.TField("instanceKey", org.apache.thrift.protocol.TType.STRUCT, (short)1); + private static final org.apache.thrift.protocol.TField OLD_TASK_FIELD_DESC = new org.apache.thrift.protocol.TField("oldTask", org.apache.thrift.protocol.TType.STRUCT, (short)2); + private static final org.apache.thrift.protocol.TField REWRITTEN_TASK_FIELD_DESC = new org.apache.thrift.protocol.TField("rewrittenTask", org.apache.thrift.protocol.TType.STRUCT, (short)3); + + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new InstanceConfigRewriteStandardSchemeFactory()); + schemes.put(TupleScheme.class, new InstanceConfigRewriteTupleSchemeFactory()); + } + + /** + * Key for the task to rewrite. + */ + public InstanceKey instanceKey; // required + /** + * The original configuration. + */ + public TaskConfig oldTask; // required + /** + * The rewritten configuration. + */ + public TaskConfig rewrittenTask; // required + + /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + /** + * Key for the task to rewrite. + */ + INSTANCE_KEY((short)1, "instanceKey"), + /** + * The original configuration. + */ + OLD_TASK((short)2, "oldTask"), + /** + * The rewritten configuration. + */ + REWRITTEN_TASK((short)3, "rewrittenTask"); + + 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_KEY + return INSTANCE_KEY; + case 2: // OLD_TASK + return OLD_TASK; + case 3: // REWRITTEN_TASK + return REWRITTEN_TASK; + 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.INSTANCE_KEY, new org.apache.thrift.meta_data.FieldMetaData("instanceKey", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, InstanceKey.class))); + tmpMap.put(_Fields.OLD_TASK, new org.apache.thrift.meta_data.FieldMetaData("oldTask", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TaskConfig.class))); + tmpMap.put(_Fields.REWRITTEN_TASK, new org.apache.thrift.meta_data.FieldMetaData("rewrittenTask", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TaskConfig.class))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(InstanceConfigRewrite.class, metaDataMap); + } + + public InstanceConfigRewrite() { + } + + public InstanceConfigRewrite( + InstanceKey instanceKey, + TaskConfig oldTask, + TaskConfig rewrittenTask) + { + this(); + this.instanceKey = instanceKey; + this.oldTask = oldTask; + this.rewrittenTask = rewrittenTask; + } + + /** + * Performs a deep copy on <i>other</i>. + */ + public InstanceConfigRewrite(InstanceConfigRewrite other) { + if (other.isSetInstanceKey()) { + this.instanceKey = new InstanceKey(other.instanceKey); + } + if (other.isSetOldTask()) { + this.oldTask = new TaskConfig(other.oldTask); + } + if (other.isSetRewrittenTask()) { + this.rewrittenTask = new TaskConfig(other.rewrittenTask); + } + } + + public InstanceConfigRewrite deepCopy() { + return new InstanceConfigRewrite(this); + } + + @Override + public void clear() { + this.instanceKey = null; + this.oldTask = null; + this.rewrittenTask = null; + } + + /** + * Key for the task to rewrite. + */ + public InstanceKey getInstanceKey() { + return this.instanceKey; + } + + /** + * Key for the task to rewrite. + */ + public InstanceConfigRewrite setInstanceKey(InstanceKey instanceKey) { + this.instanceKey = instanceKey; + return this; + } + + public void unsetInstanceKey() { + this.instanceKey = null; + } + + /** Returns true if field instanceKey is set (has been assigned a value) and false otherwise */ + public boolean isSetInstanceKey() { + return this.instanceKey != null; + } + + public void setInstanceKeyIsSet(boolean value) { + if (!value) { + this.instanceKey = null; + } + } + + /** + * The original configuration. + */ + public TaskConfig getOldTask() { + return this.oldTask; + } + + /** + * The original configuration. + */ + public InstanceConfigRewrite setOldTask(TaskConfig oldTask) { + this.oldTask = oldTask; + return this; + } + + public void unsetOldTask() { + this.oldTask = null; + } + + /** Returns true if field oldTask is set (has been assigned a value) and false otherwise */ + public boolean isSetOldTask() { + return this.oldTask != null; + } + + public void setOldTaskIsSet(boolean value) { + if (!value) { + this.oldTask = null; + } + } + + /** + * The rewritten configuration. + */ + public TaskConfig getRewrittenTask() { + return this.rewrittenTask; + } + + /** + * The rewritten configuration. + */ + public InstanceConfigRewrite setRewrittenTask(TaskConfig rewrittenTask) { + this.rewrittenTask = rewrittenTask; + return this; + } + + public void unsetRewrittenTask() { + this.rewrittenTask = null; + } + + /** Returns true if field rewrittenTask is set (has been assigned a value) and false otherwise */ + public boolean isSetRewrittenTask() { + return this.rewrittenTask != null; + } + + public void setRewrittenTaskIsSet(boolean value) { + if (!value) { + this.rewrittenTask = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case INSTANCE_KEY: + if (value == null) { + unsetInstanceKey(); + } else { + setInstanceKey((InstanceKey)value); + } + break; + + case OLD_TASK: + if (value == null) { + unsetOldTask(); + } else { + setOldTask((TaskConfig)value); + } + break; + + case REWRITTEN_TASK: + if (value == null) { + unsetRewrittenTask(); + } else { + setRewrittenTask((TaskConfig)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case INSTANCE_KEY: + return getInstanceKey(); + + case OLD_TASK: + return getOldTask(); + + case REWRITTEN_TASK: + return getRewrittenTask(); + + } + 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_KEY: + return isSetInstanceKey(); + case OLD_TASK: + return isSetOldTask(); + case REWRITTEN_TASK: + return isSetRewrittenTask(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof InstanceConfigRewrite) + return this.equals((InstanceConfigRewrite)that); + return false; + } + + public boolean equals(InstanceConfigRewrite that) { + if (that == null) + return false; + + boolean this_present_instanceKey = true && this.isSetInstanceKey(); + boolean that_present_instanceKey = true && that.isSetInstanceKey(); + if (this_present_instanceKey || that_present_instanceKey) { + if (!(this_present_instanceKey && that_present_instanceKey)) + return false; + if (!this.instanceKey.equals(that.instanceKey)) + return false; + } + + boolean this_present_oldTask = true && this.isSetOldTask(); + boolean that_present_oldTask = true && that.isSetOldTask(); + if (this_present_oldTask || that_present_oldTask) { + if (!(this_present_oldTask && that_present_oldTask)) + return false; + if (!this.oldTask.equals(that.oldTask)) + return false; + } + + boolean this_present_rewrittenTask = true && this.isSetRewrittenTask(); + boolean that_present_rewrittenTask = true && that.isSetRewrittenTask(); + if (this_present_rewrittenTask || that_present_rewrittenTask) { + if (!(this_present_rewrittenTask && that_present_rewrittenTask)) + return false; + if (!this.rewrittenTask.equals(that.rewrittenTask)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + List<Object> list = new ArrayList<Object>(); + + boolean present_instanceKey = true && (isSetInstanceKey()); + list.add(present_instanceKey); + if (present_instanceKey) + list.add(instanceKey); + + boolean present_oldTask = true && (isSetOldTask()); + list.add(present_oldTask); + if (present_oldTask) + list.add(oldTask); + + boolean present_rewrittenTask = true && (isSetRewrittenTask()); + list.add(present_rewrittenTask); + if (present_rewrittenTask) + list.add(rewrittenTask); + + return list.hashCode(); + } + + @Override + public int compareTo(InstanceConfigRewrite other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetInstanceKey()).compareTo(other.isSetInstanceKey()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetInstanceKey()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.instanceKey, other.instanceKey); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetOldTask()).compareTo(other.isSetOldTask()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetOldTask()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.oldTask, other.oldTask); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetRewrittenTask()).compareTo(other.isSetRewrittenTask()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetRewrittenTask()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.rewrittenTask, other.rewrittenTask); + 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("InstanceConfigRewrite("); + boolean first = true; + + sb.append("instanceKey:"); + if (this.instanceKey == null) { + sb.append("null"); + } else { + sb.append(this.instanceKey); + } + first = false; + if (!first) sb.append(", "); + sb.append("oldTask:"); + if (this.oldTask == null) { + sb.append("null"); + } else { + sb.append(this.oldTask); + } + first = false; + if (!first) sb.append(", "); + sb.append("rewrittenTask:"); + if (this.rewrittenTask == null) { + sb.append("null"); + } else { + sb.append(this.rewrittenTask); + } + 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 (instanceKey != null) { + instanceKey.validate(); + } + if (oldTask != null) { + oldTask.validate(); + } + if (rewrittenTask != null) { + rewrittenTask.validate(); + } + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { + try { + read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class InstanceConfigRewriteStandardSchemeFactory implements SchemeFactory { + public InstanceConfigRewriteStandardScheme getScheme() { + return new InstanceConfigRewriteStandardScheme(); + } + } + + private static class InstanceConfigRewriteStandardScheme extends StandardScheme<InstanceConfigRewrite> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, InstanceConfigRewrite 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_KEY + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.instanceKey = new InstanceKey(); + struct.instanceKey.read(iprot); + struct.setInstanceKeyIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // OLD_TASK + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.oldTask = new TaskConfig(); + struct.oldTask.read(iprot); + struct.setOldTaskIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 3: // REWRITTEN_TASK + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.rewrittenTask = new TaskConfig(); + struct.rewrittenTask.read(iprot); + struct.setRewrittenTaskIsSet(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, InstanceConfigRewrite struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.instanceKey != null) { + oprot.writeFieldBegin(INSTANCE_KEY_FIELD_DESC); + struct.instanceKey.write(oprot); + oprot.writeFieldEnd(); + } + if (struct.oldTask != null) { + oprot.writeFieldBegin(OLD_TASK_FIELD_DESC); + struct.oldTask.write(oprot); + oprot.writeFieldEnd(); + } + if (struct.rewrittenTask != null) { + oprot.writeFieldBegin(REWRITTEN_TASK_FIELD_DESC); + struct.rewrittenTask.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class InstanceConfigRewriteTupleSchemeFactory implements SchemeFactory { + public InstanceConfigRewriteTupleScheme getScheme() { + return new InstanceConfigRewriteTupleScheme(); + } + } + + private static class InstanceConfigRewriteTupleScheme extends TupleScheme<InstanceConfigRewrite> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, InstanceConfigRewrite struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetInstanceKey()) { + optionals.set(0); + } + if (struct.isSetOldTask()) { + optionals.set(1); + } + if (struct.isSetRewrittenTask()) { + optionals.set(2); + } + oprot.writeBitSet(optionals, 3); + if (struct.isSetInstanceKey()) { + struct.instanceKey.write(oprot); + } + if (struct.isSetOldTask()) { + struct.oldTask.write(oprot); + } + if (struct.isSetRewrittenTask()) { + struct.rewrittenTask.write(oprot); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, InstanceConfigRewrite struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(3); + if (incoming.get(0)) { + struct.instanceKey = new InstanceKey(); + struct.instanceKey.read(iprot); + struct.setInstanceKeyIsSet(true); + } + if (incoming.get(1)) { + struct.oldTask = new TaskConfig(); + struct.oldTask.read(iprot); + struct.setOldTaskIsSet(true); + } + if (incoming.get(2)) { + struct.rewrittenTask = new TaskConfig(); + struct.rewrittenTask.read(iprot); + struct.setRewrittenTaskIsSet(true); + } + } + } + +} +
