http://git-wip-us.apache.org/repos/asf/airavata/blob/25da582a/airavata-api/airavata-api-stubs/src/main/java/org/apache/airavata/model/data/movement/UnicoreDataMovement.java ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-api-stubs/src/main/java/org/apache/airavata/model/data/movement/UnicoreDataMovement.java b/airavata-api/airavata-api-stubs/src/main/java/org/apache/airavata/model/data/movement/UnicoreDataMovement.java new file mode 100644 index 0000000..a20377d --- /dev/null +++ b/airavata-api/airavata-api-stubs/src/main/java/org/apache/airavata/model/data/movement/UnicoreDataMovement.java @@ -0,0 +1,635 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * Autogenerated by Thrift Compiler (0.9.2) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +package org.apache.airavata.model.data.movement; + +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"}) +/** + * Data Movement through UnicoreStorage + * + * unicoreEndPointURL: + * unicoreGateway End Point. The provider will query this service to fetch required service end points. + */ +@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2015-12-2") +public class UnicoreDataMovement implements org.apache.thrift.TBase<UnicoreDataMovement, UnicoreDataMovement._Fields>, java.io.Serializable, Cloneable, Comparable<UnicoreDataMovement> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("UnicoreDataMovement"); + + private static final org.apache.thrift.protocol.TField DATA_MOVEMENT_INTERFACE_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("dataMovementInterfaceId", org.apache.thrift.protocol.TType.STRING, (short)1); + private static final org.apache.thrift.protocol.TField SECURITY_PROTOCOL_FIELD_DESC = new org.apache.thrift.protocol.TField("securityProtocol", org.apache.thrift.protocol.TType.I32, (short)2); + private static final org.apache.thrift.protocol.TField UNICORE_END_POINT_URL_FIELD_DESC = new org.apache.thrift.protocol.TField("unicoreEndPointURL", 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 UnicoreDataMovementStandardSchemeFactory()); + schemes.put(TupleScheme.class, new UnicoreDataMovementTupleSchemeFactory()); + } + + public String dataMovementInterfaceId; // required + /** + * + * @see SecurityProtocol + */ + public SecurityProtocol securityProtocol; // required + public String unicoreEndPointURL; // 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 { + DATA_MOVEMENT_INTERFACE_ID((short)1, "dataMovementInterfaceId"), + /** + * + * @see SecurityProtocol + */ + SECURITY_PROTOCOL((short)2, "securityProtocol"), + UNICORE_END_POINT_URL((short)3, "unicoreEndPointURL"); + + 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: // DATA_MOVEMENT_INTERFACE_ID + return DATA_MOVEMENT_INTERFACE_ID; + case 2: // SECURITY_PROTOCOL + return SECURITY_PROTOCOL; + case 3: // UNICORE_END_POINT_URL + return UNICORE_END_POINT_URL; + 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.DATA_MOVEMENT_INTERFACE_ID, new org.apache.thrift.meta_data.FieldMetaData("dataMovementInterfaceId", org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + tmpMap.put(_Fields.SECURITY_PROTOCOL, new org.apache.thrift.meta_data.FieldMetaData("securityProtocol", org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, SecurityProtocol.class))); + tmpMap.put(_Fields.UNICORE_END_POINT_URL, new org.apache.thrift.meta_data.FieldMetaData("unicoreEndPointURL", org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(UnicoreDataMovement.class, metaDataMap); + } + + public UnicoreDataMovement() { + this.dataMovementInterfaceId = "DO_NOT_SET_AT_CLIENTS"; + + } + + public UnicoreDataMovement( + String dataMovementInterfaceId, + SecurityProtocol securityProtocol, + String unicoreEndPointURL) + { + this(); + this.dataMovementInterfaceId = dataMovementInterfaceId; + this.securityProtocol = securityProtocol; + this.unicoreEndPointURL = unicoreEndPointURL; + } + + /** + * Performs a deep copy on <i>other</i>. + */ + public UnicoreDataMovement(UnicoreDataMovement other) { + if (other.isSetDataMovementInterfaceId()) { + this.dataMovementInterfaceId = other.dataMovementInterfaceId; + } + if (other.isSetSecurityProtocol()) { + this.securityProtocol = other.securityProtocol; + } + if (other.isSetUnicoreEndPointURL()) { + this.unicoreEndPointURL = other.unicoreEndPointURL; + } + } + + public UnicoreDataMovement deepCopy() { + return new UnicoreDataMovement(this); + } + + @Override + public void clear() { + this.dataMovementInterfaceId = "DO_NOT_SET_AT_CLIENTS"; + + this.securityProtocol = null; + this.unicoreEndPointURL = null; + } + + public String getDataMovementInterfaceId() { + return this.dataMovementInterfaceId; + } + + public UnicoreDataMovement setDataMovementInterfaceId(String dataMovementInterfaceId) { + this.dataMovementInterfaceId = dataMovementInterfaceId; + return this; + } + + public void unsetDataMovementInterfaceId() { + this.dataMovementInterfaceId = null; + } + + /** Returns true if field dataMovementInterfaceId is set (has been assigned a value) and false otherwise */ + public boolean isSetDataMovementInterfaceId() { + return this.dataMovementInterfaceId != null; + } + + public void setDataMovementInterfaceIdIsSet(boolean value) { + if (!value) { + this.dataMovementInterfaceId = null; + } + } + + /** + * + * @see SecurityProtocol + */ + public SecurityProtocol getSecurityProtocol() { + return this.securityProtocol; + } + + /** + * + * @see SecurityProtocol + */ + public UnicoreDataMovement setSecurityProtocol(SecurityProtocol securityProtocol) { + this.securityProtocol = securityProtocol; + return this; + } + + public void unsetSecurityProtocol() { + this.securityProtocol = null; + } + + /** Returns true if field securityProtocol is set (has been assigned a value) and false otherwise */ + public boolean isSetSecurityProtocol() { + return this.securityProtocol != null; + } + + public void setSecurityProtocolIsSet(boolean value) { + if (!value) { + this.securityProtocol = null; + } + } + + public String getUnicoreEndPointURL() { + return this.unicoreEndPointURL; + } + + public UnicoreDataMovement setUnicoreEndPointURL(String unicoreEndPointURL) { + this.unicoreEndPointURL = unicoreEndPointURL; + return this; + } + + public void unsetUnicoreEndPointURL() { + this.unicoreEndPointURL = null; + } + + /** Returns true if field unicoreEndPointURL is set (has been assigned a value) and false otherwise */ + public boolean isSetUnicoreEndPointURL() { + return this.unicoreEndPointURL != null; + } + + public void setUnicoreEndPointURLIsSet(boolean value) { + if (!value) { + this.unicoreEndPointURL = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case DATA_MOVEMENT_INTERFACE_ID: + if (value == null) { + unsetDataMovementInterfaceId(); + } else { + setDataMovementInterfaceId((String)value); + } + break; + + case SECURITY_PROTOCOL: + if (value == null) { + unsetSecurityProtocol(); + } else { + setSecurityProtocol((SecurityProtocol)value); + } + break; + + case UNICORE_END_POINT_URL: + if (value == null) { + unsetUnicoreEndPointURL(); + } else { + setUnicoreEndPointURL((String)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case DATA_MOVEMENT_INTERFACE_ID: + return getDataMovementInterfaceId(); + + case SECURITY_PROTOCOL: + return getSecurityProtocol(); + + case UNICORE_END_POINT_URL: + return getUnicoreEndPointURL(); + + } + 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 DATA_MOVEMENT_INTERFACE_ID: + return isSetDataMovementInterfaceId(); + case SECURITY_PROTOCOL: + return isSetSecurityProtocol(); + case UNICORE_END_POINT_URL: + return isSetUnicoreEndPointURL(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof UnicoreDataMovement) + return this.equals((UnicoreDataMovement)that); + return false; + } + + public boolean equals(UnicoreDataMovement that) { + if (that == null) + return false; + + boolean this_present_dataMovementInterfaceId = true && this.isSetDataMovementInterfaceId(); + boolean that_present_dataMovementInterfaceId = true && that.isSetDataMovementInterfaceId(); + if (this_present_dataMovementInterfaceId || that_present_dataMovementInterfaceId) { + if (!(this_present_dataMovementInterfaceId && that_present_dataMovementInterfaceId)) + return false; + if (!this.dataMovementInterfaceId.equals(that.dataMovementInterfaceId)) + return false; + } + + boolean this_present_securityProtocol = true && this.isSetSecurityProtocol(); + boolean that_present_securityProtocol = true && that.isSetSecurityProtocol(); + if (this_present_securityProtocol || that_present_securityProtocol) { + if (!(this_present_securityProtocol && that_present_securityProtocol)) + return false; + if (!this.securityProtocol.equals(that.securityProtocol)) + return false; + } + + boolean this_present_unicoreEndPointURL = true && this.isSetUnicoreEndPointURL(); + boolean that_present_unicoreEndPointURL = true && that.isSetUnicoreEndPointURL(); + if (this_present_unicoreEndPointURL || that_present_unicoreEndPointURL) { + if (!(this_present_unicoreEndPointURL && that_present_unicoreEndPointURL)) + return false; + if (!this.unicoreEndPointURL.equals(that.unicoreEndPointURL)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + List<Object> list = new ArrayList<Object>(); + + boolean present_dataMovementInterfaceId = true && (isSetDataMovementInterfaceId()); + list.add(present_dataMovementInterfaceId); + if (present_dataMovementInterfaceId) + list.add(dataMovementInterfaceId); + + boolean present_securityProtocol = true && (isSetSecurityProtocol()); + list.add(present_securityProtocol); + if (present_securityProtocol) + list.add(securityProtocol.getValue()); + + boolean present_unicoreEndPointURL = true && (isSetUnicoreEndPointURL()); + list.add(present_unicoreEndPointURL); + if (present_unicoreEndPointURL) + list.add(unicoreEndPointURL); + + return list.hashCode(); + } + + @Override + public int compareTo(UnicoreDataMovement other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetDataMovementInterfaceId()).compareTo(other.isSetDataMovementInterfaceId()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetDataMovementInterfaceId()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.dataMovementInterfaceId, other.dataMovementInterfaceId); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetSecurityProtocol()).compareTo(other.isSetSecurityProtocol()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSecurityProtocol()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.securityProtocol, other.securityProtocol); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetUnicoreEndPointURL()).compareTo(other.isSetUnicoreEndPointURL()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetUnicoreEndPointURL()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.unicoreEndPointURL, other.unicoreEndPointURL); + 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("UnicoreDataMovement("); + boolean first = true; + + sb.append("dataMovementInterfaceId:"); + if (this.dataMovementInterfaceId == null) { + sb.append("null"); + } else { + sb.append(this.dataMovementInterfaceId); + } + first = false; + if (!first) sb.append(", "); + sb.append("securityProtocol:"); + if (this.securityProtocol == null) { + sb.append("null"); + } else { + sb.append(this.securityProtocol); + } + first = false; + if (!first) sb.append(", "); + sb.append("unicoreEndPointURL:"); + if (this.unicoreEndPointURL == null) { + sb.append("null"); + } else { + sb.append(this.unicoreEndPointURL); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + if (dataMovementInterfaceId == null) { + throw new org.apache.thrift.protocol.TProtocolException("Required field 'dataMovementInterfaceId' was not present! Struct: " + toString()); + } + if (securityProtocol == null) { + throw new org.apache.thrift.protocol.TProtocolException("Required field 'securityProtocol' was not present! Struct: " + toString()); + } + if (unicoreEndPointURL == null) { + throw new org.apache.thrift.protocol.TProtocolException("Required field 'unicoreEndPointURL' was not present! Struct: " + toString()); + } + // 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 UnicoreDataMovementStandardSchemeFactory implements SchemeFactory { + public UnicoreDataMovementStandardScheme getScheme() { + return new UnicoreDataMovementStandardScheme(); + } + } + + private static class UnicoreDataMovementStandardScheme extends StandardScheme<UnicoreDataMovement> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, UnicoreDataMovement 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: // DATA_MOVEMENT_INTERFACE_ID + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.dataMovementInterfaceId = iprot.readString(); + struct.setDataMovementInterfaceIdIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // SECURITY_PROTOCOL + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.securityProtocol = org.apache.airavata.model.data.movement.SecurityProtocol.findByValue(iprot.readI32()); + struct.setSecurityProtocolIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 3: // UNICORE_END_POINT_URL + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.unicoreEndPointURL = iprot.readString(); + struct.setUnicoreEndPointURLIsSet(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, UnicoreDataMovement struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.dataMovementInterfaceId != null) { + oprot.writeFieldBegin(DATA_MOVEMENT_INTERFACE_ID_FIELD_DESC); + oprot.writeString(struct.dataMovementInterfaceId); + oprot.writeFieldEnd(); + } + if (struct.securityProtocol != null) { + oprot.writeFieldBegin(SECURITY_PROTOCOL_FIELD_DESC); + oprot.writeI32(struct.securityProtocol.getValue()); + oprot.writeFieldEnd(); + } + if (struct.unicoreEndPointURL != null) { + oprot.writeFieldBegin(UNICORE_END_POINT_URL_FIELD_DESC); + oprot.writeString(struct.unicoreEndPointURL); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class UnicoreDataMovementTupleSchemeFactory implements SchemeFactory { + public UnicoreDataMovementTupleScheme getScheme() { + return new UnicoreDataMovementTupleScheme(); + } + } + + private static class UnicoreDataMovementTupleScheme extends TupleScheme<UnicoreDataMovement> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, UnicoreDataMovement struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + oprot.writeString(struct.dataMovementInterfaceId); + oprot.writeI32(struct.securityProtocol.getValue()); + oprot.writeString(struct.unicoreEndPointURL); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, UnicoreDataMovement struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + struct.dataMovementInterfaceId = iprot.readString(); + struct.setDataMovementInterfaceIdIsSet(true); + struct.securityProtocol = org.apache.airavata.model.data.movement.SecurityProtocol.findByValue(iprot.readI32()); + struct.setSecurityProtocolIsSet(true); + struct.unicoreEndPointURL = iprot.readString(); + struct.setUnicoreEndPointURLIsSet(true); + } + } + +} +
http://git-wip-us.apache.org/repos/asf/airavata/blob/25da582a/airavata-api/airavata-api-stubs/src/main/java/org/apache/airavata/model/data/resource/ReplicaLocationModel.java ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-api-stubs/src/main/java/org/apache/airavata/model/data/resource/ReplicaLocationModel.java b/airavata-api/airavata-api-stubs/src/main/java/org/apache/airavata/model/data/resource/ReplicaLocationModel.java new file mode 100644 index 0000000..b0c14cc --- /dev/null +++ b/airavata-api/airavata-api-stubs/src/main/java/org/apache/airavata/model/data/resource/ReplicaLocationModel.java @@ -0,0 +1,462 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * Autogenerated by Thrift Compiler (0.9.2) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +package org.apache.airavata.model.data.resource; + +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.2)", date = "2015-12-2") +public class ReplicaLocationModel implements org.apache.thrift.TBase<ReplicaLocationModel, ReplicaLocationModel._Fields>, java.io.Serializable, Cloneable, Comparable<ReplicaLocationModel> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("ReplicaLocationModel"); + + private static final org.apache.thrift.protocol.TField PHYSICAL_LOCATIONS_FIELD_DESC = new org.apache.thrift.protocol.TField("physicalLocations", org.apache.thrift.protocol.TType.LIST, (short)1); + + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new ReplicaLocationModelStandardSchemeFactory()); + schemes.put(TupleScheme.class, new ReplicaLocationModelTupleSchemeFactory()); + } + + public List<String> physicalLocations; // 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 { + PHYSICAL_LOCATIONS((short)1, "physicalLocations"); + + 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: // PHYSICAL_LOCATIONS + return PHYSICAL_LOCATIONS; + 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 _Fields optionals[] = {_Fields.PHYSICAL_LOCATIONS}; + 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.PHYSICAL_LOCATIONS, new org.apache.thrift.meta_data.FieldMetaData("physicalLocations", org.apache.thrift.TFieldRequirementType.OPTIONAL, + new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(ReplicaLocationModel.class, metaDataMap); + } + + public ReplicaLocationModel() { + } + + /** + * Performs a deep copy on <i>other</i>. + */ + public ReplicaLocationModel(ReplicaLocationModel other) { + if (other.isSetPhysicalLocations()) { + List<String> __this__physicalLocations = new ArrayList<String>(other.physicalLocations); + this.physicalLocations = __this__physicalLocations; + } + } + + public ReplicaLocationModel deepCopy() { + return new ReplicaLocationModel(this); + } + + @Override + public void clear() { + this.physicalLocations = null; + } + + public int getPhysicalLocationsSize() { + return (this.physicalLocations == null) ? 0 : this.physicalLocations.size(); + } + + public java.util.Iterator<String> getPhysicalLocationsIterator() { + return (this.physicalLocations == null) ? null : this.physicalLocations.iterator(); + } + + public void addToPhysicalLocations(String elem) { + if (this.physicalLocations == null) { + this.physicalLocations = new ArrayList<String>(); + } + this.physicalLocations.add(elem); + } + + public List<String> getPhysicalLocations() { + return this.physicalLocations; + } + + public ReplicaLocationModel setPhysicalLocations(List<String> physicalLocations) { + this.physicalLocations = physicalLocations; + return this; + } + + public void unsetPhysicalLocations() { + this.physicalLocations = null; + } + + /** Returns true if field physicalLocations is set (has been assigned a value) and false otherwise */ + public boolean isSetPhysicalLocations() { + return this.physicalLocations != null; + } + + public void setPhysicalLocationsIsSet(boolean value) { + if (!value) { + this.physicalLocations = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case PHYSICAL_LOCATIONS: + if (value == null) { + unsetPhysicalLocations(); + } else { + setPhysicalLocations((List<String>)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case PHYSICAL_LOCATIONS: + return getPhysicalLocations(); + + } + 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 PHYSICAL_LOCATIONS: + return isSetPhysicalLocations(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof ReplicaLocationModel) + return this.equals((ReplicaLocationModel)that); + return false; + } + + public boolean equals(ReplicaLocationModel that) { + if (that == null) + return false; + + boolean this_present_physicalLocations = true && this.isSetPhysicalLocations(); + boolean that_present_physicalLocations = true && that.isSetPhysicalLocations(); + if (this_present_physicalLocations || that_present_physicalLocations) { + if (!(this_present_physicalLocations && that_present_physicalLocations)) + return false; + if (!this.physicalLocations.equals(that.physicalLocations)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + List<Object> list = new ArrayList<Object>(); + + boolean present_physicalLocations = true && (isSetPhysicalLocations()); + list.add(present_physicalLocations); + if (present_physicalLocations) + list.add(physicalLocations); + + return list.hashCode(); + } + + @Override + public int compareTo(ReplicaLocationModel other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetPhysicalLocations()).compareTo(other.isSetPhysicalLocations()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetPhysicalLocations()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.physicalLocations, other.physicalLocations); + 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("ReplicaLocationModel("); + boolean first = true; + + if (isSetPhysicalLocations()) { + sb.append("physicalLocations:"); + if (this.physicalLocations == null) { + sb.append("null"); + } else { + sb.append(this.physicalLocations); + } + 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 ReplicaLocationModelStandardSchemeFactory implements SchemeFactory { + public ReplicaLocationModelStandardScheme getScheme() { + return new ReplicaLocationModelStandardScheme(); + } + } + + private static class ReplicaLocationModelStandardScheme extends StandardScheme<ReplicaLocationModel> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, ReplicaLocationModel 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: // PHYSICAL_LOCATIONS + if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { + { + org.apache.thrift.protocol.TList _list8 = iprot.readListBegin(); + struct.physicalLocations = new ArrayList<String>(_list8.size); + String _elem9; + for (int _i10 = 0; _i10 < _list8.size; ++_i10) + { + _elem9 = iprot.readString(); + struct.physicalLocations.add(_elem9); + } + iprot.readListEnd(); + } + struct.setPhysicalLocationsIsSet(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, ReplicaLocationModel struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.physicalLocations != null) { + if (struct.isSetPhysicalLocations()) { + oprot.writeFieldBegin(PHYSICAL_LOCATIONS_FIELD_DESC); + { + oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, struct.physicalLocations.size())); + for (String _iter11 : struct.physicalLocations) + { + oprot.writeString(_iter11); + } + oprot.writeListEnd(); + } + oprot.writeFieldEnd(); + } + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class ReplicaLocationModelTupleSchemeFactory implements SchemeFactory { + public ReplicaLocationModelTupleScheme getScheme() { + return new ReplicaLocationModelTupleScheme(); + } + } + + private static class ReplicaLocationModelTupleScheme extends TupleScheme<ReplicaLocationModel> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, ReplicaLocationModel struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetPhysicalLocations()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetPhysicalLocations()) { + { + oprot.writeI32(struct.physicalLocations.size()); + for (String _iter12 : struct.physicalLocations) + { + oprot.writeString(_iter12); + } + } + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, ReplicaLocationModel struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + { + org.apache.thrift.protocol.TList _list13 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32()); + struct.physicalLocations = new ArrayList<String>(_list13.size); + String _elem14; + for (int _i15 = 0; _i15 < _list13.size; ++_i15) + { + _elem14 = iprot.readString(); + struct.physicalLocations.add(_elem14); + } + } + struct.setPhysicalLocationsIsSet(true); + } + } + } + +} + http://git-wip-us.apache.org/repos/asf/airavata/blob/25da582a/airavata-api/airavata-api-stubs/src/main/java/org/apache/airavata/model/data/resource/ResourceModel.java ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-api-stubs/src/main/java/org/apache/airavata/model/data/resource/ResourceModel.java b/airavata-api/airavata-api-stubs/src/main/java/org/apache/airavata/model/data/resource/ResourceModel.java new file mode 100644 index 0000000..9193175 --- /dev/null +++ b/airavata-api/airavata-api-stubs/src/main/java/org/apache/airavata/model/data/resource/ResourceModel.java @@ -0,0 +1,684 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * Autogenerated by Thrift Compiler (0.9.2) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +package org.apache.airavata.model.data.resource; + +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.2)", date = "2015-12-2") +public class ResourceModel implements org.apache.thrift.TBase<ResourceModel, ResourceModel._Fields>, java.io.Serializable, Cloneable, Comparable<ResourceModel> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("ResourceModel"); + + private static final org.apache.thrift.protocol.TField RESOURCE_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("resourceId", org.apache.thrift.protocol.TType.STRING, (short)1); + private static final org.apache.thrift.protocol.TField RESOURCE_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("resourceName", org.apache.thrift.protocol.TType.STRING, (short)2); + private static final org.apache.thrift.protocol.TField REPLICA_LOCATIONS_FIELD_DESC = new org.apache.thrift.protocol.TField("replicaLocations", org.apache.thrift.protocol.TType.LIST, (short)3); + + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new ResourceModelStandardSchemeFactory()); + schemes.put(TupleScheme.class, new ResourceModelTupleSchemeFactory()); + } + + public String resourceId; // optional + public String resourceName; // optional + public List<ReplicaLocationModel> replicaLocations; // 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 { + RESOURCE_ID((short)1, "resourceId"), + RESOURCE_NAME((short)2, "resourceName"), + REPLICA_LOCATIONS((short)3, "replicaLocations"); + + 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: // RESOURCE_ID + return RESOURCE_ID; + case 2: // RESOURCE_NAME + return RESOURCE_NAME; + case 3: // REPLICA_LOCATIONS + return REPLICA_LOCATIONS; + 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 _Fields optionals[] = {_Fields.RESOURCE_ID,_Fields.RESOURCE_NAME}; + 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.RESOURCE_ID, new org.apache.thrift.meta_data.FieldMetaData("resourceId", org.apache.thrift.TFieldRequirementType.OPTIONAL, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + tmpMap.put(_Fields.RESOURCE_NAME, new org.apache.thrift.meta_data.FieldMetaData("resourceName", org.apache.thrift.TFieldRequirementType.OPTIONAL, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + tmpMap.put(_Fields.REPLICA_LOCATIONS, new org.apache.thrift.meta_data.FieldMetaData("replicaLocations", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT , "ReplicaLocationModel")))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(ResourceModel.class, metaDataMap); + } + + public ResourceModel() { + } + + public ResourceModel( + List<ReplicaLocationModel> replicaLocations) + { + this(); + this.replicaLocations = replicaLocations; + } + + /** + * Performs a deep copy on <i>other</i>. + */ + public ResourceModel(ResourceModel other) { + if (other.isSetResourceId()) { + this.resourceId = other.resourceId; + } + if (other.isSetResourceName()) { + this.resourceName = other.resourceName; + } + if (other.isSetReplicaLocations()) { + List<ReplicaLocationModel> __this__replicaLocations = new ArrayList<ReplicaLocationModel>(other.replicaLocations.size()); + for (ReplicaLocationModel other_element : other.replicaLocations) { + __this__replicaLocations.add(other_element); + } + this.replicaLocations = __this__replicaLocations; + } + } + + public ResourceModel deepCopy() { + return new ResourceModel(this); + } + + @Override + public void clear() { + this.resourceId = null; + this.resourceName = null; + this.replicaLocations = null; + } + + public String getResourceId() { + return this.resourceId; + } + + public ResourceModel setResourceId(String resourceId) { + this.resourceId = resourceId; + return this; + } + + public void unsetResourceId() { + this.resourceId = null; + } + + /** Returns true if field resourceId is set (has been assigned a value) and false otherwise */ + public boolean isSetResourceId() { + return this.resourceId != null; + } + + public void setResourceIdIsSet(boolean value) { + if (!value) { + this.resourceId = null; + } + } + + public String getResourceName() { + return this.resourceName; + } + + public ResourceModel setResourceName(String resourceName) { + this.resourceName = resourceName; + return this; + } + + public void unsetResourceName() { + this.resourceName = null; + } + + /** Returns true if field resourceName is set (has been assigned a value) and false otherwise */ + public boolean isSetResourceName() { + return this.resourceName != null; + } + + public void setResourceNameIsSet(boolean value) { + if (!value) { + this.resourceName = null; + } + } + + public int getReplicaLocationsSize() { + return (this.replicaLocations == null) ? 0 : this.replicaLocations.size(); + } + + public java.util.Iterator<ReplicaLocationModel> getReplicaLocationsIterator() { + return (this.replicaLocations == null) ? null : this.replicaLocations.iterator(); + } + + public void addToReplicaLocations(ReplicaLocationModel elem) { + if (this.replicaLocations == null) { + this.replicaLocations = new ArrayList<ReplicaLocationModel>(); + } + this.replicaLocations.add(elem); + } + + public List<ReplicaLocationModel> getReplicaLocations() { + return this.replicaLocations; + } + + public ResourceModel setReplicaLocations(List<ReplicaLocationModel> replicaLocations) { + this.replicaLocations = replicaLocations; + return this; + } + + public void unsetReplicaLocations() { + this.replicaLocations = null; + } + + /** Returns true if field replicaLocations is set (has been assigned a value) and false otherwise */ + public boolean isSetReplicaLocations() { + return this.replicaLocations != null; + } + + public void setReplicaLocationsIsSet(boolean value) { + if (!value) { + this.replicaLocations = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case RESOURCE_ID: + if (value == null) { + unsetResourceId(); + } else { + setResourceId((String)value); + } + break; + + case RESOURCE_NAME: + if (value == null) { + unsetResourceName(); + } else { + setResourceName((String)value); + } + break; + + case REPLICA_LOCATIONS: + if (value == null) { + unsetReplicaLocations(); + } else { + setReplicaLocations((List<ReplicaLocationModel>)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case RESOURCE_ID: + return getResourceId(); + + case RESOURCE_NAME: + return getResourceName(); + + case REPLICA_LOCATIONS: + return getReplicaLocations(); + + } + 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 RESOURCE_ID: + return isSetResourceId(); + case RESOURCE_NAME: + return isSetResourceName(); + case REPLICA_LOCATIONS: + return isSetReplicaLocations(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof ResourceModel) + return this.equals((ResourceModel)that); + return false; + } + + public boolean equals(ResourceModel that) { + if (that == null) + return false; + + boolean this_present_resourceId = true && this.isSetResourceId(); + boolean that_present_resourceId = true && that.isSetResourceId(); + if (this_present_resourceId || that_present_resourceId) { + if (!(this_present_resourceId && that_present_resourceId)) + return false; + if (!this.resourceId.equals(that.resourceId)) + return false; + } + + boolean this_present_resourceName = true && this.isSetResourceName(); + boolean that_present_resourceName = true && that.isSetResourceName(); + if (this_present_resourceName || that_present_resourceName) { + if (!(this_present_resourceName && that_present_resourceName)) + return false; + if (!this.resourceName.equals(that.resourceName)) + return false; + } + + boolean this_present_replicaLocations = true && this.isSetReplicaLocations(); + boolean that_present_replicaLocations = true && that.isSetReplicaLocations(); + if (this_present_replicaLocations || that_present_replicaLocations) { + if (!(this_present_replicaLocations && that_present_replicaLocations)) + return false; + if (!this.replicaLocations.equals(that.replicaLocations)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + List<Object> list = new ArrayList<Object>(); + + boolean present_resourceId = true && (isSetResourceId()); + list.add(present_resourceId); + if (present_resourceId) + list.add(resourceId); + + boolean present_resourceName = true && (isSetResourceName()); + list.add(present_resourceName); + if (present_resourceName) + list.add(resourceName); + + boolean present_replicaLocations = true && (isSetReplicaLocations()); + list.add(present_replicaLocations); + if (present_replicaLocations) + list.add(replicaLocations); + + return list.hashCode(); + } + + @Override + public int compareTo(ResourceModel other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetResourceId()).compareTo(other.isSetResourceId()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetResourceId()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.resourceId, other.resourceId); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetResourceName()).compareTo(other.isSetResourceName()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetResourceName()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.resourceName, other.resourceName); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetReplicaLocations()).compareTo(other.isSetReplicaLocations()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetReplicaLocations()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.replicaLocations, other.replicaLocations); + 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("ResourceModel("); + boolean first = true; + + if (isSetResourceId()) { + sb.append("resourceId:"); + if (this.resourceId == null) { + sb.append("null"); + } else { + sb.append(this.resourceId); + } + first = false; + } + if (isSetResourceName()) { + if (!first) sb.append(", "); + sb.append("resourceName:"); + if (this.resourceName == null) { + sb.append("null"); + } else { + sb.append(this.resourceName); + } + first = false; + } + if (!first) sb.append(", "); + sb.append("replicaLocations:"); + if (this.replicaLocations == null) { + sb.append("null"); + } else { + sb.append(this.replicaLocations); + } + 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 ResourceModelStandardSchemeFactory implements SchemeFactory { + public ResourceModelStandardScheme getScheme() { + return new ResourceModelStandardScheme(); + } + } + + private static class ResourceModelStandardScheme extends StandardScheme<ResourceModel> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, ResourceModel 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: // RESOURCE_ID + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.resourceId = iprot.readString(); + struct.setResourceIdIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // RESOURCE_NAME + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.resourceName = iprot.readString(); + struct.setResourceNameIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 3: // REPLICA_LOCATIONS + if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { + { + org.apache.thrift.protocol.TList _list0 = iprot.readListBegin(); + struct.replicaLocations = new ArrayList<ReplicaLocationModel>(_list0.size); + ReplicaLocationModel _elem1; + for (int _i2 = 0; _i2 < _list0.size; ++_i2) + { + _elem1 = new ReplicaLocationModel(); + _elem1.read(iprot); + struct.replicaLocations.add(_elem1); + } + iprot.readListEnd(); + } + struct.setReplicaLocationsIsSet(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, ResourceModel struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.resourceId != null) { + if (struct.isSetResourceId()) { + oprot.writeFieldBegin(RESOURCE_ID_FIELD_DESC); + oprot.writeString(struct.resourceId); + oprot.writeFieldEnd(); + } + } + if (struct.resourceName != null) { + if (struct.isSetResourceName()) { + oprot.writeFieldBegin(RESOURCE_NAME_FIELD_DESC); + oprot.writeString(struct.resourceName); + oprot.writeFieldEnd(); + } + } + if (struct.replicaLocations != null) { + oprot.writeFieldBegin(REPLICA_LOCATIONS_FIELD_DESC); + { + oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.replicaLocations.size())); + for (ReplicaLocationModel _iter3 : struct.replicaLocations) + { + _iter3.write(oprot); + } + oprot.writeListEnd(); + } + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class ResourceModelTupleSchemeFactory implements SchemeFactory { + public ResourceModelTupleScheme getScheme() { + return new ResourceModelTupleScheme(); + } + } + + private static class ResourceModelTupleScheme extends TupleScheme<ResourceModel> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, ResourceModel struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetResourceId()) { + optionals.set(0); + } + if (struct.isSetResourceName()) { + optionals.set(1); + } + if (struct.isSetReplicaLocations()) { + optionals.set(2); + } + oprot.writeBitSet(optionals, 3); + if (struct.isSetResourceId()) { + oprot.writeString(struct.resourceId); + } + if (struct.isSetResourceName()) { + oprot.writeString(struct.resourceName); + } + if (struct.isSetReplicaLocations()) { + { + oprot.writeI32(struct.replicaLocations.size()); + for (ReplicaLocationModel _iter4 : struct.replicaLocations) + { + _iter4.write(oprot); + } + } + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, ResourceModel struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(3); + if (incoming.get(0)) { + struct.resourceId = iprot.readString(); + struct.setResourceIdIsSet(true); + } + if (incoming.get(1)) { + struct.resourceName = iprot.readString(); + struct.setResourceNameIsSet(true); + } + if (incoming.get(2)) { + { + org.apache.thrift.protocol.TList _list5 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); + struct.replicaLocations = new ArrayList<ReplicaLocationModel>(_list5.size); + ReplicaLocationModel _elem6; + for (int _i7 = 0; _i7 < _list5.size; ++_i7) + { + _elem6 = new ReplicaLocationModel(); + _elem6.read(iprot); + struct.replicaLocations.add(_elem6); + } + } + struct.setReplicaLocationsIsSet(true); + } + } + } + +} + http://git-wip-us.apache.org/repos/asf/airavata/blob/25da582a/airavata-api/airavata-api-stubs/src/main/java/org/apache/airavata/model/error/AiravataClientException.java ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-api-stubs/src/main/java/org/apache/airavata/model/error/AiravataClientException.java b/airavata-api/airavata-api-stubs/src/main/java/org/apache/airavata/model/error/AiravataClientException.java new file mode 100644 index 0000000..2890071 --- /dev/null +++ b/airavata-api/airavata-api-stubs/src/main/java/org/apache/airavata/model/error/AiravataClientException.java @@ -0,0 +1,550 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * Autogenerated by Thrift Compiler (0.9.2) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +package org.apache.airavata.model.error; + +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"}) +/** + * This exception is thrown by Airavata Services when a call fails as a result of + * a problem that a client may be able to resolve. For example, if the user + * attempts to execute an application on a resource gateway does not have access to. + * + * This exception would not be used for internal system errors that do not + * reflect user actions, but rather reflect a problem within the service that + * the client cannot resolve. + * + * airavataErrorType: The message type indicating the error that occurred. + * must be one of the values of AiravataErrorType. + * + * parameter: If the error applied to a particular input parameter, this will + * indicate which parameter. + */ +@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2015-12-2") +public class AiravataClientException extends TException implements org.apache.thrift.TBase<AiravataClientException, AiravataClientException._Fields>, java.io.Serializable, Cloneable, Comparable<AiravataClientException> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("AiravataClientException"); + + private static final org.apache.thrift.protocol.TField AIRAVATA_ERROR_TYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("airavataErrorType", org.apache.thrift.protocol.TType.I32, (short)1); + private static final org.apache.thrift.protocol.TField PARAMETER_FIELD_DESC = new org.apache.thrift.protocol.TField("parameter", 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 AiravataClientExceptionStandardSchemeFactory()); + schemes.put(TupleScheme.class, new AiravataClientExceptionTupleSchemeFactory()); + } + + /** + * + * @see AiravataErrorType + */ + public AiravataErrorType airavataErrorType; // required + public String parameter; // 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 { + /** + * + * @see AiravataErrorType + */ + AIRAVATA_ERROR_TYPE((short)1, "airavataErrorType"), + PARAMETER((short)2, "parameter"); + + 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: // AIRAVATA_ERROR_TYPE + return AIRAVATA_ERROR_TYPE; + case 2: // PARAMETER + return PARAMETER; + 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 _Fields optionals[] = {_Fields.PARAMETER}; + 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.AIRAVATA_ERROR_TYPE, new org.apache.thrift.meta_data.FieldMetaData("airavataErrorType", org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, AiravataErrorType.class))); + tmpMap.put(_Fields.PARAMETER, new org.apache.thrift.meta_data.FieldMetaData("parameter", org.apache.thrift.TFieldRequirementType.OPTIONAL, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(AiravataClientException.class, metaDataMap); + } + + public AiravataClientException() { + } + + public AiravataClientException( + AiravataErrorType airavataErrorType) + { + this(); + this.airavataErrorType = airavataErrorType; + } + + /** + * Performs a deep copy on <i>other</i>. + */ + public AiravataClientException(AiravataClientException other) { + if (other.isSetAiravataErrorType()) { + this.airavataErrorType = other.airavataErrorType; + } + if (other.isSetParameter()) { + this.parameter = other.parameter; + } + } + + public AiravataClientException deepCopy() { + return new AiravataClientException(this); + } + + @Override + public void clear() { + this.airavataErrorType = null; + this.parameter = null; + } + + /** + * + * @see AiravataErrorType + */ + public AiravataErrorType getAiravataErrorType() { + return this.airavataErrorType; + } + + /** + * + * @see AiravataErrorType + */ + public AiravataClientException setAiravataErrorType(AiravataErrorType airavataErrorType) { + this.airavataErrorType = airavataErrorType; + return this; + } + + public void unsetAiravataErrorType() { + this.airavataErrorType = null; + } + + /** Returns true if field airavataErrorType is set (has been assigned a value) and false otherwise */ + public boolean isSetAiravataErrorType() { + return this.airavataErrorType != null; + } + + public void setAiravataErrorTypeIsSet(boolean value) { + if (!value) { + this.airavataErrorType = null; + } + } + + public String getParameter() { + return this.parameter; + } + + public AiravataClientException setParameter(String parameter) { + this.parameter = parameter; + return this; + } + + public void unsetParameter() { + this.parameter = null; + } + + /** Returns true if field parameter is set (has been assigned a value) and false otherwise */ + public boolean isSetParameter() { + return this.parameter != null; + } + + public void setParameterIsSet(boolean value) { + if (!value) { + this.parameter = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case AIRAVATA_ERROR_TYPE: + if (value == null) { + unsetAiravataErrorType(); + } else { + setAiravataErrorType((AiravataErrorType)value); + } + break; + + case PARAMETER: + if (value == null) { + unsetParameter(); + } else { + setParameter((String)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case AIRAVATA_ERROR_TYPE: + return getAiravataErrorType(); + + case PARAMETER: + return getParameter(); + + } + 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 AIRAVATA_ERROR_TYPE: + return isSetAiravataErrorType(); + case PARAMETER: + return isSetParameter(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof AiravataClientException) + return this.equals((AiravataClientException)that); + return false; + } + + public boolean equals(AiravataClientException that) { + if (that == null) + return false; + + boolean this_present_airavataErrorType = true && this.isSetAiravataErrorType(); + boolean that_present_airavataErrorType = true && that.isSetAiravataErrorType(); + if (this_present_airavataErrorType || that_present_airavataErrorType) { + if (!(this_present_airavataErrorType && that_present_airavataErrorType)) + return false; + if (!this.airavataErrorType.equals(that.airavataErrorType)) + return false; + } + + boolean this_present_parameter = true && this.isSetParameter(); + boolean that_present_parameter = true && that.isSetParameter(); + if (this_present_parameter || that_present_parameter) { + if (!(this_present_parameter && that_present_parameter)) + return false; + if (!this.parameter.equals(that.parameter)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + List<Object> list = new ArrayList<Object>(); + + boolean present_airavataErrorType = true && (isSetAiravataErrorType()); + list.add(present_airavataErrorType); + if (present_airavataErrorType) + list.add(airavataErrorType.getValue()); + + boolean present_parameter = true && (isSetParameter()); + list.add(present_parameter); + if (present_parameter) + list.add(parameter); + + return list.hashCode(); + } + + @Override + public int compareTo(AiravataClientException other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetAiravataErrorType()).compareTo(other.isSetAiravataErrorType()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetAiravataErrorType()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.airavataErrorType, other.airavataErrorType); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetParameter()).compareTo(other.isSetParameter()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetParameter()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.parameter, other.parameter); + 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("AiravataClientException("); + boolean first = true; + + sb.append("airavataErrorType:"); + if (this.airavataErrorType == null) { + sb.append("null"); + } else { + sb.append(this.airavataErrorType); + } + first = false; + if (isSetParameter()) { + if (!first) sb.append(", "); + sb.append("parameter:"); + if (this.parameter == null) { + sb.append("null"); + } else { + sb.append(this.parameter); + } + first = false; + } + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + if (airavataErrorType == null) { + throw new org.apache.thrift.protocol.TProtocolException("Required field 'airavataErrorType' was not present! Struct: " + toString()); + } + // 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 AiravataClientExceptionStandardSchemeFactory implements SchemeFactory { + public AiravataClientExceptionStandardScheme getScheme() { + return new AiravataClientExceptionStandardScheme(); + } + } + + private static class AiravataClientExceptionStandardScheme extends StandardScheme<AiravataClientException> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, AiravataClientException 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: // AIRAVATA_ERROR_TYPE + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.airavataErrorType = org.apache.airavata.model.error.AiravataErrorType.findByValue(iprot.readI32()); + struct.setAiravataErrorTypeIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // PARAMETER + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.parameter = iprot.readString(); + struct.setParameterIsSet(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, AiravataClientException struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.airavataErrorType != null) { + oprot.writeFieldBegin(AIRAVATA_ERROR_TYPE_FIELD_DESC); + oprot.writeI32(struct.airavataErrorType.getValue()); + oprot.writeFieldEnd(); + } + if (struct.parameter != null) { + if (struct.isSetParameter()) { + oprot.writeFieldBegin(PARAMETER_FIELD_DESC); + oprot.writeString(struct.parameter); + oprot.writeFieldEnd(); + } + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class AiravataClientExceptionTupleSchemeFactory implements SchemeFactory { + public AiravataClientExceptionTupleScheme getScheme() { + return new AiravataClientExceptionTupleScheme(); + } + } + + private static class AiravataClientExceptionTupleScheme extends TupleScheme<AiravataClientException> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, AiravataClientException struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + oprot.writeI32(struct.airavataErrorType.getValue()); + BitSet optionals = new BitSet(); + if (struct.isSetParameter()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetParameter()) { + oprot.writeString(struct.parameter); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, AiravataClientException struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + struct.airavataErrorType = org.apache.airavata.model.error.AiravataErrorType.findByValue(iprot.readI32()); + struct.setAiravataErrorTypeIsSet(true); + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.parameter = iprot.readString(); + struct.setParameterIsSet(true); + } + } + } + +} + http://git-wip-us.apache.org/repos/asf/airavata/blob/25da582a/airavata-api/airavata-api-stubs/src/main/java/org/apache/airavata/model/error/AiravataErrorType.java ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-api-stubs/src/main/java/org/apache/airavata/model/error/AiravataErrorType.java b/airavata-api/airavata-api-stubs/src/main/java/org/apache/airavata/model/error/AiravataErrorType.java new file mode 100644 index 0000000..09409f2 --- /dev/null +++ b/airavata-api/airavata-api-stubs/src/main/java/org/apache/airavata/model/error/AiravataErrorType.java @@ -0,0 +1,99 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * Autogenerated by Thrift Compiler (0.9.2) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +package org.apache.airavata.model.error; + + +import java.util.Map; +import java.util.HashMap; +import org.apache.thrift.TEnum; + +/** + * A list of Airavata API Error Message Types + * + * UNKNOWN: No information available about the error + * + * PERMISSION_DENIED: Not permitted to perform action + * + * INTERNAL_ERROR: Unexpected problem with the service + * + * AUTHENTICATION_FAILURE: The client failed to authenticate. + * + * INVALID_AUTHORIZATION: Security Token and/or Username and/or password is incorrect + * + * AUTHORIZATION_EXPIRED: Authentication token expired + * + * UNKNOWN_GATEWAY_ID: The gateway is not registered with Airavata. + * + * UNSUPPORTED_OPERATION: Operation denied because it is currently unsupported. + */ +public enum AiravataErrorType implements org.apache.thrift.TEnum { + UNKNOWN(0), + PERMISSION_DENIED(1), + INTERNAL_ERROR(2), + AUTHENTICATION_FAILURE(3), + INVALID_AUTHORIZATION(4), + AUTHORIZATION_EXPIRED(5), + UNKNOWN_GATEWAY_ID(6), + UNSUPPORTED_OPERATION(7); + + private final int value; + + private AiravataErrorType(int value) { + this.value = value; + } + + /** + * Get the integer value of this enum value, as defined in the Thrift IDL. + */ + public int getValue() { + return value; + } + + /** + * Find a the enum type by its integer value, as defined in the Thrift IDL. + * @return null if the value is not found. + */ + public static AiravataErrorType findByValue(int value) { + switch (value) { + case 0: + return UNKNOWN; + case 1: + return PERMISSION_DENIED; + case 2: + return INTERNAL_ERROR; + case 3: + return AUTHENTICATION_FAILURE; + case 4: + return INVALID_AUTHORIZATION; + case 5: + return AUTHORIZATION_EXPIRED; + case 6: + return UNKNOWN_GATEWAY_ID; + case 7: + return UNSUPPORTED_OPERATION; + default: + return null; + } + } +}
